diff --git a/src/ui/android/assets/help_content.html b/src/ui/android/assets/help_content.html index 9d1440f2d..e65f79584 100644 --- a/src/ui/android/assets/help_content.html +++ b/src/ui/android/assets/help_content.html @@ -2,7 +2,7 @@

GF Offline Translator: -text and speech translation for 14 languages with +text and speech translation for 16 languages with quality control

@@ -82,15 +82,17 @@ The following table gives a rough idea of what to expect: coverage quality speed speech Bulgarian in only Catalan in only - Chinese* + Chinese* Dutch English + Estonian Finnish in only French German Hindi in only Italian - Japanese** + Japanese** + Russian Spanish Swedish in only Thai** diff --git a/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java b/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java index 3ed06b1c4..47f949cdd 100644 --- a/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java +++ b/src/ui/android/src/org/grammaticalframework/ui/android/Translator.java @@ -291,6 +291,28 @@ public class Translator { return output ; } + // lowercase the first word if (1) it is not in the lexicon and (2) its lowercase version is in the lexicon + // otherwise it will be left uppercase and treated as a name + private String lowercaseIfBetter(String input) { + String[] words = input.split(" ") ; + + String firstword = words[0] ; + + String lowerfirstword = firstword.toLowerCase() ; + + if (lookupMorpho(firstword).isEmpty() && !(lookupMorpho(lowerfirstword).isEmpty())) { + words[0] = lowerfirstword ; + String output = "" ; + for (String w : words) { + output = output + " " + w ; + } + return output ; + } else { + return input ; + } + + } + /** * Takes a lot of time. Must not be called on the main thread. */ @@ -298,7 +320,9 @@ public class Translator { if (getSourceLanguage().getLangCode().equals("cmn-Hans-CN")) { // for Chinese we need to put space after every character input = explode(input); - } + } else { + input = lowercaseIfBetter(input); + } ; String output = null; List exprs = new ArrayList();