Build 1.0_r1(from source)

android.speech.recognition.impl
Class EmbeddedRecognizerImpl

java.lang.Object
  extended by android.speech.recognition.EmbeddedRecognizer
      extended by android.speech.recognition.impl.EmbeddedRecognizerImpl
All Implemented Interfaces:
Recognizer, Runnable

public class EmbeddedRecognizerImpl
extends EmbeddedRecognizer
implements Runnable


Constructor Summary
EmbeddedRecognizerImpl()
          Creates a new instance.
 
Method Summary
 void configure(String config)
          Configures the recognizer.
 Grammar createGrammar(String value, GrammarListener listener)
          Creates an embedded grammar.
static EmbeddedRecognizerImpl getInstance()
          Returns the singleton instance.
 void getParameters(Vector<String> params)
          Retrieves the values of recognition parameters.
 void recognize(AudioStream audio, Grammar grammar)
          This convenience method is equivalent to invoking recognize(audio, grammars) with a single grammar.
 void recognize(AudioStream audio, Vector<Grammar> grammars)
          Begins speech recognition.
 void resetAcousticState()
          The recognition accuracy improves over time as the recognizer adapts to the surrounding environment.
 void run()
          Begin doing the active part of the class' code.
 void setListener(RecognizerListener listener)
          Sets the recognizer event listener.
 void setParameters(Hashtable<String,String> params)
          Sets the values of recognition parameters.
 void stop()
          Terminates a recognition if one is in-progress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedRecognizerImpl

EmbeddedRecognizerImpl()
Creates a new instance.

Method Detail

getInstance

public static EmbeddedRecognizerImpl getInstance()
Returns the singleton instance.

Returns:
the singleton instance

run

public void run()
Description copied from interface: Runnable
Begin doing the active part of the class' code.

Specified by:
run in interface Runnable

configure

public void configure(String config)
               throws IllegalArgumentException,
                      FileNotFoundException,
                      IOException,
                      UnsatisfiedLinkError,
                      ClassNotFoundException
Description copied from class: EmbeddedRecognizer
Configures the recognizer.

Specified by:
configure in class EmbeddedRecognizer
Parameters:
config - recognizer configuration file
Throws:
IllegalArgumentException - if config is null or an empty string
FileNotFoundException - if the specified file could not be found
IOException - if the specified file could not be opened
UnsatisfiedLinkError - if the recognizer plugin could not be loaded
ClassNotFoundException - if the recognizer plugin could not be found

setListener

public void setListener(RecognizerListener listener)
Description copied from interface: Recognizer
Sets the recognizer event listener.

Specified by:
setListener in interface Recognizer
Parameters:
listener - listens for recognizer events

createGrammar

public Grammar createGrammar(String value,
                             GrammarListener listener)
                      throws IllegalArgumentException
Description copied from interface: Recognizer
Creates an embedded grammar.

Specified by:
createGrammar in interface Recognizer
Parameters:
value - value of that grammarType. Could be a URL or an inline grammar.
Returns:
a grammar
Throws:
IllegalArgumentException - if value is null or listener is not of type GrammarListener.

resetAcousticState

public void resetAcousticState()
Description copied from class: EmbeddedRecognizer
The recognition accuracy improves over time as the recognizer adapts to the surrounding environment. This method enables developers to reset the adaptation when the environment is known to have changed.

Specified by:
resetAcousticState in class EmbeddedRecognizer

recognize

public void recognize(AudioStream audio,
                      Vector<Grammar> grammars)
Description copied from interface: Recognizer
Begins speech recognition.

Specified by:
recognize in interface Recognizer
Parameters:
audio - the audio stream to recognizer
grammars - a collection of grammar sets to recognize against
See Also:
Recognizer.recognize(AudioStream, Grammar)

recognize

public void recognize(AudioStream audio,
                      Grammar grammar)
Description copied from interface: Recognizer
This convenience method is equivalent to invoking recognize(audio, grammars) with a single grammar.

Specified by:
recognize in interface Recognizer
Parameters:
audio - the audio to recognizer
grammar - a grammar to recognize against
See Also:
Recognizer.recognize(AudioStream, Vector)

stop

public void stop()
Description copied from interface: Recognizer
Terminates a recognition if one is in-progress. This must not be called until the recognize method returns; otherwise the result is not defined.

Specified by:
stop in interface Recognizer
See Also:
RecognizerListener.onStopped()

setParameters

public void setParameters(Hashtable<String,String> params)
Description copied from interface: Recognizer
Sets the values of recognition parameters.

Specified by:
setParameters in interface Recognizer
Parameters:
params - the parameter key-value pairs to set

getParameters

public void getParameters(Vector<String> params)
Description copied from interface: Recognizer
Retrieves the values of recognition parameters.

Specified by:
getParameters in interface Recognizer
Parameters:
params - the names of the parameters to retrieve

Build 1.0_r1(from source)

Please submit a feedback, bug or feature