| 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 [ |
| 6 { |
| 7 "namespace": "experimental.speechInput", |
| 8 "types": [ |
| 9 { |
| 10 "id": "SpeechInputStartOptions", |
| 11 "type": "object", |
| 12 "description": "Object describing the options used for speech recognitio
n.", |
| 13 "properties": { |
| 14 "language": { |
| 15 "type": "string", |
| 16 "optional": true, |
| 17 "description": "BCP-47 language code of the language to recognize. W
hen set to 'auto' or not defined defaults to user's most preferred content langu
age. Will use 'en-US' if not supported or invalid." |
| 18 }, |
| 19 "grammar": { |
| 20 "type": "string", |
| 21 "description": "Name of the grammar to use. Defaults to 'builtin:dic
tation'.", |
| 22 "optional": true |
| 23 }, |
| 24 "filterProfanities": { |
| 25 "type": "boolean", |
| 26 "optional": true, |
| 27 "description": "Enable or disable profanity filtering. Will use the
default Chrome filtering settings if not set." |
| 28 } |
| 29 } |
| 30 }, |
| 31 { |
| 32 "id": "SpeechInputError", |
| 33 "type": "object", |
| 34 "description": "Object describing a speech input error.", |
| 35 "properties": { |
| 36 "code": { |
| 37 "type": "string", |
| 38 "enum": ["noSpeechHeard", "noResults", "captureError", "networkError
"], |
| 39 "description": "Code identifying the error case." |
| 40 } |
| 41 } |
| 42 }, |
| 43 { |
| 44 "id": "SpeechInputResultHypothesis", |
| 45 "type": "object", |
| 46 "description": "Object describing a speech recognition hypothesis.", |
| 47 "properties": { |
| 48 "utterance": { |
| 49 "type": "string", |
| 50 "description": "Text of this hypothesis." |
| 51 }, |
| 52 "confidence": { |
| 53 "type": "number", |
| 54 "description": "Confidence of the hypothesis. Rated from 0 (lowest)
to 1 (highest)." |
| 55 } |
| 56 } |
| 57 }, |
| 58 { |
| 59 "id": "SpeechInputResultEvent", |
| 60 "type": "object", |
| 61 "description": "Object containing the recognition results.", |
| 62 "properties": { |
| 63 "hypotheses": { |
| 64 "type": "array", |
| 65 "optional": true, |
| 66 "description": "Array of zero or more objects describing the stable
candidate hypotheses sorted by decreasing likelihood.", |
| 67 "items": { "$ref": "SpeechInputResultHypothesis" } |
| 68 } |
| 69 } |
| 70 } |
| 71 ], |
| 72 "functions": [ |
| 73 { |
| 74 "name": "start", |
| 75 "type": "function", |
| 76 "description": "Request to start recording as a new speech recognition s
ession.", |
| 77 "parameters": [ |
| 78 { |
| 79 "name": "options", |
| 80 "$ref": "SpeechInputStartOptions", |
| 81 "optional": true, |
| 82 "description": "Options used for this speech recognition session." |
| 83 }, |
| 84 { |
| 85 "name": "callback", |
| 86 "type": "function", |
| 87 "optional": true, |
| 88 "description": "Called when the speech recognition session has succe
ssfully started recording.", |
| 89 "parameters": [] |
| 90 } |
| 91 ] |
| 92 }, |
| 93 { |
| 94 "name": "stop", |
| 95 "type": "function", |
| 96 "description": "Request to stop an ongoing speech recognition session.", |
| 97 "parameters": [ |
| 98 { |
| 99 "name": "callback", |
| 100 "type": "function", |
| 101 "optional": true, |
| 102 "description": "Called when the audio recording has stopped and any
pending recognition results have been completed.", |
| 103 "parameters": [] |
| 104 } |
| 105 ] |
| 106 }, |
| 107 { |
| 108 "name": "isRecording", |
| 109 "type": "function", |
| 110 "description": "Determine if audio recording is currently in process in
Chrome, not limited to this API.", |
| 111 "parameters": [ |
| 112 { |
| 113 "name": "callback", |
| 114 "type": "function", |
| 115 "optional": true, |
| 116 "parameters": [ |
| 117 { |
| 118 "name": "result", |
| 119 "type": "boolean", |
| 120 "description": "Flag set to true if recording is in process in C
hrome, false otherwise." |
| 121 } |
| 122 ] |
| 123 } |
| 124 ] |
| 125 } |
| 126 ], |
| 127 "events": [ |
| 128 { |
| 129 "name": "onError", |
| 130 "type": "function", |
| 131 "description": "Called in case of an error in speech recognition.", |
| 132 "parameters": [ |
| 133 { |
| 134 "name": "error", |
| 135 "$ref": "SpeechInputError", |
| 136 "description": "Error being reported." |
| 137 } |
| 138 ] |
| 139 }, |
| 140 { |
| 141 "name": "onSoundStart", |
| 142 "type": "function", |
| 143 "description": "Called when the system starts detecting sound in the inp
ut data.", |
| 144 "parameters": [] |
| 145 }, |
| 146 { |
| 147 "name": "onSoundEnd", |
| 148 "type": "function", |
| 149 "description": "Called when the system detects enough silence to conside
r the ongoing speech has ended.", |
| 150 "parameters": [] |
| 151 }, |
| 152 { |
| 153 "name": "onResult", |
| 154 "type": "function", |
| 155 "description": "Called when speech recognition results are available.", |
| 156 "parameters": [ |
| 157 { |
| 158 "name": "event", |
| 159 "$ref": "SpeechInputResultEvent", |
| 160 "description": "Object containing the speech recognition results." |
| 161 } |
| 162 ] |
| 163 } |
| 164 ] |
| 165 } |
| 166 ] |
| OLD | NEW |