beshiribrahim commited on
Commit
5c8be83
·
verified ·
1 Parent(s): 80afd27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -2
README.md CHANGED
@@ -4,7 +4,115 @@ language:
4
  - tig
5
  tags:
6
  - tigre
7
- - africa
8
- - low-resource
 
9
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - tig
5
  tags:
6
  - tigre
7
+ - language-model
8
+ - kenlm
9
+ - n-gram
10
  ---
11
+
12
+ # Tigre 3-gram Language Model (KenLM)
13
+
14
+ ### Overview
15
+
16
+ This repository provides a **3-gram Language Model (LM)** for the **Tigre** language, trained using the **KenLM** toolkit. This model is a foundational resource for various downstream NLP and speech applications, including:
17
+
18
+ - Rescoring hypotheses in Automatic Speech Recognition (ASR).
19
+ - Improving text generation and fluency in Machine Translation (MT).
20
+ - Performing basic text filtering and quality control.
21
+
22
+ The model is provided in the highly optimized binary (`.arpa`) format, making it suitable for efficient use in production environments.
23
+
24
  ---
25
+
26
+ ## Model Statistics
27
+
28
+ This language model was trained using KenLM on the **Tigre Monolingual Text Dataset (Tigre-Data 1.0)**.
29
+
30
+ | Statistic | Value |
31
+ | :----------------------------------- | :-------- |
32
+ | **Model Order** | 3-gram |
33
+ | **Vocabulary Size (Unique 1-grams)** | 316,548 |
34
+ | **Total Unique N-grams (1-to-3)** | 1,285,462 |
35
+ | **Example Perplexity** (on 'ቤት') | 147.12 |
36
+
37
+ _Note: The total raw training tokens used for this model can be found in the Tigre Monolingual Text Dataset card (approximately 14.7 million tokens)._
38
+
39
+ ---
40
+
41
+ ## Training Data Source
42
+
43
+ This model was trained exclusively on the **BeitTigreAI/tigre-data-monolingual-text** dataset.
44
+
45
+ More detailed information about the training data, including its domain, bias, preprocessing steps, and source statistics, can be found in the dataset's documentation:
46
+ [Tigre Monolingual Text Dataset README](https://huggingface.co/datasets/BeitTigreAI/tigre-data-monolingual-text/blob/main/README.md)
47
+
48
+ ---
49
+
50
+ ## Files and Structure
51
+
52
+ The repository contains the following files:
53
+
54
+ tigre-data-kenLM/
55
+ ├── README.md <-- This file
56
+ ├── hf_readme.ipynb <-- Jupyter notebook used for statistics extraction
57
+ └── tigre-data-kenLM.arpa <-- The primary language model file (ARPA format)
58
+
59
+ ## How to Use the Model
60
+
61
+ You can load and query the model using the Python bindings for **KenLM** (`kenlm`).
62
+
63
+ ### Installation
64
+
65
+ To use the model in Python, install the KenLM bindings:
66
+
67
+ ```bash
68
+ !pip install kenlm
69
+
70
+
71
+
72
+ ## Example Usage (Perplexity and Score)
73
+ The following Python code demonstrates how to load the model and query it for log probability and perplexity:
74
+
75
+ ```python
76
+
77
+ import kenlm
78
+ from huggingface_hub import hf_hub_download
79
+
80
+ # 1. Download the ARPA model file from the Hugging Face Hub
81
+ arpa_path = hf_hub_download(
82
+ repo_id="BeitTigreAI/tigre-data-kenLM",
83
+ filename="tigre-data-kenLM.arpa",
84
+ repo_type="model"
85
+ )
86
+
87
+ # 2. Load the KenLM model
88
+ lm = kenlm.Model(arpa_path)
89
+
90
+ # Example single sentence to score
91
+ test_sentence = "ዕርቃን ሓይልን ንግሥን" # Or use one of the lines from your list
92
+
93
+ # A. Calculate Log10 Probability of the entire sentence
94
+ log_prob = lm.score(test_sentence)
95
+ print(f"Sentence: '{test_sentence}'")
96
+ print(f"Log10 Probability: {log_prob:.4f}")
97
+
98
+ # B. Calculate Perplexity of the entire sentence
99
+ perplexity = lm.perplexity(test_sentence)
100
+ print(f"Perplexity: {perplexity:.2f}")
101
+
102
+ ```
103
+
104
+ ## Licensing and Citation
105
+
106
+ The Tigre 3-gram Language Model is licensed under CC-BY-SA-4.0.
107
+
108
+ ## Citation
109
+
110
+ If you use this resource in your work, please cite the repository by referencing its Hugging Face entry:
111
+
112
+ ## Recommended Citation Format:
113
+
114
+ ## Repository Name: Tigre 3-gram Language Model (KenLM)
115
+
116
+ ## Organization: BeitTigreAI
117
+
118
+ URL: https://huggingface.co/datasets/BeitTigreAI/tigre-data-kenLM