From ccc42b7d93ab42c54f7e0871b3f5457c9df9a8a9 Mon Sep 17 00:00:00 2001 From: Skylion007 Date: Sun, 1 Sep 2013 17:49:37 -0400 Subject: Added region autodetection Allows other attributes to be detected such accents & dialects. Eg. "Ye old store" would return English(old). --- .../speech/synthesiser/Synthesiser.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/com/darkprograms/speech/synthesiser/Synthesiser.java b/src/com/darkprograms/speech/synthesiser/Synthesiser.java index aa58c51..82691a7 100644 --- a/src/com/darkprograms/speech/synthesiser/Synthesiser.java +++ b/src/com/darkprograms/speech/synthesiser/Synthesiser.java @@ -247,20 +247,30 @@ public class Synthesiser { } /** - * Searches RawData for Language + * Searches RawData for Language & region if possible * @param RawData the raw String directly from Google you want to search through * @return The language parsed from the rawData or null if Google cannot determine it. */ private String parseRawData(String rawData){ for(int i = 0; i+50) + return rawData.substring(i+2,i+2+lastQuote); + } + else{ + String possible = rawData.substring(i+2,i+4); + if(containsLettersOnly(possible)){//Required due to Google's inconsistent formatting. + //System.out.println(possible); + return possible; + } } } - } + }//End of Loop return null; } -- cgit v1.2.3