new WebspeechAudioInput()
Members
-
_pluginName
-
-
_prevResultString
-
field for storing the previous (main) recontion result (this is used for calculating "unstable" parts, see
helper_extract_results
) -
aborted
-
-
active
-
-
currentFailureCallbackfunction
-
-
currentSuccessCallbackfunction
-
-
DEFAULT_ALTERNATIVE_RESULTS
-
-
default_error_functionfunction
-
-
DEFAULT_LANGUAGE
-
-
constantEVENT_RESULT_FIELD
-
-
constantEVENT_SCORE_FIELD
-
-
final_recognition_result
-
-
helper_error_handlerfunction
-
-
intermediate_results
-
-
loggermmir.Logger
-
-
max_error_retry
-
Maximal number of errors-in-a-row for trying to restart recognition in repeat-mode.
- Default Value:
- 5
- See:
-
error_counter
-
micLevelsImplFile
-
-
pluginExportswebspeechAudioInput
-
-
recognitionSpeechRecognition
-
-
recording
-
-
constantRESULT_TYPESEnum
-
Result types (returned by the native/Cordova plugin)
-
SpeechRecognitionImplSpeechRecognition
-
-
constantUNSTABLE_LIMIT
-
Methods
-
cancelRecognition()
-
default_error_function()
-
-
helper_error_handler(){Boolean}
-
default helper for error-events: determines, if RESTART is allowed/possible (in case of RECORDing mode), AND otherwise triggers the current failure-callbacks. SIDE-EFFECTS: sets private field aborted:=true if RESTART is NOT possible.
Returns:
Type Description Boolean true, if the function could process the error (i.e. return false for unknown errors; these should be handled by the invoking code of this helper function) -
helper_extract_results()
-
create callback-arguments for ASR-result callback:
Returns:
Array with [ String result, Number score, String type ["INTERIM" | "FINAL" ], Arrayalternatives, //OPTIONAL String unstable //OPTIONAL ] -
initialize()
-
-
recognize()
-
Start speech recognition with end-of-speech detection: the recognizer automatically tries to detect when speech has finished and triggers the status-callback accordingly with results.
NOTE: no end event, if recognize() is stopped via stopRecord()
-
asyncstartRecord(options, statusCallback, failureCallback)
-
Start speech recognition (without end-of-speech detection): after starting, the recognition continues until
stopRecord
is called.Name Type Description options
PlainObject optional OPTIONAL options for Automatic Speech Recognition: { success: OPTIONAL Function, the status-callback (see arg statusCallback) , error: OPTIONAL Function, the error callback (see arg failureCallback) , language: OPTIONAL String, the language for recognition (if omitted, the current language setting is used) , intermediate: OTPIONAL Boolean, set true for receiving intermediate results (NOTE not all ASR engines may support intermediate results) , results: OTPIONAL Number, set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option) , mode: OTPIONAL "search" | "dictation", set how many recognition alternatives should be returned at most (NOTE not all ASR engines may support this option) , eosPause: OTPIONAL "short" | "long", length of pause after speech for end-of-speech detection (NOTE not all ASR engines may support this option) , disableImprovedFeedback: OTPIONAL Boolean, disable improved feedback when using intermediate results (NOTE not all ASR engines may support this option) }
statusCallback
function optional OPTIONAL callback function that is triggered when, recognition starts, text results become available, and recognition ends. The callback signature is: callback( text: String | "", confidence: Number | Void, status: "FINAL"|"INTERIM"|"INTERMEDIATE"|"RECORDING_BEGIN"|"RECORDING_DONE", alternatives: Array<{result: String, score: Number}> | Void, unstable: String | Void )
Usually, for status"FINAL" | "INTERIM" | "INTERMEDIATE"
text results are returned, where"INTERIM": an interim result, that might still change "INTERMEDIATE": a stable, intermediate result "FINAL": a (stable) final result, before the recognition stops
If present, theunstable
argument provides a preview for the currently processed / recognized text.
NOTE that when usingintermediate
mode, status-calls with"INTERMEDIATE"
may contain "final intermediate" results, too.
NOTE: if used in combination withoptions.success
, this argument will supersede the optionsfailureCallback
function optional OPTIONAL callback function that is triggered when an error occurred. The callback signature is: callback(error)
NOTE: if used in combination withoptions.error
, this argument will supersede the options -
stopRecord()