mirror of https://github.com/apache/lucene.git
Caved in.... HashSet all the way around it is
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150228 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d7ce21934
commit
7ceae266c5
|
@ -57,7 +57,6 @@ package org.apache.lucene.analysis;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes stop words from a token stream.
|
* Removes stop words from a token stream.
|
||||||
|
@ -65,7 +64,7 @@ import java.util.Set;
|
||||||
|
|
||||||
public final class StopFilter extends TokenFilter {
|
public final class StopFilter extends TokenFilter {
|
||||||
|
|
||||||
private Set stopWords;
|
private HashSet stopWords;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a filter which removes words from the input
|
* Constructs a filter which removes words from the input
|
||||||
|
@ -80,7 +79,7 @@ public final class StopFilter extends TokenFilter {
|
||||||
* Constructs a filter which removes words from the input
|
* Constructs a filter which removes words from the input
|
||||||
* TokenStream that are named in the Hashtable.
|
* TokenStream that are named in the Hashtable.
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #StopFilter(TokenStream, Set)} StopFilter(TokenStream,Map)} instead
|
* @deprecated Use {@link #StopFilter(TokenStream, HashSet)} StopFilter(TokenStream,Map)} instead
|
||||||
*/
|
*/
|
||||||
public StopFilter(TokenStream in, Hashtable stopTable) {
|
public StopFilter(TokenStream in, Hashtable stopTable) {
|
||||||
super(in);
|
super(in);
|
||||||
|
@ -91,9 +90,9 @@ public final class StopFilter extends TokenFilter {
|
||||||
* Constructs a filter which removes words from the input
|
* Constructs a filter which removes words from the input
|
||||||
* TokenStream that are named in the Set.
|
* TokenStream that are named in the Set.
|
||||||
*/
|
*/
|
||||||
public StopFilter(TokenStream in, Set stopWords) {
|
public StopFilter(TokenStream in, HashSet stopWords) {
|
||||||
super(in);
|
super(in);
|
||||||
this.stopWords = new HashSet(stopWords);
|
this.stopWords = stopWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,8 +116,8 @@ public final class StopFilter extends TokenFilter {
|
||||||
* This permits this stopWords construction to be cached once when
|
* This permits this stopWords construction to be cached once when
|
||||||
* an Analyzer is constructed.
|
* an Analyzer is constructed.
|
||||||
*/
|
*/
|
||||||
public static final Set makeStopSet(String[] stopWords) {
|
public static final HashSet makeStopSet(String[] stopWords) {
|
||||||
Set stopTable = new HashSet(stopWords.length);
|
HashSet stopTable = new HashSet(stopWords.length);
|
||||||
for (int i = 0; i < stopWords.length; i++)
|
for (int i = 0; i < stopWords.length; i++)
|
||||||
stopTable.add(stopWords[i]);
|
stopTable.add(stopWords[i]);
|
||||||
return stopTable;
|
return stopTable;
|
||||||
|
|
Loading…
Reference in New Issue