def parse(self, utterance, context=None, N=<NUM_LIT:1>):
start = time.time()<EOL>context_trie = None<EOL>if context and isinstance(context, list):<EOL><INDENT>context.sort(key=lambda x: x.get('<STR_LIT>'))<EOL>context_trie = Trie()<EOL>for entity in context:<EOL><INDENT>entity_value, entity_type = entity.get('<STR_LIT:data>')[<NUM_LIT:0>]<EOL>context_trie.insert(entity_value.lower(),<EOL>data=(entity_value, entity_type),<EOL>weight=entity.get('<STR_LIT>'))<EOL><DEDENT><DEDENT>tagged = self._tagger.tag(utterance.lower(), context_trie=context_trie)<EOL>self.emit("<STR_LIT>",<EOL>{<EOL>'<STR_LIT>': utterance,<EOL>'<STR_LIT>': list(tagged),<EOL>'<STR_LIT:time>': time.time() - start<EOL>})<EOL>start = time.time()<EOL>bke = BronKerboschExpander(self._tokenizer)<EOL>def score_clique(clique):<EOL><INDENT>score = <NUM_LIT:0.0><EOL>for tagged_entity in clique:<EOL><INDENT>ec = tagged_entity.get('<STR_LIT>', [{'<STR_LIT>': <NUM_LIT:0.0>}])[<NUM_LIT:0>].get('<STR_LIT>')<EOL>score += ec * len(tagged_entity.get('<STR_LIT>', [{'<STR_LIT>': '<STR_LIT>'}])[<NUM_LIT:0>].get('<STR_LIT>')) / (<EOL>len(utterance) + <NUM_LIT:1>)<EOL><DEDENT>return score<EOL><DEDENT>parse_results = bke.expand(tagged, clique_scoring_func=score_clique)<EOL>count = <NUM_LIT:0><EOL>for result in parse_results:<EOL><INDENT>count += <NUM_LIT:1><EOL>parse_confidence = <NUM_LIT:0.0><EOL>for tag in result:<EOL><INDENT>sample_entity = tag['<STR_LIT>'][<NUM_LIT:0>]<EOL>entity_confidence = sample_entity.get('<STR_LIT>', <NUM_LIT:0.0>) * float(<EOL>len(sample_entity.get('<STR_LIT>'))) / len(utterance)<EOL>parse_confidence += entity_confidence<EOL><DEDENT>yield {<EOL>'<STR_LIT>': utterance,<EOL>'<STR_LIT>': result,<EOL>'<STR_LIT:time>': time.time() - start,<EOL>'<STR_LIT>': parse_confidence<EOL>}<EOL>if count >= N:<EOL><INDENT>break<EOL><DEDENT><DEDENT>
Used to find tags within utterance with a given confidence

        Args:
            utterance(str): conversational piece given by the user
            context(list): a list of entities
            N(int): number of results
        Returns: yield an object with the following fields
            utterance(str): the value passed in
            tags(list) : a list of tags found in utterance
            time(time) : duration since call of function
            confidence(float) : float indicating how confident of a match to the
                utterance. This might be used to determan the most likely intent.