
KStemLexicon
- Namespace
- Rowles.LeanCorpus.Analysis.Stemmers
- Assembly
- Rowles.LeanCorpus.dll
Immutable IKStemLexicon backed by a frozen set.
public sealed class KStemLexicon : IKStemLexicon
- Inheritance
-
KStemLexicon
- Implements
Remarks
The lexicon must be provided via From(IEnumerable<string>),
FromFile(string), or FromStream(Stream). A lexicon file is
available in the repository under lexicons/kstem-dict.txt.
Contains(ReadOnlySpan<char>)
Returns true when word is a known base form.
Contains(string)
Returns true when word is a known base form.
ContainsPreLowered(ReadOnlySpan<char>)
Returns true when word is a known base form.
The caller guarantees the input is already lowercased, so the implementation
can skip the internal ToLowerInvariant step.
From(IEnumerable<string>)
Builds a lexicon from base-form words. Empty lines and duplicate entries are ignored.
FromEmbeddedResource(string, Assembly?)
Loads a UTF-8 text lexicon from an embedded resource in the calling assembly.
FromFile(string)
Loads a UTF-8 text lexicon from disk. If path is relative,
it is resolved against BaseDirectory.
FromStream(Stream)
Loads a UTF-8 text lexicon from a stream, using one base form per line.
Lines starting with # are ignored. The stream is not disposed.