You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/08/21 12:25:06 UTC

[3/8] incubator-joshua git commit: minor cleanup of assignment logic

minor cleanup of assignment logic


Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/e3b60ca9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/e3b60ca9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/e3b60ca9

Branch: refs/heads/JOSHUA-284
Commit: e3b60ca9a7fea7d25a8533b630a1a66d29349a6f
Parents: 49dbf8c
Author: Matt Post <po...@cs.jhu.edu>
Authored: Sun Aug 21 06:53:26 2016 -0500
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Sun Aug 21 06:53:26 2016 -0500

----------------------------------------------------------------------
 .../decoder/chart_parser/ComputeNodeResult.java | 31 +++++++++-----------
 1 file changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/e3b60ca9/src/main/java/org/apache/joshua/decoder/chart_parser/ComputeNodeResult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/joshua/decoder/chart_parser/ComputeNodeResult.java b/src/main/java/org/apache/joshua/decoder/chart_parser/ComputeNodeResult.java
index 9833734..d92665d 100644
--- a/src/main/java/org/apache/joshua/decoder/chart_parser/ComputeNodeResult.java
+++ b/src/main/java/org/apache/joshua/decoder/chart_parser/ComputeNodeResult.java
@@ -51,9 +51,9 @@ public class ComputeNodeResult {
   // transitionCost + the Viterbi costs of the tail nodes.
   private float viterbiCost;
 
-  // viterbiCost + a future estimate (outside cost estimate).
-  private float pruningCostEstimate;
-
+  // The future or outside cost (estimated)
+  private float futureCostEstimate;
+  
   // The StateComputer objects themselves serve as keys.
   private List<DPState> dpStates;
 
@@ -76,7 +76,7 @@ public class ComputeNodeResult {
 
     // The total Viterbi cost of this edge. This is the Viterbi cost of the tail nodes, plus
     // whatever costs we incur applying this rule to create a new hyperedge.
-    float viterbiCost = 0.0f;
+    this.viterbiCost = 0.0f;
     
     if (LOG.isDebugEnabled()) {
       LOG.debug("ComputeNodeResult():");
@@ -102,10 +102,10 @@ public class ComputeNodeResult {
     List<DPState> allDPStates = new ArrayList<DPState>();
 
     // The transition cost is the new cost incurred by applying this rule
-    float transitionCost = 0.0f;
+    this.transitionCost = 0.0f;
 
     // The future cost estimate is a heuristic estimate of the outside cost of this edge.
-    float futureCostEstimate = 0.0f;
+    this.futureCostEstimate = 0.0f;
 
     /*
      * We now iterate over all the feature functions, computing their cost and their expected future
@@ -132,10 +132,7 @@ public class ComputeNodeResult {
     viterbiCost += transitionCost;
     if (LOG.isDebugEnabled())
       LOG.debug("-> COST = {}", transitionCost);
-    // Set the final results.
-    this.pruningCostEstimate = viterbiCost + futureCostEstimate;
-    this.viterbiCost = viterbiCost;
-    this.transitionCost = transitionCost;
+
     this.dpStates = allDPStates;
   }
 
@@ -189,12 +186,17 @@ public class ComputeNodeResult {
     return featureDelta;
   }
 
+  public float getFutureEstimate() {
+    return this.futureCostEstimate;
+  }
+  
   public float getPruningEstimate() {
-    return this.pruningCostEstimate;
+    return getViterbiCost() + getFutureEstimate();
   }
 
   /**
-   *  The complete cost of the Viterbi derivation at this point
+   *  The complete cost of the Viterbi derivation at this point.
+   *  
    *  @return float representing cost
    */
   public float getViterbiCost() {
@@ -217,9 +219,4 @@ public class ComputeNodeResult {
   public List<DPState> getDPStates() {
     return this.dpStates;
   }
-
-  public void printInfo() {
-    System.out.println("scores: " + transitionCost + "; " + viterbiCost + "; "
-        + pruningCostEstimate);
-  }
 }