Downloads · 30 days
0
metythorn/khmer-ngram-models
khmer-ngram-models is a machine learning model from metythorn. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains KenLM n-gram language models for Khmer language.
Downloads · 30 days
0
Access
Public
Updated Jul 3, 2025
Repo size
9.8 GB
Likes
0
Public
Click a slice to open those files.
.binary9.8 GB · 100%
From the Hugging Face model README
This repository contains KenLM n-gram language models for Khmer language.
khmer_bigrams.binary: Bigram language modelkhmer_trigrams.binary: Trigram language modelimport kenlm
# Load models
bigram_model = kenlm.LanguageModel("khmer_bigrams.binary")
trigram_model = kenlm.LanguageModel("khmer_trigrams.binary")
# Score a sentence
sentence = "ខ្ញុំ ស្រលាញ់ ភាសា ខ្មែរ ។"
bigram_score = bigram_model.score(sentence)
trigram_score = trigram_model.score(sentence)
print(f"Bigram score: {bigram_score}")
print(f"Trigram score: {trigram_score}")
pip install kenlm
from huggingface_hub import hf_hub_download
# Download bigram model
bigram_path = hf_hub_download(
repo_id="YOUR_USERNAME/khmer-ngram-models",
filename="khmer_bigrams.binary"
)
# Download trigram model
trigram_path = hf_hub_download(
repo_id="YOUR_USERNAME/khmer-ngram-models",
filename="khmer_trigrams.binary"
)