75df2742635b09f97e8d7ec9396750aa17046567,snips_nlu/intent_parser/builtin_intent_parser.py,BuiltinIntentParser,get_intent,#BuiltinIntentParser#Any#,45
Before Change
def get_intent(self, text):
intents = get_built_in_intents(text, self.builtin_intents)
if len(intents) == 0:
return None
else:
return max(intents, key=lambda x: x["prob"])
def get_entities(self, text, intent=None):
if intent is None:
most_likely_intent = self.get_intent(text)
if most_likely_intent is None:
After Change
return {"text": text, "intent": intent, "entities": entities}
def get_intent(self, text):
if not self.intents:
return None
tokenized_text = tokenize({"text": unicode(text)})
max_proba, best_intent = -1., None
for intent in self.intents:
intent_classifier = IntentClassifier(
intent_config_file=os.path.join(
self.configs_path, "%s.pb" % intent),
gazetteers_dir=self.gazetteers_path
)
proba = intent_classifier.transform(tokenized_text)
if (max_proba < 0.) or (proba > max_proba):
max_proba = proba
best_intent = intent
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: snipsco/snips-nlu
Commit Name: 75df2742635b09f97e8d7ec9396750aa17046567
Time: 2017-03-24
Author: tristan.deleu@gmail.com
File Name: snips_nlu/intent_parser/builtin_intent_parser.py
Class Name: BuiltinIntentParser
Method Name: get_intent
Project Name: snipsco/snips-nlu
Commit Name: 75df2742635b09f97e8d7ec9396750aa17046567
Time: 2017-03-24
Author: tristan.deleu@gmail.com
File Name: snips_nlu/intent_parser/builtin_intent_parser.py
Class Name: BuiltinIntentParser
Method Name: get_entities
Project Name: RaRe-Technologies/gensim
Commit Name: 19a2292b8b21da8fd83e5f8129debb4b9ab4c14f
Time: 2014-07-01
Author: radimrehurek@seznam.cz
File Name: gensim/corpora/dictionary.py
Class Name: Dictionary
Method Name: from_corpus