khmer-dictionary / README.md
phonsobon's picture
Add g2p config (word->pronunciation, train/val/test); fix pronunciation typos
2afb0c6 verified
|
Raw History Blame Contribute Delete
9.54 kB
metadata
language:
  - km
license: other
license_name: nckl-khmer-dictionary-2022
pretty_name: Khmer Dictionary 2022 (NCKL)
size_categories:
  - 10K<n<100K
task_categories:
  - text-generation
  - fill-mask
tags:
  - khmer
  - dictionary
  - lexicon
  - monolingual-dictionary
configs:
  - config_name: entries
    default: true
    data_files:
      - split: train
        path: data/entries.parquet
  - config_name: senses
    data_files:
      - split: train
        path: data/senses.parquet
  - config_name: g2p
    data_files:
      - split: train
        path: data/g2p/train.parquet
      - split: validation
        path: data/g2p/validation.parquet
      - split: test
        path: data/g2p/test.parquet

Khmer Dictionary 2022 (វចនានុក្រមខ្មែរ ២០២២)

A clean, machine-readable version of the Khmer Dictionary 2022 from the National Council of Khmer Language (NCKL), Royal Academy of Cambodia. It is a monolingual dictionary: the headwords, definitions and examples are all in Khmer.

count
Entries (words with their own definition) 41,087
Senses (individual meanings) 44,698
Unique headwords 25,285
Sub-entries (compounds/derived words under a headword) 13,477
Unique words (headwords + sub-entries) 38,674

Quick start

from datasets import load_dataset

# One row per word, with all its meanings nested in `senses`
entries = load_dataset("phonsobon/khmer-dictionary", "entries", split="train")

# One flat row per meaning, which is easier for pandas, search and training
senses = load_dataset("phonsobon/khmer-dictionary", "senses", split="train")

df = senses.to_pandas()
df[df.word == "កក"][["word", "pronunciation", "part_of_speech_en", "definition", "examples"]]

Configurations

entries (default): one row per word

{
  "entry_id": 3,
  "word": "ក",
  "headword": "ក",
  "homograph": 3,
  "is_subentry": false,
  "pronunciation": "ក",
  "pronunciation_note": "",
  "etymology": "",
  "senses": [
    {"sense_no": 1, "sense_label": "១)", "part_of_speech": "ន.", "part_of_speech_en": "noun",
     "definition": "អវយវៈដែលតពីក្បាលទៅស្មាឬទៅខ្លួននៃមនុស្សសត្វ",
     "examples": "កមនុស្ស, កមាន់។", "notes": ""},
    {"sense_no": 2, "sense_label": "២)", "part_of_speech": "ន.", "part_of_speech_en": "noun",
     "definition": "កន្លែងដែលតជាប់ពីមាត់ដបជាដើមចុះទៅទល់នឹងក្អេងក៏ហៅ ក ដែរ",
     "examples": "កដប, កក្អម។", "notes": ""}
  ]
}

senses: one row per meaning (flat)

The senses config has the same fields, flattened. Every row repeats its word's word, pronunciation, etymology, etc., so each row makes sense on its own. It also has sense_id, the original row id. A CSV copy is in data/senses.csv, and a plain list of every word is in data/words.txt.

g2p: word → pronunciation pairs for grapheme-to-phoneme training

Clean spelling → pronunciation pairs, ready for training a Khmer G2P, transliteration or spelling-check model. It is split by word, so all readings of a word are in the same split (90 / 5 / 5).

split pairs
train 34,807
validation 1,942
test 1,934
{"word": "កករចិត្ត", "pronunciation": "ក-ក-ចិត", "entry_ids": [20], "syllables": 3}
Field Description
word Spelling (Khmer script only)
pronunciation Reading in Khmer script, syllables separated by -. Remove the - if you only need the phoneme string
entry_ids The dictionary entries this pair comes from (homographs share one row)
syllables Number of syllables

What is left out compared with the full dictionary:

  • 163 proverbs and idioms with no pronunciation (e.g. កង្កែបអាចម៍គោហ៊ានលោតខាំពស់វែក). They are still in entries / senses.
  • Bound/combining forms such as កម្ពុជ—. They are not standalone words, and their reading changes inside compounds.
  • Phrases with spaces, ... or abbreviations in brackets.

Alternative readings (a ឬ b) become separate rows, and duplicate (word, pronunciation) pairs are merged.

