Build 1.0_r1(from source)

android.speech.recognition
Interface Recognizer

All Known Implementing Classes:
EmbeddedRecognizer, EmbeddedRecognizerImpl

public interface Recognizer

Speech recognizer interface.


Method Summary
 Grammar createGrammar(String value, GrammarListener listener)
          Creates an embedded grammar.
 void getParameters(Vector<String> parameters)
          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 setListener(RecognizerListener listener)
          Sets the recognizer event listener.
 void setParameters(Hashtable<String,String> parameters)
          Sets the values of recognition parameters.
 void stop()
          Terminates a recognition if one is in-progress.
 

Method Detail

setListener

void setListener(RecognizerListener listener)
Sets the recognizer event listener.

Parameters:
listener - listens for recognizer events

createGrammar

Grammar createGrammar(String value,
                      GrammarListener listener)
                      throws IllegalArgumentException
Creates an embedded grammar.

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.

recognize

void recognize(AudioStream audio,
               Vector<Grammar> grammars)
               throws IllegalStateException,
                      IllegalArgumentException,
                      UnsupportedOperationException
Begins speech recognition.

Parameters:
audio - the audio stream to recognizer
grammars - a collection of grammar sets to recognize against
Throws:
IllegalStateException - if any of the grammars are not loaded
IllegalArgumentException - if audio is null, in-use by another component or empty. Or if grammars is null or grammars count is less than one. Or if the audio codec differs from recognizer codec.
UnsupportedOperationException - if the recognizer does not support the number of grammars specified.
See Also:
recognize(AudioStream, Grammar)

recognize

void recognize(AudioStream audio,
               Grammar grammar)
               throws IllegalStateException,
                      IllegalArgumentException
This convenience method is equivalent to invoking recognize(audio, grammars) with a single grammar.

Parameters:
audio - the audio to recognizer
grammar - a grammar to recognize against
Throws:
IllegalStateException - if grammar is not loaded
IllegalArgumentException - if audio is null, in-use by another component or is empty. Or if grammar is null or if the audio codec differs from the recognizer codec.
See Also:
recognize(AudioStream, Vector)

stop

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

See Also:
RecognizerListener.onStopped()

setParameters

void setParameters(Hashtable<String,String> parameters)
Sets the values of recognition parameters.

Parameters:
parameters - the parameter key-value pairs to set

getParameters

void getParameters(Vector<String> parameters)
Retrieves the values of recognition parameters.

Parameters:
parameters - the names of the parameters to retrieve

Build 1.0_r1(from source)

Please submit a feedback, bug or feature