Ejemplo n.º 1
0
def make_smart_meta_click_pattern(attention_vector, embeddings, name=None):
  assert attention_vector is not None
  if name is None:
    import random
    name = 's-meta-na-' + str(random.random())

  best_id = np.argmax(attention_vector)
  confidence = attention_vector[best_id]
  best_embedding_v = embeddings[best_id]
  meta_pattern = FuzzyPattern(None, _name=name)
  meta_pattern.embeddings = np.array([best_embedding_v])

  return meta_pattern, confidence, best_id
Ejemplo n.º 2
0
 def create_pattern(self, pattern_name, ppp):
   _ppp = (ppp[0].lower(), ppp[1].lower(), ppp[2].lower())
   fp = FuzzyPattern(_ppp, pattern_name)
   self.patterns.append(fp)
   self.patterns_dict[pattern_name] = fp
   return fp