org.apache.lucene.analysis
Class WordlistLoader

java.lang.Object
  extended byorg.apache.lucene.analysis.WordlistLoader

public class WordlistLoader
extends Object

Loader for text files that represent a list of stopwords.

Version:
$Id: WordlistLoader.java 387550 2006-03-21 15:36:32Z yonik $
Author:
Gerhard Schwarz

Constructor Summary
WordlistLoader()
           
 
Method Summary
static HashSet getWordSet(File wordfile)
          Loads a text file and adds every line as an entry to a HashSet (omitting leading and trailing whitespace).
static HashSet getWordSet(Reader reader)
          Reads lines from a Reader and adds every line as an entry to a HashSet (omitting leading and trailing whitespace).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordlistLoader

public WordlistLoader()
Method Detail

getWordSet

public static HashSet getWordSet(File wordfile)
                          throws IOException
Loads a text file and adds every line as an entry to a HashSet (omitting leading and trailing whitespace). Every line of the file should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).

Parameters:
wordfile - File containing the wordlist
Returns:
A HashSet with the file's words
Throws:
IOException

getWordSet

public static HashSet getWordSet(Reader reader)
                          throws IOException
Reads lines from a Reader and adds every line as an entry to a HashSet (omitting leading and trailing whitespace). Every line of the Reader should contain only one word. The words need to be in lowercase if you make use of an Analyzer which uses LowerCaseFilter (like StandardAnalyzer).

Parameters:
reader - Reader containing the wordlist
Returns:
A HashSet with the reader's words
Throws:
IOException


Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.