snipsco / snips-issues

Feel free to share your bugs with us.
14 stars 5 forks source link

When the command contains "cancel", no intent is detected. #134

Closed jenskastensson closed 5 years ago

jenskastensson commented 5 years ago

What's the issue? When the command contains "cancel", no intent is detected.

Use Cases Impacted Any command containing the word Cancel

How to reproduce Add training example "please cancel the alarm Test in console, works as expected Say to ASR, no intent is detelcted

Expected behavior It should be possible to use the word cancel

Version and Environment Raspberry Pi & Stretch, v0.62.3

Logs [13:56:12] [Asr] was asked to listen on site bedroom [13:56:16] [Asr] captured text "please cancel the alarm" in 4.0s [13:56:16] [Asr] was asked to stop listening on site bedroom [13:56:16] [AudioServer] was asked to play a wav of 93.1 kB with id '9c836173-9dc7-41d7-9e89-461520b1dbee' on site bedroom [13:56:17] [AudioServer] finished playing wav with id '9c836173-9dc7-41d7-9e89-461520b1dbee' [13:56:17] [Dialogue] session with id '4d42687a-88c2-4513-a711-ebb0811758a3' was ended on site bedroom. The session was aborted by the user [13:56:17] [Asr] was asked to stop listening on site bedroom [13:56:17] [Hotword] was asked to toggle itself 'on' on site bedroom [13:56:21] [Hotword] detected on site bedroom, for model hey_snips [13:56:21] [Asr] was asked to stop listening on site bedroom [13:56:21] [Hotword] was asked to toggle itself 'off' on site bedroom [13:56:21] [Dialogue] session with id '2e25ccaf-a457-48eb-b974-1ea7b32edf1c' was started on site bedroom [13:56:21] [AudioServer] was asked to play a wav of 41.1 kB with id '227f4954-f96c-4d9f-90db-0f296e607359' on site bedroom [13:56:22] [AudioServer] finished playing wav with id '227f4954-f96c-4d9f-90db-0f296e607359' [13:56:22] [Asr] was asked to listen on site bedroom [13:56:25] [Asr] captured text "please delete the alarm" in 3.0s [13:56:25] [Asr] was asked to stop listening on site bedroom [13:56:25] [AudioServer] was asked to play a wav of 93.1 kB with id 'affceb7d-cd02-46f7-9c9e-8785e8cd96bd' on site bedroom [13:56:27] [AudioServer] finished playing wav with id 'affceb7d-cd02-46f7-9c9e-8785e8cd96bd' [13:56:27] [Nlu] was asked to parse input "please delete the alarm" [13:56:27] [Nlu] detected intent ProKNX:cancelAlarm with confidence score 0.987 for input "please delete the alarm" [13:56:27] [Dialogue] New intent detected ProKNX:cancelAlarm with confidence 0.987

Additional information If you have some details you want to share or the root cause seems identified, put it here.

Workaround Do not use the word cancel

cpoisson commented 5 years ago

Hi @jenskastensson,

Yes, it is the expected behavior, and an easy fall trap for users.

The word "cancel" is somehow already used by the dialogue to make the user able to cancel any ongoing session.

You can suppress this behavior by modifying the following file.

cat /usr/share/snips/assistant/custom_dialogue/speak/en.json
{
    "language": "en",
    "confirmation_cancel_pattern": "(?i)(?:\\W+|^)(?:cancel)(?:\\W+|$)",
    "confirmation_yes_pattern": "(?i)(?:\\W+|^)(?:yes)(?:\\W+|$)",
    "confirmation_no_pattern": "(?i)(?:\\W+|^)(?:no)(?:\\W+|$)",
    "general_misunderstanding": "Sorry I didn't understand what you want",
    "answer_misunderstanding": "I couldn't understand your answer"
}

=> just replace the word cancel in the regular expression by something else (could be nothing)

"confirmation_cancel_pattern": "(?i)(?:\\W+|^)(?:cancel)(?:\\W+|$)
jenskastensson commented 5 years ago

OK, thanks that explains our problem and a very important piece of information! I see the German file is quite ambitious, but now we know where to look and work-around if needed.

cpoisson commented 5 years ago

Yup, and not so easy to document :/. Maybe a warning in the doc in the intent section. I'll look into that.