private void checkDictionary( final FusionDictionary dict, final List<String> words, final SparseArray<List<Integer>> bigrams, final HashMap<String, List<String>> shortcutMap) { assertNotNull(dict); // check unigram for (final String word : words) { final PtNode ptNode = FusionDictionary.findWordInTree(dict.mRootNodeArray, word); assertNotNull(ptNode); } // check bigram for (int i = 0; i < bigrams.size(); ++i) { final int w1 = bigrams.keyAt(i); for (final int w2 : bigrams.valueAt(i)) { final PtNode ptNode = FusionDictionary.findWordInTree(dict.mRootNodeArray, words.get(w1)); assertNotNull(words.get(w1) + "," + words.get(w2), ptNode.getBigram(words.get(w2))); } } // check shortcut if (shortcutMap != null) { for (final Entry<String, List<String>> entry : shortcutMap.entrySet()) { assertTrue(words.contains(entry.getKey())); final PtNode ptNode = FusionDictionary.findWordInTree(dict.mRootNodeArray, entry.getKey()); for (final String word : entry.getValue()) { assertNotNull( "shortcut not found: " + entry.getKey() + ", " + word, ptNode.getShortcut(word)); } } } }