Fix #6076
This commit is contained in:
parent
d819db7c8e
commit
8d8e450c6b
1 changed files with 13 additions and 3 deletions
|
@ -5,10 +5,13 @@ import java.util.Map;
|
||||||
|
|
||||||
public class CommonWords {
|
public class CommonWords {
|
||||||
private static Map<String, Integer> commonWordsDictionary = new LinkedHashMap<>();
|
private static Map<String, Integer> commonWordsDictionary = new LinkedHashMap<>();
|
||||||
|
private static Map<String, Integer> frequentlyUsedWordsDictionary = new LinkedHashMap<>();
|
||||||
private static void addCommon(String string) {
|
private static void addCommon(String string) {
|
||||||
commonWordsDictionary.put(string, commonWordsDictionary.size());
|
commonWordsDictionary.put(string, commonWordsDictionary.size());
|
||||||
}
|
}
|
||||||
|
private static void addFrequentlyUsed(String string) {
|
||||||
|
frequentlyUsedWordsDictionary.put(string, frequentlyUsedWordsDictionary.size());
|
||||||
|
}
|
||||||
public static int getCommon(String name) {
|
public static int getCommon(String name) {
|
||||||
// if(true) {
|
// if(true) {
|
||||||
// // not ready for old versions yet
|
// // not ready for old versions yet
|
||||||
|
@ -18,9 +21,14 @@ public class CommonWords {
|
||||||
return i == null ? -1 : i.intValue();
|
return i == null ? -1 : i.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getFrequentlyUsed(String name) {
|
||||||
|
Integer i = frequentlyUsedWordsDictionary.get(name);
|
||||||
|
return i == null ? -1 : i.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
public static int getCommonSearch(String name) {
|
public static int getCommonSearch(String name) {
|
||||||
Integer i = commonWordsDictionary.get(name);
|
Integer i = commonWordsDictionary.get(name);
|
||||||
return i == null ? -1 : i.intValue();
|
return i == null ? getFrequentlyUsed(name) : i.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCommonGeocoding(String name) {
|
public static int getCommonGeocoding(String name) {
|
||||||
|
@ -29,6 +37,8 @@ public class CommonWords {
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
addFrequentlyUsed("santa");
|
||||||
|
|
||||||
addCommon("la");
|
addCommon("la");
|
||||||
addCommon("via");
|
addCommon("via");
|
||||||
addCommon("rua");
|
addCommon("rua");
|
||||||
|
|
Loading…
Reference in a new issue