Section navigation

Public classSealed 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.

Public method Contains(ReadOnlySpan<char>)

Returns true when word is a known base form.

Public method Contains(string)

Returns true when word is a known base form.

Public method 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.

Public method From(IEnumerable<string>)

Builds a lexicon from base-form words. Empty lines and duplicate entries are ignored.

Public method FromEmbeddedResource(string, Assembly?)

Loads a UTF-8 text lexicon from an embedded resource in the calling assembly.

Public method FromFile(string)

Loads a UTF-8 text lexicon from disk. If path is relative, it is resolved against BaseDirectory.

Public method 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.