diff options
author | 2012-01-16 11:54:31 +0900 | |
---|---|---|
committer | 2012-01-16 12:07:03 +0900 | |
commit | eddfbb68dcff55c85b3d5b82d406f543bd038825 (patch) | |
tree | 8b34aec9d60b014b954a88bdba387f833d7183fe | |
parent | c88026e1dfa9dce6d2aee9b9964342a22644dcd1 (diff) | |
download | latinime-eddfbb68dcff55c85b3d5b82d406f543bd038825.tar.gz latinime-eddfbb68dcff55c85b3d5b82d406f543bd038825.tar.xz latinime-eddfbb68dcff55c85b3d5b82d406f543bd038825.zip |
Add a helper method
Change-Id: I7a898940d5f672bbee0da0c02af7a08297051ec3
-rw-r--r-- | tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java index 2327e1972..3ab206d80 100644 --- a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java +++ b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java @@ -435,6 +435,16 @@ public class FusionDictionary implements Iterable<Word> { } /** + * Helper method to find out whether a word is in the dict or not. + */ + public boolean hasWord(final String s) { + if (null == s || "".equals(s)) { + throw new RuntimeException("Can't search for a null or empty string"); + } + return null != findWordInTree(mRoot, s); + } + + /** * Recursively count the number of character groups in a given branch of the trie. * * @param node the parent node. |