def word_vec(self, word, use_norm=False):
        """Get the word's representations in vector space, as a 1D numpy array.

        Parameters
        ----------
        word : str
            A single word whose vector needs to be returned.
        use_norm : bool
            If True, returns normalized vector.

        Returns
        -------
        :class:`numpy.ndarray`
            The word's representations in vector space, as a 1D numpy array.

        Raises
        ------
        KeyError
            For words with all ngrams absent, a KeyError is raised.

        Example
        -------
        >>> from gensim.models import FastText
        >>> sentences = [["cat", "say", "meow"], ["dog", "say", "woof"]]
        >>>
        >>> model = FastText(sentences, min_count=1)
        >>> meow_vector = model.word_vec('meow')  # get vector for word

        """
        return FastTextKeyedVectors.word_vec(self.wv, word, use_norm=use_norm)
Exemple #2
0
 def word_vec(self, word, use_norm=False):
     return FastTextKeyedVectors.word_vec(self.wv, word, use_norm=use_norm)
Exemple #3
0
 def word_vec(self, word, use_norm=False):
     return FastTextKeyedVectors.word_vec(self.wv, word, use_norm=use_norm)