Class GrammarList

  • All Implemented Interfaces:
    AutoCloseable

    public final class GrammarList
    extends Grammar
    implements AutoCloseable
    Allows adding multiple grammars to a SpeechRecognizer to improve the accuracy of speech recognition. GrammarLists are only usable in specific scenarios and are not generally available. Note: close() must be called in order to release underlying resources held by the object.
    • Method Detail

      • fromRecognizer

        public static GrammarList fromRecognizer​(Recognizer recognizer)
        Creates a GrammarList from a given speech recognizer. Creating a grammar list from a recognizer is only usable in specific scenarios and is not generally available.
        Parameters:
        recognizer - The recognizer to get the grammar list from.
        Returns:
        GrammarList associated to the recognizer.
      • add

        public void add​(Grammar grammar)
        Adds a single grammar to the current recognizer.
        Parameters:
        grammar - Grammar to add.