673eb1f351468f4d385d9cc2156a367a3c911bde,snips_nlu/intent_parser/regex_intent_parser.py,RegexIntentParser,get_intent,#RegexIntentParser#Any#,145

Before Change


        for intent in self.regexes_per_intent.keys():
            entities_per_intent[intent] = self.get_slots(text, intent)

        intents_probas = dict()
        total_nb_entities = sum(
            len(entities) for entities in entities_per_intent.values())
        // TODO: handle intents without slots
        if total_nb_entities == 0:
            return None
        for intent_name, entities in entities_per_intent.iteritems():
            intents_probas[intent_name] = float(len(entities)) / float(
                total_nb_entities)

        top_intent, top_proba = max(intents_probas.items(),
                                    key=operator.itemgetter(1))
        return IntentClassificationResult(intent_name=top_intent,
                                          probability=top_proba)

    def get_slots(self, text, intent=None):

After Change


            raise AssertionError("RegexIntentParser must be fitted before "
                                 "calling `get_entities`")
        for intent, regexes in self.regexes_per_intent.iteritems():
            for regex in regexes:
                if regex.match(text) is not None:
                    return IntentClassificationResult(intent_name=intent,
                                                      probability=1.0)
        return None

    def get_slots(self, text, intent=None):
        if not self.fitted:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: snipsco/snips-nlu
Commit Name: 673eb1f351468f4d385d9cc2156a367a3c911bde
Time: 2017-05-03
Author: adrien.ball@snips.net
File Name: snips_nlu/intent_parser/regex_intent_parser.py
Class Name: RegexIntentParser
Method Name: get_intent


Project Name: maxpumperla/deep_learning_and_the_game_of_go
Commit Name: a17ac3677d207e04a53ed70fa971fbf436c0266f
Time: 2020-04-08
Author: 41198454+JingOY0610@users.noreply.github.com
File Name: code/dlgo/agent/alphago.py
Class Name: AlphaGoMCTS
Method Name: policy_rollout


Project Name: shibing624/pycorrector
Commit Name: 8f76475c3e5b3533b40e7ba41ca11ec987ffe974
Time: 2020-03-15
Author: xuming624@qq.com
File Name: pycorrector/corrector.py
Class Name: Corrector
Method Name: correct