Skip to main content

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 "ျမန္မာစာေပ"

Metadata

Release files for burmesenlp 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for burmesenlp 1.2.0
File Size Uploaded
burmesenlp-1.2.0.tar.gz 769.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for burmesenlp 1.2.0
File Interpreter ABI Platform
burmesenlp-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / burmesenlp-1.2.0.tar.gz

Download URL burmesenlp-1.2.0.tar.gz
Size 769.6 kB
Tags Source
SHA-256 checksum
How to use checksums
45c43126f00761ad669d73d7e021b04d6184d895438954130fa03f3d61cd3244
BLAKE2b-256 checksum
How to use checksums
fb89e7795267435b231a920434f73563c767deaad6502aa0572aa7c6977d25d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / burmesenlp-1.2.0-py3-none-any.whl

Download URL burmesenlp-1.2.0-py3-none-any.whl
Size 787.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8af4c26297f294cde5f8c671359cf9790d411e3385039df3e0d461b190d5eb49
BLAKE2b-256 checksum
How to use checksums
2830a21a1fd45fa6822eaec2612d794d893b7f947dd14b6be4f89ba4b4914994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page