예제 #1
0
 def get_word_vector(self, word):
     if self.method == "fasttext-jamo":
         word = jamo_sentence(word)
     if self._is_in_vocabulary(word):
         vector = self.dictionary[word]
     else:
         if "fasttext" in self.method:
             vector = self.model.get_word_vector(word)
         else:
             vector = np.zeros(self.dim)
     return vector
예제 #2
0
 def _is_in_vocabulary(self, word):
     if self.method == "fasttext-jamo":
         word = jamo_sentence(word)
     return word in self.dictionary.keys()