PhraseListGrammar Class

Implements

java.lang.AutoCloseable

public final class PhraseListGrammar
extends Grammar
implements java.lang.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

Modifier and Type Method and Description
void addPhrase(String phrase)

Adds a single phrase to the current recognizer.

void clear()

Clears all phrases added to the current recognizer.

void close()

Dispose of associated resources.

static PhraseListGrammar fromRecognizer(Recognizer recognizer)

Creates a PhraseListGrammar from a given speech recognizer.

Methods inherited from Grammar

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

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.

Overrides:

PhraseListGrammar.close()

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.

Applies to