--- license: cc-by-nc-sa-4.0 language: - bo tags: - classical-tibetan - historical-text - normalisation - kenlm - n-gram - language-model - corpus - low-resource - digital-humanities size_categories: - 10M180 million words of Standard Classical Tibetan), available from [Zenodo (Meelen & Roux 2020)](https://zenodo.org/records/3951503). Each file is prepared in a different form: | File | Size | Description | |---|---|---| | `unsegACTib_lines_kenlm_20260103_220309.txt` | 2.16 GB | Non-tokenised ACTib lines — used to train [`pagantibet/5gram-kenLM_char`](https://huggingface.co/pagantibet/5gram-kenLM_char) | | `unsegACTib-tok_lines_kenlm_20260103_220119.txt` | 2.32 GB | Tokenised ACTib lines — used to train [`pagantibet/5gram-kenLM_char-tok`](https://huggingface.co/pagantibet/5gram-kenLM_char-tok) | *Note: the Hugging Face Dataset Viewer displays the dataset as a single train split — this is a technical default.* Both files are UTF-8 encoded plain text with one line per sequence. In the tokenised file, tokens are separated by spaces as produced by the customised Botok tokeniser (see [Data_Preparation](https://github.com/pagantibet/normalisation/tree/main/Data_Preparation)). The ACTib does not contain natural linebreaks and includes non-Tibetan material (e.g. page numbers, section markers) that is unsuitable for language model training. Before use, the corpus was cleaned and split into artificial manuscript-length lines of varying length using the `createTiblines.py` script (see [Data_Preparation](https://github.com/pagantibet/normalisation/tree/main/Data_Preparation)). This produces lines of realistic, varied lengths that match the sequence units encountered during normalisation at inference time. --- ## Usage The training notebook [`KenLM_trainforNormalisation.ipynb`](https://github.com/pagantibet/normalisation/blob/main/Training/KenLM_trainforNormalisation.ipynb) walks through the full training process and can be run on Google Colab. The key steps are as follows: ### Step 1 — Install KenLM ```bash sudo apt-get install -y build-essential cmake libboost-all-dev \ libboost-program-options-dev libboost-system-dev \ libboost-thread-dev libboost-test-dev libeigen3-dev zlib1g-dev git clone https://github.com/kpu/kenlm.git cd kenlm && mkdir build && cd build cmake .. && make -j 4 ``` ### Step 2 — Convert to Space-Separated Characters KenLM requires space-separated tokens. For character-level modelling, each character must be separated by a space. Apply this to whichever file you are using: ```python # For the non-tokenised file with open("unsegACTib_lines_kenlm_20260103_220309.txt") as f_in, \ open("actib_char.txt", "w") as f_out: for line in f_in: f_out.write(" ".join(line.strip()) + "\n") # For the tokenised file with open("unsegACTib-tok_lines_kenlm_20260103_220119.txt") as f_in, \ open("actib_char_tok.txt", "w") as f_out: for line in f_in: f_out.write(" ".join(line.strip()) + "\n") ``` ### Step 3 — Train the 5-gram KenLM Using the parameters from Meelen & Griffiths (2026): ```bash # Non-tokenised model ./kenlm/build/bin/lmplz \ -o 5 \ --prune 0 1 1 2 2 \ --discount_fallback \ < actib_char.txt \ > model_5gram_char.arpa # Tokenised model ./kenlm/build/bin/lmplz \ -o 5 \ --prune 0 1 1 2 2 \ --discount_fallback \ < actib_char_tok.txt \ > model_5gram_char_tok.arpa ``` **Parameter notes:** - `-o 5` — 5-gram order - `--prune 0 1 1 2 2` — pruning thresholds per n-gram order (unigrams kept, higher-order singletons pruned) - `--discount_fallback` — modified Kneser-Ney discounting with fallback Training completes in under 5 minutes on Google Colab. Full parameter settings are reported in the Appendix of Meelen & Griffiths (2026). ### Step 4 — (Optional) Convert to Binary For faster loading with the compiled KenLM Python backend: ```bash ./kenlm/build/bin/build_binary model_5gram_char.arpa model_5gram_char.bin ``` *Note: The pure Python ARPA backend used in the inference scripts requires `.arpa` format. The `.bin` format is only compatible with the compiled `kenlm` Python package.* --- ## Relationship to Other Resources This corpus sits at the base of the KenLM training pipeline. The diagram below shows how it connects to the rest of the PaganTibet normalisation stack: ``` ACTib corpus (Zenodo) │ ▼ createTiblines.py ──→ unsegACTib_lines_kenlm_*.txt (this dataset, non-tokenised file) │ ▼ botokenise_src-tgt.py ──→ unsegACTib-tok_lines_kenlm_*.txt (this dataset, tokenised file) │ ├──→ lmplz (KenLM) ──→ 5gram-kenLM_char (non-tokenised KenLM model) └──→ lmplz (KenLM) ──→ 5gram-kenLM_char-tok (tokenised KenLM model) │ ▼ Used as beam search re-ranker in normalisationS2S inference ``` --- ## Related Models and Resources | Resource | Link | |---|---| | Non-tokenised KenLM model (trained on this data) | [`pagantibet/5gram-kenLM_char`](https://huggingface.co/pagantibet/5gram-kenLM_char) | | Tokenised KenLM model (trained on this data) | [`pagantibet/5gram-kenLM_char-tok`](https://huggingface.co/pagantibet/5gram-kenLM_char-tok) | | Non-tokenised Seq2Seq model | [`pagantibet/normalisationS2S-nontokenised`](https://huggingface.co/pagantibet/normalisationS2S-nontokenised) | | Tokenised Seq2Seq model | [`pagantibet/normalisationS2S-tokenised`](https://huggingface.co/pagantibet/normalisationS2S-tokenised) | | S2S training dataset | [`pagantibet/normalisation-S2S-training`](https://huggingface.co/datasets/pagantibet/normalisation-S2S-training) | | KenLM training notebook | [`KenLM_trainforNormalisation.ipynb`](https://github.com/pagantibet/normalisation/blob/main/Training/KenLM_trainforNormalisation.ipynb) | | Data preparation scripts & ReadMes | [github.com/pagantibet/normalisation/Data_Preparation](https://github.com/pagantibet/normalisation/tree/main/Data_Preparation) | | Inference scripts & ReadMe | [github.com/pagantibet/normalisation/Inference](https://github.com/pagantibet/normalisation/tree/main/Inference) | | ACTib corpus | [Zenodo (Meelen & Roux 2020)](https://zenodo.org/records/3951503) | | PaganTibet project | [pagantibet.com](https://www.pagantibet.com/) | --- ## License This dataset is released under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/). It may be used freely for non-commercial research and educational purposes, with attribution and under the same licence terms. --- ## Funding This work was partially funded by the European Union (ERC, Pagan Tibet, grant no. 101097364). Views and opinions expressed are those of the authors only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency.