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

📄 hierarchicalsearch.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 2 页
字号:
// file: $isip/class/search/HierarchicalSearch/HierarchicalSearch.h// version: $Id: HierarchicalSearch.h,v 1.63 2003/04/03 05:04:07 alphonso Exp $//// make sure definitions are only made once//#ifndef ISIP_HIERARCHICAL_SEARCH#define ISIP_HIERARCHICAL_SEARCH// isip include files://#ifndef ISIP_FRONT_END#include <FrontEnd.h>#endif#ifndef ISIP_VECTOR_FLOAT#include <VectorFloat.h>#endif#ifndef ISIP_STACK#include <Stack.h>#endif#ifndef ISIP_QUEUE#include <Queue.h>#endif#ifndef ISIP_TRACE#include <Trace.h>#endif#ifndef ISIP_INSTANCE#include <Instance.h>#endif#ifndef ISIP_CONTEXT_POOL#include <ContextPool.h>#endif#ifndef ISIP_HISTORY_POOL#include <HistoryPool.h>#endif#ifndef ISIP_HASH_KEY#include <HashKey.h>#endif#ifndef ISIP_SEARCH_LEVEL#include <SearchLevel.h>#endif#ifndef ISIP_SEARCH_NODE#include <SearchNode.h>#endif#ifndef ISIP_BI_GRAPH#include <BiGraph.h>#endif#ifndef NGRAM_CACHE#include <NGramCache.h>#endif// HierarchicalSearch:	A hierarchical, synchronous, Viterbi search engine.//// The basic premise behind this is as follows:// //      1) The search space is hierarchical in that each level has nodes and//         each node is either:// 	   a) composed of a sub-graph + probability evaluation// 	   b) composed of probability evaluation.// //      2) At each level you will be able to do the following: // 	   a) beam prune// 	   b) instance prune// 	   c) generate context-dependent scoring models on the fly including//            cross-symbol models// 	   d) specify whether search information is to be maintained -//            otherwise we can prune away redundant information. For instance,//            once a word is completed, it is no longer necessary to maintain//            the sub-word units that correspond to that word.// 	   e) turn on/off sub-level evaluation////      3) Each graph position will be capable of the following: // 	   a) generate a probability of being in that graph position given the // 	      input stream. For acoustic models, this will involve direct // 	      evaluation of the data stream. For levels like language models,//            this will not involve manipulation of the data stream at all.//            Any level can access the data stream as it will be passed from//            the highest level all the way down to the lowest via pointer//            reference.// 	   b) store the overlapping paths in the sub-graph as a "lexical" tree.// 	   c) use N-symbol models related to the possible entries on that level////      4) We will revolve around the concept of a "trace" where the // 	   trace moves through the graph and keeps track of the paths/scores//         through the search space// class HierarchicalSearch {    //---------------------------------------------------------------------------  //  // public constants  //  //---------------------------------------------------------------------------public:  // define the class name  //  static const String CLASS_NAME;  //----------------------------------------  //  // i/o related constants  //  //----------------------------------------    static const String DEF_PARAM;    //----------------------------------------  //  // other important constants  //  //----------------------------------------    // define the search mode choices  //  enum SEARCH_MODE { DECODE = 0, TRAIN, DEF_SEARCH_MODE = DECODE };  // define the start frame index  //  static const llong DEF_START_FRAME = -1;  static const long DEF_CONTEXT_LEVEL = 0;  static const boolean DEF_CONTEXT_MODE = false;    //----------------------------------------  //  // default values and arguments  //  //----------------------------------------    // default values  //  static const long DEF_NUM_LEVELS = 1;  static const long DEF_CAPACITY = 12000;    // default arguments to methods  //  static const long DEF_NUM_FRAMES = -1;  static const long DEF_INITIAL_LEVEL = 0;  static const long ALL_LEVELS = -1;    //---------------------------------------  //  // error codes  //  //---------------------------------------  static const long ERR = (long)90700;  static const long ERR_LEVEL = (long)90701;    //---------------------------------------------------------------------------  //  // protected data  //  //---------------------------------------------------------------------------protected:  // define a search mode flag  //  SEARCH_MODE search_mode_d;  // current frame's feature vector  //  VectorFloat features_d;    // the search levels, sub-graphs are maintained at each SearchLevel   //  Vector<SearchLevel> search_levels_d;  // initial search level  //  Long initial_level_d;    // current frame in the search  //  Long current_frame_d;  // the lexical tree list  //  SingleLinkedList<LexicalTree> lex_tree_list_d;  // current maximal trace scores  //  Vector<Float> max_trace_scores_d;  // current maximal instance scores  //  Vector<Float> max_instance_scores_d;    // n-symbol probability lookup variables  //  NGramCache nsymbol_cache_d;  Vector<Long> nsymbol_indices_d;  // lists to keep track of instances during the search  //  Vector<DoubleLinkedList<Instance> > instance_lists_d;  DoubleLinkedList<Instance> instance_valid_hyps_d;    // lists to keep track of traces during the search  //  Vector<DoubleLinkedList<Trace> > trace_lists_d;  DoubleLinkedList<Trace> trace_valid_hyps_d;  // define a bi-graph structure that stores the entire search path  //  BiGraph<TrainNode> trellis_d;  // define a mapping from the hypothesis path to the vertices  //  HashTable<HashKey<Instance>, BiGraphVertex<TrainNode> > instance_mapping_d;  // define the context generation level  //  Long context_level_d;  boolean context_generation_mode_d;    // define the context generation list  //  Vector<String> context_list_d;    HashTable<String, Ulong> context_hash_d;  // history and context pools  //  HistoryPool history_pool_d;  ContextPool context_pool_d;    // define a static debug level  //  static Integral::DEBUG debug_level_d;  // define a static memory manager  //  static MemoryManager mgr_d;    //---------------------------------------------------------------------------  //  // required public methods  //  //---------------------------------------------------------------------------public:  // method: name  //  static const String& name() {    return CLASS_NAME;  }  static boolean diagnose(Integral::DEBUG debug_level);    // debug methods:  //  the setDebug method for this class is static because the debug_level is  //  shared across all objects of this class  //  boolean debug(const unichar* message) const;  // method: setDebug  //  static boolean setDebug(Integral::DEBUG debug_level) {    debug_level_d = debug_level;    return true;  }  // destructor/constructor(s)  //  ~HierarchicalSearch();  HierarchicalSearch();  HierarchicalSearch(const HierarchicalSearch& copy_search);    // method: assign  //  boolean assign(const HierarchicalSearch& copy_search) {    return Error::handle(name(), L"assign", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }  // method: sofSize  //  long sofSize() const {    return Error::handle(name(), L"sofSize", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }    // method: read  //  boolean read(Sof& sof, long tag, const String& cname = CLASS_NAME) {    return Error::handle(name(), L"read", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }  // method: write  //  boolean write(Sof& sof, long tag, const String& cname = CLASS_NAME) const {    return Error::handle(name(), L"write", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }  // method: readData  //  boolean readData(Sof& sof, const String& pname = DEF_PARAM,		   long size = SofParser::FULL_OBJECT, boolean param = true,                   boolean nested = false) {    return Error::handle(name(), L"readData", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }  // method: writeData  //  boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const {    return Error::handle(name(), L"writeData", Error::NOT_IMPLEM, __FILE__,			 __LINE__);  }  // method: eq  //  boolean eq(const HierarchicalSearch& compare_search) const {    return search_levels_d.eq(compare_search.search_levels_d);  }    // method: new  //  static void* operator new(size_t size) {    return mgr_d.get();  }  // method: new[]  //  static void* operator new[](size_t size) {    return mgr_d.getBlock(size);  }  // method: delete  //  static void operator delete(void* ptr) {    mgr_d.release(ptr);  }  // method: delete[]  //  static void operator delete[](void* ptr) {    mgr_d.releaseBlock(ptr);  }  // method: setGrowSize  //  static boolean setGrowSize(long grow_size) {    return mgr_d.setGrow(grow_size);  }  // clear method  //  boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);  //---------------------------------------------------------------------------  //  // class-specific public methods  //  //---------------------------------------------------------------------------  // method: setSearchMode  //  boolean setSearchMode(SEARCH_MODE arg) {    search_mode_d = arg;    return true;  }  // method: getSearchMode  //  SEARCH_MODE getSearchMode() {    return search_mode_d;  }

⌨️ 快捷键说明

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