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/06/03 21:01:38 UTC

[07/14] incubator-joshua git commit: bugfix: where to destroy KenLM allocations

bugfix: where to destroy KenLM allocations


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

Branch: refs/heads/joshua_api
Commit: 19aadf0e240acb09c5b4336068e6368083f26bef
Parents: ebdf643
Author: Matt Post <po...@cs.jhu.edu>
Authored: Wed May 25 11:47:23 2016 -0400
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Wed May 25 11:47:23 2016 -0400

----------------------------------------------------------------------
 src/joshua/decoder/Decoder.java       | 12 ++++++++++++
 src/joshua/decoder/DecoderThread.java | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/19aadf0e/src/joshua/decoder/Decoder.java
----------------------------------------------------------------------
diff --git a/src/joshua/decoder/Decoder.java b/src/joshua/decoder/Decoder.java
index 414d547..2cc8438 100644
--- a/src/joshua/decoder/Decoder.java
+++ b/src/joshua/decoder/Decoder.java
@@ -510,6 +510,18 @@ public class Decoder {
         out.write("\n".getBytes());
       }
       out.flush();
+    
+      /*
+       * KenLM hack. If using KenLMFF, we need to tell KenLM to delete the pool used to create chart
+       * objects for this sentence.
+       */
+      // TODO: make sure this works here
+      for (FeatureFunction feature : featureFunctions) {
+        if (feature instanceof StateMinimizingLanguageModel) {
+          ((StateMinimizingLanguageModel) feature).destroyPool(hg.sentence.id());
+          break;
+        }
+      }
     }
     
     if (config.n_best_file != null)

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/19aadf0e/src/joshua/decoder/DecoderThread.java
----------------------------------------------------------------------
diff --git a/src/joshua/decoder/DecoderThread.java b/src/joshua/decoder/DecoderThread.java
index cf78420..7a04500 100644
--- a/src/joshua/decoder/DecoderThread.java
+++ b/src/joshua/decoder/DecoderThread.java
@@ -148,18 +148,6 @@ public class DecoderThread extends Thread {
     Decoder.LOG(1, String.format("Input %d: Translation took %.3f seconds", sentence.id(), seconds));
     Decoder.LOG(1, String.format("Input %d: Memory used is %.1f MB", sentence.id(), (Runtime
         .getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000000.0));
-
-     /*
-     * KenLM hack. If using KenLMFF, we need to tell KenLM to delete the pool used to create chart
-     * objects for this sentence.
-     */
-    // TODO: make sure this works here
-    for (FeatureFunction feature : featureFunctions) {
-      if (feature instanceof StateMinimizingLanguageModel) {
-        ((StateMinimizingLanguageModel) feature).destroyPool(sentence.id());
-        break;
-      }
-    }
     
     /* Return the translation unless we're doing synchronous parsing. */
     if (!joshuaConfiguration.parse || hypergraph == null) {