OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_ERROR_H_ |
6 #define CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ | 6 #define CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_ERROR_H_ |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/string16.h" | |
12 #include "content/common/content_export.h" | |
13 | 7 |
14 namespace content { | 8 namespace content { |
15 | 9 |
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: | 10 // 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 | 11 // http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html#spe ech-input-error |
34 enum SpeechRecognitionErrorCode { | 12 enum SpeechRecognitionErrorCode { |
35 // There was no error. | 13 // There was no error. |
36 SPEECH_RECOGNITION_ERROR_NONE = 0, | 14 SPEECH_RECOGNITION_ERROR_NONE = 0, |
37 // The user or a script aborted speech input. | 15 // The user or a script aborted speech input. |
38 SPEECH_RECOGNITION_ERROR_ABORTED, | 16 SPEECH_RECOGNITION_ERROR_ABORTED, |
39 // There was an error with recording audio. | 17 // There was an error with recording audio. |
40 SPEECH_RECOGNITION_ERROR_AUDIO, | 18 SPEECH_RECOGNITION_ERROR_AUDIO, |
41 // There was a network error. | 19 // There was a network error. |
42 SPEECH_RECOGNITION_ERROR_NETWORK, | 20 SPEECH_RECOGNITION_ERROR_NETWORK, |
43 // No speech heard before timeout. | 21 // No speech heard before timeout. |
44 SPEECH_RECOGNITION_ERROR_NO_SPEECH, | 22 SPEECH_RECOGNITION_ERROR_NO_SPEECH, |
45 // Speech was heard, but could not be interpreted. | 23 // Speech was heard, but could not be interpreted. |
46 SPEECH_RECOGNITION_ERROR_NO_MATCH, | 24 SPEECH_RECOGNITION_ERROR_NO_MATCH, |
47 // There was an error in the speech recognition grammar. | 25 // There was an error in the speech recognition grammar. |
48 SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR, | 26 SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR, |
49 }; | 27 }; |
50 | 28 |
51 struct CONTENT_EXPORT SpeechRecognitionResult { | 29 // Error details for the SPEECH_RECOGNITION_ERROR_AUDIO error. |
52 SpeechRecognitionErrorCode error; | 30 enum SpeechAudioErrorDetails { |
Primiano Tucci (use gerrit)
2012/03/23 10:52:19
I know that the presence of SpeechAudioErrorDetail
Satish
2012/03/23 10:57:45
Can this be added in the next CLs where it is actu
| |
53 SpeechRecognitionHypothesisArray hypotheses; | 31 SPEECH_AUDIO_ERROR_DETAILS_UNKNOWN = 0, |
32 SPEECH_AUDIO_ERROR_DETAILS_NO_MIC, | |
33 SPEECH_AUDIO_ERROR_DETAILS_IN_USE | |
34 }; | |
54 | 35 |
55 SpeechRecognitionResult(); | 36 struct CONTENT_EXPORT SpeechRecognitionError { |
56 ~SpeechRecognitionResult(); | 37 SpeechRecognitionErrorCode code; |
38 int details; | |
39 | |
40 SpeechRecognitionError(SpeechRecognitionErrorCode code_val) | |
41 : code(code_val), | |
42 details(0) {} | |
43 SpeechRecognitionError(SpeechRecognitionErrorCode code_val, int details_val) | |
44 : code(code_val), | |
45 details(details_val) {} | |
57 }; | 46 }; |
58 | 47 |
59 } // namespace content | 48 } // namespace content |
60 | 49 |
61 #endif // CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ | 50 #endif // CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_ERROR_H_ |
OLD | NEW |