Interface STTService


@NonNullByDefault public interface STTService
This is the interface that a speech-to-text service has to implement.
Author:
Kelly Davis - Initial contribution
  • Method Details

    • getId

      String getId()
      Returns a simple string that uniquely identifies this service
      Returns:
      an id that identifies this service
    • getLabel

      String getLabel(@Nullable Locale locale)
      Returns a localized human readable label that can be used within UIs.
      Parameters:
      locale - the locale to provide the label for
      Returns:
      a localized string to be used in UIs
    • getSupportedLocales

      Set<Locale> getSupportedLocales()
      Obtain the Locales available from this STTService
      Returns:
      The Locales available from this service
    • getSupportedFormats

      Set<AudioFormat> getSupportedFormats()
      Obtain the audio formats supported by this STTService
      Returns:
      The audio formats supported by this service
    • recognize

      STTServiceHandle recognize(STTListener sttListener, AudioStream audioStream, Locale locale, Set<String> grammars) throws STTException
      This method starts the process of speech recognition. The audio data of the passed AudioStream is passed to the speech recognition engine. The recognition engine attempts to recognize speech as being spoken in the passed Locale and containing statements specified in the passed grammars. Recognition is indicated by fired STTEvent events targeting the passed STTListener. The passed AudioStream must be of a supported AudioFormat. In other words an AudioFormat compatible with one returned from the getSupportedFormats() method. The passed Locale must be supported. That is to say it must be a Locale returned from the getSupportedLocales() method. The passed grammars must consist of a syntactically valid grammar as specified by the JSpeech Grammar Format. If grammars is null or empty, large vocabulary continuous speech recognition is attempted.
      Parameters:
      sttListener - Non-null STTListener that STTEvent events target
      audioStream - The AudioStream from which speech is recognized
      locale - The Locale in which the target speech is spoken
      grammars - The JSpeech Grammar Format grammar specifying allowed statements
      Returns:
      A STTServiceHandle used to abort recognition
      Throws:
      STTException - if any parameter is invalid or a STT problem occurs
      See Also: