Tokenize¶
burmesenlp.tokenize.word_tokenize ¶
word_tokenize(text: str, engine: str = 'longest', *, lexicon: Optional[Lexicon] = None) -> List[str]
Segment text into words.
Today only engine="longest" is implemented. Future values such as
"sentencepiece" or "evopiece" will plug into the same API.
Source code in src/burmesenlp/tokenize/word.py
burmesenlp.tokenize.syllable_tokenize ¶
burmesenlp.tokenize.sentence_tokenize ¶
sentence_tokenize(text: str, *, lexicon: Optional[Lexicon] = None, split_on_final_particles: bool = True, engine: str = 'longest') -> List[str]
Segment text into sentences via the grammar-aware pipeline.
Runs word tokenization (engine), BMWE, POS, and phrase chunking, then splits on chunk/POS structure (not bare သည်/တယ် matching).
Source code in src/burmesenlp/tokenize/__init__.py
burmesenlp.tokenize.sentence.SentenceSegmenter ¶
Chunk/POS-aware sentence segmenter.
Preferred entry point: :meth:segment_from_chunks.
:meth:segment remains as a punctuation-only fallback when chunks
are unavailable (legacy Token stream).
Source code in src/burmesenlp/tokenize/sentence.py
segment_from_chunks ¶
segment_from_chunks(words: Sequence[str], pos_tags: Sequence[Union[str, Tuple[str, str]]], chunks: Sequence[Chunk], text: str, *, char_spans: Optional[Sequence[Tuple[int, int]]] = None) -> List[Sentence]
Segment using phrase chunks over words / pos_tags.
char_spans[i] is (start, end) into text for words[i].
When omitted, sentences are built by joining word strings (offsets
are approximate / zero).
Source code in src/burmesenlp/tokenize/sentence.py
segment ¶
Legacy fallback: punctuation-only splits over word Tokens.
Does not split on သည်/တယ်/ပါ. Prefer
:meth:segment_from_chunks in the full pipeline.
Source code in src/burmesenlp/tokenize/sentence.py
burmesenlp.tokenize.longest.WordSegmenter ¶
Source code in src/burmesenlp/tokenize/longest.py
segment ¶
Group syllable-level tokens into word-level tokens.