From 930a1db93a53b12bd119c2cdfb690964d880a4bc Mon Sep 17 00:00:00 2001 From: batuhaneralp Date: Fri, 24 Dec 2021 00:22:44 +0300 Subject: [PATCH 1/3] init --- Dictionary/Dictionary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Dictionary/Dictionary.py b/Dictionary/Dictionary.py index 27c4e67..d99f6ce 100644 --- a/Dictionary/Dictionary.py +++ b/Dictionary/Dictionary.py @@ -114,6 +114,7 @@ def longestWordSize(self) -> int: return maxLength def __getPosition(self, word: Word) -> int: + print('IM IN') lo = 0 hi = len(self.words) - 1 while lo <= hi: From 9f66dc5c315353fed4ed0234e318f9c16d57f138 Mon Sep 17 00:00:00 2001 From: batuhaneralp <47421327+batuhaneralp@users.noreply.github.com> Date: Fri, 24 Dec 2021 18:33:17 +0300 Subject: [PATCH 2/3] mostSimilarWord takes VectorizedWord instead of str --- Dictionary/VectorizedDictionary.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dictionary/VectorizedDictionary.py b/Dictionary/VectorizedDictionary.py index 1ac1cdf..c1cfd92 100644 --- a/Dictionary/VectorizedDictionary.py +++ b/Dictionary/VectorizedDictionary.py @@ -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 @@ -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()) From 0f5c4184b461caea94853533bf0e0323901727e1 Mon Sep 17 00:00:00 2001 From: batuhaneralp <47421327+batuhaneralp@users.noreply.github.com> Date: Fri, 24 Dec 2021 18:35:21 +0300 Subject: [PATCH 3/3] Cleared debugging code --- Dictionary/Dictionary.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Dictionary/Dictionary.py b/Dictionary/Dictionary.py index 56835bf..c6e7bed 100644 --- a/Dictionary/Dictionary.py +++ b/Dictionary/Dictionary.py @@ -167,7 +167,6 @@ def longestWordSize(self) -> int: return maxLength def __getPosition(self, word: Word) -> int: - print('IM IN') lo = 0 hi = len(self.words) - 1 while lo <= hi: