Package joshua.discriminative.ranker

Examples of joshua.discriminative.ranker.HGRanker


  public void initializeDecoder(String configFile){
    VariationalDecoderConfiguration.readConfigFile(configFile);
    this.symbolTbl = new BuildinSymbol(null);
    this.featFunctions = new ArrayList<FeatureFunction>();
    this.ranker = new HGRanker(featFunctions);
    this.approximatorMap = new HashMap<VariationalNgramApproximator, FeatureTemplateBasedFF>();   
    VariationalDecoderConfiguration.initializeModels(configFile, this.symbolTbl, this.featFunctions, this.approximatorMap);   
    this.insideOutsideScalingFactor =  VariationalDecoderConfiguration.insideoutsideScalingFactor;

    //this.kbestExtractor = new KBestExtractor(p_symbol); 
View Full Code Here


    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;
     
View Full Code Here

TOP

Related Classes of joshua.discriminative.ranker.HGRanker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.