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

📄 isip_network_converter.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
📖 第 1 页 / 共 4 页
字号:
       line.tokenize(values(i), pos, DELIMITER_CHAR);     }          // put the data into the hash table     //     hash_table_a.insert(values(0), &values(1));            // debug information     //     if (debug_level >= Integral::BRIEF) {       //if ( true ) {       Console::put(line);     }         }  }  // close the input file  //  input_file.close();  // exit gracefully  //  return true;  }// method: readSMSymbols//// arguments://  SearchLevel&: (output) construct the search level//  HashTable<String, String>&: (intput) the hash table which stored data//  String& prefix_a: (output) the pefix//// return: boolean value indicating status//// this method reads symbols with statistical model//boolean readSMSymbols(Vector<SearchSymbol>& sm_symbols_a,		      HashTable<String, String>& hash_table_a,		      String& prefix_a) {  // local variable  //  String hash_key;  String symbol_prefix;  // find the number of symbols in SM symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_SM_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_SM_SYMBOL);  readSymbols(sm_symbols_a,	      hash_table_a, hash_key, symbol_prefix);  // exit gracefully  //  return true;  }// method: readSearchLevel//// arguments://  SearchLevel&: (output) construct the search level//  HashTable<String, String>&: (intput) the hash table which stored data//  String& prefix_a: (output) the pefix//// return: boolean value indicating status//// this method reads the data into a SearchLevel//boolean readSearchLevel(SearchLevel& search_level_a,			HashTable<String, String>& hash_table_a,			String& prefix_a) {  // local variable  //  String hash_key;  // set the name for this level  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_NAME);  String level_tag;  level_tag.assign(*hash_table_a.get(hash_key));  // debug information  //  if (debug_level >= Integral::BRIEF) {    level_tag.debug(L"level_tag");  }	  search_level_a.setLevelTag(level_tag);    // set symbol table and all other symbols  // including : non_speech, exclude_symbols,  //  // find the number of symbols in the symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_SYMBOL_SIZE);  String symbol_prefix;  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_SYMBOL);  readSymbols(search_level_a.getSymbolTable(),	      hash_table_a, hash_key, symbol_prefix);  // find the number of symbols in the context symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_CONTEXT_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_CONTEXT);  Vector<SearchSymbol> context_symbols;  readSymbols(context_symbols, 	      hash_table_a, hash_key, symbol_prefix);  convertContextMapping(context_symbols,			search_level_a.getContextMap());  // find the number of symbols in the non-speech symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_NON_SPEECH_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_NON_SPEECH_SYMBOL);  readSymbols(search_level_a.getNonSpeechSymbolTable(),	      hash_table_a, hash_key, symbol_prefix);  // find the number of symbols in the context-less symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_CONTEXTLESS_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_CONTEXTLESS_SYMBOL);  readSymbols(search_level_a.getContextLessSymbolTable(),	      hash_table_a, hash_key, symbol_prefix);    // find the number of symbols in the dummy symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_DUMMY_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_DUMMY_SYMBOL);  readSymbols(search_level_a.getDummySymbolTable(),	      hash_table_a, hash_key, symbol_prefix);    // find the number of symbols in the skip symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_SKIP_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_SKIP_SYMBOL);  readSymbols(search_level_a.getSkipSymbolTable(),	      hash_table_a, hash_key, symbol_prefix);    // find the number of symbols in the exclude symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_EXCLUDE_SYMBOL_SIZE);  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_LEVEL_EXCLUDE_SYMBOL);  readSymbols(search_level_a.getExcludeSymbolTable(),	      hash_table_a, hash_key, symbol_prefix);    // find the number of graphs  //  long num_of_graphs = 0;  hash_key.assign(prefix_a);  hash_key.concat(IO_LEVEL_GRAPH_SIZE);    hash_table_a.get(hash_key)->get(num_of_graphs);  Long graph_num(num_of_graphs);  //graph_num.debug(L"graph_num");    // set the number of graphs  //  if ( num_of_graphs > 0 ){    search_level_a.setNumSubGraphs(num_of_graphs);  }    // read graphs for a paticular level  //  for (long j = 0; j < num_of_graphs; j++){   // set the prefix   //   String curr_graph;   curr_graph.assign((long)j);      String graph_prefix;   graph_prefix.assign(prefix_a);   graph_prefix.concat(IO_DIGRAPH_PREFIX);   graph_prefix.concat(curr_graph);   // read the graph   //   readSubGraph(search_level_a, search_level_a.getSubGraph(j),		hash_table_a, graph_prefix);  }    // exit gracefully  //  return true;  }// method: readSubGraph//// arguments://  DiGraph<SearchNode>&: (output) construct this DiGraph//  HashTable<String, String>&: (intput) the hash table which holds the data//  String& prefix_a: (input) the prefix//// return: boolean value indicating status//// this method reads the data into a DiGraph<SearchNode>//boolean readSubGraph(SearchLevel& search_level_a,		     DiGraph<SearchNode>& sub_graph_a,		     HashTable<String, String>& hash_table_a,		     String& prefix_a) {  // local variable  //  String hash_key;  SingleLinkedList<SingleLinkedList<GraphVertex<SearchNode> > >    vertices_list(DstrBase::SYSTEM);  // debug infor  //  //prefix_a.debug(L"subgraph: ");  // get the number of vertices  //  hash_key.assign(prefix_a);  hash_key.concat(IO_DIGRAPH_VERTEX_SIZE);  long num_of_vertices = 0;  hash_table_a.get(hash_key)->get(num_of_vertices);  // get the number of arcs  //  hash_key.assign(prefix_a);  hash_key.concat(IO_DIGRAPH_ARC_SIZE);  long num_of_arcs = 0;  hash_table_a.get(hash_key)->get(num_of_arcs);  // debug information  //  Long arcs_num(num_of_arcs);  //arcs_num.debug(L"arcs_num");  // read graphs for a paticular level  //  for (long i = 0; i < num_of_vertices; i++){   // set the prefix   //   String curr_vertex;   curr_vertex.assign((long)i);      String vertex_prefix;   vertex_prefix.assign(prefix_a);   vertex_prefix.concat(IO_VERTEX_PREFIX);   vertex_prefix.concat(curr_vertex);   // create a new list to hold a list of vertices   //   SingleLinkedList<GraphVertex<SearchNode> >* vertices_on_node =     new SingleLinkedList<GraphVertex<SearchNode> >(DstrBase::USER);      // read the vertex   //   readVertices(search_level_a, sub_graph_a,		*vertices_on_node, hash_table_a, vertex_prefix);   vertices_list.insert(vertices_on_node);     }  // read graphs for a paticular level  //  for (long j = 0; j < num_of_arcs; j++){   // set the prefix   //   String curr_arc;   curr_arc.assign((long)j);      String arc_prefix;   arc_prefix.assign(prefix_a);   arc_prefix.concat(IO_ARC_PREFIX);   arc_prefix.concat(curr_arc);   // read the arcs   //   readArcs(sub_graph_a, vertices_list, hash_table_a, arc_prefix);  }  // exit gracefully  //  return true;  }// method: readVertices//// arguments://  DiGraph<SearchNode>&: (output) construct this DiGraph//  SingleLinkedList<GraphVertex<SearchNode>>& vertices_list_a://                  (input) hold the pointers of Vertices//  HashTable<String, String>&: (intput) the hash table which holds the data//  String& prefix_a: (input) the prefix//// return: boolean value indicating status//// this method reads the data into a DiGraph and store pointers of Vertices//boolean readVertices(SearchLevel& search_level_a,		     DiGraph<SearchNode>& sub_graph_a,		     SingleLinkedList<GraphVertex<SearchNode> > &		     vertices_list_a,		     HashTable<String, String>& hash_table_a,		     String& prefix_a) {  // local variable  //  String hash_key;  Vector<SearchSymbol> symbol_list;  GraphVertex<SearchNode>* curr_vert = NULL;  // debug infor  //  //prefix_a.debug(L"vertex: ");  // read the type of the node  //  hash_key.assign(prefix_a);  hash_key.concat(IO_VERTEX_TYPE);  long vertex_type = 0;  hash_table_a.get(hash_key)->get(vertex_type);  // branch on the vertex type  //  switch ( vertex_type ){  case START_VERTEX:    curr_vert = sub_graph_a.getStart();    vertices_list_a.insert(curr_vert);      return true;      case TERM_VERTEX:    curr_vert = sub_graph_a.getTerm();    vertices_list_a.insert(curr_vert);      return true;  case NODE_VERTEX:    break;  default:    return Error::handle(L"readVertices", L"vertex type",			 Error::ARG, __FILE__, __LINE__);      }    // find the number of symbols in the symbol table  //  hash_key.assign(prefix_a);  hash_key.concat(IO_VERTEX_SYMBOL_SIZE);  String symbol_prefix;  symbol_prefix.assign(prefix_a);  symbol_prefix.concat(IO_VERTEX_SYMBOL);  readSymbols(symbol_list, hash_table_a, hash_key, symbol_prefix);  // set the search nodes for the graph  //  for ( int i = 0; i < symbol_list.length(); i++ ){    // create a new search node    //    SearchNode* curr_node = new SearchNode();    curr_node->setSearchLevel(&search_level_a);    long symbol_index = search_level_a.getSymbolIndex(symbol_list(i));    // check if this index is in the range of symbols    //    if (symbol_index < 0 ) {      Long index(symbol_index);      index.debug(L"symbol_index");      symbol_list(i).debug(L"symbol_list(i)");      symbol_list.debug(L"symbol_list");      return Error::handle(L"readVertices", L"invalid symbol index",			   Error::ARG, __FILE__, __LINE__);    }    curr_node->setSymbolId(symbol_index);    curr_vert = sub_graph_a.insertVertex(curr_node);    vertices_list_a.insert(curr_vert);    }  // debug infor  //  //prefix_a.debug(L"vertex: ");  // exit gracefully  //  return true;  }// method: readArcs//// arguments://  DiGraph<SearchNode>&: (output) construct this DiGraph//  SingleLinkedList<GraphVertex<SearchNode>>& vertices_list_a://                  (output) hold the pointers to vertices//  HashTable<String, String>&: (intput) the hash table which holds the data//  String& prefix_a: (input) the prefix//// return: boolean value indicating status//// this method reads the data into a DiGraph and store pointers of vertices//boolean readArcs(DiGraph<SearchNode>& sub_graph_a,		 SingleLinkedList<SingleLinkedList<GraphVertex<SearchNode> > >&		 vertices_list_a,		 HashTable<String, String>& hash_table_a,		 String& prefix_a) {      // local variable  //  String hash_key;  // debug infor  //  //prefix_a.debug(L"arc: ");  // find the from_id  //  long from_id;  hash_key.assign(prefix_a);  hash_key.concat(IO_ARC_FROM_ID);  hash_table_a.get(hash_key)->get(from_id);  // find the from_id  //  long to_id;  hash_key.assign(prefix_a);  hash_key.concat(IO_ARC_TO_ID);  hash_table_a.get(hash_key)->get(to_id);  // get the epsilon flag  //  boolean is_epsilon;  hash_key.assign(prefix_a);  hash_key.concat(IO_ARC_EPSILON);  hash_table_a.get(hash_key)->get(is_epsilon);  // get the transition  //  float weight;  hash_key.assign(prefix_a);  hash_key.concat(IO_ARC_WEIGHTS);  hash_table_a.get(hash_key)->get(weight);    // get number of vertex in the from node  //  long num_of_from_vertices = vertices_list_a(from_id).length();  // get number of vertex in the to node  //  long num_of_to_vertices = vertices_list_a(to_id).length();  // set the weights  //  if ( ! is_epsilon ){

⌨️ 快捷键说明

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