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