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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

burmesenlp-1.0.1.tar.gz (679.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

burmesenlp-1.0.1-py3-none-any.whl (711.0 kB view details)

Uploaded Python 3

File details

Details for the file burmesenlp-1.0.1.tar.gz.

File metadata

  • Download URL: burmesenlp-1.0.1.tar.gz
  • Upload date:
  • Size: 679.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for burmesenlp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 426a2098ec0635fa1518ad31bd4b7d2040c447e6dbb44f07b32ffb4f48b88096
MD5 799ac0b9ed9298e91f6fbce607b35375
BLAKE2b-256 07c9bd5edd4e5866049bdee1fc7c715ac1b46f7fe0452f7bbdeb3b421cf5fe2d

See more details on using hashes here.

File details

Details for the file burmesenlp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: burmesenlp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 711.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for burmesenlp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2ada56585d9306b57412b05533494861354415a38a0cb067fdc6de9b03acec4
MD5 3d8ba80123011ec26f0c97296f1d0c27
BLAKE2b-256 0e5c416676a33ed4c4e6945f3db764b861bc5d116435fd8899426b1cd323b753

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

This release

1.0.1 This release

2 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