splitIntoTerms method Null safety

  1. @override
List<String> splitIntoTerms(
  1. String source
)
override

Splits source into all the terms.

Implementation

@override
List<String> splitIntoTerms(String source) {
  // replace all punctuation with whitespace.
  source = source
      .replaceAll(RegExp(English.rePunctuationSelector), ' ')
      // replace all brackets and carets with _kTokenDelimiter.
      .replaceAll(RegExp(English.reBracketsAndCarets), ' ')
      // replace all repeated white-space with a single white-space.
      .replaceAll(RegExp(r'(\s{2,})'), ' ');
  // split at white-space
  final terms = source.split(RegExp(' '));
  return terms;
}