Package org.openhab.core.voice
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 Summary
Modifier and TypeMethodDescriptiongetId()
Returns a simple string that uniquely identifies this serviceReturns a localized human readable label that can be used within UIs.Obtain the audio formats supported by this STTServiceObtain the Locales available from this STTServicerecognize
(STTListener sttListener, AudioStream audioStream, Locale locale, Set<String> grammars) This method starts the process of speech recognition.
-
Method Details
-
getId
String getId()Returns a simple string that uniquely identifies this service- Returns:
- an id that identifies this service
-
getLabel
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
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 passedAudioStream
is passed to the speech recognition engine. The recognition engine attempts to recognize speech as being spoken in the passedLocale
and containing statements specified in the passedgrammars
. Recognition is indicated by firedSTTEvent
events targeting the passedSTTListener
. The passedAudioStream
must be of a supportedAudioFormat
. In other words anAudioFormat
compatible with one returned from thegetSupportedFormats()
method. The passedLocale
must be supported. That is to say it must be aLocale
returned from thegetSupportedLocales()
method. The passedgrammars
must consist of a syntactically valid grammar as specified by the JSpeech Grammar Format. Ifgrammars
is null or empty, large vocabulary continuous speech recognition is attempted.- Parameters:
sttListener
- Non-nullSTTListener
thatSTTEvent
events targetaudioStream
- TheAudioStream
from which speech is recognizedlocale
- TheLocale
in which the target speech is spokengrammars
- 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:
-