You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an IntentDeterminationEngine along the lines of the Multi Intent parser Example, with no required entity type and several optional ones.
Stacktrace
File "/home/pln/.PyCharm2019.3/config/scratches/scratch_12.py", line 16, in <module>
print([i for i in engine.determine_intent(utterance, include_tags=False)])
File "/home/pln/.PyCharm2019.3/config/scratches/scratch_12.py", line 16, in <listcomp>
print([i for i in engine.determine_intent(utterance, include_tags=False)])
File "/home/pln/.virtualenvs/nluservice/src/adapt-parser/adapt/engine.py", line 131, in determine_intent
best_intent, tags = self.__best_intent(result, remaining_context)
File "/home/pln/.virtualenvs/nluservice/src/adapt-parser/adapt/engine.py", line 81, in __best_intent
i, tags = intent.validate_with_tags(parse_result.get('tags') + context_as_entities, parse_result.get('confidence'))
File "/home/pln/.virtualenvs/nluservice/src/adapt-parser/adapt/intent.py", line 190, in validate_with_tags
total_confidence = intent_confidence / len(tags) * confidence
ZeroDivisionError: float division by zero
Steps to replicate the Issue
Define an IntentDeterminationEngine as such:
engine: IntentDeterminationEngine=IntentDeterminationEngine()
engine.register_entity("Kevin", "who") # same problem if several entitiesbuilder: IntentBuilder=IntentBuilder("Buddies")
builder.optionally("who") # same problem if several entity typesengine.register_intent_parser(builder.build())
Use it on an utterance that contains an entity, get expected results
print([iforiinengine.determine_intent("Kevin is a friend")]) # works
Use it on an utterance that contains no entity, get an exception
print([iforiinengine.determine_intent("Julien is a friend")]) # raises
Can also be reproduced with an empty utterance "".
Be as specific as possible about the expected condition, and the deviation from expected condition.
I expect the engine to return an empty determination ([]) when no entity is recognized, instead of raising a generic ZeroDivisionError exception.
The text was updated successfully, but these errors were encountered:
Its final value is used to compute the total confidence in the line 190 I linked above. Thus, the new value of confidence defined line 192 is never used:
IntentDeterminationEngine
along the lines of the Multi Intent parser Example, with no required entity type and several optional ones.Stacktrace
Steps to replicate the Issue
IntentDeterminationEngine
as such:Can also be reproduced with an empty utterance
""
.Be as specific as possible about the expected condition, and the deviation from expected condition.
I expect the engine to return an empty determination (
[]
) when no entity is recognized, instead of raising a genericZeroDivisionError
exception.The text was updated successfully, but these errors were encountered: