TWebSpeechRecognition
Description
TWebSpeachRecognition
is a non-visual component that uses the browser API
to do real-time speech recognition. The component can return the spoken text as well as setup a series of commands the component can respond to. Note that it depends on the browser where the app is running whether speech recognition will work offline or will need a connection to the server. Also, speech recognition happens on the microphone input, so permission to access the microphone from the web application is a prerequisite.
These commands can have extra variables which you can re.
- One word variable ‘:variablename’
- Sentences ‘*tag’
- Optional words ‘(optional)’
Methods
Method | Description |
---|---|
procedure Start; | Starts speechrecognition and enables mic |
procedure Abort; | Stops SpeechRecognition and turns off mic |
procedure Pause | Stops listening but speechrecognition and mic are still enabled |
procedure Resume; | Resumes SpeechRecognition , always use this after initial start |
Properties for TWebSpeechRecognition
Property | Description |
---|---|
property Language: String | Sets the language of the speechrecognition: ‘en-US’ |
property Commands: TCommands | Collection of available commands |
The commands collection consists of TCommand instances with following properties:
Property | Description |
---|---|
Value: string | The command as text to detect |
Tag | Generic useable identifier |
OnCommand | Event triggered when this spoken command matching value was detected. |
Following rules apply for the specification of commands:
Add between round brackets () optional parts of the command.
Example: close (window)
This command will be triggered if either ‘close’ or ‘close window’ is heard.
Use the asterix of part of the spoken text that should be returned as a parameter via the OnCommand event handler.
Example: close :object
This command will be triggered when ‘close xxxx’ is spoken en it will return what was recognized as word after ‘close’ via the parameter list with key value ‘object’. This parameter is a single word.
Example: close *object
This command will be triggered when ‘close xxxx yyyy’ is spoken en it will return what was recognized as words after ‘close’ via the parameter list with key value ‘object’. This parameter can contain multiple words.
Events
Event | Description |
---|---|
property OnStart | Event triggered when the speechrecognition has been started |
Property OnEnd | Event triggerd when the speechrecognition has ended |
Property OnSoundStart | Event triggered when the speechrecognition has received sound |
Property OnErro | Event triggered when there is a generic error |
Property OnNetworkError | Event triggered when there is a network error |
Property OnPermissionBlockedError | Event triggered when the Speech Recognition has been blocked |
Property OnPermissionDeniedError | Event triggered when the Speech Recognition has been denied |
Property OnResult | Event triggered when the Speech Recognition has a result. Return the spoken text |
Property OnNoResultMatch | Event triggered when the component can’t match the spoken text to a command. Returns the spoken text. |
Property OnResultMatch | Event triggers when the component matched a command. Returns the spoken text, the optional parameters the user might have said, the executed command and a list of alternatives. |
TCommand
Property | Description |
---|---|
Property Name | Sets the sentence the user has to speak to trigger this command. |
Property OnCommand | Triggers when the user says the command. Returns a list of parameters from the command. |