OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/string16.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 struct SpeechRecognitionHypothesis { |
| 17 string16 utterance; |
| 18 double confidence; |
| 19 |
| 20 SpeechRecognitionHypothesis() : confidence(0.0) {} |
| 21 |
| 22 SpeechRecognitionHypothesis(const string16 utterance_value, |
| 23 double confidence_value) |
| 24 : utterance(utterance_value), |
| 25 confidence(confidence_value) { |
| 26 } |
| 27 }; |
| 28 |
| 29 typedef std::vector<SpeechRecognitionHypothesis> |
| 30 SpeechRecognitionHypothesisArray; |
| 31 |
| 32 // This enumeration follows the values described here: |
| 33 // http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html#spe
ech-input-error |
| 34 enum SpeechRecognitionErrorCode { |
| 35 // There was no error. |
| 36 SPEECH_RECOGNITION_ERROR_NONE = 0, |
| 37 // The user or a script aborted speech input. |
| 38 SPEECH_RECOGNITION_ERROR_ABORTED, |
| 39 // There was an error with recording audio. |
| 40 SPEECH_RECOGNITION_ERROR_AUDIO, |
| 41 // There was a network error. |
| 42 SPEECH_RECOGNITION_ERROR_NETWORK, |
| 43 // No speech heard before timeout. |
| 44 SPEECH_RECOGNITION_ERROR_NO_SPEECH, |
| 45 // Speech was heard, but could not be interpreted. |
| 46 SPEECH_RECOGNITION_ERROR_NO_MATCH, |
| 47 // There was an error in the speech recognition grammar. |
| 48 SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR, |
| 49 }; |
| 50 |
| 51 struct CONTENT_EXPORT SpeechRecognitionResult { |
| 52 SpeechRecognitionErrorCode error; |
| 53 SpeechRecognitionHypothesisArray hypotheses; |
| 54 |
| 55 SpeechRecognitionResult(); |
| 56 ~SpeechRecognitionResult(); |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ |
OLD | NEW |