|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Asynchronous version of ASR Resource methods.
The Automatic Speech Recognition (ASR) resource performs recognition and/or training. An ASR resource that performs recognition has associated with it a recognition algorithm which uses a context to recognize words from utterances presented in an input media stream, returning recognition results to the application.
ASR Interface
Fields inherited from interface javax.telephony.media.ResourceConstants |
e_Disconnected, FOREVER, q_Disconnected, q_RTC, rtcc_Disconnected, rtcc_TriggerRTC, v_Forever |
Fields inherited from interface javax.telephony.media.MediaConstants |
e_OK, q_Duration, q_Standard |
Method Summary | |
Async_ASREvent |
async_contextCopy(java.lang.String contextResource,
java.lang.String containerContext,
Symbol direction)
Copy a Context from a Resource to a Container, or from a Container to a Resource. |
Async_ASREvent |
async_contextCreate(java.lang.String resourceContext,
Symbol trainingType,
java.util.Dictionary contextParams)
Creates a new context on the ASR Resource. |
Async_ASREvent |
async_contextGetParameters(java.lang.String resourceContext,
Symbol[] keys)
Retrieve context parameter values for a Context loaded in this resource. |
Async_ASREvent |
async_contextRemove(java.lang.String resourceContext)
Remove an existing Context from an ASR Resource. |
Async_ASREvent |
async_contextSetParameters(java.lang.String resourceContext,
java.util.Dictionary contextParams)
This function sets the parameters associated with a particular Context that is loaded on a Resource. |
Async_ASREvent |
async_getFinalResults()
Non-blocking version of getFinalResults(). |
Async_ASREvent |
async_getResults()
Non-blocking version of getResults(). |
Async_ASREvent |
async_getRuleExpansion(java.lang.String grammarContext,
java.lang.String ruleName)
Non-blocking version of getRuleExpansion(). |
Async_ASREvent |
async_idleASR()
Non-blocking version of idleASR(). |
Async_ASREvent |
async_recognize(RTC[] rtcs,
java.util.Dictionary optargs)
Non-blocking version of recognize(). |
Async_ASREvent |
async_setRuleExpansion(java.lang.String grammarContext,
java.lang.String ruleName,
java.lang.String ruleExpansion)
Non-blocking version of setRuleExpansion(). |
Async_ASREvent |
async_startASR()
Non-blocking version of startASR(). |
Async_ASREvent |
async_stopASR()
Non-blocking version of stopASR(). |
Async_ASREvent |
async_updateParameters()
Non-blocking verions of updateParameters(). |
Async_ASREvent |
async_wordCommit(java.lang.String wordContext,
java.lang.String wordTemp,
java.lang.String wordString)
Commits a Word, as trained, into a Context. |
Async_ASREvent |
async_wordCreate(java.lang.String wordContext,
java.lang.String wordTemp)
Create a new Word within a loaded Context. |
Async_ASREvent |
async_wordDeleteLastUtterance(java.lang.String wordContext,
java.lang.String wordTemp)
Prevent the previous utterance from contributing to training. |
Async_ASREvent |
async_wordDeleteTraining(java.lang.String wordContext,
java.lang.String wordString)
Delete all training associated with a Word in the specified Context. |
Async_ASREvent |
async_wordDestroy(java.lang.String wordContext,
java.lang.String wordString)
Remove a word from a loaded Context. |
Async_ASREvent |
async_wordTrain(java.lang.String wordContext,
java.lang.String wordString)
Train a Word in a Context. |
Method Detail |
public Async_ASREvent async_recognize(RTC[] rtcs, java.util.Dictionary optargs)
Initiate speech recognition on the ASR resource. The returned event contains only the highest-probablility result. That is, it contains at most one TokenSequence.
rtcs
- a RTC[] containing RTCs to be in effect during this call.optargs
- a Dictionary containing optional arguments.ASREvent
public Async_ASREvent async_getResults()
Retrieve intermediate recognition results and do not reset the recognizer. This method is valid whenever partial results are ready. The recognizer can be in either of state Recognizing or ResultsReady.
public Async_ASREvent async_getFinalResults()
Retrieve recognition results and reset the recognizer.
This is roughly equivalent to getResults() followed by triggerRTC(ASR.rtca_Idle).
public Async_ASREvent async_startASR()
Starts a recognizer that is in a paused state. The Paused states are v_RecognitionPaused and v_TrainingPaused; the Recognizer moves to the states v_Recognizing and v_Training, respectively.
public Async_ASREvent async_stopASR()
Stops the Recognizer when it is in the "Recognizing" or "Training" states. The recognizer transitions to the next state as if though they had completed execution. For example, the ASR resource would move from v_Recognizing to v_ResultsAvailable.
public Async_ASREvent async_idleASR()
Forces a Recognizer into the Idle state.
Is this a transaction? or a void return?
The function is valid at any time, and is commonly used to move a Recognizer from the v_ResultsAvailable state into the v_Idle state without retrieving results from the Recognizer. Note that on entry to the Idle state, any recognition results or uncommitted training data is lost.
This function is also available as ASR.rtca_idle.
public Async_ASREvent async_updateParameters()
Set resource parameters according to p_UpdateParametersList.
This function (also available as ASR.rtca_updateParameters) is useful for barge-in scenarios, where the timeout values change after the prompt has completed playing.
If p_UpdateParametersList is not set or empty, then nothing is done and this method returns normally.
public Async_ASREvent async_getRuleExpansion(java.lang.String grammarContext, java.lang.String ruleName)
For a Grammar Context loaded on a resource, this method
retrieves the current expansion of the rule RuleName
in the Grammar Context GrammarContextName.
The rule expansion is returned as part of
the completion event for this function and is available using
ASREvent.getRuleExpansion()
.
grammarContext
- the name of a loaded grammar Context.ruleName
- a String that names the rule to be expanded.public Async_ASREvent async_setRuleExpansion(java.lang.String grammarContext, java.lang.String ruleName, java.lang.String ruleExpansion)
For a loaded Grammar Context, this function sets the rule expansion of the rule ruleName to the rule expansion given in the ruleExpansion argument. The syntax of RuleExpansion is defined by the JSGF grammar specification language.
grammarContext
- a loaded Context.ruleName
- a String that names the rule being defined.ruleExpansion
- a String containing the rule expansion.public Async_ASREvent async_wordCommit(java.lang.String wordContext, java.lang.String wordTemp, java.lang.String wordString)
The argument tempWord identifies the Word to be committed. When an utterance corresponding to that Word is detected, the recognizer will return wordString as the result. wordString is not the return value of the function -- wordString is the value the Recognizer will return as an answer in the Token field in the result object. wordString is permanent -- once set, the association between the Word and wordString cannot be changed. wordString is not necessarily an exact transcription of the utterance; in most cases, an arbitrary String is used.
For example, in a scenario where arbitrary voice labels are associated with a telephone number, the actual transcription is unknown. wordString can be an arbitrary index, and that index can used by the application to find the correct telephone number.
If this function is used to commit additional training to an already-existing Word, then wordTemp should be the permanent name for the Word; in that case, the value of wordString is ignored.
wordContext
- the Context to which this word is committed.wordTemp
- a String that identifes the word to commit.wordString
- the permanent String to identify this word.public Async_ASREvent async_wordCreate(java.lang.String wordContext, java.lang.String wordTemp)
wordContext
- the Context in which Word is created.wordTemp
- a String containing the temporary name of the word.public Async_ASREvent async_wordDeleteLastUtterance(java.lang.String wordContext, java.lang.String wordTemp)
This method must be issued before any new training is made or before the training is committed to the Context. That is, this method must be issued before any other train(), and commit() method; either of those methods makes the utterance part of the permanent training of the Word.
wordContext
- the Context in which the work is being trained.wordTemp
- the String that identifies the word being trained.public Async_ASREvent async_wordDeleteTraining(java.lang.String wordContext, java.lang.String wordString)
If the Word has been committed, then wordString must be the permanent name of the Word. If the Word has not been committed, then wordString must be the temporary name.
wordContext
- the Context from which the training is deleted.wordString
- the String that idenifies word to be deleted.public Async_ASREvent async_wordDestroy(java.lang.String wordContext, java.lang.String wordString)
If the Word has been committed, then wordString must be the permanent name of the Word. If the Word has not been committed, then wordString must be the temporary name.
wordContext
- the Context from which the Word is removed.wordString
- the String that identifies the word.public Async_ASREvent async_wordTrain(java.lang.String wordContext, java.lang.String wordString)
p_TrainingType
),
and associates this information with the Word.
The Word might be one that has been trained before, or one that has just been created. If the Word has been committed, then wordString must be the permanent name of the Word. If the Word has not been committed, then wordString must be the temporary name.
Not all Recognizers can add additional training to a Word
that has already been committed to a
Context. The attribute a_TrainingModifiable may be queried
to determine the Recognizer's abilities:
v_NotModifiable means that training cannot be modified.
v_Retrain means that retraining the Word is possible,
but only by performing a asrTrain.deleteTraining() and
retraining the Word entirely.
v_AddTraining means that additional training
may be added to a Word by using the asrTrain.train() command.
Some Recognizers may perform training automatically, issuing prompts and collecting utterances until a sufficient number of good utterances have been collected. Such Recognizers, which have the attribute a_AutomaticTraining set to true, will run in automatic mode when the parameter p_AutomaticTraining is set to true. When training is over, they will issue a single completion event. The parameter p_NumberRepetitions, available in some Recognizers, may be set to dictate how many training utterances the Recognizer should use in AutomaticTraining mode.
Recognizers have different requirements for the minimum number of utterances necessary to provide training for a new Word; if the application is collecting utterances, the application will need to provide at least that many utterances to the Recognizer. The range of the p_NumberRepetitions parameter may be queried to determine this number, which is indicated by the minimum number of repetitions. The Recognizer may also have an upper limit on the number of utterances it can use for training; the p_NumberRepetitions parameter may also be queried to determine this number, which is the maximum number of repetitions.
Different types of training may be available on Recognizers; the a_TrainingType attribute indicates which types are available. The parameter p_TrainingType is used to set the type when more than one type is supported: p_TrainingType takes on the values v_Speech, v_Text, and v_Phonetic to describe the training input. Recognizers that accept training of type v_Phonetic use IPA as their text input for training. If p_TrainingType is set to v_Text or v_Phonetic, the dictionary entry p_TrainingInfo must also be present. This array of String will contain either the text or phonetic representation of the training material, as appropriate.
wordContext
- the Context in which the word is trained.wordString
- a String that identifies the word to be trained.public Async_ASREvent async_contextCopy(java.lang.String contextResource, java.lang.String containerContext, Symbol direction)
The method contextCreate must be used to create the Context on the resource before using this method. If not, should we auto-define that Context? or should we define the Exception that is thrown?
The direction Symbol specifies whether the copy is from a resource to a container (v_FromResource) or from a container to a resource (v_ToResource).
To copy a Context from a Container to the Resource for the purpose of training, then the symbol v_ToResourceTraining should be used.
When copying a Context to the Resource, the argument resourceContext assigns a name to the Context. This name is used to identify the Context as loaded in the Resource. It does not need to be the same name used to identify the Context in a Container.
This is a non-destructive copy; the source copy of the Context is unaffected. If a Context of the same name already exists at the destination, it will be overwritten and lost. If the destination is a container, a new Context Object will be created to accommodate the Context if necessary. If the destination is an ASR Resource, and the Resource currently has a Context, and the Resource does not support multiple Contexts or the Resource has no room for this Context the copy will fail. In such cases the application must take corrective action, e.g., free up room on the ASR Resource by performing a asrContext.remove().
A Context copied into the Resource is inactive, it joins the set of inactive contexts.
contextResource
- a Context within the ASR Resource.containerContext
- a String containing the name of the container
context.direction
- a Symbol indicating the direction and type of copy.
Must be one of ASRConstants.v_ToResource
,
ASRConstants.v_FromResource
, or
ASRConstants.v_ToResourceTraining
.public Async_ASREvent async_contextCreate(java.lang.String resourceContext, Symbol trainingType, java.util.Dictionary contextParams)
The ASR Resource implementation must support Context modification.
The trainingType argment indicates the type of input used to perform training. The possible values are: v_Speech, v_Phonetic, v_Text
Any context parameter -- including those that are normally read-only and cannot be written by the application - may be set during the time of creation by sending the appropriate Dictionary entry in contextParms.
resourceContext
- a Context to be created in the Resource.trainingType
- a Symbol that identifies the type of input
to be used for training this Context.contextParams
- a Dictionary containing the context parameters.public Async_ASREvent async_contextGetParameters(java.lang.String resourceContext, Symbol[] keys)
If a key refers to a Parameter that is not present, or the Context has no meaning associated with a particular Symbol, or that parameter cannot be returned, then the key is ignored, no error is generated, and that key does not appear returned Dictionary.
If there is not ASR Resource configured in this MediaService, or if the ASR Resource cannot return parameters for the given Context, or if the Context is not loaded in the ASR Resource, then null is returned.
resourceContext
- the Context from which parameters are retrievedkeys
- an array of Symbols identifying the requested parameters.public Async_ASREvent async_contextRemove(java.lang.String resourceContext)
To preserve a Context, copy it to a Container using the contextCopy() method.
resourceContext
- the Context to be removed.public Async_ASREvent async_contextSetParameters(java.lang.String resourceContext, java.util.Dictionary contextParams)
resourceContext
- the Context on which parameters are to be set.contextParams
- a Dictionary of parameters to set.
|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |