| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services", | 5 [DartPackage="mojo_services", |
| 6 JavaPackage="org.chromium.mojo.speech_recognizer"] | 6 JavaPackage="org.chromium.mojo.speech_recognizer"] |
| 7 module speech_recognizer; | 7 module speech_recognizer; |
| 8 | 8 |
| 9 enum Error { | 9 enum Error { |
| 10 NETWORK_TIMEOUT = 1, | 10 NETWORK_TIMEOUT = 1, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // Confidence score in [0,1]. | 25 // Confidence score in [0,1]. |
| 26 float confidence_score; | 26 float confidence_score; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Receives events from the |SpeechRecognizerService|. | 29 // Receives events from the |SpeechRecognizerService|. |
| 30 interface SpeechRecognizerListener { | 30 interface SpeechRecognizerListener { |
| 31 // Called when an error occurs. | 31 // Called when an error occurs. |
| 32 OnRecognizerError(Error error_code); | 32 OnRecognizerError(Error error_code); |
| 33 | 33 |
| 34 // Called when the recognizer receives results. | 34 // Called when the recognizer receives results. |complete| will be true if |
| 35 OnResults(array<UtteranceCandidate> results); | 35 // the recognizer has stopped listening with these results. |
| 36 OnResults(array<UtteranceCandidate> results, bool complete); |
| 36 | 37 |
| 37 // Called when sound level changes. | 38 // Called when sound level changes. |
| 38 OnSoundLevelChanged(float rmsDb); | 39 OnSoundLevelChanged(float rmsDb); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 // |SpeechRecognizerService| provides access to a speech recognition service. | 42 // |SpeechRecognizerService| provides access to a speech recognition service. |
| 42 // It is responsible for reading microphone input, deciding when the user is | 43 // It is responsible for reading microphone input, deciding when the user is |
| 43 // done speaking, and performing speech recognition on the result. | 44 // done speaking, and performing speech recognition on the result. |
| 44 [ServiceName="speech_recognizer::SpeechRecognizerService"] | 45 [ServiceName="speech_recognizer::SpeechRecognizerService"] |
| 45 interface SpeechRecognizerService { | 46 interface SpeechRecognizerService { |
| 46 // Starts listening to the user. When listening has finished or an error | 47 // Starts listening to the user. When listening has finished or an error |
| 47 // occurs, returns |result_or_error|. Any call to Listen() made while another | 48 // occurs, returns |result_or_error|. Any call to Listen() made while another |
| 48 // is in progress will immediately return an error. | 49 // is in progress will immediately return an error. |
| 49 Listen(SpeechRecognizerListener listener); | 50 Listen(SpeechRecognizerListener listener); |
| 50 | 51 |
| 51 // Stops the SpeechRecognizer from listening and finishes any previous call | 52 // Stops the SpeechRecognizer from listening and finishes any previous call |
| 52 // to Listen() causing it to return. | 53 // to Listen() causing it to return. |
| 53 StopListening(); | 54 StopListening(); |
| 54 }; | 55 }; |
| OLD | NEW |