public static boolean isStopWord(String word) { if (word == null) { return false; } if (searchTree == null) { initSearchTree(); } return searchTree.getValueForExactKey(word.toLowerCase()) != null; }
private static void initSearchTree() { searchTree = new ConcurrentRadixTree<Boolean>(new DefaultCharArrayNodeFactory()); for (String s : STOP_WORDS) { searchTree.put(s, Boolean.TRUE); } }