From 69697818ece13eef31ca225aa730fd3cfad34027 Mon Sep 17 00:00:00 2001 From: Mathieu B Date: Mon, 2 Aug 2021 11:08:19 +0200 Subject: [PATCH] cleaned recognise method --- jarvis/skills/intent_manager.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jarvis/skills/intent_manager.py b/jarvis/skills/intent_manager.py index b2a5b09..00aefd6 100644 --- a/jarvis/skills/intent_manager.py +++ b/jarvis/skills/intent_manager.py @@ -84,6 +84,10 @@ def recognise(sentence, client_ip=None, client_port=None): sentence = sentence.lower() print(sentence) + data = dict() + data['client_ip'] = client_ip + data['client_port'] = client_port + if len(intents_handlers_adapt) > 0: try: best_intents = adapt_engine.determine_intent(sentence, 100) @@ -91,7 +95,7 @@ def recognise(sentence, client_ip=None, client_port=None): # print(best_intent) # DEBUG - data = {'utterance': sentence, 'client_ip': client_ip, 'client_port': client_port} + data['utterance'] = sentence for key, val in best_intent.items(): if key != 'intent_type' and key != 'target' and key != 'confidence': data[key] = val @@ -116,9 +120,6 @@ def recognise(sentence, client_ip=None, client_port=None): else: data['utterance'] = result.sent - data['client_ip'] = client_ip - data['client_port'] = client_port - data.update(result.matches) # adding the matches from padatious to the data handle(result.name, data)