Exemple #1
0
 def answer_gg(self, context, word):
     """ make a guess regarding topic based on provided context and word
     """
     if word in self.matrix.columns:
         percept_tag = self.matrix[word].idxmax()
         distances = [hp.calc_euclidean_distance(i, self.cs.percepts[percept_tag]) for i in context]
         return [distances.index(min(distances)), percept_tag]
     else:
         return "word unknown"
Exemple #2
0
 def get_best_match(self, point):
     """ returns best matching percept tag for given point
     """
     distance = 9999999999999999999999999999
     best_match = ""
     for i in self.percepts.keys():
         dist = hp.calc_euclidean_distance(point, self.percepts[i])
         if dist < distance:
             distance = dist
             best_match = i
     return best_match