Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class javax.speech.EngineModeDesc

java.lang.Object
  |
  +--javax.speech.EngineModeDesc
Subclasses:
RecognizerModeDesc, SynthesizerModeDesc

public class EngineModeDesc
extends Object
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:

engine name
A string that uniquely identifies a speech engine. e.g. "Acme Recognizer"
mode name
A string that uniquely identifies a mode of operation of the speech engine. e.g. "Spanish Dictator"
Locale
A 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).
Running
A 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.
Selection

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

  1. Request a list of engine mode descriptors from availableRecognizers or availableSynthesizers,
  2. Select one of the descriptors using the methods of EngineList and EngineModeDesc and its sub-classes,
  3. Pass the selected descriptor to the createRecognizer or createSynthesizer method of Central.

See Also:
RecognizerModeDesc, SynthesizerModeDesc, 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

EngineModeDesc

public EngineModeDesc()
Empty constructor sets engine name, mode name, Locale and running all to null.


EngineModeDesc

public EngineModeDesc(Locale locale)
Construct an EngineModeDesc for a locale. The engine name, mode name and running are set to null.

EngineModeDesc

public EngineModeDesc(String engineName,
                      String modeName,
                      Locale locale,
                      Boolean running)
Constructor provided with engine name, mode name, locale and running. Any parameter may be null.
Method Detail

getEngineName

public String getEngineName()
Get the engine name. The engine name should be a unique string across the provider company and across companies.

setEngineName

public void setEngineName(String engineName)
Set the engine name. May be null.

getModeName

public String getModeName()
Get the mode name. The mode name that should uniquely identify a single mode of operation of a speech engine (per-engine unique).

setModeName

public void setModeName(String modeName)
Set the mode name. May be null.

getLocale

public Locale getLocale()
Get the Locale. The locale for an engine mode must have the language defined but the country may be undefined. (e.g. Locale.ENGLISH indicates the English language spoken in any country). The locale variant is typically ignored.

setLocale

public void setLocale(Locale locale)
Set the Locale. May be null.

getRunning

public Boolean getRunning()
Get the running feature. Values may be TRUE, FALSE or null (null means "don't care").

setRunning

public void setRunning(Boolean running)
Set the running feature. Values may be TRUE, FALSE or null (null means "don't care").

match

public boolean match(EngineModeDesc require)
Determine whether an 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).

equals

public 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.
Overrides:
equals in class Object

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