Build 1.0_r1(from source)

android.speech.srec
Class Srec

java.lang.Object
  extended by android.speech.srec.Srec

public class Srec
extends Object

Simple, synchronous speech recognizer, using the SREC package.


Nested Class Summary
 class Srec.Grammar
          Represents a grammar loaded into the recognizer.
 
Constructor Summary
Srec(String configFile)
          Create an instance of a SREC speech recognizer.
 
Method Summary
 void dispose()
          Clean up resources.
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
 String getResult(int index, String key)
          Get a result value
 int getResultCount()
          Get the number of recognition results.
 String[] getResultKeys(int index)
          Get a set of keys for the result.
 Srec.Grammar loadGrammar(String g2gFileName)
          Creates a Srec recognizer.
 boolean process()
          Process some audio and return the next state.
 void reset()
          Reset the recognizer to the idle state.
 void start()
          Start recognition
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Srec

Srec(String configFile)
throws IOException
Create an instance of a SREC speech recognizer.

Parameters:
configFile - pathname of the baseline*.par configuration file.
Throws:
IOException
Method Detail

loadGrammar

public Srec.Grammar loadGrammar(String g2gFileName)
                         throws IOException
Creates a Srec recognizer.

Parameters:
g2gFileName - pathname of a g2g grammar file.
Returns:
Throws:
IOException

start

public void start()
Start recognition


process

public boolean process()
Process some audio and return the next state.

Returns:
true if complete

getResultCount

public int getResultCount()
Get the number of recognition results.

Returns:

getResultKeys

public String[] getResultKeys(int index)
Get a set of keys for the result.

Parameters:
index - index of result.
Returns:
array of keys.

getResult

public String getResult(int index,
                        String key)
Get a result value

Parameters:
index - index of the result.
key - key of the result.
Returns:
the result.

reset

public void reset()
Reset the recognizer to the idle state.


dispose

public void dispose()
Clean up resources.


finalize

protected void finalize()
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class Object

Build 1.0_r1(from source)

Please submit a feedback, bug or feature