Skip to main content

Neam (នាម)

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

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

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

An entity counts only if both its boundaries and its type are exact. Retraining with different seeds gives about 86–87 on average. See MODEL_CARD.md for the details and limitations.

Paper: Neam: Open Named Entity Recognition for Khmer News with a Small ALBERT Ensemble (preprint, 2026).

How it was built: moriartyputh.github.io/neam, a visual walkthrough of the pipeline, experiments and results.

Install

pip install neam            # library
pip install "neam[app]"     # plus the web app

Python 3.10+. Install the PyTorch build that suits your machine first if you want GPU support. The model (about 265 MB) downloads from the Hugging Face Hub on first use.

To work on the code itself, clone the repository and run pip install -e ".[app]".

Use

from neam import Neam

ner = Neam.from_pretrained("MoriartyPuth/neam")   # or a local model folder
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

From the command line:

python -m neam.inference --text "ក្រសួងអប់រំ យុវជន និងកីឡា បានប្រកាសលទ្ធផលថ្មី។"

Each entity has label, text, start, end (Python character offsets into the input) and score, the model's mean confidence, which is not a calibrated probability.

Web app

The web app is app.py in this repository. Run it from a clone after pip install -e ".[app]":

python app.py                      # http://127.0.0.1:7860
python app.py --model /path/to/local/model

Paste Khmer text, or open Import an online article and give a public news URL. The page is fetched with redirect and private-network checks, and the text is limited to 20,000 characters. Highlights: PER red, ORG green, LOC blue.

How it works

  1. Segmentation. Text is split into words with khmer-nltk. Only zero-width characters (U+200B/C/D) are dropped; offsets always point into the original string.
  2. Subword alignment. Each word's label is read from its first subword that is not a bare SentencePiece ▁ marker.
  3. Overlapping windows. Long texts are read in 128-subword windows that overlap. Each word is taken from the window where it has the most context on both sides.
  4. Ensemble and Viterbi. Seven ALBERT models' probabilities are averaged and decoded into the best valid IOB2 sequence.
  5. Display rules. Short honorifics (លោក) join a following name while ceremonial titles (ឯកឧត្តម, សម្តេច, …) stay outside it, place designators (ខេត្ត, ស្រុក, …) are completed, nationality phrases (ជនជាតិ + country) are not tagged as places, and punctuation, whitespace and zero-width characters are trimmed from span edges.

The labelling rules are in docs/annotation_policy.md.

Development

python -m unittest discover -s tests

scripts/export_model.py packages a trained ensemble folder into the Hub layout (ensemble.json plus members/). Training code and research history are kept in a separate research repository.

Citation

If you use Neam, please cite the preprint:

@misc{puthcambo2026neam,
  title  = {Neam: Open Named Entity Recognition for Khmer News with a Small {ALBERT} Ensemble},
  author = {{Eav Puthcambo}},
  year   = {2026},
  note   = {Preprint, ResearchGate},
  url    = {https://www.researchgate.net/publication/417187812_Neam_Open_Named_Entity_Recognition_for_Khmer_News_with_a_Small_ALBERT_Ensemble}
}

License

Apache-2.0. See LICENSE and NOTICE for third-party attributions.

Metadata

Release files for neam 0.2.1

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

Source distribution (sdist)

Source distribution for neam 0.2.1
File Size Uploaded Provenance Actions
neam-0.2.1.tar.gz 28.4 kB Without provenance Details for neam-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 50.4 kB

Release files / neam-0.2.1.tar.gz

Download URL neam-0.2.1.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
626b864caf8f11b6d55c5b5f78d3a6323e28be631e80a223f0c343c51a6b8e7c
BLAKE2b-256 checksum
How to use checksums
b44e3b7ccb74c288c143364d4d646516059f1ec6beba03b6cdc6103d1cf56f7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / neam-0.2.1-py3-none-any.whl

Download URL neam-0.2.1-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c13050cf81c14d0fcff1413f48f35784e8fc18ca061f1fef840382020684fec
BLAKE2b-256 checksum
How to use checksums
2aa89e11450561ae005f16588013c4f4d739d6ba9ce810b4f102d57a47b2f130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for neam 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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