Closed PLNech closed 3 years ago
I believe fixing this could just mean refactoring validate_with_tags
. For now I'd see this as:
Update the line 190 that divides by the length of a potentially empty collection: https://github.com/MycroftAI/adapt/blob/402d2d82048e5f7de2d8edd1c2efd9c9260f74bb/adapt/intent.py#L190
total_confidence = [..] or 0 if not tags
Take the opportunity to clarify the role of the confidence
parameter, documented as a float
:
https://github.com/MycroftAI/adapt/blob/402d2d82048e5f7de2d8edd1c2efd9c9260f74bb/adapt/intent.py#L137-L142
From my understanding, its value is always ignored, being redefined here: https://github.com/MycroftAI/adapt/blob/402d2d82048e5f7de2d8edd1c2efd9c9260f74bb/adapt/intent.py#L155
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: https://github.com/MycroftAI/adapt/blob/402d2d82048e5f7de2d8edd1c2efd9c9260f74bb/adapt/intent.py#L192
confidence
from validate_with_tags
's parameters as it is never used confidence
by _
in line 192 as it 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
Define an
IntentDeterminationEngine
as such:Use it on an utterance that contains an entity, get expected results
Use it on an utterance that contains no entity, get an exception
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.