ehatcher 2004/03/10 01:59:57
Modified: src/java/org/apache/lucene/analysis StopFilter.java
Log:
another refinement to the ongoing StopFilter refactorings
Revision Changes Path
1.8 +7 -7 jakarta-lucene/src/java/org/apache/lucene/analysis/StopFilter.java
Index: StopFilter.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/analysis/StopFilter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StopFilter.java 10 Mar 2004 00:18:02 -0000 1.7
+++ StopFilter.java 10 Mar 2004 09:59:57 -0000 1.8
@@ -65,7 +65,7 @@
public final class StopFilter extends TokenFilter {
- private Set table;
+ private Set stopWords;
/**
* Constructs a filter which removes words from the input
@@ -73,7 +73,7 @@
*/
public StopFilter(TokenStream in, String[] stopWords) {
super(in);
- table = makeStopSet(stopWords);
+ this.stopWords = makeStopSet(stopWords);
}
/**
@@ -84,16 +84,16 @@
*/
public StopFilter(TokenStream in, Hashtable stopTable) {
super(in);
- table = stopTable.keySet();
+ stopWords = new HashSet(stopTable.keySet());
}
/**
* Constructs a filter which removes words from the input
* TokenStream that are named in the Set.
*/
- public StopFilter(TokenStream in, Set stopTable) {
+ public StopFilter(TokenStream in, Set stopWords) {
super(in);
- table = stopTable;
+ this.stopWords = new HashSet(stopWords);
}
/**
@@ -114,7 +114,7 @@
/**
* Builds a Set from an array of stop words,
* appropriate for passing into the StopFilter constructor.
- * This permits this table construction to be cached once when
+ * This permits this stopWords construction to be cached once when
* an Analyzer is constructed.
*/
public static final Set makeStopSet(String[] stopWords) {
@@ -130,7 +130,7 @@
public final Token next() throws IOException {
// return the first non-stop word found
for (Token token = input.next(); token != null; token = input.next())
- if (!table.contains(token.termText))
+ if (!stopWords.contains(token.termText))
return token;
// reached EOS -- return null
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
|