code: public void handleContextVector(String focusKey,
                                      String secondaryKey,
                                      SparseDoubleVector context) {
          // Find the most similar existing word sense.
          int senseNumber = 0;
          int bestSense = 0;
          double bestSimilarity = -1;
  
          while (true) {
              // Create the word sense key based on the sense number.
              Vector wordSense = getVector((senseNumber == 0)
                      ? focusKey
                      : focusKey + "-" + senseNumber);
  
              // If no word sense exists then we have examined all known word senses.
              if (wordSense == null)
                  break;
  
              // Compute the similarity of this context vector to the current word
              // sense.
              double similarity = Similarity.cosineSimilarity(wordSense, context);
              if (similarity > bestSimilarity) {
                  bestSimilarity = similarity;
                  bestSense = senseNumber;
              }
  
              senseNumber++;
          }
  
          // If a reporter is provided, report the sense labeling.
          if (reporter != null)
              reporter.updateAssignment(focusKey, secondaryKey, bestSense);
      }
docs: {@inheritDoc}