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

📄 lm_11.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
📖 第 1 页 / 共 3 页
字号:
  rule_weight.assign(100000);   triple.assign(start, rule_vertex_list, rule_weight);  close_list.concat(triple);  long exten_index = 0;    // loop through all rules  //  boolean more_rules = open_list.gotoFirst();  while(more_rules) {    // debug message    //    debug_string.assign(L"debug 2");    debug_string.debug(L"point");      // getting current rule name;    //    String temp_string;    String* rulename = &temp_string;    //String* rulename = NULL;    open_list.remove(rulename);        if(rulename->eq(L"ISIP_JSGF_1_0_START")) {      rule.concat(L" <");      rule.concat(grammar_name_a);        rule.concat(L"> = ");    }    else if(rulename->eq(L"ISIP_JSGF_1_0_TERM")) {      more_rules = open_list.gotoFirst();       // debug message      //      debug_string.assign(L"debug 3");      debug_string.debug(L"point");        continue;    }    else {      rule.concat(L" <");      rule.concat(*rulename);        rule.concat(L"> = ");    }    long i_index = 0;    for(long i = 0; i < close_list.length(); i++) {      if(rulename->eq(close_list(i).first())) {	 rule_vertex_list = close_list(i).second();	 i_index = i;	 break;      }    }    rule_weight = close_list(i_index).third();    int more_vertex = 0;    SearchSymbol tmp_sym;    SearchSymbol sym;    //GraphVertex<SearchNode>* curr_vert = new GraphVertex<SearchNode>();    GraphVertex<SearchNode>* curr_vert = (GraphVertex<SearchNode>*) NULL;        // debug message    //    debug_string.assign(L"debug 5");    debug_string.debug(L"point");      // loop through all vertices created by JSGF rule    //    for(boolean more_vertices = rule_vertex_list.gotoFirst();	more_vertices; more_vertices = rule_vertex_list.gotoNext()) {          // getting current vertex       //      Long * curr_vert_index = rule_vertex_list.getCurr();      curr_vert = verts[(long)*curr_vert_index];           if (curr_vert->getItem() == &DiGraph<SearchNode>::START_OBJ) {	sym.assign(L"<ISIP_JSGF_1_0_START>");      }      else if (curr_vert->getItem() == &DiGraph<SearchNode>::TERM_OBJ) {	// debug message	//	debug_string.assign(L"debug 6");	debug_string.debug(L"point");  	continue;      }      else {	if(more_vertex==0) {	  curr_vert->getItem()->getSymbol(sym);	  tmp_sym.concat(sym);	  more_vertex++;	}	else {	  tmp_sym.concat(L" | ");	  curr_vert->getItem()->getSymbol(sym);	  tmp_sym.concat(sym);	  more_vertex++;	}      }            // debug message      //      debug_string.assign(L"debug 7");      debug_string.debug(L"point");            }// end for(more_vertices)        if (more_vertex <= 1)           rule.concat(sym);    else {      rule.concat(L"( ");      rule.concat(tmp_sym);      rule.concat(L" )");    }    rule.concat(L" (");    int is_alternative = 0;        if((float)rule_weight <= 0) {      // the rule is self loop      //      String tmp_weight;      tmp_weight.assign(rule_weight);            // add weight to the rule line      //      rule.concat(L" /");      rule.concat(tmp_weight);      rule.concat(L"/ ");      rule.concat(L"<");      rule.concat(*rulename);      rule.concat(L">");      is_alternative++;    }    SingleLinkedList<GraphArc<SearchNode> >subgroup_list;    Vector<String> other_rules;        // loop through all the available arcs starting from the current vertex    //    for (boolean more_paths = curr_vert->gotoFirst(); more_paths;	 more_paths = curr_vert->gotoNext()) {      // debug message      //      debug_string.assign(L"debug 8");      debug_string.debug(L"point");              // get the next vertex and its weight      //      GraphArc<SearchNode>* tmp_arc = curr_vert->getCurr();      GraphVertex<SearchNode>* next_vert = tmp_arc->getVertex();      boolean selfrule = false;      boolean otherrule = false;      String tmp_name;            for(long i = 0; i < close_list.length(); i++) {	SingleLinkedList<Long> vertex_list = close_list(i).second();	boolean is_equal_vertex = false;      // debug message      //      debug_string.assign(L"debug 9");      debug_string.debug(L"point");        	for(boolean more_vertices = vertex_list.gotoFirst();	    more_vertices; more_vertices = vertex_list.gotoNext()) {      // debug message      //      debug_string.assign(L"debug 10");      debug_string.debug(L"point");        	  Long * tmp_vert_index = vertex_list.getCurr();	  GraphVertex<SearchNode>* tmp_vert = verts[(long)*tmp_vert_index];	  if (next_vert->eq(*tmp_vert) && next_vert->compareVertices(*tmp_vert)) {	    is_equal_vertex = true;	    break;	  }	}	if (is_equal_vertex) {	  tmp_name = close_list(i).first();	  if (tmp_name.eq(*rulename)) {	     	    selfrule = true;	    break;	  }	  else {	    otherrule = true;	    break;	  }	}      }//end for(long i =0)            if (selfrule) {		// do nothing	//	      }      else if (otherrule) {	boolean done_other_rules = false;	for( long r_index = 0; r_index < other_rules.length(); r_index++) {	  if(tmp_name.eq(other_rules(r_index))) {	    done_other_rules = true;	  }	}	if(done_other_rules) {	  //do nothing	  //	}	else {  	  float weight = tmp_arc->getWeight();	  if(is_alternative == 0) {	    is_alternative++;	  }	  else {	    rule.concat(L" | ");	  }	  	  // add weight to the rule line	  //	  rule.concat(L" /");	  rule.concat(weight);	  rule.concat(L"/ ");	  rule.concat(L" <");	  rule.concat(tmp_name);	  rule.concat(L"> ");	  other_rules.concat(tmp_name);	}      }      else {	// added to singlinkedlist to get new subgroup	//	subgroup_list.insert(tmp_arc);      }	      }// for(more paths)    // getting subgroup    //    Vector<SingleLinkedList<GraphArc<SearchNode> > >subgroup_table;    getSubgroup(subgroup_list, subgroup_table, verts, num_vertices);        // write subgroup information to open_list and close_list    //    for(long k = 0; k < subgroup_table.length(); k++) {            SingleLinkedList<GraphArc<SearchNode> > new_group;      new_group = subgroup_table(k);      new_group.gotoFirst();                  // getting current rule name;      //      GraphArc<SearchNode>* current_arc;      current_arc = new_group.getCurr();      GraphVertex<SearchNode>* current_vert = current_arc->getVertex();      float weight = current_arc->getWeight();            boolean is_loop_extension = false;      Float self_weight = 100000;            // debug message      //      debug_string.assign(L"debug 11");      debug_string.debug(L"point");              // loop through all the available arcs starting from the current vertex      //      for (boolean more_paths = current_vert->gotoFirst(); more_paths;	   more_paths = curr_vert->gotoNext()) {	      // debug message      //      debug_string.assign(L"debug 12");      debug_string.debug(L"point");        	// get the next vertex and its weight	//	GraphArc<SearchNode>* tmp_arc = current_vert->getCurr();	GraphVertex<SearchNode>* next_vert = tmp_arc->getVertex();	if(current_vert->eq(*next_vert)) {	  is_loop_extension = true;	  self_weight = tmp_arc->getWeight();	  break;	}      }            // get rule extension      //      if(is_alternative == 0) {	is_alternative++;      }      else {	rule.concat(L" | ");      }            String exten;      String extension_name;            // add extension to the rule line      //      if(current_vert->getItem() == &DiGraph<SearchNode>::TERM_OBJ) {	exten.concat(L" <ISIP_JSGF_1_0_TERM>");	extension_name.concat(L"ISIP_JSGF_1_0_TERM");      }      else {			exten.concat(L" <extension");	exten.concat(exten_index);	exten.concat(L">");	extension_name.concat(L"extension");	extension_name.concat(exten_index);	exten_index++;      }                  // add weight to the rule line      //      rule.concat(L" /");      rule.concat(weight);      rule.concat(L"/ ");	      rule.concat(exten);      open_list.insert(&extension_name);      SingleLinkedList<Long> vertex_list;      // loop through all the available arcs starting from the current vertex      //      for (boolean more_paths = new_group.gotoFirst(); more_paths;	   more_paths = new_group.gotoNext()) {      // debug message      //      debug_string.assign(L"debug 13");      debug_string.debug(L"point");        	// get the next vertex and its weight	//	GraphArc<SearchNode>* tmp_arc = new_group.getCurr();	GraphVertex<SearchNode>* next_vert = tmp_arc->getVertex();	Long index;	for (long j = 0; j < num_vertices; j++) {	  if ( next_vert == verts[j]) {	    index = j;	    break;	  }	}	vertex_list.insert(&index);      }	      // store runle_extension information into close_list and open_list      //      Triple<String, SingleLinkedList<Long>, Float > triple;                triple.assign(extension_name, vertex_list, self_weight);      close_list.concat(triple);  	    }           rule.concat(L" ) ");     rule.concat(L";\n");    more_rules = open_list.gotoFirst();       }// end for(more_rules)    JSGF_output.concat(rule);  // return the JSGF grammar string  //  return JSGF_output;}// method: getSubgroup//// arguments:SingleLinkedList<GraphArc<SearchNode> > & subgroup_list_a: (input)//  a list of GraphArc //  Queue<SingleLinkedList<GraphArc<SearchNode> > > &subgroup_table_a: (output)//  a Vector containing subgroup based on weights and connection relationship//  GraphVertex<SearchNode>** verts_a; (input) an array of GraphVertex storing//  information of graph//  long num_vertices_a; (input) number of vertex of the graph// return: a boolean value indicating status//// This method takes a GraphArc list as input and based on weights and// connection relationship in the graph, group GraoupArc to form new subgroup//   boolean LanguageModel::getSubgroup(SingleLinkedList<GraphArc<SearchNode> >				   subgroup_list_a, Vector<SingleLinkedList<GraphArc<SearchNode> > >& subgroup_table_a, GraphVertex<SearchNode>* verts_a[],				   long num_vertices_a){  // debug message  //  String debug_string;    // loop through all GraphArcs  //  for(boolean more_arcs = subgroup_list_a.gotoFirst();      more_arcs; more_arcs = subgroup_list_a.gotoNext()) {

⌨️ 快捷键说明

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