Share via


class PhraseListGrammar

class PhraseListGrammar
  : public Grammar

Represents a phrase list grammar for dynamic grammar scenarios. Added in version 1.5.0.

Members

PhraseListGrammar

Syntax: public inline explicit PhraseListGrammar ( SPXGRAMMARHANDLE hgrammar );

Internal constructor. Creates a new instance using the provided handle.

Parameters

  • hgrammar Phrase list grammar handle.

AddPhrase

Syntax: public inline void AddPhrase ( const std::string & text );

Adds a simple phrase that may be spoken by the user.

Parameters

  • text The phrase to be added.

SetWeight

Syntax: public inline void SetWeight ( double weight );

Sets the phrase list grammar biasing weight. The allowed range is [0.0, 2.0]. The default weight is 1.0. Value zero disables the phrase list.

Parameters

  • weight Phrase list grammar biasing weight.

Clear

Syntax: public inline void Clear ( );

Clears all phrases from the phrase list grammar.

FromRecognizer

Syntax: public template< > inline static std::shared_ptr< PhraseListGrammar > FromRecognizer ( std::shared_ptr< T > recognizer );

Creates a phrase list grammar for the specified recognizer.

Parameters

  • recognizer The recognizer from which to obtain the phrase list grammar.

Returns

A shared pointer to phrase list grammar.