Class PhraseListGrammar

  • All Implemented Interfaces:
    AutoCloseable

    public final class PhraseListGrammar
    extends Grammar
    implements AutoCloseable
    Allows additions of new phrases to improve speech recognition. Phrases added to the recognizer are effective at the start of the next recognition, or the next time the SpeechSDK must reconnect to the speech service. Note: close() must be called in order to release underlying resources held by the object. Added in version 1.5.0
    • Method Detail

      • fromRecognizer

        public static PhraseListGrammar fromRecognizer​(Recognizer recognizer)
        Creates a PhraseListGrammar from a given speech recognizer. Will accept any recognizer that derives from Recognizer.
        Parameters:
        recognizer - The recognizer to add phrase lists to.
        Returns:
        PhraseListGrammar associated to the recognizer.
      • addPhrase

        public void addPhrase​(String phrase)
        Adds a single phrase to the current recognizer.
        Parameters:
        phrase - Phrase to add.
      • clear

        public void clear()
        Clears all phrases added to the current recognizer.