beshiribrahim commited on
Commit
2c6ae34
·
verified ·
1 Parent(s): f55608a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md CHANGED
@@ -3,3 +3,47 @@ license: cc-by-sa-4.0
3
  language:
4
  - tig
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5403133630752563), ('ሐደክዉ', 0.5009863972663879), ('ኢመሓዛትካ', 0.4794275760650635), ('ለቤት', 0.47765740752220154), ('ከቤት', 0.4470037817955017), ('ለብርሂ', 0.41692110896110535), ('ከሺነት', 0.4148196578025818), ('ከሺነትነ', 0.41287708282470703), ('ወንጌላይት', 0.410333514213562), ('ወንጌላይ', 0.40985122323036194)]
27
+ [('ዋልዳይትተ', 0.9436762928962708), ('ዋልዳይትናመ', 0.9374170303344727), ('ከዋልዳይት', 0.9302672147750854), ('ዋልዳይትኪ', 0.9297484755516052), ('ዋልዳይትቼ', 0.922221302986145), ('ዋልዳይትነ', 0.9221974611282349), ('ዋልዳይትመ', 0.9156748652458191), ('ዋልዳይትኩም', 0.9076657891273499), ('ዋልዳይትዬ', 0.8774775266647339), ('ዋልዳይትከ', 0.8705683350563049)]
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
+