コード例 #1
0
  public static boolean isStopWord(String word) {
    if (word == null) {
      return false;
    }

    if (searchTree == null) {
      initSearchTree();
    }

    return searchTree.getValueForExactKey(word.toLowerCase()) != null;
  }
コード例 #2
0
 private static void initSearchTree() {
   searchTree = new ConcurrentRadixTree<Boolean>(new DefaultCharArrayNodeFactory());
   for (String s : STOP_WORDS) {
     searchTree.put(s, Boolean.TRUE);
   }
 }