類 PhraseListGrammar

class PhraseListGrammar
  : public Grammar

表示動態文法案例的片語清單文法。 已在1.5.0版中新增。

成員

PhraseListGrammar 語法

語法:public inline explicit PhraseListGrammar ( SPXGRAMMARHANDLE hgrammar );

內部建構函式。 使用提供的句柄建立新的實例。

參數

  • hgrammar 片組清單文法句柄。

添加短語

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

新增使用者可能說出的簡單片語。

參數

  • text 要新增的片語。

設定重量

語法:public inline void SetWeight ( double weight );

設置短語清單語法偏差權重。 允許的範圍為 [0.0, 2.0]。 默認權重為1.0。 值 0 將禁用短語清單。

參數

  • weight 短語清單語法偏向權重。

清楚

語法:public inline void Clear ( );

從片語清單文法清除所有片語。

FromRecognizer

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

建立指定辨識器的片語清單文法。

參數

  • recognizer 要從中取得詞組清單文法的辨識器。

退貨

片語清單文法的共享指標。