|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RecognizerProperties
Enables control of the properties of a Recognizer
.
The RecognizerProperties
object is obtained by calling the
getRecognizerProperties
method of a Recognizer
.
RecognizerProperties
inherits the following behavior from the
EngineProperties
interface
(described in detail in the EngineProperties
documentation):
get
and set
method
(JavaBeans property method patterns).
Engine
will apply a change as soon as possible.
EnginePropertyListener
may be attached
to receive EnginePropertyEvent
s.
Engine
s may ignore changes to properties or
apply maximum and minimum limits.
If an Engine
does not apply a property change request,
this is reflected in the corresponding EnginePropertyEvent
.
Recognizer
s that support a SpeakerManager
(see
getSpeakerProfiles
),
the RecognizerProperties
may be stored
and loaded as part of the data associated with a SpeakerProfile
.
SpeakerManager
methods that affect the current SpeakerProfile
may also affect RecognizerProperties
.
EnginePropertyEvent
s will also occur in this context.
getRecognizerProperties
,
EngineProperties
,
SpeakerManager
,
SpeakerProfile
,
getSpeakerProfiles
Field Summary | |
---|---|
static int |
ADAPT_PAUSED
A value signifying that adaptation may occur while PAUSED . |
static int |
ADAPT_RESUMED
A value signifying that adaptation may occur while RESUMED . |
static int |
ENDPOINT_AUTOMATIC
A value signifying that no application action is required for endpointing. |
static int |
ENDPOINT_MANUAL
A value signifying that the application must pause and
resume audio for each utterance. |
static int |
ENDPOINT_PUSH_TO_START
A value signifying that the endpoint is determined by a push-to-start approach. |
static int |
ENDPOINT_PUSH_TO_TALK
A value signifying that the endpoint is determined by a push-to-talk approach. |
static int |
ENDPOINT_SPEECH_DETECTION
A value signifying that the endpoint detection is based on the speech signal. |
static int |
MAX_ACCURACY
A value signifying maximum accuracy vs. speed during recognition. |
static int |
MAX_CONFIDENCE
A value signifying that maximum confidence is required for recognition. |
static int |
MAX_SENSITIVITY
A value signifying maximum sensitivity to noise during recognition. |
static int |
MIN_ACCURACY
A value signifying minimum accuracy vs. speed during recognition. |
static int |
MIN_CONFIDENCE
A value signifying that minimum confidence is required for recognition. |
static int |
MIN_SENSITIVITY
A value signifying minimum sensitivity to noise during recognition. |
static int |
NORM_ACCURACY
A value signifying normal accuracy vs. speed during recognition. |
static int |
NORM_CONFIDENCE
A value signifying that normal confidence is required for recognition. |
static int |
NORM_SENSITIVITY
A value signifying normal sensitivity to noise during recognition. |
static int |
UNKNOWN_CONFIDENCE
A value signifying that the confidence value is unknown. |
Fields inherited from interface EngineProperties |
---|
MAX_PRIORITY, MAX_UNTRUSTED_PRIORITY, MIN_PRIORITY, NORM_TRUSTED_PRIORITY, NORM_UNTRUSTED_PRIORITY |
Method Summary | |
---|---|
int |
getAdaptation()
Gets the adaptation property. |
int |
getCompleteTimeout()
Gets the completeTimeout property. |
int |
getConfidenceThreshold()
Gets the confidenceThreshold property. |
int |
getEndpointStyle()
Gets the endpointStyle property. |
int |
getIncompleteTimeout()
Gets the incompleteTimeout property. |
int |
getNumResultAlternatives()
Gets the numResultAlternatives property. |
int |
getPriority()
Gets the priority property. |
int |
getSensitivity()
Gets the sensitivity property. |
int |
getSpeedVsAccuracy()
Gets the speedVsAccuracy property. |
boolean |
isResultAudioProvided()
Gets the resultAudioProvided property. |
boolean |
isTrainingProvided()
Gets the trainingProvided property. |
void |
setAdaptation(int adaptation)
Sets the adaptation property. |
void |
setCompleteTimeout(int completeTimeout)
Sets the completeTimeout property. |
void |
setConfidenceThreshold(int confidenceThreshold)
Sets the confidenceThreshold property. |
void |
setEndpointStyle(int endpointStyle)
Sets the endpointStyle property. |
void |
setIncompleteTimeout(int incompleteTimeout)
Sets the incompleteTimeout property. |
void |
setNumResultAlternatives(int numResultAlternatives)
Sets the numResultAlternatives property. |
void |
setPriority(int priority)
Sets the priority property. |
void |
setResultAudioProvided(boolean resultAudioProvided)
Sets the resultAudioProvided property. |
void |
setSensitivity(int sensitivity)
Sets the sensitivity property. |
void |
setSpeedVsAccuracy(int speedVsAccuracy)
Sets the speedVsAccuracy property. |
void |
setTrainingProvided(boolean trainingProvided)
Sets the trainingProvided property. |
Methods inherited from interface EngineProperties |
---|
addEnginePropertyListener, getBase, removeEnginePropertyListener, reset, setBase |
Field Detail |
---|
static final int UNKNOWN_CONFIDENCE
setConfidenceThreshold
,
Constant Field Valuesstatic final int MIN_CONFIDENCE
setConfidenceThreshold
,
Constant Field Valuesstatic final int NORM_CONFIDENCE
setConfidenceThreshold
,
Constant Field Valuesstatic final int MAX_CONFIDENCE
setConfidenceThreshold
,
Constant Field Valuesstatic final int MIN_SENSITIVITY
setSensitivity
,
Constant Field Valuesstatic final int NORM_SENSITIVITY
setSensitivity
,
Constant Field Valuesstatic final int MAX_SENSITIVITY
setSensitivity
,
Constant Field Valuesstatic final int MIN_ACCURACY
setSpeedVsAccuracy
,
Constant Field Valuesstatic final int NORM_ACCURACY
setSpeedVsAccuracy
,
Constant Field Valuesstatic final int MAX_ACCURACY
setSpeedVsAccuracy
,
Constant Field Valuesstatic final int ADAPT_PAUSED
PAUSED
.
setAdaptation
,
Engine.PAUSED
,
Constant Field Valuesstatic final int ADAPT_RESUMED
RESUMED
.
setAdaptation
,
Engine.RESUMED
,
Constant Field Valuesstatic final int ENDPOINT_AUTOMATIC
resume
once
after allocate
and after adding any RuleGrammar
s.
The Recognizer
finds endpoints within a continuous audio stream.
This can apply to any of the endpoint styles as described in
setEndpointStyle
.
Some resource limited implementations may require
ENDPOINT_MANUAL
.
setEndpointStyle
,
resume
,
allocate
,
RuleGrammar
,
ENDPOINT_MANUAL
,
Constant Field Valuesstatic final int ENDPOINT_MANUAL
pause
and
resume
audio for each utterance.
Some resource limited implementations may require the application to
explicitly control the input audio stream
with resume
and pause
for each utterance.
If the endpointStyle
is
ENDPOINT_MANUAL & ENDPOINT_PUSH_TO_TALK
,
the application should call resume
when a button is pressed
and call pause
when the button is released
.
If the endpointStyle is
ENDPOINT_MANUAL & ENDPOINT_PUSH_TO_START
,
the application should call resume
when a button is pressed
and call pause
when resultUpdate
provides
a ResultEvent
with a FinalResult
.
This style may not be combined with ENDPOINT_SPEECH_DETECTION
.
Implementations may support ENDPOINT_PUSH_TO_TALK
and
ENDPOINT_PUSH_TO_START
with ENDPOINT_AUTOMATIC
style.
setEndpointStyle
,
resultUpdate
,
resume
,
pause
,
ResultEvent
,
FinalResult
,
ENDPOINT_AUTOMATIC
,
ENDPOINT_PUSH_TO_TALK
,
ENDPOINT_PUSH_TO_START
,
ENDPOINT_SPEECH_DETECTION
,
Constant Field Valuesstatic final int ENDPOINT_SPEECH_DETECTION
Recognizer
determines where an utterance
begins and ends using the speech signal itself.
For example, a Recognizer
can use differences in
audio energy levels to determine the begin and end of speech.
setEndpointStyle
,
Constant Field Valuesstatic final int ENDPOINT_PUSH_TO_TALK
See the description of ENDPOINT_MANUAL for details.
setEndpointStyle
,
ENDPOINT_MANUAL
,
Constant Field Valuesstatic final int ENDPOINT_PUSH_TO_START
Recognizer
can use differences in
audio energy levels to determine the end of speech.
See the description of ENDPOINT_MANUAL for details.
setEndpointStyle
,
ENDPOINT_MANUAL
,
Constant Field ValuesMethod Detail |
---|
int getAdaptation()
adaptation
property.
setAdaptation
int getCompleteTimeout()
completeTimeout
property.
setCompleteTimeout
int getConfidenceThreshold()
confidenceThreshold
property.
setConfidenceThreshold
int getEndpointStyle()
endpointStyle
property.
setEndpointStyle
int getIncompleteTimeout()
incompleteTimeout
property.
setIncompleteTimeout
int getNumResultAlternatives()
numResultAlternatives
property.
setNumResultAlternatives
int getPriority()
priority
property.
getPriority
in interface EngineProperties
priority
for this Engine
instancesetPriority
int getSensitivity()
sensitivity
property.
setSensitivity
int getSpeedVsAccuracy()
speedVsAccuracy
property.
setSpeedVsAccuracy
boolean isResultAudioProvided()
resultAudioProvided
property.
true
if result audio is providedsetResultAudioProvided
boolean isTrainingProvided()
trainingProvided
property.
true
if training information is providedsetTrainingProvided
void setAdaptation(int adaptation) throws IllegalArgumentException
adaptation
property.
This value determines when a Recognizer
may adapt
to the audio signal.
Adaptation to the audio signal can improve recognition accuracy.
However, it is sometimes better to ignore the audio when
it does not represent normal operating conditions.
For example, if music plays when PAUSED
but not RESUMED
,
then adaptation while PAUSED
may degrade recognition accuracy.
A value of ADAPT_PAUSED
allows the Recognizer
to adapt while PAUSED
.
A value of ADAPT_RESUMED
allows the Recognizer
to adapt while RESUMED
.
A value of (ADAPT_PAUSED | ADAPT_RESUMED
) allows
the Recognizer
to always adapt.
The default value of this property is implementation dependent. Applications should set this value for interaction appropriate for the task.
The requested value may be rejected or limited.
adaptation
- the desired adaptation
value
IllegalArgumentException
- if the property value is not validgetAdaptation
,
ADAPT_PAUSED
,
ADAPT_RESUMED
,
PAUSED
,
RESUMED
,
addEnginePropertyListener
void setCompleteTimeout(int completeTimeout) throws IllegalArgumentException
completeTimeout
property.
This timeout value, in milliseconds, determines the length of silence
required following user speech before the Recognizer
finalizes a Result
(with a RESULT_ACCEPTED
or RESULT_REJECTED
event).
The completeTimeout
property is used when the speech is
a complete match to an active Grammar
.
By contrast, the incompleteTimeout
property is used when
the speech is an incomplete match to an active Grammar
.
A long completeTimeout
value delays Result
completion and
therefore makes response time slow.
A short completeTimeout
value may lead to an utterance
being broken up inappropriately.
Reasonable completeTimeout
values are typically in the range of
300 milliseconds (0.3 seconds) to 1000 milliseconds (1.0 seconds),
depending on the application.
The default value of this property is implementation dependent. Applications should set this value for interaction appropriate for the task.
The requested value may be rejected or limited.
completeTimeout
- the timeout value in milliseconds
IllegalArgumentException
- if the property value
is not a positive integergetCompleteTimeout
,
setIncompleteTimeout
,
addEnginePropertyListener
,
RESULT_ACCEPTED
,
RESULT_REJECTED
,
Result
void setConfidenceThreshold(int confidenceThreshold) throws IllegalArgumentException
confidenceThreshold
property.
The confidenceThreshold
value can vary between
MIN_CONFIDENCE
and MAX_CONFIDENCE
.
A value of NORM_CONFIDENCE
is the default
for the Recognizer
.
A value of MAX_CONFIDENCE
requires the Recognizer
to
have maximum confidence in its Result
s or otherwise reject them.
A value of MIN_CONFIDENCE
requires only low confidence so
fewer Result
s are rejected.
The requested value may be rejected or limited.
confidenceThreshold
- a value specifying the confidence threshold
IllegalArgumentException
- if the property value is out of rangegetConfidenceThreshold
,
addEnginePropertyListener
,
MIN_CONFIDENCE
,
NORM_CONFIDENCE
,
MAX_CONFIDENCE
,
Result
void setEndpointStyle(int endpointStyle) throws IllegalArgumentException
endpointStyle
property.
The endpointStyle
is set to an integer constant representing the
endpoint style of the Recognizer
.
This determines how a Recognizer
knows when an utterance begins
and ends.
An application may decide to change its style of interaction
based on this value.
Acceptable input styles are
ENDPOINT_SPEECH_DETECTION
,
ENDPOINT_PUSH_TO_TALK
, and
ENDPOINT_PUSH_TO_START
.
These values are mutually exclusive.
The input styles may be modified by the behavior styles
ENDPOINT_AUTOMATIC
and ENDPOINT_MANUAL
.
These values are mutually exclusive.
The constant descriptions provide more detail.
Not all Recognizer
s support all styles.
If more than one mutually exclusive style is specified, then the
Recognizer
will choose its preferred style.
The requested value may be rejected or limited.
endpointStyle
- a value specifying the endpoint style
IllegalArgumentException
- if the property value is not validgetEndpointStyle
,
ENDPOINT_AUTOMATIC
,
ENDPOINT_MANUAL
,
ENDPOINT_SPEECH_DETECTION
,
ENDPOINT_PUSH_TO_TALK
,
ENDPOINT_PUSH_TO_START
void setIncompleteTimeout(int incompleteTimeout) throws IllegalArgumentException
incompleteTimeout
property.
The incompleteTimeout
value, in milliseconds, determines
the required length of silence following
user speech after which a Recognizer
finalizes a Result
.
The incompleteTimeout
applies when the speech prior to the
silence is an incomplete match of the active Grammar
s.
In this case, once the timeout is triggered, the partial result
is rejected (with a RESULT_REJECTED
event).
The incompleteTimeout
also applies when the speech prior
to the silence is a complete match of an active Grammar
,
but where it is possible to speak further and still
match the Grammar
.
For example, in a Grammar
for digit sequences for
telephone numbers it might be legal to speak either 7 or 10 digits.
If the user pauses briefly after speaking 7 digits then the
incomplete timeout applies because the user may then continue with
a further 3 digits.
By contrast, the completeTimeout
is used when the speech is
a complete match to an active Grammar
and
no further words can be spoken.
A long incompleteTimeout
value delays Result
completion
and therefore slows response time.
A short incompleteTimeout
value may
lead to an utterance being broken up inappropriately.
The incompleteTimeout
is usually longer than
the completeTimeout
to allow users to pause mid-utterance
(for example, to breathe).
The default value of this property is implementation dependent. Applications should set this value for interaction appropriate for the task.
The requested value may be rejected or limited.
incompleteTimeout
- the timeout value in milliseconds
IllegalArgumentException
- if the property value
is not a positive integergetIncompleteTimeout
,
setCompleteTimeout
,
addEnginePropertyListener
,
RESULT_REJECTED
,
Result
void setNumResultAlternatives(int numResultAlternatives) throws IllegalArgumentException
numResultAlternatives
property.
This property indicates the preferred maximum number of
N-best alternatives in FinalResult
objects.
A value of 1
indicates that the application wants
only the best result.
A value of 0
indicates that the application wants all
available alternatives.
Recognizer
s are not required to provide this number of
alternatives for every Result
and the number of alternatives may
vary from Result
to Result
.
Recognizer
s should only provide alternative tokens that are
considered reasonable: that is, the alternatives should be above
the confidenceThreshold
property value
(unless the Result
is REJECTED
).
Providing alternatives requires additional computing resources. Applications should only request the number of alternatives that they are likely to use.
The default value of this property is 1
.
The requested value may be rejected or limited.
numResultAlternatives
- the desired number
of FinalRuleResult
alternatives
IllegalArgumentException
- if the parameter is not a positive integergetNumResultAlternatives
,
getAlternativeTokens
,
addEnginePropertyListener
,
FinalResult
,
REJECTED
void setPriority(int priority) throws IllegalArgumentException
priority
property.
The priority
values range between
MIN_PRIORITY
and MAX_PRIORITY
.
The priority
used may be lower than the priority
requested (rejected or limited).
In this case, the return value will differ from the value requested.
Trusted applications may use the full range of priority
values.
Untrusted applications have a maximum of MAX_UNTRUSTED_PRIORITY
,
which is less than MAX_PRIORITY
.
The default priority
values
for trusted and untrusted applications are
NORM_TRUSTED_PRIORITY
and NORM_UNTRUSTED_PRIORITY
,
respectively.
The priority
property should be used with care
to avoid starvation of other applications.
Changing the priority
may be asynchronous, so any resulting
focus change may not occur immediately.
The priority
property may determine the order in which
Engine
instances interact.
For example, focus gain and loss may be affected by priority
.
A trusted application could use a higher priority
to avoid
losing focus during a user's answer to an important question.
setPriority
in interface EngineProperties
priority
- the priority
for this engine
IllegalArgumentException
- if the property value is out of rangegetPriority
,
EngineManager
,
addEnginePropertyListener
,
MIN_PRIORITY
,
NORM_TRUSTED_PRIORITY
,
NORM_UNTRUSTED_PRIORITY
,
MAX_UNTRUSTED_PRIORITY
,
MAX_PRIORITY
void setResultAudioProvided(boolean resultAudioProvided)
resultAudioProvided
property.
If set to true
, the Recognizer
is requested
to provide audio with FinalResult
objects.
If available, the audio is provided through the getAudio
methods
of the FinalResult
interface.
Some Recognizer
s that can provide audio for a FinalResult
cannot provide audio for all Result
s.
Applications must test audio availability
for each individual Result
as described
in the getAudio
methods.
A Recognizer
that does not provide audio will
limit the value to false
.
The default value for this property is false
.
The requested value may be rejected or limited.
resultAudioProvided
- the value for this propertyisResultAudioProvided
,
FinalResult
,
getAudio
,
addEnginePropertyListener
void setSensitivity(int sensitivity) throws IllegalArgumentException
sensitivity
property.
The sensitivity
can vary between
MIN_SENSITIVITY
and MAX_SENSITIVITY
.
A value of NORM_SENSITIVITY
is
the default for the Recognizer
.
A value of MAX_SENSITIVITY
makes
the Recognizer
more sensitive to quiet input,
but also more sensitive to noise.
A value of MIN_SENSITIVITY
may require the user to speak louder,
but makes the Recognizer
less sensitive to background noise.
Some Recognizer
s set the gain automatically during use,
or through a setup "Wizard". For these Recognizer
s,
the sensitivity adjustment should be used only in extreme cases
where the automatic settings are not adequate.
The requested value may be rejected or limited.
sensitivity
- the value for this property
IllegalArgumentException
- if the property value is not validgetSensitivity
,
addEnginePropertyListener
,
MIN_SENSITIVITY
,
NORM_SENSITIVITY
,
MAX_SENSITIVITY
void setSpeedVsAccuracy(int speedVsAccuracy) throws IllegalArgumentException
speedVsAccuracy
property.
A value of NORM_ACCURACY
is the default compromise
between speed and accuracy for the Recognizer
.
A value of MIN_ACCURACY
minimizes response time.
A value of MAX_ACCURACY
maximizes recognition accuracy.
Why are speed and accuracy a trade-off?
A Recognizer
determines what a user says by
testing different possible sequences of words
(with legal sequences being defined by the active Grammar
s).
If the Recognizer
tests more sequences it is more likely to find
the correct sequence, but the additional processing makes it slower.
Increasing Grammar
complexity and decreasing the computer power
both make this trade-off more important.
Conversely, a simpler Grammar
or more powerful computer
make the trade-off less important.
The requested value may be rejected or limited.
speedVsAccuracy
- the value for this property
IllegalArgumentException
- if the property value is out of rangegetSpeedVsAccuracy
,
addEnginePropertyListener
,
MIN_ACCURACY
,
NORM_ACCURACY
,
MAX_ACCURACY
void setTrainingProvided(boolean trainingProvided)
trainingProvided
property.
If true
, request a Recognizer
to provide
training information for FinalResult
objects
through the tokenCorrection
method.
Not all Recognizer
s support training.
Also, Recognizer
s that do support training are not required to
support training data for all Result
s.
A Recognizer
that does not support training
will limit the value to false
.
The default value for this property is false
.
The requested value may be rejected or limited.
trainingProvided
- the value for this propertyisTrainingProvided
,
tokenCorrection
,
addEnginePropertyListener
,
FinalResult
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.