code: def disambiguate_entity(key, text):
      
      new_ent = l.DERIVED_ENT[key][0]
  
      if len(l.DERIVED_ENT[key]) > 1:
          transformed = TFIDF_MODEL.transform([text])
          scores = CLF.predict_proba(transformed).tolist()[0]
          scores = sorted(zip(scores, TARGET_NAMES), key=lambda x: x[0],
                          reverse=True)
          names = [i.name for i in l.DERIVED_ENT[key]]
          scores = [i for i in scores if i[1] in names]
          try:
              new_ent = l.ENTITIES[scores[0][1]]
          except IndexError:
              logging.debug('\tAmbiguity not resolved for "%s"', str(key))
  
      return new_ent
docs: Resolve ambiguity between entities with same dimensionality.