Asterisk-Java

org.asteriskjava.fastagi
Class SpeechRecognitionResult

java.lang.Object
  extended by org.asteriskjava.fastagi.SpeechRecognitionResult
All Implemented Interfaces:
java.io.Serializable

public class SpeechRecognitionResult
extends java.lang.Object
implements java.io.Serializable

Contains the results of a speech recognition command.

Since:
1.0.0
See Also:
AgiChannel.speechRecognize(String, int), AgiChannel.speechRecognize(String, int, int), SpeechRecognizeCommand, Serialized Form

Nested Class Summary
static class SpeechRecognitionResult.SpeechResult
          Container class for recognized speech.
 
Constructor Summary
SpeechRecognitionResult(AgiReply agiReply)
           
 
Method Summary
 java.util.List<SpeechRecognitionResult.SpeechResult> getAllResults()
           
 char getDigit()
          Returns the DTMF digit that was received.
 int getEndpos()
          Returns the position where the prompt stopped playing because a DTMF digit was received or speech was recognized (barge in).
 java.lang.String getGrammar()
          Returns the grammar for the first recognition result.
 int getNumberOfResults()
          Returns how many results have been recoginized.
 int getScore()
          Returns the confidence score for the first recognition result.
 java.lang.String getText()
          Returns the text for the first recognition result.
 boolean isDtmf()
          Checks whether a DTMF digit was recieved.
 boolean isSpeech()
          Checks whether speech was recognized.
 boolean isTimeout()
          Checks whether a timeout was encountered and neither a DTMF digit was received nor speech was recognized.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpeechRecognitionResult

public SpeechRecognitionResult(AgiReply agiReply)
Method Detail

isDtmf

public boolean isDtmf()
Checks whether a DTMF digit was recieved.

Returns:
true if a DTMF digit was received, false otherwise.
See Also:
getDigit()

isSpeech

public boolean isSpeech()
Checks whether speech was recognized.

Returns:
true if speech was recognized, false otherwise.
See Also:
getText(), getScore(), getGrammar()

isTimeout

public boolean isTimeout()
Checks whether a timeout was encountered and neither a DTMF digit was received nor speech was recognized.

Returns:
true a timeout was encountered, false otherwise.

getDigit

public char getDigit()
Returns the DTMF digit that was received.

Returns:
the DTMF digit that was received or 0x0 if none was received.

getEndpos

public int getEndpos()
Returns the position where the prompt stopped playing because a DTMF digit was received or speech was recognized (barge in).

Returns:
the position where the prompt stopped playing, 0 if it was played completely.

getScore

public int getScore()
Returns the confidence score for the first recognition result. This is an integer between 0 (lowest confidence) and 1000 (highest confidence).

Returns:
the confidence score for the first recognition result or 0 if no speech was recognized.

getText

public java.lang.String getText()
Returns the text for the first recognition result. This is the text that was recognized by the speech engine.

Returns:
the text for the first recognition result or null if no speech was recognized.

getGrammar

public java.lang.String getGrammar()
Returns the grammar for the first recognition result. This is the grammar that was used by the speech engine.

Returns:
the grammar for the first recognition result or null if no speech was recognized.

getNumberOfResults

public int getNumberOfResults()
Returns how many results have been recoginized. Usually there is only one result but if multiple rules in the grammar match multiple results may be returned.

Returns:
the number of results recognized.

getAllResults

public java.util.List<SpeechRecognitionResult.SpeechResult> getAllResults()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Asterisk-Java

Copyright © 2004-2009 Stefan Reuter. All Rights Reserved.