Section navigation

Public classSealed StemmerAnalyser

Namespace
Rowles.LeanCorpus.Analysis.Analysers
Assembly
Rowles.LeanCorpus.dll

Generic analyser that runs tokenise → lowercase → stop-word removal → stem using the supplied ISpanStemmer.

public sealed class StemmerAnalyser : IAnalyser
Inheritance
StemmerAnalyser
Implements

Remarks

Thread-safety: the inner Analyser pipeline maintains per-instance buffers. Create one instance per thread, or use the indexer's built-in per-thread analyser cloning.

Convenience factory methods are provided for common stemmer configurations.

Public constructor StemmerAnalyser(ISpanStemmer)

Initialises a new StemmerAnalyser with the given stemmer.

Public method Analyse(ReadOnlySpan<char>, ISpanTokenSink)

Analyses the input text and emits tokens synchronously into sink. Callers that require a materialised List<T> should use CountingTokenSink as the sink argument.

Public method FromStemmer(ISpanStemmer)

Creates a StemmerAnalyser that uses a named stemmer. Resolves the stemmer from the provided callback, useful with DI.

Public method Hunspell(HunspellDictionary)

Creates a StemmerAnalyser using a Hunspell dictionary.

Public method KStem(IKStemLexicon)

Creates a StemmerAnalyser using the Krovetz stemmer with an in-memory lexicon.

Public method KStem(string)

Creates a StemmerAnalyser using the Krovetz stemmer with a file-based lexicon.

Public method LightEnglish()

Creates a StemmerAnalyser using the lightweight English stemmer.

Public method Porter()

Creates a StemmerAnalyser using the Porter stemmer.