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 2017/01/26 01:02:55 UTC

[4/7] incubator-joshua git commit: do the glue grammar check before loading the packed grammar

do the glue grammar check before loading the packed grammar


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

Branch: refs/heads/JOSHUA-327
Commit: d870a593ca49584a167ad742bc50b0bbcc0e8f84
Parents: 288e256
Author: Matt Post <po...@cs.jhu.edu>
Authored: Wed Jan 25 20:01:55 2017 -0500
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Wed Jan 25 20:01:55 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/joshua/decoder/Decoder.java    | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/d870a593/src/main/java/org/apache/joshua/decoder/Decoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/joshua/decoder/Decoder.java b/src/main/java/org/apache/joshua/decoder/Decoder.java
index 73db86a..e105fd2 100644
--- a/src/main/java/org/apache/joshua/decoder/Decoder.java
+++ b/src/main/java/org/apache/joshua/decoder/Decoder.java
@@ -459,6 +459,15 @@ public class Decoder {
 
       } else {
         if (new File(path).isDirectory()) {
+          /* Bug check. It is a problem if you load the glue grammar before a packed grammar, due to vocabulary
+           * issues. That should be fixed one day, but in the meantime, it is important to tell people about it.
+           */
+          if (glueGrammar != null) {
+            LOG.error("FATAL: the glue grammar must be listed AFTER any packed grammar.");
+            LOG.error("  Change the order in the config file so that your packed grammar is loaded first.");
+            throw new RuntimeException("Glue grammar loaded before a packed grammar.");
+          }
+
           try {
             PackedGrammar packed_grammar = new PackedGrammar(path, span_limit, owner, type, joshuaConfiguration);
             packed_grammars.add(packed_grammar);
@@ -469,14 +478,6 @@ public class Decoder {
             throw new RuntimeException(msg);
           }
 
-          /* Bug check. It is a problem if you load the glue grammar before a packed grammar, due to vocabulary
-           * issues. That should be fixed one day, but in the meantime, it is important to tell people about it.
-           */
-          if (glueGrammar != null) {
-            LOG.error("FATAL: the glue grammar must be listed AFTER any packed grammar.");
-            LOG.error("  Change the order in the config file so that your packed grammar is loaded first.");
-            throw new RuntimeException("Glue grammar loaded before a packed grammar.");
-          }
         } else {
           // thrax, hiero, samt
           grammar = new MemoryBasedBatchGrammar(type, path, owner,