Package joshua.decoder.hypergraph

Examples of joshua.decoder.hypergraph.TrivialInsideOutside


//  return changed hg
  public HyperGraph decoding(HyperGraph hg, int sentenceID, BufferedWriter out) {   
 
    //=== step-1: run inside-outside
    //note, inside and outside will use the transition_cost of each hyperedge, this cost is already linearly interpolated
    TrivialInsideOutside pInsideOutside = new TrivialInsideOutside();
    pInsideOutside.runInsideOutside(hg, 0, 1, insideOutsideScalingFactor);//ADD_MODE=0=sum; LOG_SEMIRING=1;
   
    //=== initialize baseline table
    //TODO:????????????????????
    ((EdgeTblBasedBaselineFF)featFunctions.get(0)).collectTransitionLogPs(hg);
   
    //=== step-2: model extraction based on the definition of Q
    for(Map.Entry<VariationalNgramApproximator, FeatureTemplateBasedFF> entry : approximatorMap.entrySet()){
      VariationalNgramApproximator approximator = entry.getKey();
      FeatureTemplateBasedFF featureFunction = entry.getValue();
      HashMap<String, Double> model = approximator.estimateModel(hg, pInsideOutside);
      featureFunction.setModel(model);     
    }
   
    //clean up
    pInsideOutside.clearState();
   
    //=== step-3: rank the HG using the baseline and variational feature
    this.ranker.rankHG(hg);

    //=== step-4: kbest extraction from the reranked HG: remember to add the new feature function into the model list
View Full Code Here


      HyperGraph testHG = diskHG.readHyperGraph();
     
      //################setup the model: including estimation of variational model
      //### step-1: run inside-outside
      //note, inside and outside will use the transition_cost of each hyperedge, this cost is already linearly interpolated
      TrivialInsideOutside insideOutsider = new TrivialInsideOutside();
      insideOutsider.runInsideOutside(testHG, 0, 1, insideOutsideScalingFactor);//ADD_MODE=0=sum; LOG_SEMIRING=1;
     
      //### step-2: model extraction based on the definition of Q
      for(Map.Entry<VariationalNgramApproximator, FeatureTemplateBasedFF> entry : approximatorMap.entrySet()){
        VariationalNgramApproximator approximator = entry.getKey();
        FeatureTemplateBasedFF featureFunction = entry.getValue();
View Full Code Here

TOP

Related Classes of joshua.decoder.hypergraph.TrivialInsideOutside

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.