am 92038bca: Merge "Add a method to import one bigram and string utilities"

* commit '92038bcacd5210c667e67f7046a6675e085868b6':
  Add a method to import one bigram and string utilities
This commit is contained in:
Satoshi Kataoka 2013-08-14 03:34:12 -07:00 committed by Android Git Automerger
commit 72d7af4f4c
2 changed files with 21 additions and 1 deletions

View File

@ -70,7 +70,17 @@ public abstract class PersonalizationDictionaryUpdateSession {
unsetPredictionDictionary();
}
public void addToPersonalizationDictionary(
public void addBigramToPersonalizationDictionary(String word0, String word1, boolean isValid,
int frequency) {
final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary();
if (dictionary == null) {
return;
}
dictionary.addToPersonalizationPredictionDictionary(word0, word1, isValid);
}
// Bulk import
public void addBigramsToPersonalizationDictionary(
final ArrayList<PersonalizationLanguageModelParam> lmParams) {
final DynamicPredictionDictionaryBase dictionary = getPredictionDictionary();
if (dictionary == null) {

View File

@ -345,4 +345,14 @@ public final class StringUtils {
// Otherwise, it doesn't look like an URL.
return false;
}
public static boolean isEmptyStringOrWhiteSpaces(String s) {
final int N = codePointCount(s);
for (int i = 0; i < N; ++i) {
if (!Character.isWhitespace(s.codePointAt(i))) {
return false;
}
}
return true;
}
}