← all projects

Neam (នាម)

2026 · active

Khmer named entity recognition for news. Finds people, organizations and places in Khmer text with exact character offsets, and runs offline on a CPU.

PythonPyTorchALBERTHugging Face#nlp#khmer#machine-learning

Neam finds people (PER), organizations (ORG) and places (LOC) in Khmer text, and returns exact character offsets into your original input. It runs offline on a CPU.

នាម means "name, noun": the named in named entity.

How well it works

Exact-span F1
Held-out Khmer news (10 articles, 199 entities) 86.7
Validation Khmer news (5 articles, 111 entities) 82.3

An entity only counts if both its boundaries and its type are exactly right.

Try it

pip install neam
from neam import Neam

ner = Neam.from_pretrained("MoriartyPuth/neam")
result = ner.predict("លោក ហ៊ុន ម៉ាណែត បានជួបជាមួយក្រសួងសុខាភិបាលនៅរាជធានីភ្នំពេញ។")
for entity in result["entities"]:
    print(entity["label"], entity["text"], entity["start"], entity["end"])
# PER លោក ហ៊ុន ម៉ាណែត 0 15
# ORG ក្រសួងសុខាភិបាល 27 42
# LOC រាជធានីភ្នំពេញ 44 58

There's also a small web app: paste Khmer text, or import a public news article by URL, and the entities get highlighted.

How it works

  1. Segmentation: text is split into words with khmer-nltk, and offsets always point back into the original string.
  2. Overlapping windows: long articles are read in overlapping 128-subword windows, and each word is taken from the window where it has the most context.
  3. Ensemble + Viterbi: seven ALBERT models' predictions are averaged, then decoded into the best valid label sequence.
  4. Display rules: Khmer-specific clean-up. Short honorifics like លោក join the following name, ceremonial titles stay outside it, and place designators such as ខេត្ត (province) are completed.