def top_intent(intent_dict) : max_intent = Intent.NONE_INTENT max_value = 0.0 for intent, intentScore in intent_dict.items(): if intentScore.score > max_value: max_intent, max_value = intent, intentScore.score return TopIntent(max_intent, max_value)
def top_intent(intents: Dict[Intent, dict]) -> TopIntent: max_intent = Intent.NONE_INTENT max_value = 0.0 for intent, value in intents: intent_score = IntentScore(value) if intent_score.score > max_value: max_intent, max_value = intent, intent_score.score return TopIntent(max_intent, max_value)
def top_intent(intents: Dict[Intent, dict]) -> TopIntent: """ This function determines the top intention of a user. """ max_intent = Intent.NONE_INTENT max_value = 0.0 for intent, value in intents: intent_score = IntentScore(value) if intent_score.score > max_value: max_intent, max_value = intent, intent_score.score return TopIntent(max_intent, max_value)