toPhrases method

Set<List<String>> toPhrases()

Returns a list of unique phrases from the terms in the collection.

Splits each unique term at white-space and adds it to the set.

Implementation

Set<List<String>> toPhrases() {
  final keywords = <List<String>>{};
  for (var term in terms) {
    term = term.normalizeWhitespace();
    final kw = term.split(RegExp(r'\s+'));
    if (kw.isNotEmpty) {
      keywords.add(kw);
    }
  }
  return keywords;
}