Update README.md
Browse files
README.md
CHANGED
|
@@ -2,48 +2,44 @@
|
|
| 2 |
license: cc-by-sa-4.0
|
| 3 |
language:
|
| 4 |
- tig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
-
pip install gensim
|
| 7 |
-
pip install fasttext huggingface_hub
|
| 8 |
-
from huggingface_hub import hf_hub_download
|
| 9 |
-
import fasttext
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
from huggingface_hub import hf_hub_download
|
| 13 |
from gensim.models import KeyedVectors
|
| 14 |
|
|
|
|
| 15 |
vec_path = hf_hub_download(
|
| 16 |
repo_id="BeitTigreAI/tigre-data-fasttext",
|
| 17 |
filename="tigre.vec",
|
| 18 |
-
repo_type="dataset"
|
| 19 |
)
|
| 20 |
|
|
|
|
| 21 |
model = KeyedVectors.load_word2vec_format(vec_path, binary=False)
|
|
|
|
|
|
|
| 22 |
print(model.most_similar("ቤት"))
|
| 23 |
print(model.most_similar("ዋልዳይት"))
|
| 24 |
|
| 25 |
-
|
| 26 |
-
[('ወቤት', 0.
|
| 27 |
-
[('ዋልዳይትተ', 0.
|
| 28 |
-
---
|
| 29 |
-
|
| 30 |
-
from huggingface_hub import hf_hub_download
|
| 31 |
-
import fasttext
|
| 32 |
-
|
| 33 |
-
bin_path = hf_hub_download(
|
| 34 |
-
repo_id="BeitTigreAI/tigre-data-fasttext",
|
| 35 |
-
filename="tig.bin",
|
| 36 |
-
repo_type="dataset"
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
ft = fasttext.load_model(bin_path)
|
| 40 |
-
|
| 41 |
-
print(ft.get_word_vector("ሻም")[:10])
|
| 42 |
-
print(ft.get_nearest_neighbors("ሻም"))
|
| 43 |
-
|
| 44 |
-
---
|
| 45 |
-
|
| 46 |
-
[-2.2306004 4.1328444 -1.307913 1.390595 -3.1971953 -1.213482
|
| 47 |
-
0.45558256 -2.998946 -0.79585505 -0.26456892]
|
| 48 |
-
[(0.5539113879203796, 'ሻማት'), (0.5307868719100952, 'ዴሪር'), (0.4694315791130066, 'ሕዋሌሻም'), (0.46039608120918274, 'ምልህዮት'), (0.45820483565330505, 'ወሻም'), (0.45434507727622986, 'ከምልህዮት'), (0.45119181275367737, 'ለምልህዮት'), (0.4460937976837158, 'ሻሙ'), (0.43825647234916687, 'ሻሞም'), (0.4371178150177002, 'ወረአየት')]
|
| 49 |
|
|
|
|
| 2 |
license: cc-by-sa-4.0
|
| 3 |
language:
|
| 4 |
- tig
|
| 5 |
+
tags:
|
| 6 |
+
- fasttext
|
| 7 |
+
- word-embeddings
|
| 8 |
+
- tigre
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Tigre FastText Embeddings
|
| 12 |
+
|
| 13 |
+
This repository provides **FastText word embeddings for the Tigre language**.
|
| 14 |
+
The embeddings can be used for similarity, clustering, text classification, or as input features in downstream NLP tasks.
|
| 15 |
+
|
| 16 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
## 📦 Installation
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
pip install gensim fasttext huggingface_hub
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
|
| 25 |
from huggingface_hub import hf_hub_download
|
| 26 |
from gensim.models import KeyedVectors
|
| 27 |
|
| 28 |
+
# Download the vec file
|
| 29 |
vec_path = hf_hub_download(
|
| 30 |
repo_id="BeitTigreAI/tigre-data-fasttext",
|
| 31 |
filename="tigre.vec",
|
| 32 |
+
repo_type="dataset"
|
| 33 |
)
|
| 34 |
|
| 35 |
+
# Load embeddings
|
| 36 |
model = KeyedVectors.load_word2vec_format(vec_path, binary=False)
|
| 37 |
+
|
| 38 |
+
# Example queries
|
| 39 |
print(model.most_similar("ቤት"))
|
| 40 |
print(model.most_similar("ዋልዳይት"))
|
| 41 |
|
| 42 |
+
```css
|
| 43 |
+
[('ወቤት', 0.54), ('ሐደክዉ', 0.50), ('ኢመሓዛትካ', 0.47), ...]
|
| 44 |
+
[('ዋልዳይትተ', 0.94), ('ዋልዳይትናመ', 0.93), ('ከዋልዳይት', 0.93), ...]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|