	private String convert_hyp_2_string(int sent_id, DerivationState cur, ArrayList<FeatureFunction> l_models, String str_hyp_numeric, 
			boolean extract_nbest_tree, boolean add_combined_score, double[] model_cost){
		String[] tem = str_hyp_numeric.split("\\s+");
		StringBuffer str_hyp =new StringBuffer();
		if(sent_id>=0){
			str_hyp.append(sent_id);
			str_hyp.append(" ||| ");
		}
		for(int t=0; t<tem.length; t++){
			tem[t] = tem[t].trim();
			if(extract_nbest_tree==true && ( tem[t].startsWith("(") || tem[t].endsWith(")"))){
				if(tem[t].startsWith("(")==true){
					String tag = this.p_symbolTable.getWord(new Integer(tem[t].substring(1)));
					str_hyp.append("(");
					str_hyp.append(tag);
				}else{
					int first_bracket_pos = tem[t].indexOf(")");
					String tag = this.p_symbolTable.getWord(new Integer(tem[t].substring(0,first_bracket_pos)));
					str_hyp.append(tag);
					str_hyp.append(tem[t].substring(first_bracket_pos));
				}
			}else{
				str_hyp.append(this.p_symbolTable.getWord(new Integer(tem[t])));
			}
			if(t<tem.length-1)
				str_hyp.append(" ");
		}
		if(model_cost!=null){
			str_hyp.append(" |||");
			double tem_sum=0.0;
			for(int k=0; k<model_cost.length; k++){				
				str_hyp.append(String.format(" %.3f", -model_cost[k]));
				tem_sum += model_cost[k]*l_models.get(k).getWeight();
			}
			if (performSanityCheck) {
				if (Math.abs(cur.cost - tem_sum) > 1e-2) {
					System.out.println("In nbest extraction, Cost does not match; cur.cost: " + cur.cost + "; temsum: " +tem_sum);
					for (int k = 0; k < model_cost.length; k++) {
						System.out.println("model weight: " + l_models.get(k).getWeight() + "; cost: " +model_cost[k]);
					}
					System.exit(1);
				}
			}
		}
		if(add_combined_score==true)			
			str_hyp.append(String.format(" ||| %.3f",-cur.cost));
		System.err.println(str_hyp.toString());
		return str_hyp.toString();
	}

	private String convert_hyp_2_string(int sent_id, DerivationState cur, ArrayList<FeatureFunction> l_models, String str_hyp_numeric, 
			boolean extract_nbest_tree, boolean add_combined_score, double[] model_cost){
		String[] tem = str_hyp_numeric.split("\\s+");
		StringBuffer str_hyp =new StringBuffer();
		if(sent_id>=0){
			str_hyp.append(sent_id);
			str_hyp.append(" ||| ");
		}
		for(int t=0; t<tem.length; t++){
			tem[t] = tem[t].trim();
			if(extract_nbest_tree==true && ( tem[t].startsWith("(") || tem[t].endsWith(")"))){
				if(tem[t].startsWith("(")==true){
					String tag = this.p_symbolTable.getWord(new Integer(tem[t].substring(1)));
					str_hyp.append("(");
					str_hyp.append(tag);
				}else{
					int first_bracket_pos = tem[t].indexOf(")");
					String tag = this.p_symbolTable.getWord(new Integer(tem[t].substring(0,first_bracket_pos)));
					str_hyp.append(tag);
					str_hyp.append(tem[t].substring(first_bracket_pos));
				}
			}else{
				str_hyp.append(this.p_symbolTable.getWord(new Integer(tem[t])));
			}
			if(t<tem.length-1)
				str_hyp.append(" ");
		}
		if(model_cost!=null){
			str_hyp.append(" |||");
			double tem_sum=0.0;
			for(int k=0; k<model_cost.length; k++){				
				str_hyp.append(String.format(" %.3f", -model_cost[k]));
				tem_sum += model_cost[k]*l_models.get(k).getWeight();
			}
			if (performSanityCheck) {
				if (Math.abs(cur.cost - tem_sum) > 1e-2) {
					System.out.println("In nbest extraction, Cost does not match; cur.cost: " + cur.cost + "; temsum: " +tem_sum);
					for (int k = 0; k < model_cost.length; k++) {
						System.out.println("model weight: " + l_models.get(k).getWeight() + "; cost: " +model_cost[k]);
					}
					System.exit(1);
				}
			}
		}
		if(add_combined_score==true)			
			str_hyp.append(String.format(" ||| %.3f",-cur.cost));
		return str_hyp.toString();
	}
