mirror of https://github.com/apache/lucene.git
Improved javadoc for Snowball stemmer code.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
88f7c967bd
commit
c2340adae8
|
@ -27,8 +27,6 @@
|
|||
<!-- Stuff needed by all targets -->
|
||||
<!-- ====================================================== -->
|
||||
<target name="init">
|
||||
<mkdir dir="${bin.dir}"/>
|
||||
|
||||
<mkdir dir="${build.dir}"/>
|
||||
<mkdir dir="${build.classes}"/>
|
||||
|
||||
|
@ -134,7 +132,7 @@
|
|||
<javadoc
|
||||
sourcepath="${src.dir}"
|
||||
overview="${src.dir}/overview.html"
|
||||
packagenames="${javadoc.packages}"
|
||||
packagenames="*"
|
||||
destdir="${build.javadoc}"
|
||||
author="true"
|
||||
version="true"
|
||||
|
|
|
@ -14,7 +14,6 @@ test.build.classes = ${test.build.dir}/classes
|
|||
|
||||
javadoc.link.java=http://java.sun.com/j2se/1.4.1/docs/api/
|
||||
javadoc.link.lucene=http://jakarta.apache.org/lucene/docs/api/
|
||||
javadoc.packages=org.apache.lucene.analysis.snowball.*
|
||||
|
||||
snowball.cvsroot=:pserver:cvsuser@cvs.tartarus.org:/home/cvs
|
||||
snowball.root=snowball/website
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
Snowball generated stemmer classes.
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
Snowball system classes.
|
||||
</body>
|
||||
</html>
|
|
@ -57,23 +57,30 @@ package org.apache.lucene.analysis.snowball;
|
|||
import org.apache.lucene.analysis.*;
|
||||
import org.apache.lucene.analysis.standard.*;
|
||||
|
||||
import net.sf.snowball.ext.*;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Hashtable;
|
||||
|
||||
/** Filters {@link StandardTokenizer} with {@link StandardFilter}, {@link
|
||||
* LowerCaseFilter}, {@link SnowballFilter} and {@link StopFilter}. */
|
||||
* LowerCaseFilter}, {@link StopFilter} and {@link SnowballFilter}.
|
||||
*
|
||||
* Available stemmers are listed in {@link net.sf.snowball.ext}. The name of a
|
||||
* stemmer is the part of the class name before "Stemmer", e.g., the stemmer in
|
||||
* {@link EnglishStemmer} is named "English".
|
||||
*/
|
||||
public class SnowballAnalyzer extends Analyzer {
|
||||
private String language;
|
||||
private String name;
|
||||
private Hashtable stopTable;
|
||||
|
||||
/** Builds an analyzer with the given stop words. */
|
||||
public SnowballAnalyzer(String language) {
|
||||
this.language = language;
|
||||
/** Builds the named analyzer with no stop words. */
|
||||
public SnowballAnalyzer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** Builds an analyzer with the given stop words. */
|
||||
public SnowballAnalyzer(String language, String[] stopWords) {
|
||||
this(language);
|
||||
/** Builds the named analyzer with the given stop words. */
|
||||
public SnowballAnalyzer(String name, String[] stopWords) {
|
||||
this(name);
|
||||
stopTable = StopFilter.makeStopTable(stopWords);
|
||||
}
|
||||
|
||||
|
@ -85,7 +92,7 @@ public class SnowballAnalyzer extends Analyzer {
|
|||
result = new LowerCaseFilter(result);
|
||||
if (stopTable != null)
|
||||
result = new StopFilter(result, stopTable);
|
||||
result = new SnowballFilter(result, language);
|
||||
result = new SnowballFilter(result, name);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,13 +59,18 @@ import java.io.IOException;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import net.sf.snowball.SnowballProgram;
|
||||
import net.sf.snowball.ext.*;
|
||||
|
||||
import org.apache.lucene.analysis.Token;
|
||||
import org.apache.lucene.analysis.TokenFilter;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
|
||||
/**
|
||||
*/
|
||||
/** A filter that stems words using a Snowball-generated stemmer.
|
||||
*
|
||||
* Available stemmers are listed in {@link net.sf.snowball.ext}. The name of a
|
||||
* stemmer is the part of the class name before "Stemmer", e.g., the stemmer in
|
||||
* {@link EnglishStemmer} is named "English".
|
||||
*/
|
||||
|
||||
public class SnowballFilter extends TokenFilter {
|
||||
private static final Object [] EMPTY_ARGS = new Object[0];
|
||||
|
@ -73,11 +78,16 @@ public class SnowballFilter extends TokenFilter {
|
|||
private SnowballProgram stemmer;
|
||||
private Method stemMethod;
|
||||
|
||||
public SnowballFilter(TokenStream in, String language) {
|
||||
/** Construct the named stemming filter.
|
||||
*
|
||||
* @param in the input tokens to stem
|
||||
* @param in the name of a stemmer
|
||||
*/
|
||||
public SnowballFilter(TokenStream in, String name) {
|
||||
this.input = in;
|
||||
try {
|
||||
Class stemClass =
|
||||
Class.forName("net.sf.snowball.ext." + language + "Stemmer");
|
||||
Class.forName("net.sf.snowball.ext." + name + "Stemmer");
|
||||
stemmer = (SnowballProgram) stemClass.newInstance();
|
||||
stemMethod = stemClass.getMethod("stem", new Class[0]);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
Lucene analyzer that uses Snowball stemmers.
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
Snowball stemmers for Lucene
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue