code: def word_disambiguate(self, context, candidates, similarity, K=10):
      result = {}
      context_words = self._extractor.context_features(context)
      candidate_features = self._extractor.entity_word_features(
          candidates
      )
      ief_dict = self.inverse_entity_frequency(candidate_features)
      for candidate, features in candidate_features.iteritems():
          score = {}
          for x in context_words:
              for y in features:
                  score[(x, y)] = similarity(x, y) * ief_dict[y]
          topk = Counter(score).most_common(K)
          if topk:
              word, scores = zip(*topk)
              result[candidate] = sum(scores)
          else:
              result[candidate] = -1.0
      if not result:
          return candidates[0]
      return Counter(result).most_common(1)[0][0]
  
file_path: sematch/sematch/nel.py
imports: from collections import Counter
  from sematch.nlp import word_tokenize
  import math
label_desc: Use image node_id 6 for calling the EntityDisambiguation obj's underlying member method code with example usage: obj.word_disambiguate(context, candidates, similarity, K) and returns: Counter, candidates