Package joshua.decoder.hypergraph

Examples of joshua.decoder.hypergraph.HyperEdge


 
  //TODO: tbl_states
  private static HGNode clone_item_with_best_deduction(VirtualItem virtual_it){
    HGNode original_it = virtual_it.p_item;
    ArrayList<HyperEdge> l_deductions = new ArrayList<HyperEdge>();   
    HyperEdge clone_dt = clone_deduction(virtual_it.best_virtual_deduction);
    l_deductions.add(clone_dt);
    return new HGNode(original_it.i, original_it.j, original_it.lhs,  l_deductions, clone_dt, original_it.getDPStates())
  }
View Full Code Here


    return new HGNode(original_it.i, original_it.j, original_it.lhs,  l_deductions, clone_dt, original_it.getDPStates())
  }
 

  private static HyperEdge clone_deduction(VirtualDeduction virtual_dt){
    HyperEdge original_dt = virtual_dt.p_dt;
    ArrayList<HGNode> l_ant_items = null;
    // l_ant_items will be changed in get_1best_tree_item
    if(original_dt.getAntNodes() != null) l_ant_items = new ArrayList<HGNode>(original_dt.getAntNodes());
    HyperEdge res = new HyperEdge(original_dt.getRule(), original_dt.bestDerivationLogP, original_dt.getTransitionLogP(false), l_ant_items, original_dt.getSourcePath());
    return res;
  }
View Full Code Here

    if(processedNodesTtbl.containsKey(it)) 
      return;
    processedNodesTtbl.put(it,1);
   
    //==== recursively call my children edges, change pointer for bestHyperedge
    HyperEdge oldEdge =it.bestHyperedge;
    it.bestHyperedge=null;
    for(HyperEdge dt : it.hyperedges){         
      adjustHyperedgeLogP(it, dt );//deduction-specifc feature
      it.semiringPlus(dt);
    }
View Full Code Here

    if(processedNodesTbl.contains(it)) 
      return;
    processedNodesTbl.add(it);
   
    //==== recursively call my children deductions, change pointer for bestHyperedge
    HyperEdge oldBestHyperedge = it.bestHyperedge;
   
    it.bestHyperedge=null;
    for(HyperEdge dt : it.hyperedges){         
      rankHyperEdge(it, dt );
      it.semiringPlus(dt);
View Full Code Here

        double finalTransitionLogP = ComputeNodeResult.computeCombinedTransitionLogP(featureFunctions, null, antNodes, 0, sentenceLength, null, this.chart.segmentID);
                   
        List<HGNode> previousItems = new ArrayList<HGNode>();
        previousItems.add(antNode);
       
        HyperEdge dt = new HyperEdge(null, logP + finalTransitionLogP, finalTransitionLogP, previousItems, null);
               
        if (null == goalItem) {
          goalItem = new HGNode(0, sentenceLength + 1, this.goalSymID, null, dt, logP + finalTransitionLogP);
          this.sortedNodes.add(goalItem);
        } else {
View Full Code Here

   
    if(noPrune==false && beamPruner!=null &&  beamPruner.relativeThresholdPrune(expectedTotalLogP)){//the hyperedge should be pruned
      this.chart.nPreprunedEdges++;
      res = null;
    }else{
      HyperEdge dt = new HyperEdge(rule, finalizedTotalLogP, transitionLogP, ants, srcPath);
      res = new HGNode(i, j, rule.getLHS(), dpStates, dt, expectedTotalLogP);
     
      /** each node has a list of hyperedges,
       * need to check whether the node is already exist,
       * if yes, just add the hyperedges, this may change the best logP of the node
View Full Code Here

      return;
    processedHGNodesTbl.add(node);
   
    //=== recursive call on each edge
    for(int i=0; i<node.hyperedges.size(); i++){
      HyperEdge oldEdge = node.hyperedges.get(i);
      HyperEdge newEdge = annotateHyperEdge(oldEdge, refereceNgramTable);
      node.hyperedges.set(i, newEdge);
    }
   
    //===@todo: release the memory consumed by the state of node, but we have to make sure all parent hyperedges have been processed
  }
View Full Code Here

 
  //TODO: tbl_states
  private static HGNode clone_item_with_best_deduction(VirtualItem virtual_it){
    HGNode original_it = virtual_it.p_item;
    ArrayList<HyperEdge> l_deductions = new ArrayList<HyperEdge>();   
    HyperEdge clone_dt = clone_deduction(virtual_it.best_virtual_deduction);
    l_deductions.add(clone_dt);
    return new HGNode(original_it.i, original_it.j, original_it.lhs,  l_deductions, clone_dt, original_it.getDPStates())
  }
View Full Code Here

    return new HGNode(original_it.i, original_it.j, original_it.lhs,  l_deductions, clone_dt, original_it.getDPStates())
  }
 

  private static HyperEdge clone_deduction(VirtualDeduction virtual_dt){
    HyperEdge originalEdge = virtual_dt.p_dt;
    ArrayList<HGNode> l_ant_items = null;
    if(originalEdge.getAntNodes()!=null)
      l_ant_items = new ArrayList<HGNode>(originalEdge.getAntNodes());//l_ant_items will be changed in get_1best_tree_item
    HyperEdge res = new HyperEdge(originalEdge.getRule(), originalEdge.bestDerivationLogP, originalEdge.getTransitionLogP(false), l_ant_items, null);
    return res;
  }
View Full Code Here

 
 
  //TODO: tbl_states
  private static HGNode clone_item(HGNode it_in){
    ArrayList<HyperEdge> l_deductions = new ArrayList<HyperEdge>();
    HyperEdge best_dt=null;
    for(HyperEdge dt : it_in.hyperedges){ 
      if(dt==it_in.bestHyperedge) best_dt = dt;        
      HyperEdge clone_dt = clone_deduction(dt);
      l_deductions.add(clone_dt);
    }
    return new HGNode(it_in.i, it_in.j, it_in.lhs,  l_deductions, best_dt, it_in.getDPStates() )
  }
View Full Code Here

TOP

Related Classes of joshua.decoder.hypergraph.HyperEdge

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.