29 lines
540 B
Python
29 lines
540 B
Python
import gensim.downloader
|
|
|
|
EMBEDDING_MODELS = {
|
|
'small': 'glove-wiki-gigaword-100', # ~128 MB
|
|
'medium': 'glove-wiki-gigaword-300', # ~376 MB
|
|
'large': 'word2vec-google-news-300', # ~1.6 GB
|
|
}
|
|
|
|
|
|
def load_embeddings(size='small'):
|
|
"Download (if needed) and load the embedding model for the given size."
|
|
return gensim.downloader.load(EMBEDDING_MODELS[size])
|
|
|
|
|
|
def synonyms(model, word, n=5):
|
|
pass
|
|
|
|
|
|
def average(model, word1, word2):
|
|
pass
|
|
|
|
|
|
def outlier(model, words):
|
|
pass
|
|
|
|
|
|
def sort(model, words):
|
|
pass
|