def most_similar(self, word, number=5):
        """
        Run a similarity query, retrieving number
        most similar words.
        """

        if self.word_vectors is None:
            raise Exception('Model must be fit before querying')

        if self.dictionary is None:
            raise Exception('No word dictionary supplied')

        try:
            word_idx = self.dictionary[word]
        except KeyError:
            raise Exception('Word not in dictionary')

        return self._similarity_query(self.word_vectors[word_idx], number)[1:]
def most_similar ( self , word , number = 5 ) : if self . word_vectors is None : raise Exception ( 'Model must be fit before querying' ) if self . dictionary is None : raise Exception ( 'No word dictionary supplied' ) try : word_idx = self . dictionary [ word ] except KeyError : raise Exception ( 'Word not in dictionary' ) return self . _similarity_query ( self . word_vectors [ word_idx ] , number ) [ 1 : ]
Run a similarity query, retrieving number
        most similar words.