code: @Override
      public Collection<String> wordsNearest(INDArray words, int top) {
          if (lookupTable instanceof InMemoryLookupTable) {
              InMemoryLookupTable l = (InMemoryLookupTable) lookupTable;
  
              INDArray syn0 = l.getSyn0();
  
              if (!normalized) {
                  synchronized (this) {
                      if (!normalized) {
                          syn0.diviColumnVector(syn0.norm2(1));
                          normalized = true;
                      }
                  }
              }
  
              INDArray similarity = Transforms.unitVec(words).mmul(syn0.transpose());
  
              List<Double> highToLowSimList = getTopN(similarity, top + 20);
  
              List<WordSimilarity> result = new ArrayList<>();
  
              for (int i = 0; i < highToLowSimList.size(); i++) {
                  String word = vocabCache.wordAtIndex(highToLowSimList.get(i).intValue());
                  if (word != null && !word.equals("UNK") && !word.equals("STOP")) {
                      INDArray otherVec = lookupTable.vector(word);
                      double sim = Transforms.cosineSim(words, otherVec);
  
                      result.add(new WordSimilarity(word, sim));
                  }
              }
  
              Collections.sort(result, new SimilarityComparator());
  
              return getLabels(result, top);
          }
  
          Counter<String> distances = new Counter<>();
  
          for (String s : vocabCache.words()) {
              INDArray otherVec = lookupTable.vector(s);
              double sim = Transforms.cosineSim(words, otherVec);
              distances.incrementCount(s, (float) sim);
          }
  
  
          distances.keepTopNElements(top);
          return distances.keySet();
  
  
      }
docs: Words nearest based on positive and negative words
  * @param top the top n words
  @return the words nearest the mean of the words