Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.speech.EngineModeDesc
EngineModeDesc
provides information about a
specific operating mode of a speech engine.
The availableRecognizers
and availableSynthesizers
methods of the Central
class provide a list of mode
descriptors for all operating modes of registered engines.
Applications may also create EngineModeDescs
for use in selecting and creating engines. Examples of uses
mode descriptors are provided in the documentation for the
Central
class.
The properties defined in the EngineModeDesc
class
apply to all speech engines including speech recognizers
and speech synthesizers. The RecognizerModeDesc
and SynthesizerModeDesc
classes extend the
EngineModeDesc
class to define specialized
properties for recognizers and synthesizers.
The EngineModeDesc
and its sub-classes follow the
Java Beans set/get property patterns. The list of properties
is outlined below.
The properties of EngineModeDesc
and its sub-classes
are all object references. All properties are defined so that a
null
value means "don't care" when selecting an engine
or matching EngineModeDesc
and its sub-classes.
For example, a Boolean
value for a property means
that its three values are true, false and don't care (null
).
The basic properties of an engine defined by EngineModeDesc
are:
java.util.Locale
object representing the
language supported by the engine mode. The country code
may be optionally defined for an engine. The Locale
variant is typically ignored.
e.g. Locale("fr", "CA") represent French spoken in Canada.
("fr" and "CA" are standard ISO codes).
Boolean
value indicating whether a speech engine
is already running. This allows for the selection of engines that
already running so that system resources are conserved.
There are two types of EngineModeDesc
object (and its sub-classes):
those created by a speech engine and those created by an application.
Engine-created descriptors are obtained through the
availableRecognizers
and availableSynthesizers
methods of the Central
class and must have all features
set to non-null values.
Applications can create descriptors using the constructors of
the descriptor classes. Applications may leave any or all of the
feature values null
to indicate "don't care".
Typically, application-created descriptors are used to test the engine-created descriptors to select an appropriate engine for creation. For example, the following code tests whether an engine mode supports Swiss German:
EngineModeDesc fromEngine = ...; // "de" is the ISO 639 language code for German // "CH" is the ISO 3166 country code for Switzerland // (see locale for details) EngineModeDesc require = new EngineModeDesc(new Locale("de", "CH")); // test whether the engine mode supports Swiss German. if (fromEngine.match(require)) ...
An application can create a descriptor and pass it to the
createRecognizer
or createSynthesizer
methods of Central
. In this common approach,
the Central
performs the engine selection.
// Create a mode descriptor that requires French EngineModeDesc desc = new EngineModeDesc(Locale.FRENCH); // Create a synthesizer that supports French Synthesizer synth = Central.createSynthesizer(desc);
Applications that need advanced selection criterion will
availableRecognizers
or availableSynthesizers
,
EngineList
and EngineModeDesc
and its sub-classes,
createRecognizer
or
createSynthesizer
method of Central
.
Constructor Summary | |
EngineModeDesc()
Empty constructor sets engine name, mode name, Locale and running all to null .
|
|
EngineModeDesc(Locale locale)
Construct an EngineModeDesc for a locale.
|
|
EngineModeDesc(String engineName,
String modeName,
Locale locale,
Boolean running)
Constructor provided with engine name, mode name, locale and running. |
Method Summary | |
boolean | equals(Object anObject)
True if and only if the parameter is not null
and is a EngineModeDesc with equal values of
Locale, engineName and modeName. |
String | getEngineName()
Get the engine name. |
Locale | getLocale()
Get the Locale. |
String | getModeName()
Get the mode name. |
Boolean | getRunning()
Get the running feature. |
boolean | match(EngineModeDesc require)
Determine whether an EngineModeDesc has all the features
defined in the require object. |
void | setEngineName(String engineName)
Set the engine name. |
void | setLocale(Locale locale)
Set the Locale. |
void | setModeName(String modeName)
Set the mode name. |
void | setRunning(Boolean running)
Set the running feature. |
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Constructor Detail |
public EngineModeDesc()
null
.
public EngineModeDesc(Locale locale)
EngineModeDesc
for a locale.
The engine name, mode name and running are set to null
.public EngineModeDesc(String engineName, String modeName, Locale locale, Boolean running)
null
.Method Detail |
public String getEngineName()
public void setEngineName(String engineName)
public String getModeName()
public void setModeName(String modeName)
public Locale getLocale()
Locale.ENGLISH
indicates the English
language spoken in any country). The locale variant is
typically ignored.public void setLocale(Locale locale)
public Boolean getRunning()
TRUE
, FALSE
or
null
(null means "don't care").public void setRunning(Boolean running)
TRUE
, FALSE
or
null
(null means "don't care").public boolean match(EngineModeDesc require)
EngineModeDesc
has all the features
defined in the require
object. Strings in
require
which are either null
or
zero-length ("") are not tested, including those in the
Locale. All string comparisons are exact (case-sensitive).public boolean equals(Object anObject)
null
and is a EngineModeDesc
with equal values of
Locale, engineName and modeName.Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com