Home › Forums › OpenEars plugins › (RapidEars) rapidEarsDidDetectLiveSpeechAsWordArray fired more then once › Reply To: (RapidEars) rapidEarsDidDetectLiveSpeechAsWordArray fired more then once
RapidEars works a bit differently than stock OpenEars and needs a slightly different approach to programming. With OpenEars, it waits until speech is complete and returns a single hypothesis, so you can just assume that there will be a one to one relationship with receiving a hypothesis and your programmatic reaction to receiving a hypothesis. RapidEars is continuously processing when it has started to detect speech, meaning that it will keep reasserting the present hypothesis until it changes or the utterance ends, because it is continuously re-scoring the hypothesis (seeing if it becomes more confident in a different hypothesis, or more confident in the current hypotheses, and seeing if more words are spoken after the current hypotheses, etc).
You can work with this style in a couple of ways. One way is just to react to your keyword the first time you catch it and not worry about the rest of the hypotheses , i.e. short circuit the listening process when you get a match. Another way (I think this is closer to your request) would be to call a “keywordDetected:” method in the callback, but only call it for a new word (meaning you store the hypothesis and only forward the method if the new hypothesis doesn’t match the stored hypothesis, meaning it is a different hypothesis. Does that make sense?