Table of Contents

Public classSealed ThaiTokeniser

Namespace
Rowles.LeanCorpus.Analysis.Tokenisers
Assembly
Rowles.LeanCorpus.dll

Lightweight Thai tokeniser using greedy longest-match segmentation with a user-supplied lexicon and grapheme-cluster fallback for unknown runs.

public sealed class ThaiTokeniser : ISpanTokeniser
ThaiTokeniser
Implements

Remarks

The lexicon must be provided via the constructor, FromFile(string), or FromStream(Stream). A starter lexicon is available in the repository under lexicons/thai-dict.txt.

Public constructor ThaiTokeniser(IEnumerable<string>)

Initialises a new ThaiTokeniser with the supplied lexicon.

Public field ThaiType

Token type emitted for Thai segments.

Public field _lexicon

Public field _maxWordLength

Public method FromFile(string)

Loads a UTF-8 text lexicon from disk, using one word per line. Lines starting with # are ignored.

Public method FromStream(Stream)

Loads a UTF-8 text lexicon from a stream, using one word per line. Lines starting with # are ignored. The stream is not disposed.

Public method ReadThaiCluster(ReadOnlySpan<char>, int, int)

Public method Tokenise(ReadOnlySpan<char>, ISpanTokenSink)

Splits the input text and emits tokens into the supplied sink.

Public method TokeniseThaiRun(ReadOnlySpan<char>, int, int, ISpanTokenSink)

Public method TryFindLongestLexiconMatch(ReadOnlySpan<char>, int, int)