Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-06-20 18:28:08 +02:00
commit b0a06eba4c
2 changed files with 12 additions and 4 deletions

View file

@ -25,6 +25,7 @@ import net.osmand.plus.voice.AbstractPrologCommandPlayer;
import net.osmand.plus.voice.TTSCommandPlayerImpl; import net.osmand.plus.voice.TTSCommandPlayerImpl;
import net.osmand.plus.voice.CommandBuilder; import net.osmand.plus.voice.CommandBuilder;
import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.voice.CommandPlayer;
import net.osmand.plus.routing.VoiceRouter;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.io.File; import java.io.File;
@ -190,7 +191,14 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
} }
return new Struct(""); return new Struct("");
} }
private Term street(CommandPlayer p, String name, String ref, String destName, String currentName) { private Term street(CommandPlayer p, String name, String ref, String destName, String currentName) {
// Pass all test strings through our character replacement method
ref = VoiceRouter.getSpeakablePointName(ref);
name = VoiceRouter.getSpeakablePointName(name);
destName = VoiceRouter.getSpeakablePointName(destName);
currentName = VoiceRouter.getSpeakablePointName(currentName);
if(p.supportsStructuredStreetNames()) { if(p.supportsStructuredStreetNames()) {
Struct next = new Struct(new Term[] { getTermString(ref), Struct next = new Struct(new Term[] { getTermString(ref),
getTermString(name), getTermString(name),

View file

@ -618,18 +618,18 @@ public class VoiceRouter {
return empty; return empty;
} }
public String getSpeakablePointName(String pn) { public static String getSpeakablePointName(String pn) {
// Replace characters which may produce unwanted tts sounds: // Replace characters which may produce unwanted TTS sounds:
if (pn != null) { if (pn != null) {
pn = pn.replace('-', ' '); pn = pn.replace('-', ' ');
pn = pn.replace(':', ' '); pn = pn.replace(':', ' ');
pn = pn.replace(";", ", "); // Trailing blank prevents punctuation being pronounced. Replace by comma for better intonation. pn = pn.replace(";", ", "); // Trailing blank prevents punctuation being pronounced. Replace by comma for better intonation.
pn = pn.replace("/", ", "); // Slash is actually pronounced by many TTS engines, ceeating an awkward voice prompt, better replace by comma. pn = pn.replace("/", ", "); // Slash is actually pronounced by many TTS engines, ceeating an awkward voice prompt, better replace by comma.
if ((player != null) && (!player.getLanguage().equals("de"))) { if ((player != null) && (!player.getLanguage().equals("de"))) {
pn = pn.replace("\u00df", "ss"); // Helps non-German tts voices to pronounce German Strasse (=street) pn = pn.replace("\u00df", "ss"); // Helps non-German TTS voices to pronounce German Straße (=street)
} }
if ((player != null) && (player.getLanguage().startsWith("en"))) { if ((player != null) && (player.getLanguage().startsWith("en"))) {
pn = pn.replace("SR", "S R"); // Avoid SR (as for State Route or Strada Regionale) be pronounced as "Senior" in English tts voice pn = pn.replace("SR", "S R"); // Avoid SR (as for State Route or Strada Regionale) be pronounced as "Senior" in English TTS voice
pn = pn.replace("Dr.", "Dr "); // Avoid pause many English TTS voices introduce after period pn = pn.replace("Dr.", "Dr "); // Avoid pause many English TTS voices introduce after period
} }
} }