Closed Nitzahon closed 3 years ago
This is unfortunately the expected behaviour of the Web Speech API. When you say "item six", Web Speech API will actually transcribe this as "item 6", which matches all of your four command phrases equally badly so ends up just matching the first one by default. The matching algorithm just operates on the raw strings and does not understand the meaning of any words.
To make things more complex, some numbers will be transcribed as words. e.g. "item four" is transcribed as "item for" - the API doesn't have enough context to know that you intended to say the number.
There are a couple of ways around this:
['item 2','item four','item 5','item 6']
So if you may recall I was the one who requested the feature of bestMatchOnly, I found a bug though, when working with an array that included the nfollowing:
when ever either "item four" or "item five" was spoken, the command that triggered the callback (aka the bestMatch) was in fact "item two"