quran-simple-clean.txt — 6,348 Quranic verses, one per line.| File | Format | Description |
|---|---|---|
quran_5gram.arpa | ARPA text | Portable n-gram model |
quran_5gram.binary | KenLM binary | Fast probing hash |
config.json | JSON | Model metadata |
1import kenlm
2
3model = kenlm.Model("quran_5gram.binary") # or .arpa
4
5# Score a verse (log10 probability)
6score = model.score("بسم الله الرحمن الرحيم")
7
8# Perplexity
9ppl = model.perplexity("الحمد لله رب العالمين")
10
11# Score a verse sequence (consecutive recitation)
12sequence = "بسم الله الرحمن الرحيم الحمد لله رب العالمين"
13seq_score = model.score(sequence)pip install kenlm