Class PhraseListGrammar
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.Grammar
-
- com.microsoft.cognitiveservices.speech.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPhrase(String phrase)Adds a single phrase to the current recognizer.voidclear()Clears all phrases added to the current recognizer.voidclose()Dispose of associated resources.static PhraseListGrammarfromRecognizer(Recognizer recognizer)Creates a PhraseListGrammar from a given speech recognizer.-
Methods inherited from class com.microsoft.cognitiveservices.speech.Grammar
fromStorageId, getImpl
-
-
-
-
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.
-
close
public void close()
Dispose of associated resources.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classGrammar
-
-