Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/java-speech-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkylion007 <dragonsrcool.aaron@gmail.com>2013-08-31 22:12:30 +0400
committerSkylion007 <dragonsrcool.aaron@gmail.com>2013-08-31 22:12:30 +0400
commit28fcf79a4bad1a8eb48a3517261bfff9f7758654 (patch)
treec317d979bd332ba4d4162aaeda69ec3a5a5ed3f6
parent272a0ee7de2e3f4663c1c6c505404a4afa561780 (diff)
Parsing Bugfix
Fixed exceedingly rare parsing error which caused a Stack Overflow Exception if the only space or punctuation was located at index 0.
-rw-r--r--src/com/darkprograms/speech/synthesiser/Synthesiser.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/darkprograms/speech/synthesiser/Synthesiser.java b/src/com/darkprograms/speech/synthesiser/Synthesiser.java
index d304df8..ddedfea 100644
--- a/src/com/darkprograms/speech/synthesiser/Synthesiser.java
+++ b/src/com/darkprograms/speech/synthesiser/Synthesiser.java
@@ -158,7 +158,7 @@ public class Synthesiser {
}
else{
int lastWord = findLastWord(input);//Checks if a space exists
- if(lastWord<0){
+ if(lastWord<=0){
fragments.add(input.substring(0,100));//In case you sent gibberish to Google.
return parseString(input.substring(100), fragments);
}else{
@@ -181,7 +181,7 @@ public class Synthesiser {
for(int i = 99; i>=0; i--){
char tmp = input.charAt(i);
if(isEndingPunctuation(tmp)){
- return i;
+ return i+1;
}
if(space==-1 && tmp == ' '){
space = i;