g2p = load_dataset("phonsobon/khmer-dictionary", "g2p")
g2p["train"][0]  # {'word': 'ក', 'pronunciation': 'ក', ...}

Fields

Field Type Description
entry_id int ID of the entry (stable, from the source database)
sense_id int (senses only) ID of this sense row in the source
word string The word being defined. For a sub-entry this is the compound (e.g. កកកុញ); otherwise it is the headword
headword string The main dictionary headword this entry belongs to (e.g. កក)
homograph int / null Homograph number when several unrelated headwords share a spelling (ក¹, ក², ក³ …)
is_subentry bool true if word is a compound/derived word listed under headword
pronunciation string Syllable-by-syllable reading in Khmer script, syllables joined by -. Alternative readings are joined with ឬ ("or")
pronunciation_note string Reading note, e.g. ជើង ត អានជា ដ (subscript ត is read as ដ)
etymology string Origin of the word, e.g. (បា.) = from Pali (see abbreviations below)
sense_no int Order of this meaning within the entry (1, 2, 3 …)
sense_label string Original sense marker in the dictionary: ១), ២) … for numbered meanings, a, b … for sub-meanings, empty if there is only one
part_of_speech string Part of speech as printed in Khmer (e.g. ន., គុ.កិ., គុ.)
part_of_speech_en string The same in English (e.g. noun, adverb, adjective)
definition string The definition
examples string Usage examples (comma-separated phrases or sentences, ending with ។)
notes string Extra notes such as cross-references, e.g. (ម.ព. ត្រង¹ ផង)។ = "see also ត្រង¹"

Abbreviations

Parts of speech (part_of_speech → part_of_speech_en)

Khmer Full form English
ន. នាម noun
កិ. កិរិយាសព្ទ verb
គុ. គុណនាម adjective
គុ.កិ. គុណកិរិយា adverb
សព្វ. សព្វនាម pronoun
ប. បុព្វបទ preposition
ឈ. ឈ្នាប់ conjunction
ឧ. ឧទានសព្ទ interjection
ធ. ធ្នាក់ particle

Etymology (etymology)

Abbr. Language
បា. Pali
សំ. Sanskrit
សំ.បា. / បា.សំ. Sanskrit and Pali
បារ. French (បារាំង)
ស. Thai/Siamese (សៀម)
ចិ. Chinese
អ. English
យ. Vietnamese (យួន)
ល. Lao

Inside etymologies, < and > show derivation (A > B = A became B), and អ.ថ. means "read as".

Common markers in definitions and notes

Marker Meaning
ម.ព. see (cross-reference)
(ព.ប្រ.) figurative usage
(ព.កា.) poetic/literary usage
(គណិត.), (គីមី.) … domain label: mathematics, chemistry …
ក¹, ក² homograph number of the referenced word

How this was cleaned

The source export was a flat table where the 2nd, 3rd … meanings of a word had blank word columns and some columns had misleading names. The changes:

  • Filled every row in. Each meaning now carries its word, pronunciation, etymology and part of speech.
  • Renamed the columns. The source sense column (which actually held the compound word) became word, poly became sense_label, and ref became entry_id.
  • Converted the homograph markup. The internal markup {¥¥}១{££} is now a superscript number (¹).
  • Cleaned the pronunciations. The [ ] brackets are removed, and reading notes moved to pronunciation_note.
  • Trimmed the definitions. The trailing :, which only pointed at the examples, is removed.
  • Added English POS labels. These are in part_of_speech_en.
  • Dropped one column. The undocumented remark flag was removed.
  • Fixed pronunciation typos. Stray ´´, : typed in place of ៈ, and doubled [[ (6 entries).
  • Left proverbs and idioms empty. Unlike some other copies of this dictionary, the 163 proverbs/idioms with no pronunciation in the source stay empty instead of borrowing the pronunciation of the row above.

The Khmer text is otherwise unchanged. Zero-width joiners and non-joiners (e.g. in អ៊‌ីចឹង) are kept on purpose: Khmer uses them to control how characters combine. A few etymologies of Thai loanwords contain private-use glyphs from the original font.

The build script is scripts/build_hf_dataset.py.

Source and license

Content © National Council of Khmer Language (ក្រុមប្រឹក្សាជាតិភាសាខ្មែរ), Royal Academy of Cambodia, Khmer Dictionary 2022. This dataset is a reformatted copy for research and language-technology use. All rights in the dictionary content remain with NCKL. Check NCKL's terms before any commercial use or redistribution.