YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Myanmar POS tagger (XLM-RoBERTa)
Fine-tuned XLM-RoBERTa for Myanmar (Burmese) part-of-speech tagging on myPOS, plus high-confidence pseudo labels from unlabeled book text.
Install (weights β this repo)
pip install torch transformers burmesenlp
Usage (transformers)
Word-segment with burmesenlp first, then tag. Myanmar script has no spaces between words; the model labels tokens, it does not choose boundaries.
Use Unicode text. Do not run zg2uni unless the source is known Zawgyi (false conversion breaks segmentation).
import torch
from burmesenlp import word_tokenize
from transformers import AutoModelForTokenClassification, AutoTokenizer
name = "aungthuhein-dev/burmese-pos-xlmr"
tokenizer = AutoTokenizer.from_pretrained(name)
model = AutoModelForTokenClassification.from_pretrained(name)
model.eval()
text = "αα±α«αΊα‘α±α¬ααΊαααΊαΈα
α―ααΌααΊαααΊααα―ααΊααΆαα±α¬αΊα‘ααα―ααΊαααΊααΆααΌα
αΊαααΊα"
words = [w for w in word_tokenize(text) if w.strip()]
inputs = tokenizer(
words,
is_split_into_words=True,
return_tensors="pt",
truncation=True,
max_length=128,
)
with torch.no_grad():
pred_ids = model(**inputs).logits.argmax(dim=-1)[0].tolist()
id2label = {int(k): v for k, v in model.config.id2label.items()}
tags, prev = [], None
for i, wid in enumerate(inputs.word_ids()):
if wid is None or wid == prev:
continue
tags.append(id2label[pred_ids[i]])
prev = wid
print(list(zip(words, tags)))
Example output:
[('αα±α«αΊα‘α±α¬ααΊαααΊαΈα
α―ααΌααΊ', 'n'), ('αααΊ', 'ppm'), ('ααα―ααΊααΆαα±α¬αΊ', 'n'),
('α‘ααα―ααΊαααΊααΆ', 'n'), ('ααΌα
αΊ', 'v'), ('αααΊ', 'ppm'), ('α', 'punc')]
Tag the first subword of each word only. Do not pass a list of words into pipeline(...) (that treats each word as a separate sentence).
Pipeline
Unicode sentence
β NFC + strip ZWJ/ZWNJ
β burmesenlp.word_tokenize
β XLM-RoBERTa (first subword = word tag)
β [(word, tag), ...]
Tagset (myPOS, 15 labels)
| Tag | Meaning |
|---|---|
abb |
Abbreviation |
adj |
Adjective |
adv |
Adverb |
conj |
Conjunction |
fw |
Foreign word |
int |
Interjection |
n |
Noun |
num |
Number |
part |
Particle |
ppm |
Post-positional marker |
pron |
Pronoun |
punc |
Punctuation |
sb |
Symbol |
tn |
Text number |
v |
Verb |
Training
- Train
xlm-roberta-baseon myPOS gold (43,196 sentences) β baseline. - Tag unlabeled book sentences; keep examples where every word-level softmax β₯ 0.95 β 205,721 pseudo-labeled sentences.
- Fine-tune on gold myPOS + pseudo labels β this checkpoint.
Evaluation
Word-level POS on a 10% myPOS holdout (train_test_split, seed=42, 4,320 sentences, 52,247 tokens). First subword of each word carries the tag; 29 sentences skipped (length / alignment at 128 subwords).
| Model | Token acc. | Micro-F1 | Macro-F1 |
|---|---|---|---|
| XLM-R baseline (myPOS only) | 97.25 | 97.25 | 94.92 |
| XLM-R + 205,721 pseudo labels (this model) | 97.24 | 97.24 | 94.99 |
Pseudo-labeling does not improve in-domain myPOS F1 (the gold-only baseline is already saturated). Extra data targets book-style vocabulary at inference, not a higher official test score.
Limitations
- In-domain myPOS F1 is tied with the gold-only baseline.
- Social, chat, and code-mixed text are not the training domain.
- Inference uses
burmesenlp.word_tokenize; pseudo-label training data used a different segmenter. - Rare tags (
abb,int,sb) have very small support on the holdout.
Citation
myPOS: Ye Kyaw Thu et al. https://github.com/ye-kyaw-thu/myPOS
Model: https://huggingface.co/aungthuhein-dev/burmese-pos-xlmr
License
Check this model card and the myPOS corpus terms before redistribution.
- Downloads last month
- 55