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

@@ -312,13 +312,19 @@ public class Translator {
} catch (ParseError e) {
output = translateByLookup(input);
}
if (output == null)
output = "% "; // make sure that we return something
return new Pair<String,List<ExprProb>>(output, exprs);
}
public String linearize(Expr expr) {
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) {