cleaned recognise method
This commit is contained in:
parent
c23390cb79
commit
69697818ec
@ -84,6 +84,10 @@ def recognise(sentence, client_ip=None, client_port=None):
|
|||||||
sentence = sentence.lower()
|
sentence = sentence.lower()
|
||||||
print(sentence)
|
print(sentence)
|
||||||
|
|
||||||
|
data = dict()
|
||||||
|
data['client_ip'] = client_ip
|
||||||
|
data['client_port'] = client_port
|
||||||
|
|
||||||
if len(intents_handlers_adapt) > 0:
|
if len(intents_handlers_adapt) > 0:
|
||||||
try:
|
try:
|
||||||
best_intents = adapt_engine.determine_intent(sentence, 100)
|
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
|
# 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():
|
for key, val in best_intent.items():
|
||||||
if key != 'intent_type' and key != 'target' and key != 'confidence':
|
if key != 'intent_type' and key != 'target' and key != 'confidence':
|
||||||
data[key] = val
|
data[key] = val
|
||||||
@ -116,9 +120,6 @@ def recognise(sentence, client_ip=None, client_port=None):
|
|||||||
else:
|
else:
|
||||||
data['utterance'] = result.sent
|
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
|
data.update(result.matches) # adding the matches from padatious to the data
|
||||||
handle(result.name, data)
|
handle(result.name, data)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user