Class SpeechResultEvent


public class SpeechResultEvent extends ClientEvent<SpeechListener>
Event fired when speech recognition produces a result.
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • SpeechResultEvent

      public SpeechResultEvent(String transcript, float confidence, boolean isFinal)
      Constructs a SpeechResultEvent.
      Parameters:
      transcript - The recognized text.
      confidence - Confidence score (0.0 to 1.0).
      isFinal - True if this is a final result, false if interim.
  • Method Details

    • getTranscript

      public String getTranscript()
      Returns the recognized text.
      Returns:
      The transcript.
    • getConfidence

      public float getConfidence()
      Returns the confidence score.
      Returns:
      Confidence from 0.0 (no confidence) to 1.0 (high confidence).
    • isFinal

      public boolean isFinal()
      Returns whether this is a final result.

      Interim results may change as more audio is processed. Final results are the speech recognizer's best interpretation.

      Returns:
      True if final, false if interim.
    • isInterim

      public boolean isInterim()
      Returns whether this is an interim (non-final) result.
      Returns:
      True if interim.
    • dispatchTo

      public void dispatchTo(SpeechListener listener)
      Description copied from class: Event
      Dispatches this event to the specified listener.

      Subclasses implement this method to call the appropriate handler method on the listener interface.

      Specified by:
      dispatchTo in class Event<SpeechListener>
      Parameters:
      listener - the listener to dispatch this event to
    • toString

      public String toString()
      Overrides:
      toString in class Object