Commit 22c81c76 authored by Jim Hoekstra's avatar Jim Hoekstra 👋🏻
Browse files

merge and added StringDist to requirements.txt

parents 0b0f0748 59ed3ca3
import gensim.downloader as api
import stringdist as sdi
class AssociatedWords:
def __init__(self):
self.N_RESULTS = 7
print('loading model')
self.N_RESULTS = 10
print("\n Word2Vec model is loading.This can take a couple of minutes.")
self.model = api.load('glove-twitter-200')
print('done loading model')
print("\n Word2Vec model is ready. Enjoy!!!")
self.base_word = None
self.gensim_result = None
......@@ -25,7 +26,9 @@ class AssociatedWords:
def passes_filter(self, word):
if 'www' in word or \
word in self.base_word:
word in self.base_word or \
sdi.rdlevenshtein_norm(word, self.base_word) < 0.5:
return False
else:
return True
......
......@@ -20,4 +20,5 @@ retrying==1.3.3
scipy==1.6.1
six==1.15.0
smart-open==4.2.0
StringDist==1.0.9
Werkzeug==1.0.1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment