Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: content/public/common/speech_recognition_error.h

Issue 9663066: Refactoring of chrome speech recognition architecture (CL1.3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compilation issues on windows. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
53 SpeechRecognitionHypothesisArray hypotheses; 31 SPEECH_AUDIO_ERROR_DETAILS_NONE = 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 SpeechAudioErrorDetails details;
39
40 SpeechRecognitionError(SpeechRecognitionErrorCode code_value)
41 : code(code_value),
42 details(SPEECH_AUDIO_ERROR_DETAILS_NONE) {}
43 SpeechRecognitionError(SpeechRecognitionErrorCode code_value,
44 SpeechAudioErrorDetails details_value)
45 : code(code_value),
46 details(details_value) {}
57 }; 47 };
58 48
59 } // namespace content 49 } // namespace content
60 50
61 #endif // CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_RESULT_H_ 51 #endif // CONTENT_PUBLIC_COMMON_SPEECH_RECOGNITION_ERROR_H_
OLDNEW
« no previous file with comments | « content/public/browser/speech_recognizer.h ('k') | content/public/common/speech_recognition_result.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698