I'm using fastText
implementation of the module gensim
. Despite getting no reasons, my program throws an exception.
Here is the code:
try:
data = []
with open(TXT_PATH, 'r', encoding='utf-8') as txt_file:
for line in txt_file:
for part in line.split(' '):
data.append(part.strip())
fastText = FastText(data, min_count=1, size=10000, window=5, workers=4)
# Print results
word_1 = 'happy'
word_2 = 'birthday'
print(f'Similarity between {word_1} and {word_2} thru fastText: {fastText.similarity(word_1, word_2)}')
except Exception as err:
print(f'\n!!!!! An error happened! Detail: {str(err)}')
The end of the output:
!!!!! An error happened! Detail: