File size: 395 Bytes
19b8775
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from gensim.models import FastText

model = FastText.load("kubhist2_increm_1880/kubhist2_tokens_1880.ft")

# obtain the full list of words
words = list(model.wv.index_to_key)
dim = model.wv.vector_size

with open("sv.vectors", "w", encoding="utf8") as f:
    f.write(f"{len(words)} {dim}\n")
    for w in words:
        vec = model.wv[w]
        f.write(w + " " + " ".join(map(str, vec)) + "\n")