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()
      Get the Locales available from this STTService.
      Returns:
      The Locales available from this service
    • getSupportedFormats

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

      STTServiceHandle recognize(STTListener sttListener, AudioStream audioStream, Locale locale) 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.

      Parameters:
      sttListener - The STTListener that STTEvent events target
      audioStream - The AudioStream from which speech is recognized
      locale - The Locale in which the target speech is spoken
      Returns:
      A STTServiceHandle used to abort recognition
      Throws:
      STTException - if any parameter is invalid or an STT problem occurs
      See Also: