The Loghatnameh of Ali Akbar Dehkhoda is the largest encyclopedic dictionary of the Persian language. It took a lifetime of work from Dehkhoda and his collaborators, and it holds centuries of Persian vocabulary, poetry, geography, history and science. It is also hard to use in code. Online it's a collection of HTML fragments and PDF files, which is fine for reading one word at a time and awkward for anything else.
I wanted to change that, so I built a cleaned, structured version of the whole dictionary.
What's inside
15% of senses sit inside compound sub-entries.
All 566,654 senses, split by where they live
| Where | Senses |
|---|---|
| Headword senses | 482,805 |
| Compound sub-entries | 83,849 |
Every entry is a single JSON object with its pronunciation, part of speech, individual senses, compound sub-entries and cited sources nested inside it. Entries are sorted in Persian alphabetical order, and each one also keeps a diacritic-free headword_plain field for search and the original raw_html for reference.
Here's what the structure looks like for a single entry:
{
"headword": "اویزه",
"pronunciation": "اَ زَ / زِ",
"pos": "اِ",
"is_proper_noun": false,
"senses": [
{
"sense_no": 1,
"text": "شراب انگور و می. (ناظم الاطباء) (برهان).",
"sources": [
{"citation": "(ناظم الاطباء)", "source": "ناظم الاطباء"},
{"citation": "(برهان)", "source": "برهان"}
]
}
]
}
How I built it
The starting point was a public raw dump of the dictionary with one HTML fragment per entry. Turning that into something usable took several steps:
- Splitting senses on the dictionary's
||separators. - Extracting sub-entries, which the dictionary marks with a leading dash followed by
phrase؛ definition. - Reading pronunciation and part of speech from the leading
[ … ]block and the coloured( … )labels. - Cleaning the text: joining the hard line wraps of the print layout, converting Arabic
يandكto their Persian formsیandک, and normalizing footnote markers. - Normalizing citations by stripping volume numbers, page numbers and prefixes, so that the same book always appears under the same name.
- Restoring alphabetical order. The website's ids are mostly alphabetical but not entirely. A block of about 3,900 entries starting with م shows up after ی. I re-sorted everything by Persian collation, ignoring diacritics, spaces and ZWNJ, which matches Dehkhoda's own ordering.
About 3,900 م entries sat after ی.
Order of entries by first letter · reads right to left · schematic, not to scale
Limitations
- 506 entries from the printed dictionary are missing from the source scrape.
- The website never published the footnotes, so only the markers remain.
- Joining print line wraps also joins the lines of quoted poetry.
raw_htmlkeeps the original breaks if you need them. - Sub-entry and source extraction is rule-based, so a small number of entries will be wrong. Sources with fewer than 20 citations aren't listed in
sources, though they stay in the text.
Try it
from datasets import load_dataset
ds = load_dataset("n9e6y/persian-dehkhoda-dictionary", split="train")
entry = ds.filter(lambda e: e["headword"] == "جلو")[0]
for sense in entry["senses"]:
print(sense["sense_no"], sense["subentry"] or "", sense["text"])
What it could be used for
A structured Dehkhoda opens up a lot for Persian NLP: building search and lookup tools, studying how word senses change over time, mining the citation network to see which classical sources the dictionary leans on, creating lexicons for spell-checking or morphology, or training and evaluating language models on a rich, literary Persian corpus.
Get the data
The dataset is available in two formats:
Acknowledgements
All the credit for the content goes to Allameh Ali Akbar Dehkhoda (1879–1956) and his collaborators. My part was only to make their life's work easier to work with. Thanks also to the compiler of the original public dump, which made this project possible.
If you use the dataset, I'd love to hear about it. Feel free to open a discussion on the Hugging Face page or send me a message.