def calc_intent(self, query):
matches = self.calc_intents(query)<EOL>if len(matches) == <NUM_LIT:0>:<EOL><INDENT>return MatchData('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>best_match = max(matches, key=lambda x: x.conf)<EOL>best_matches = (match for match in matches if match.conf == best_match.conf)<EOL>return min(best_matches, key=lambda x: sum(map(len, x.matches.values())))<EOL>
Tests all the intents against the query and returns
match data of the best intent

Args:
    query (str): Input sentence to test against intents
Returns:
    MatchData: Best intent match