mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
removing spaces from App output of Chi,Jpn,Tha to get nicer speech output (and of course follow the target lang conventions)
This commit is contained in:
@@ -234,6 +234,10 @@ public class Translator {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String implode(String s) {
|
||||||
|
return s.replaceAll("\\s","");
|
||||||
|
}
|
||||||
|
|
||||||
private String translateWord(String input) {
|
private String translateWord(String input) {
|
||||||
|
|
||||||
String output = input.toUpperCase() ; // if all else fails, return the word itself in upper case ///in brackets
|
String output = input.toUpperCase() ; // if all else fails, return the word itself in upper case ///in brackets
|
||||||
@@ -308,6 +312,11 @@ public class Translator {
|
|||||||
if (output == null)
|
if (output == null)
|
||||||
output = "% "; // make sure that we return something
|
output = "% "; // make sure that we return something
|
||||||
|
|
||||||
|
if (getTargetLanguage().getLangCode().equals("cmn-Hans-CN") ||
|
||||||
|
getTargetLanguage().getLangCode().equals("ja-JP") ||
|
||||||
|
getTargetLanguage().getLangCode().equals("th-TH"))
|
||||||
|
output = implode(output) ;
|
||||||
|
|
||||||
return new Pair<String,List<ExprProb>>(output, exprs);
|
return new Pair<String,List<ExprProb>>(output, exprs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +325,12 @@ public class Translator {
|
|||||||
String s = targetLang.linearize(expr);
|
String s = targetLang.linearize(expr);
|
||||||
if (s == null)
|
if (s == null)
|
||||||
s = "% "; // make sure that we return something
|
s = "% "; // make sure that we return something
|
||||||
return s;
|
|
||||||
|
if (getTargetLanguage().getLangCode().equals("cmn-Hans-CN") ||
|
||||||
|
getTargetLanguage().getLangCode().equals("ja-JP") ||
|
||||||
|
getTargetLanguage().getLangCode().equals("th-TH"))
|
||||||
|
return implode(s) ;
|
||||||
|
else return s ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] bracketedLinearize(Expr expr) {
|
public Object[] bracketedLinearize(Expr expr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user