code: public Map<String, Float> findSynonyms(String target, int cnt) {
      float[] vec = transform(target);
  
      if ((vec == null) || (cnt == 0))
        return Collections.emptyMap();
  
      int[] synonyms = new int[cnt];
      float[] scores = new float[cnt];
  
  
      int min = 0;
      for (int i = 0; i < cnt; i++) {
        synonyms[i] = i;
        scores[i] = cosineSimilarity(vec, i * vec.length, _output._vecs);
        if (scores[i] < scores[min])
          min = i;
      }
  
      final int vocabSize = _output._vocab.size();
      for (int i = cnt; i < vocabSize; i++) {
        float score = cosineSimilarity(vec, i * vec.length, _output._vecs);
        if ((score <= scores[min]) || (score >= 0.999999))
          continue;
        synonyms[min] = i;
        scores[min] = score;
        // find a new min
        min = 0;
        for (int j = 1; j < cnt; j++)
          if (scores[j] < scores[min])
            min = j;
      }
  
      Map<String, Float> result = new HashMap<>(cnt);
      for (int i = 0; i < cnt; i++)
        result.put(_output._words[synonyms[i]].toString(), scores[i]);
      return result;
    }
docs: Find synonyms (i.e. word-vectors with the highest cosine similarity)
  
  @param target String of desired word
  @param cnt Number of synonyms to find