Find synonyms of a word

        :param word: a word or a vector representation of word
        :param num: number of synonyms to find
        :return: array of (word, cosineSimilarity)

        .. note:: Local use only
5918
def findSynonyms(self, word, num):
        
        if not isinstance(word, basestring):
            word = _convert_to_vector(word)
        words, similarity = self.call("findSynonyms", word, num)
        return zip(words, similarity)
671640
def get_word_vector(self, word):
        """"""
        dim = self.get_dimension()
        b = fasttext.Vector(dim)
        self.f.getWordVector(b, word)
        return np.array(b)
806192
def search(self, word, limit=30):
        
        search = Search(PrefixQuery("word", word), sort={"count": "desc"})
        for doc in self.connection.search(
                search, indexes=[self.index], count=limit):
            yield (doc["word"], doc["count"])
1199799
def _repeat_word(word, N, word_space=" "):
    
    message = (word_space + word) * N
    message = message[len(word_space):]
    return message
530252
def spell(self, word: str) -> List[str]:
        
        if not word:
            return ""

        candidates = (
            self.known([word])
            or self.known(_edits1(word))
            or self.known(_edits2(word))
            or [word]
        )
        candidates.sort(key=self.freq, reverse=True)

        return candidates
567888
protected void appendWordFeatures( IWord word )
    {
        //add the pinyin to the pool
        if ( config.APPEND_CJK_PINYIN 
                && config.LOAD_CJK_PINYIN && word.getPinyin() != null ) {
            IWord pinyin = new Word(word.getPinyin(), IWord.T_CJK_PINYIN);
            pinyin.setPosition(word.getPosition());
            pinyin.setEntity(word.getEntity());
            wordPool.add(pinyin);
        }
        
        //add the synonyms words to the pool
        if ( config.APPEND_CJK_SYN 
                && config.LOAD_CJK_SYN && word.getSyn() != null ) {
            SegKit.appendSynonyms(wordPool, word);
        }
    }
92892
public static List<Word> split(Word word){
        String value = GENERIC_TRIE.get(word.getText());
        if(value==null){
            return null;
        }
        List<Word> words = new ArrayList<>();
        for(String val : value.split("\\s+")){
            words.add(new Word(val));
        }
        if(words.isEmpty()){
            return null;
        }
        return words;
    }
855817
def word_literals(self):
        """"""
        literals = []
        for word_synsets in self.synsets:
            word_literals = set()
            for synset in word_synsets:
                for variant in synset.get(SYN_VARIANTS):
                    if LITERAL in variant:
                        word_literals.add(variant[LITERAL])
            literals.append(list(sorted(word_literals)))
        return literals
685770
def synonyms(self):
        
        if self.cid:
            results = get_json(self.cid, operation='synonyms')
            return results['InformationList']['Information'][0]['Synonym'] if results else []
48797
def find_regions(self, word):
        
        length = len(word)

        for index, match in enumerate(re.finditer("[aeiouy][^aeiouy]", word)):
            if index == 0:
                if match.end() < length:
                    self.r1 = match.end()
            if index == 1:
                if match.end() < length:
                    self.r2 = match.end()
                break
156149
private final int getIndexFor(String word) {
        Integer index = termToIndex.get(word);
        if (index == null) {     
            synchronized(this) {
                // recheck to see if the term was added while blocking
                index = termToIndex.get(word);
                // if another thread has not already added this word while the
                // current thread was blocking waiting on the lock, then add it.
                if (index == null) {
                    int i = wordIndexCounter++;
                    termToIndex.put(word, i);
                    return i; // avoid the auto-boxing to assign i to index
                }
            }
        }
        return index;
    }
559051
def get_matches(self, word):
        
        matches = self.gen_matches(word)
        # defend this against bad user input for regular expression patterns
        try:
            matches = self.exclude_matches(matches)
        except Exception:
            sys.stderr.write(traceback.format_exc())
            return None
        else:
            if self.use_suffix:
                matches = [self.inflect(match) for match in matches]
            return list(matches)
379852
function _getWishIdsInEnteredMagicWords(word) {
  const startingCharWishesObj = _climbDownChain(
    _enteredMagicWords,
    word.split(''),
  )
  if (startingCharWishesObj) {
    return _getPropFromPosterity(startingCharWishesObj, 'wishes', true)
  } else {
    return []
  }
}
769124
def _get_ngrams(n, text):
  
  ngram_set = set()
  text_length = len(text)
  max_index_ngram_start = text_length - n
  for i in range(max_index_ngram_start + 1):
    ngram_set.add(tuple(text[i:i + n]))
  return ngram_set
726369
def words(num_of_word)
      target_len = num_of_word.times.inject(0){ |sum| sum + rand(@char_count_range_in_a_word) }
      sentence_key = bsearch(sentence_map_keys, target_len)
      unless sentence_key
        sentence_key = sentence_map.keys.min
      end
      wk_word = sentence_map[sentence_key].sample
      return wk_word.sub(/[#{ sentence_end_chars.join() }]$/, "")
    end
595516
def word_fts(self, word):
        
        return list(map(self.fts, self.segs(word)))
1366343
def _get_word_ngrams(n, sentences):
    
    assert len(sentences) > 0
    assert n > 0

    words = _split_into_words(sentences)
    return _get_ngrams(n, words)