- Home /
Does the keyword recognizer understand phrases?
I am using the keyword recognizer in Unity to display output on specific keyword and I am able to detect words like red or green.
keywords.Add("Red", () =>{Red();});
keywords.Add("white", () => { white(); });
However, the recognizer does not work when I use a phrase in the dictionery.
keywords.Add("Red Ball", () =>{Red();});
It doesn't detect the phrase red ball. If I make them as two different functions then I have to speak both words far apart in time. Is there a way to detect phrases in the UNity phrase recognition?
Answer by JPhilipp · Feb 16, 2018 at 10:07 PM
Have you tried setting the ConfidenceLevel to Low? We have fairly good results in our tries with longer words as well as two word phrases.
using UnityEngine.Windows.Speech;
KeywordRecognizer keywordRecognizer = null;
void Start() {
keywordRecognizer = new KeywordRecognizer(words, ConfidenceLevel.Low);
keywordRecognizer.OnPhraseRecognized += OnPhraseRecognized;
keywordRecognizer.Start();
}
void OnPhraseRecognized(PhraseRecognizedEventArgs args) {
Debug.Log("We recognized \"" + speech + "\" with confidence " + args.confidence);
}
Also, there's PhraseRecognizer instead of KeywordRecognizer, though I haven't yet tried that.
Answer by Clrj14 · Mar 07, 2018 at 08:38 AM
I have recently come across this problem as well with the keyword recognizer. I'm going to attempt PhraseRecognizer this week. I'll keep you guys posted if I can get it working.