parent
2bed1531c2
commit
e5c7f0981d
|
@ -90,28 +90,31 @@ public class ContactsDictionary extends ExpandableDictionary {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
while (!cursor.isAfterLast()) {
|
while (!cursor.isAfterLast()) {
|
||||||
String name = cursor.getString(INDEX_NAME);
|
String name = cursor.getString(INDEX_NAME);
|
||||||
int len = name.length();
|
|
||||||
|
|
||||||
// TODO: Better tokenization for non-Latin writing systems
|
if (name != null) {
|
||||||
for (int i = 0; i < len; i++) {
|
int len = name.length();
|
||||||
if (Character.isLetter(name.charAt(i))) {
|
|
||||||
int j;
|
|
||||||
for (j = i + 1; j < len; j++) {
|
|
||||||
char c = name.charAt(j);
|
|
||||||
|
|
||||||
if (!(c == '-' || c == '\'' ||
|
// TODO: Better tokenization for non-Latin writing systems
|
||||||
Character.isLetter(c))) {
|
for (int i = 0; i < len; i++) {
|
||||||
break;
|
if (Character.isLetter(name.charAt(i))) {
|
||||||
|
int j;
|
||||||
|
for (j = i + 1; j < len; j++) {
|
||||||
|
char c = name.charAt(j);
|
||||||
|
|
||||||
|
if (!(c == '-' || c == '\'' ||
|
||||||
|
Character.isLetter(c))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String word = name.substring(i, j);
|
String word = name.substring(i, j);
|
||||||
i = j - 1;
|
i = j - 1;
|
||||||
|
|
||||||
// Safeguard against adding really long words. Stack
|
// Safeguard against adding really long words. Stack
|
||||||
// may overflow due to recursion
|
// may overflow due to recursion
|
||||||
if (word.length() < maxWordLength) {
|
if (word.length() < maxWordLength) {
|
||||||
super.addWord(word, 128);
|
super.addWord(word, 128);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue