Example #1
0
 private static CharArraySet resolveNamedWords(
     Collection<String> words, Map<String, Set<?>> namedWords, boolean ignoreCase) {
   if (namedWords == null) {
     return new CharArraySet(words, ignoreCase);
   }
   CharArraySet setWords = new CharArraySet(words.size(), ignoreCase);
   for (String word : words) {
     if (namedWords.containsKey(word)) {
       setWords.addAll(namedWords.get(word));
     } else {
       setWords.add(word);
     }
   }
   return setWords;
 }
 private CharArraySet getWordSet(ResourceLoader loader, String wordFiles, boolean ignoreCase)
     throws IOException {
   List<String> files = splitFileNames(wordFiles);
   CharArraySet words = null;
   if (files.size() > 0) {
     // default stopwords list has 35 or so words, but maybe don't make it that
     // big to start
     words = new CharArraySet(files.size() * 10, ignoreCase);
     for (String file : files) {
       List<String> wlist = getLines(loader, file.trim());
       words.addAll(StopFilter.makeStopSet(wlist, ignoreCase));
     }
   }
   return words;
 }