OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_INPUT_RESULT_H_ | |
6 #define CONTENT_PUBLIC_COMMON_SPEECH_INPUT_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 SpeechInputHypothesis { | |
17 string16 utterance; | |
18 double confidence; | |
19 | |
20 SpeechInputHypothesis() : confidence(0.0) {} | |
21 | |
22 SpeechInputHypothesis(const string16 utterance_value, double confidence_value) | |
23 : utterance(utterance_value), | |
24 confidence(confidence_value) { | |
25 } | |
26 }; | |
27 | |
28 typedef std::vector<SpeechInputHypothesis> SpeechInputHypothesisArray; | |
29 | |
30 // This enumeration follows the values described here: | |
31 // http://www.w3.org/2005/Incubator/htmlspeech/2010/10/google-api-draft.html#spe
ech-input-error | |
32 enum SpeechInputError { | |
33 // There was no error. | |
34 SPEECH_INPUT_ERROR_NONE = 0, | |
35 // The user or a script aborted speech input. | |
36 SPEECH_INPUT_ERROR_ABORTED, | |
37 // There was an error with recording audio. | |
38 SPEECH_INPUT_ERROR_AUDIO, | |
39 // There was a network error. | |
40 SPEECH_INPUT_ERROR_NETWORK, | |
41 // No speech heard before timeout. | |
42 SPEECH_INPUT_ERROR_NO_SPEECH, | |
43 // Speech was heard, but could not be interpreted. | |
44 SPEECH_INPUT_ERROR_NO_MATCH, | |
45 // There was an error in the speech recognition grammar. | |
46 SPEECH_INPUT_ERROR_BAD_GRAMMAR, | |
47 }; | |
48 | |
49 struct CONTENT_EXPORT SpeechInputResult { | |
50 SpeechInputError error; | |
51 SpeechInputHypothesisArray hypotheses; | |
52 | |
53 SpeechInputResult(); | |
54 ~SpeechInputResult(); | |
55 }; | |
56 | |
57 } // namespace content | |
58 | |
59 #endif // CONTENT_PUBLIC_COMMON_SPEECH_INPUT_RESULT_H_ | |
OLD | NEW |