Skip to content

Commit 536c1be

Browse files
committed
Adjusted text pre process order
1 parent 83530f7 commit 536c1be

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/translation

app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/translation/Translator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,6 @@ public long getCurrentResultID(){
13231323
private String correctText(String text, Locale locale){
13241324
String correctedText = text;
13251325
String language = locale.getLanguage();
1326-
correctedText = correctedText.replaceAll("\\s+", " "); // collapse whitespace
13271326
//we add an eventual period if missing (or in general a terminator symbol)
13281327
if(!language.equals("th")) {
13291328
correctedText = correctedText.trim(); //we remove eventual white space from both ends of the text
@@ -1339,6 +1338,8 @@ private String correctText(String text, Locale locale){
13391338
.replaceAll("\\p{Cntrl}", "") // remove other control chars
13401339
.trim();
13411340
}
1341+
// collapse whitespace
1342+
correctedText = correctedText.replaceAll("\\s+", " ");
13421343
return correctedText;
13431344
}
13441345

0 commit comments

Comments
 (0)