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

📄 pdt_07.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
📖 第 1 页 / 共 2 页
字号:
  }    // read the question and answers from an sof file  //  ques_ans.read(input_sof, long(0));  // close the input questions and answers file  //  input_sof.close();  // compute the length of the context  //  long context_len = (long)1 + left_context_a + right_context_a;  // create all possible context-symbols of given length using the  // upper_symbol_table  //  Vector<ContextMap> all_context_map;  createContexts(upper_symbol_table_a, context_len, all_context_map);    // remove all the contexts that are not allowed  //  Vector<ContextMap> valid_context_map;  validateContexts(upper_contextless_symbol_table_a,		   all_context_map, valid_context_map);  // get the contexts that do not exist in the input context-maps  //  Vector<ContextMap> unseen_context_map;  getUnseenContexts(context_map_a, valid_context_map, unseen_context_map);    // create the new context-map, lower-level subgraphs, symbol-table  //  updateLowerLevel(context_map_a, unseen_context_map, sub_graphs_a,		   symbol_table_a, symbol_hash_a);  // add the central-phone and state indices as the first two  // attributes. note that the PhoneticDecisionTree is first split  // using the central-symbol (phone) attribute, then using the  // symbol-position (state) and then recursively using the phonetic  // questions. this way we have n*m number of sub-trees.  //  Attribute temp_attribute;  String temp_cph;  temp_cph.assign(CPH);  String temp_pos;  temp_pos.assign(POS);  SingleLinkedList<String> temp_all_cph;  SingleLinkedList<String> temp_all_pos;      // get central phones that have context, don't include the last two  // symbols since NO_LEFT_CONTEXT and NO_RIGHT_CONTEXT  //  for (long k = 0; k < upper_symbol_table_a.length(); k++) {    // local variables    //    String temp_symbol;    boolean include = true;    temp_symbol.assign(upper_symbol_table_a(k));    // don't include the contextless symbols    //    for (long kk = 0; kk < upper_contextless_symbol_table_a.length(); kk++) {            if (temp_symbol.eq(upper_contextless_symbol_table_a(kk))) {	include = false;      }    }          // don't include NO_LEFT_CONTEXT and NO_RIGHT_CONTEXT    //    if ((temp_symbol.eq(SearchSymbol::NO_LEFT_CONTEXT)) ||	(temp_symbol.eq(SearchSymbol::NO_RIGHT_CONTEXT))) {      include = false;    }    // include only necessary symbols    //    if (include) {      temp_all_cph.insert(&temp_symbol);    }  }    for (long l = 0; l < context_len; l++) {    String temp_pos;    temp_pos.assign(l);    temp_all_pos.insert(&temp_pos);  }    temp_attribute.assign(temp_cph, temp_all_cph);  attributes_d.insert(&temp_attribute);  temp_attribute.assign(temp_pos, temp_all_pos);  attributes_d.insert(&temp_attribute);    // get all possible answers for phonetic-decision-trees  //  SingleLinkedList<String> temp_all_ans;  String tmp_yes;  tmp_yes.assign(YES);  String tmp_no;  tmp_no.assign(NO);  temp_all_ans.insert(&tmp_yes);  temp_all_ans.insert(&tmp_no);  // read questions and then answeres seperately that will be used  // later  //  for (long k = 0; k < ques_ans.length(); k++) {    // local variables    //    Long temp_index;    String temp_string;    String temp_ques;    String temp_symbol;    Pair<Long, String> temp_question;    temp_index = ques_ans(k).first();    temp_ques = ques_ans(k).second();    temp_symbol = ques_ans(k).third();        // read the questions only if the question is not already read    // before    //    temp_question.assign(temp_index, temp_ques);        if (!questions.contains(&temp_question)) {      questions.insert(&temp_question);      // add the questions & possible-answers to the attributes_d      //      Attribute temp_attribute;      String temp_question_string;      temp_question_string.assign(temp_index);      temp_question_string.concat(temp_ques);      temp_attribute.assign(temp_question_string, temp_all_ans);      attributes_d.insert(&temp_attribute);    }        // read the answeres variable    //    temp_string.assign(temp_index);    temp_string.concat(temp_ques);    temp_string.concat(temp_symbol);    String temp_yes;    temp_yes.assign(YES);    answers.insert(temp_string, &temp_yes);  }  // loop-over all the unseen context-maps with no central symbol as  // contextless, and tie corresponding statistical-models  //  for (long i = 0; i < unseen_context_map.length(); i++) {        // local variables    //    Vector<SearchSymbol> context;    Ulong context_index;    DiGraph<SearchNode> sub_graph;    SingleLinkedList<SearchNode> snodes;    SingleLinkedList<TopoTriple> sarcs;    HashTable<String, String> attr_value;	      // get the context and the context-index    //    context = unseen_context_map(i).getContext();    context_index = unseen_context_map(i).getContextIndex();    // extract the attributes for this context by looping over all the    // questions    //    for (boolean morea = questions.gotoFirst(); morea;	 morea = questions.gotoNext()) {            // local variables      //      Pair<Long, String>* question;      Long direction;      SearchSymbol symbol;      String question_string;      String extended_question;      String direction_string;      String* answer;      String temp_no;      temp_no.assign(NO);            // get the direction (this also gives the position) from the      // question      //      question = questions.getCurr();      direction = question->first();            // get the search symbol corresponding to the direction and      // position      //      symbol = context((context.length()/2) + direction);            // combine direction(position), question and symbol      //      direction_string.assign(direction);      question_string.concat(direction_string);      question_string.concat(question->second());      extended_question.assign(question_string);      extended_question.concat(symbol);            // get the answer for this extended questions from the answers      // hashtable. if the hashtable contains the key, it has the      // answer. else the answer is NO      //      if (answers.containsKey(extended_question)) {	answer = answers.get(extended_question);      }            else	answer = &temp_no;            // use the question_string and answer to form attribute-value pair      // that is added to the attr_value hashtable      //      attr_value.insert(question_string, answer);    }        // add the central-symbol (central-phone) to the attributes    //    String answer;    SearchSymbol symbol = context((context.length() - 1)/2);    answer.assign(symbol);    attr_value.insert(temp_cph, &answer);        // get the corresponding sub-graph for this context-index    //    sub_graph = sub_graphs_a(context_index);        // loop-over all the SearchNode's in this sub-graph, get the    // symbol id's (states) and then accumulate the statistical-models    // corresponding to the symbols (states)    //    sub_graph.get(snodes, sarcs);        // intialize the position of the symbol (state)    //    long position = (long)0;        for (boolean more = snodes.gotoFirst(); more; more = snodes.gotoNext()) {            // local variables      //      SearchNode* snode;      long symbol_id;      Long* stat_model_index;      StatisticalModel stat_model;      HashTable<String, String> temp_attr_value;      // create a DataPoint that corresponds to the search-symbol at      // this node      //      DataPoint data_point;      StatisticalModel sm;      GaussianModel gm;      MixtureModel mm;      mm.add(gm);      sm.assign(mm);      sm.setOccupancy((Double)0);      // get the SearchNode      //      snode = snodes.getCurr();             // get the symbol id at this search node      //      symbol_id = snode->getSymbolId();            // proceed only if the symbol is not dummy or default,      // I.e. symbol-id is non-negative      //      if(symbol_id >= (long)0) {		// get the index corresponding to this symbol (state)	//	SearchSymbol ss = symbol_table_a(symbol_id);	stat_model_index = symbol_hash_a.get(ss);      	// add the symbol-position (state-position) to the	// attributes, increment the position	//	temp_attr_value.assign(attr_value);	String position_string;	position_string.assign(position);	temp_attr_value.insert(temp_pos, &position_string);	position++;		// get a datapoint by combining statistical-model index,	// statistical-model and the hash-table of attribute-value	//	data_point.assign(*stat_model_index, sm, temp_attr_value);		// get the index for this data-point to which it is tied	//	Long n_index = 0;	n_index = classifyDataPoint(data_point);	// update the index in the symbol hash-table	//	symbol_hash_a.remove(ss);	if (!symbol_hash_a.insert(ss, &n_index)) {	  return Error::handle(name(), L"getStatTest",			       ERR, __FILE__, __LINE__);	}      } // end of if statement    } // end of loop-over of SearchNodes that contain search-symbol id's  } // end of loop-over of unseen context-maps    // exit gracefully  //  return res;}

⌨️ 快捷键说明

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