
KStemmer
- Namespace
- Rowles.LeanCorpus.Analysis.Stemmers
- Assembly
- Rowles.LeanCorpus.dll
Lexicon-validated English stemmer inspired by Krovetz stemming.
public sealed class KStemmer : ISpanStemmer
- Implements
Constructors
KStemmer(IKStemLexicon)
Initialises a new KStemmer with the supplied base-form lexicon.
Fields
Methods
ApplyRulesCore(Span<char>, int)
Applies inflectional and derivational rules without re-checking exceptions or the lexicon (caller has already done so).
BuildRuleLookup(MorphRule[])
Builds a lookup dictionary keyed by the last 2 characters of each rule's suffix.
Stem(ReadOnlySpan<char>, Span<char>)
Stems
wordintooutput. Returns the length of the stemmed result, or -1 ifoutputis too small. The caller must ensureoutput.Length >= word.Lengthfor guaranteed success.
Stem(string)
Convenience overload returning a stemmed string.
StemCore(Span<char>, int)
Core stemming logic operating on the already-lowered word in
output. Called fromStem(ReadOnlySpan{char}, Span{char})which hasn't pre-checked exceptions or the lexicon.
StemPreLowered(ReadOnlySpan<char>, Span<char>)
Same as
Stem(ReadOnlySpan{char}, Span{char})but assumes the input is already lowercased. Callers who have already lowercased via LowercaseFilter can use this to avoid a redundant per-characterToLowerInvariantpass.