FeatureFunction ff = new FeatureTemplateBasedFF(featID, weight, modelTbl, this.featTemplates, restrictedFeatureSet);
//==== reranker
List<FeatureFunction> features = new ArrayList<FeatureFunction>();
features.add(ff);
HGRanker reranker = new HGRanker(features);
//==== kbest
boolean addCombinedCost = false;
KBestExtractor kbestExtractor = new KBestExtractor(symbolTbl, MRConfig.use_unique_nbest, MRConfig.use_tree_nbest, false, addCombinedCost, false, true);
//==== loop
HyperGraphFactory hgFactory = new HyperGraphFactory(curHypFilePrefix, referenceFiles, MRConfig.ngramStateID, symbolTbl, true);
hgFactory.startLoop();
for(int sentID=0; sentID< this.numTrainingSentence; sentID ++){
HGAndReferences res = hgFactory.nextHG();
reranker.rankHG(res.hg);//reset best pointer and transition prob
String hypSent = kbestExtractor.getKthHyp(res.hg.goalNode, 1, -1, null, null);
double bleu = BLEU.computeSentenceBleu(res.referenceSentences, hypSent);
bleuSum += bleu;