dialogflow/dialogflow-android-client

Hard to detect final speech recognition result when using GoogleRecognitionServiceImpl

Opened this issue · 0 comments

This is an enhancement proposal, I hope I'm not missing anything.

When you use the GoogleRecognitionServiceImpl as the AIService, there's no easy way of notifying the user of their final speech output when its submitted to API.AI.

You can use the PartialResultsListener with GoogleRecognitionServiceImpl, but you get something like 2 callbacks to PartialResultsListener.onPartialResults(List<String>) after receiving the AIListener.onListeningFinished() callback.

Here's the logcat output from my phone to illustrate the issue, refer to the last 3-4 lines:
api_ai_partial_result_listener_output_logcat

The really hacky, nasty and potentially fragile way to detect the final input is to just wait for 2 callbacks after AIListener.onListeningFinished().

I'd like to modify theGoogleRecognitionServiceImpl.InternalRecognitionListener.onResults(Bundle) handling by adding something like a QuerySubmitListener (prevents breaking the PartialResultsListener contract). The QuerySubmitListener would notify developers of the query or queries and the confidences (right about here https://github.com/api-ai/apiai-android-client/blob/master/ailib/src/main/java/ai/api/services/GoogleRecognitionServiceImpl.java#L392).

Happy to create a PR if this sounds OK