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