Views
No views yet
pip install hezar1from hezar.embeddings import Embedding
2
3fasttext = Embedding.load("hezarai/fasttext-fa-300")
4# Get embedding vector
5vector = fasttext("هزار")
6# Find the word that doesn't match with the rest
7doesnt_match = fasttext.doesnt_match(["خانه", "اتاق", "ماشین"])
8# Find the top-n most similar words to the given word
9most_similar = fasttext.most_similar("هزار", top_n=5)
10# Find the cosine similarity value between two words
11similarity = fasttext.similarity("مهندس", "دکتر")