Open domcross opened 4 years ago
Hey, I like the concept of using the Fallback, and think we should avoid single keyword Adapt intents where ever possible. However I think we need to consider this one pretty carefully, so I'm just going to lay my thoughts out a few initial thoughts so anyone can add or poke holes.
Behaviours
Should we use the Fallback but still match the vocab more broadly rather than requiring the utterance to be an exact match?. This should allow us to still handle utterances like:
Will want to make sure this doesn't impact the latency of "stopping". This should be better now that we pause audio output while we wait for the response.
The stop-handler matches only if the utterance is the single word "stop" (or one of the other words in Stop.voc), it will ignore all other phrases like "stop the music", "where is the next bus stop" or "play please don't stop the music"
Phrase "silent" is in Stop.voc of mycroft-stop skill and in Mute.voc of mycroft-timer skill. Utterance "silent" is handled by mycroft-timer, in a quick test I found that this behaviour is the same as before.
p.s. Kudos and apologies go to Jarbas - he submitted similar PR two years ago but it never got merged. I found it out only after submitting my PR.
Yeah, the challenge is that people often say more than just "stop" eg "please stop". So we need to strike a balance there.
Shifting the Skill to be a Fallback gives everything else the opportunity to respond first, so presuming there is some kind of Transport Skill "where is the next stop" should get handled by that Skill rather than go to the Fallback Skills.
My concern with being too specific on the stop vocab is that people might find that what they used to say suddenly no longer works.
Shouldn't be a problem to add phrases like "please stop" or "quiet please" to Stop.voc
, there is "shut up" and "be quiet" already in there. The exact phrase must match, though.
Another solution could be fuzzy matching:
>>> from mycroft.util.parse import match_one
>>> words = ['stop','silence','shut up', 'be quiet']
>>> match_one('please stop', words)
('stop', 0.5333333333333333)
>>> match_one('quiet', words)
('be quiet', 0.7692307692307693)
>>> match_one('stop', words)
('stop', 1.0)
>>> match_one('quiet please', words)
('be quiet', 0.5)
>>> match_one('shut up now', words)
('shut up', 0.7777777777777778)
>>> match_one('can you shut up please', words)
('shut up', 0.4827586206896552)
>>> match_one('can you shut up', words)
('shut up', 0.6363636363636364)
>>> match_one('just shut up', words)
('shut up', 0.7368421052631579)
But what would be a good threshold value for score then - >=0.7
?
fixes issue #1566
Make this a
FallbackSkill
, check in fallback-handler if utterance matches exactly phrase fromStop.voc
and emitmycroft.stop
accordingly.