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/25 21:15:10 UTC

incubator-joshua git commit: Added check / warning that packed grammar is loaded first

Repository: incubator-joshua
Updated Branches:
  refs/heads/JOSHUA-328 [created] 288e256c6


Added check / warning that packed grammar is loaded first


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

Branch: refs/heads/JOSHUA-328
Commit: 288e256c609b4bae3bfdedc364eb0160fcb015bc
Parents: 3ef13a0
Author: Matt Post <po...@cs.jhu.edu>
Authored: Wed Jan 25 16:14:59 2017 -0500
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Wed Jan 25 16:14:59 2017 -0500

----------------------------------------------------------------------
 src/main/java/org/apache/joshua/decoder/Decoder.java | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/288e256c/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 7b202b9..73db86a 100644
--- a/src/main/java/org/apache/joshua/decoder/Decoder.java
+++ b/src/main/java/org/apache/joshua/decoder/Decoder.java
@@ -468,6 +468,15 @@ public class Decoder {
                 + "Perhaps it doesn't exist, or it may be an old packed file format.";
             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,