Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dictionary/VectorizedDictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def addWord(self, word: VectorizedWord):
"""
self.words.append(word)

def mostSimilarWord(self, name: str) -> VectorizedWord:
def mostSimilarWord(self, word: VectorizedWord) -> VectorizedWord:
"""
The mostSimilarWord method takes a String name as an input, declares a maxDistance as -1 and creates a
VectorizedWord word by getting the given name from words list. Then, it loops through the words list and if the
Expand All @@ -43,9 +43,10 @@ def mostSimilarWord(self, name: str) -> VectorizedWord:
"""
maxDistance = -1
result = None
word = self.getWord(name)
#word = self.getWord(name)
if word is None:
return None

for currentWord in self.words:
if currentWord != word and isinstance(word, VectorizedWord):
distance = word.getVector().dotProduct(currentWord.getVector())
Expand Down