append method
Append the target text for language detection.
If the total size of target text exceeds the limit size specified by
Detector.set_max_text_length(int)
, the rest is cut down.
Implementation
void append(String text) {
text = text.replaceAll(ureRe, ' ');
text = text.replaceAll(mailRe, ' ');
text = NGram.normalizeVi(text);
String pre = ' ';
for (int i = 0; i < min(text.length, maxTextLength); i++) {
String ch = text[i];
if (ch != ' ' || pre != ' ') {
this.text += ch;
}
pre = ch;
}
}