1
0
forked from GitHub/gf-core

make sure that the app doesn't crash even if nonExist is used somewhere in the grammars

This commit is contained in:
kr.angelov
2014-12-09 12:31:36 +00:00
parent fa412e53d2
commit f2a23c8924

View File

@@ -313,12 +313,18 @@ public class Translator {
output = translateByLookup(input); output = translateByLookup(input);
} }
if (output == null)
output = "% "; // make sure that we return something
return new Pair<String,List<ExprProb>>(output, exprs); return new Pair<String,List<ExprProb>>(output, exprs);
} }
public String linearize(Expr expr) { public String linearize(Expr expr) {
Concr targetLang = getTargetConcr(); Concr targetLang = getTargetConcr();
return targetLang.linearize(expr); String s = targetLang.linearize(expr);
if (s == null)
s = "% "; // make sure that we return something
return s;
} }
public Object[] bracketedLinearize(Expr expr) { public Object[] bracketedLinearize(Expr expr) {