Package org.openhab.core.voice.text
Interface HumanLanguageInterpreter
- All Known Implementing Classes:
AbstractRuleBasedInterpreter
@NonNullByDefault
public interface HumanLanguageInterpreter
This is the interface that a human language text interpreter has to implement.
- Author:
- Tilman Kamp - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
getGrammar
(Locale locale, String format) Gets the grammar of all commands of a givenLocale
of the interpretergetId()
Returns a simple string that uniquely identifies this serviceReturns a localized human readable label that can be used within UIs.Gets all supported grammar format specifiersGets all supported languages of the interpreter by theirLocale
sInterprets a human language text fragment of a givenLocale
default String
interpret
(Locale locale, String text, @Nullable DialogContext dialogContext) Interprets a human language text fragment of a givenLocale
with optional access to the context of a dialog execution.
-
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
-
interpret
Interprets a human language text fragment of a givenLocale
- Parameters:
locale
- language of the text (given by aLocale
)text
- the text to interpret- Returns:
- a human language response
- Throws:
InterpretationException
-
interpret
default String interpret(Locale locale, String text, @Nullable DialogContext dialogContext) throws InterpretationException Interprets a human language text fragment of a givenLocale
with optional access to the context of a dialog execution.- Parameters:
locale
- language of the text (given by aLocale
)text
- the text to interpret- Returns:
- a human language response
- Throws:
InterpretationException
-
getGrammar
Gets the grammar of all commands of a givenLocale
of the interpreter- Parameters:
locale
- language of the commands (given by aLocale
)format
- the grammar format- Returns:
- a grammar of the specified format
-
getSupportedLocales
Gets all supported languages of the interpreter by theirLocale
s- Returns:
- Set of supported languages (each given by a
Locale
) or null, if there is no constraint
-
getSupportedGrammarFormats
Gets all supported grammar format specifiers- Returns:
- Set of supported grammars (each given by a short name)
-