termSplitter property Null safety

TermSplitter termSplitter
override

The English implementation of termSplitter.

Algorithm:

  • Replace all punctuation, brackets and carets with white_space.
  • Split into terms at any sequence of white-space characters.
  • Trim leading and trailing white-space from all terms.
  • Trim any non=word characters from the end of all terms, unless it matches any of the abbreviations.
  • Return only non-empty terms.

Implementation

@override
TermSplitter get termSplitter => (SourceText source) => source
    .replacePunctuationWithWhiteSpace()
    .splitAtWhiteSpace(abbreviations);