diff --git a/DroidFish/src/org/petero/droidfish/Speech.java b/DroidFish/src/org/petero/droidfish/Speech.java index 287c989..f921d28 100644 --- a/DroidFish/src/org/petero/droidfish/Speech.java +++ b/DroidFish/src/org/petero/droidfish/Speech.java @@ -279,6 +279,8 @@ public class Speech { } private static String fromToString(String from, Language lang) { + if ("b4".equals(from)) // Some TTS systems convert "b4" to "before" + from = "b 4"; switch (lang) { case EN: if ("a".equals(from)) @@ -295,7 +297,19 @@ public class Speech { } private static String toToString(String to, Language lang) { - return to; + if ("b4".equals(to)) // Some TTS systems convert "b4" to "before" + to = "b 4"; + switch (lang) { + case EN: + return to; + case DE: + return to; + case ES: + return to; + case NONE: + return ""; + } + throw new IllegalArgumentException(); } private static String captureToString(String to, Language lang) { @@ -362,7 +376,7 @@ public class Speech { case DE: return "Schach!"; case ES: - return ",jaque!"; + return ", jaque!"; case NONE: return ""; } @@ -376,7 +390,7 @@ public class Speech { case DE: return "Schach matt!"; case ES: - return ",mate!"; + return ", mate!"; case NONE: return ""; } diff --git a/DroidFishTest/src/org/petero/droidfish/gamelogic/SpeechTest.java b/DroidFishTest/src/org/petero/droidfish/gamelogic/SpeechTest.java index 58827a8..f6caa2a 100644 --- a/DroidFishTest/src/org/petero/droidfish/gamelogic/SpeechTest.java +++ b/DroidFishTest/src/org/petero/droidfish/gamelogic/SpeechTest.java @@ -79,7 +79,7 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); res = game.processString("b4"); - assertEquals(new String[]{"b4", "b4", "b4"}, + assertEquals(new String[]{"b 4", "b 4", "b 4"}, moveToText(game.prevPos(), res.second, lang)); res = game.processString("a5"); @@ -91,11 +91,11 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); res = game.processString("axb4"); - assertEquals(new String[]{"ae takes b4", "a schlägt b4", "a captura b4"}, + assertEquals(new String[]{"ae takes b 4", "a schlägt b 4", "a captura b 4"}, moveToText(game.prevPos(), res.second, lang)); res = game.processString("axb4"); - assertEquals(new String[]{"ae takes b4", "a schlägt b4", "a captura b4"}, + assertEquals(new String[]{"ae takes b 4", "a schlägt b 4", "a captura b 4"}, moveToText(game.prevPos(), res.second, lang)); } { @@ -119,7 +119,7 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); res = game.processString("Bb4"); - assertEquals(new String[]{"Bishop b4 check!", "Läufer b4 Schach!", "Alfil b4 ,jaque!"}, + assertEquals(new String[]{"Bishop b 4 check!", "Läufer b 4 Schach!", "Alfil b 4 , jaque!"}, moveToText(game.prevPos(), res.second, lang)); res = game.processString("c3"); @@ -131,7 +131,7 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); res = game.processString("cxb4"); - assertEquals(new String[]{"c takes b4", "c schlägt b4", "c captura b4"}, + assertEquals(new String[]{"c takes b 4", "c schlägt b 4", "c captura b 4"}, moveToText(game.prevPos(), res.second, lang)); res = game.processString("O-O"); @@ -148,7 +148,7 @@ public class SpeechTest extends TestCase { res = game.processString("gxf8Q+"); assertEquals(new String[]{"g takes f8 Queen check!", "g schlägt f8 Umwandlung zu Dame Schach!", - "g captura f8 Dama ,jaque!"}, + "g captura f8 Dama , jaque!"}, moveToText(game.prevPos(), res.second, lang)); res = game.processString("Kxf8"); @@ -182,7 +182,7 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); res = game.processString("Qh4"); - assertEquals(new String[]{"Queen h4 check mate!", "Dame h4 Schach matt!", "Dama h4 ,mate!"}, + assertEquals(new String[]{"Queen h4 check mate!", "Dame h4 Schach matt!", "Dama h4 , mate!"}, moveToText(game.prevPos(), res.second, lang)); } { @@ -193,7 +193,7 @@ public class SpeechTest extends TestCase { moveToText(game.prevPos(), res.second, lang)); playMoves(game, "Nxd4 Nxd5 Qxd5 Qxd4 Qxd4 Nf3 Qxd1 Kxd1"); res = game.processString("O-O-O"); - assertEquals(new String[]{"Long castle check!", "Große Rochade Schach!", "Enroque largo ,jaque!"}, + assertEquals(new String[]{"Long castle check!", "Große Rochade Schach!", "Enroque largo , jaque!"}, moveToText(game.prevPos(), res.second, lang)); playMoves(game, "Kc1"); res = game.processString("Rd7");