Example #1
0
File: wsp.py Project: harrhunt/WSP
 def average_distance(cls, start: WSP, end: WSP):
     total_distance = 0
     for word in start.onyms:
         if Word2Vec.contains(word):
             total_distance += cls.distance(word, end.word)
     average_distance = total_distance / len(start.onyms)
     return average_distance
Example #2
0
File: wsp.py Project: harrhunt/WSP
 def wsp_similarity(cls, start: WSP, end: WSP):
     total_vector = np.zeros(shape=(300, ), dtype=np.float32)
     for word in start.onyms:
         if Word2Vec.contains(word):
             total_vector = np.add(Word2Vec.vector(word), total_vector)
     Word2Vec.add_vector(start.name, total_vector)
     return Word2Vec.similarity(start.name, end.word)