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 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
    • interpret

      String interpret(Locale locale, String text) throws InterpretationException
      Interprets a human language text fragment of a given Locale
      Parameters:
      locale - language of the text (given by a Locale)
      text - the text to interpret
      Returns:
      a human language response
      Throws:
      InterpretationException
    • getGrammar

      @Nullable String getGrammar(Locale locale, String format)
      Gets the grammar of all commands of a given Locale of the interpreter
      Parameters:
      locale - language of the commands (given by a Locale)
      format - the grammar format
      Returns:
      a grammar of the specified format
    • getSupportedLocales

      Set<Locale> getSupportedLocales()
      Gets all supported languages of the interpreter by their Locales
      Returns:
      Set of supported languages (each given by a Locale) or null, if there is no constraint
    • getSupportedGrammarFormats

      Set<String> getSupportedGrammarFormats()
      Gets all supported grammar format specifiers
      Returns:
      Set of supported grammars (each given by a short name)