TokenCollectionExtension extension Null safety

Extension methods on a collection of Token.

on

Properties

allTerms List<String>
Returns a list of all the terms from the collection of Tokens, in the same order as they occur in the SourceText.
read-only
terms Set<String>
Returns the set of unique terms from the collection of Tokens.
read-only

Methods

byTerm(Term term) Iterable<Token>
Filters the collection for tokens with Token.term == term.
firstPosition(Term term) int
Returns the lowest Token.termPosition where Token.term == term.
kGrams([int k = 2]) Map<KGram, Set<Term>>
Returns a hashmap of k-grams to terms from the collection of tokens.
lastPosition(Term term) int
Returns the highest Token.termPosition where Token.term == term.
@Deprecated('The [maxIndex] extension method will be removed.')
termCount(Term term) int
Returns the count where Token.term == term.