Downloads · 30 days
0
hugohow/5gram-french-kenLM
5gram-french-kenLM is a machine learning model from hugohow. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Nov 14, 2024
Repo size
1000 MB
Likes
1
Public
Click a slice to open those files.
.bin1000 MB · 100%
From the Hugging Face model README
Install
pip install kenlm huggingface_hub
Simply run the following code:
import kenlm
from huggingface_hub import hf_hub_download
# Téléchargement du fichier du modèle depuis le Hub Hugging Face
model_file = hf_hub_download(
repo_id="hugohow/5gram-french-kenLM", filename="lm_5gram_big.bin"
)
# Chargement du modèle KenLM
model = kenlm.Model(model_file)
# Get perplexity
print(model.perplexity("je vais à la maison"))
# 20.6 (low perplexity, since sentence style is formal and with no grammar mistakes)
print(model.perplexity("jevais à la maisond"))
# 17041.7 (high perplexity, since the sentence is colloquial and contains grammar mistakes)