lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r168970 - in /lucene/java/trunk/src/java/org/apache/lucene/analysis: StopAnalyzer.java standard/StandardAnalyzer.java
Date Fri, 06 May 2005 22:28:53 GMT
Author: dnaber
Date: Fri May  6 15:28:52 2005
New Revision: 168970

URL: http://svn.apache.org/viewcvs?rev=168970&view=rev
Log:
convenience constructors that load list of stop words from a file

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/analysis/StopAnalyzer.java
    lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/StopAnalyzer.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/analysis/StopAnalyzer.java?rev=168970&r1=168969&r2=168970&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/StopAnalyzer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/StopAnalyzer.java Fri May  6 15:28:52
2005
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
 import java.io.Reader;
 import java.util.Set;
 
@@ -42,6 +44,11 @@
   /** Builds an analyzer which removes words in the provided array. */
   public StopAnalyzer(String[] stopWords) {
     this.stopWords = StopFilter.makeStopSet(stopWords);
+  }
+  
+  /** Builds an analyzer with the stop words from the given file. */
+  public StopAnalyzer(File stopwordsFile) throws IOException {
+    stopWords = WordlistLoader.getWordSet(stopwordsFile);
   }
 
   /** Filters LowerCaseTokenizer with StopFilter. */

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java?rev=168970&r1=168969&r2=168970&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/standard/StandardAnalyzer.java Fri
May  6 15:28:52 2005
@@ -17,6 +17,9 @@
  */
 
 import org.apache.lucene.analysis.*;
+
+import java.io.File;
+import java.io.IOException;
 import java.io.Reader;
 import java.util.Set;
 
@@ -41,6 +44,11 @@
   /** Builds an analyzer with the given stop words. */
   public StandardAnalyzer(String[] stopWords) {
     stopSet = StopFilter.makeStopSet(stopWords);
+  }
+
+  /** Builds an analyzer with the stop words from the given file. */
+  public StandardAnalyzer(File stopwords) throws IOException {
+    stopSet = WordlistLoader.getWordSet(stopwords);
   }
 
   /** Constructs a {@link StandardTokenizer} filtered by a {@link



Mime
View raw message