BurmeseNLP
Rule-based Myanmar (Burmese) NLP preprocessing: normalization, syllable / word / sentence segmentation, POS tagging, phrase chunking, gazetteer NER, clause parsing, and corpus export.
Install
pip install burmesenlp
Requires Python 3.9+. Runtime depends on PyYAML.
No dictionary path or model download is required.
Quick start
from burmesenlp import (
BurmeseNLP,
CorpusExporter,
process,
word_tokenize,
pos_tag,
zg2uni,
)
import json
# One-shot pipeline (returns a Document)
doc = process("စာပေကိုဖတ်သည်။သူကစားသည်။")
doc.words
doc.sentences
doc.pos_tags
doc.chunks
doc.entities # gazetteer NER (empty if no list hits)
doc.clauses # clause layer over phrases
# Document JSON
json.dumps(doc.to_dict(), ensure_ascii=False, indent=2)
Document also supports dict-style access (doc["words"]).
Gazetteer NER & clauses
doc = process("ဒေါ်အောင်ဆန်းစုကြည် ရန်ကုန်ကို သွားသည်။")
for e in doc.entities:
print(e.text, e.entity_type)
for clause in doc.clauses:
print(clause.type, clause.text)
# Skip gazetteer matching
doc = process("...", gazetteer=False)
Corpus export
from burmesenlp import CorpusExporter, process
doc = process("စာပေကိုဖတ်သည်။")
exporter = CorpusExporter()
print(exporter.to_jsonl(doc)) # also CoNLL / BRAT / Label Studio
Stateful pipeline
from burmesenlp import BurmeseNLP
nlp = BurmeseNLP()
nlp.syllable_segment("မြန်မာစာပေ")
nlp.word_segment("ကျွန်တော်ကျောင်းသို့သွားသည်")
nlp.sentence_segment("စာပေကိုဖတ်သည်။သူကစားသည်။")
nlp.pos_tag(["ကျွန်တော်", "ကျောင်း", "သို့", "သွား", "သည်"])
Helpers
from burmesenlp import word_tokenize, pos_tag, zg2uni
word_tokenize("ကျွန်တော်ကျောင်းသို့သွားသည်", engine="longest")
pos_tag(["ကျွန်တော်", "ကျောင်း"], engine="rule")
zg2uni("ျမန္မာစာေပ")
Custom dictionary
from burmesenlp import BurmeseNLP
nlp = BurmeseNLP(dictionary_path="my_dict.json") # or .txt import
nlp.add_to_dictionary("နည်းပညာ", ["NOUN"])
nlp.save_dictionary("my_dict.json")
Canonical JSON: { "word": ["tag1", "tag2"] }. Tags must be from
burmesenlp.POS_TAGS.
CLI
burmesenlp --mode words "ကျွန်တော်ကျောင်းသို့သွားသည်။"
burmesenlp --json --mode all "စာပေကိုဖတ်သည်။"
burmesenlp --mode zg2uni "ျမန္မာစာေပ"
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file burmesenlp-1.1.0.tar.gz.
File metadata
- Download URL: burmesenlp-1.1.0.tar.gz
- Upload date:
- Size: 682.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6a74e101b950e3b3624f931a778e63a81931fc78de6258f3f2846911a2f882d
|
|
| MD5 |
8a9506b4ce3377159078c9146794d7b9
|
|
| BLAKE2b-256 |
19ebada720a173f592220c76a208229626badb6b5391bdd4c935d7f85221a20e
|
File details
Details for the file burmesenlp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: burmesenlp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 713.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
971abadf2ef8767e70418ae9774c70f28d7c5c800eecb5aa58105fde3635005b
|
|
| MD5 |
5e16fd2b269cfa3489956f293a6571b7
|
|
| BLAKE2b-256 |
434d211afefc2166c5fb0ab489ece8a4c565d21243315f8a4dbd3df3dcfde74a
|