gov.nist.nlpir.irf.de.normalize
Class StopWordTable

java.lang.Object
  |
  +--gov.nist.nlpir.irf.de.normalize.StopWordTable
Direct Known Subclasses:
EngStopWordTable01

public class StopWordTable
extends java.lang.Object

This class implements a table of unique stop word strings

NOTE: entries are lowercased before addition and words to be looked up are lowercased first.

Version:
$Revision: 1.1 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.

Field Summary
private static int EOF
          Working copy of end of file marker value
private  java.util.HashSet table
          Table of stop words
 
Constructor Summary
StopWordTable()
          Constructs an empty stopword table
StopWordTable(java.lang.String fileName)
          Creates the Stop Word Table from a file.
 
Method Summary
 void addWord(java.lang.String word)
          Adds a lowercased stop word to the table
 boolean containsWord(java.lang.String wordToLookUp)
          Tests whether the given word is in the table or not.
 void present()
          Presents the contents of the table.
 void removeWord(java.lang.String word)
          Removes a stop word from the table
 int size()
          Returns the number of words in the table
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

table

private java.util.HashSet table
Table of stop words

EOF

private static int EOF
Working copy of end of file marker value
Constructor Detail

StopWordTable

public StopWordTable()
Constructs an empty stopword table

StopWordTable

public StopWordTable(java.lang.String fileName)
Creates the Stop Word Table from a file. The file must contain the list of terms. A term is a sequence of letters and/or digits. Terms must be separated by one or more chars which are not letters/digits. If file cannot be opened, constructor returns with empty stringtable (size() = 0)
Parameters:
fileName - the name of the file used.
Method Detail

addWord

public final void addWord(java.lang.String word)
Adds a lowercased stop word to the table

removeWord

public final void removeWord(java.lang.String word)
Removes a stop word from the table

size

public final int size()
Returns the number of words in the table
Returns:
the number of words in the table

present

public void present()
Presents the contents of the table.

containsWord

public final boolean containsWord(java.lang.String wordToLookUp)
Tests whether the given word is in the table or not.
Returns:
true if the word is in the table,
false otherwise.