⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osbrec_utils.h

📁 Open VXI. This is a open source.
💻 H
字号:
/****************License************************************************ * * Copyright 2000.  SpeechWorks International, Inc.   * * Use of this software is subject to notices and obligations set forth * in the SpeechWorks Public License - Software Version 1.1 which is * included with this software. * * SpeechWorks is a registered trademark, and SpeechWorks Here,  * DialogModules and the SpeechWorks logo are trademarks of SpeechWorks  * International, Inc. in the United States and other countries.  *  ************************************************************************ * * $Id: osbrec_utils.h,v 1.1.2.4 2001/10/03 18:42:22 dmeyer Exp $ * * Rec integration utils * ****************************************************************************/#ifndef _OSBREC_UTILS#define _OSBREC_UTILS#include "VXItypes.h"#include "VXIvalue.h"#include "VXIlog.h"#include <list>#include <string>typedef std::basic_string<VXIchar> vxistring;// Constants for diagnostic logging tags//static const VXIunsigned DIAG_TAG_RECOGNITION = 0;static const VXIunsigned DIAG_TAG_GRAMMARS    = 1;class OSBrecWordList;class OSBrecGrammar { public:  virtual void SetEnabled(bool) = 0;  // Sets the flag indicating whether or not the grammar is enabled for the  // next recognition.  virtual bool IsEnabled() const = 0;  // Returns current enabled state of this grammar.  virtual bool CheckPhrase(const VXIchar* best, const VXIchar** val) const = 0;  // Is this phrase supported by this grammar?  If so, find the matching  // value string.  OSBrecGrammar() { }  virtual ~OSBrecGrammar() { }};struct OSBrecData {public:  void Clear();  // Release all existing grammars.  void AddGrammar(OSBrecGrammar *);  // Add a new grammar.  The OSBrecData assumes ownership of the grammar.  void FreeGrammar(OSBrecGrammar *);  // Removed an exising grammar.  The corresponding grammar is destroyed.  OSBrecGrammar * FindGrammarForPhrase(const VXIchar* best,				       const VXIchar** val);  // Returns a grammar pointer and return value for an enabled grammar  // containing this phrase.  Otherwise, no grammar matches and NULL is  // returned.  OSBrecGrammar * CreateWordListFromString(const VXIchar* str) const;  // Returns a grammar pointer from a string, which may be JSGF. On failure  // NULL is returned.  VXIlogResult Error(VXIunsigned errorID, const VXIchar *format, ...) const;  VXIlogResult Diag(VXIunsigned tag, const VXIchar *subtag,		    const VXIchar *format, ...) const;  OSBrecData(VXIunsigned diagLogBase, VXIlogInterface *log);  virtual ~OSBrecData();private:  void GrammarGetNextToken(const vxistring & grammar,			   vxistring::size_type pos,			   vxistring::size_type end,			   vxistring & token) const;  bool GrammarConvertJSGFString(const vxistring & language,				const vxistring & incoming,				OSBrecWordList * gp) const;    private:  VXIunsigned diagLogBase;  VXIlogInterface *log;  typedef std::list<OSBrecGrammar *> GRAMMARS;  GRAMMARS grammars;};#endif /* include guard */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -