Jacson

de.spieleck.app.lang
Class StemmerEN

java.lang.Object
  extended byde.spieleck.app.lang.StemmerEN
All Implemented Interfaces:
Stemmer

public class StemmerEN
extends java.lang.Object
implements Stemmer

Stemmer, implementing the Porter Stemming Algorithm The Stemmer class transforms a word into its root form. The input word can be provided a character at time (by calling add()), or at once by calling one of the various stem(something) methods.

Version:
taken by fsn
Author:
lucene-dev, fsn

Field Summary
static java.lang.String NORM_AL
           
static java.lang.String NORM_ATE
           
static java.lang.String NORM_BLE
           
static java.lang.String NORM_IC
           
static java.lang.String NORM_IZE
           
 
Constructor Summary
StemmerEN()
           
 
Method Summary
 void add(char ch)
          Add a character to the word being stemmed.
 char[] getResultBuffer()
          Returns a reference to a character buffer containing the results of the stemming process.
 int getResultLength()
          Returns the length of the word resulting from the stemming process.
static void main(java.lang.String[] args)
          Test program for demonstrating the Stemmer.
 void reset()
          reset() resets the stemmer so it can stem another word.
 boolean stem()
          Stem the word placed into the Stemmer buffer through calls to add().
 boolean stem(char[] word)
          Stem a word contained in a char[].
 boolean stem(char[] word, int wordLen)
          Stem a word contained in a leading portion of a char[] array.
 boolean stem(char[] wordBuffer, int offset, int wordLen)
          Stem a word contained in a portion of a char[] array.
 boolean stem(int i0)
           
 java.lang.String stem(java.lang.String s)
          Stem a word provided as a String.
 java.lang.String toString()
          After a word has been stemmed, it can be retrieved by toString(), or a reference to the internal buffer can be retrieved by getResultBuffer and getResultLength (which is generally more efficient.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORM_ATE

public static final java.lang.String NORM_ATE
See Also:
Constant Field Values

NORM_BLE

public static final java.lang.String NORM_BLE
See Also:
Constant Field Values

NORM_IZE

public static final java.lang.String NORM_IZE
See Also:
Constant Field Values

NORM_AL

public static final java.lang.String NORM_AL
See Also:
Constant Field Values

NORM_IC

public static final java.lang.String NORM_IC
See Also:
Constant Field Values
Constructor Detail

StemmerEN

public StemmerEN()
Method Detail

reset

public void reset()
reset() resets the stemmer so it can stem another word. If you invoke the stemmer by calling add(char) and then stem(), you must call reset() before starting another word.


add

public void add(char ch)
Add a character to the word being stemmed. When you are finished adding characters, you can call stem(void) to process the word.


toString

public java.lang.String toString()
After a word has been stemmed, it can be retrieved by toString(), or a reference to the internal buffer can be retrieved by getResultBuffer and getResultLength (which is generally more efficient.)


getResultLength

public int getResultLength()
Returns the length of the word resulting from the stemming process.


getResultBuffer

public char[] getResultBuffer()
Returns a reference to a character buffer containing the results of the stemming process. You also need to consult getResultLength() to determine the length of the result.


stem

public java.lang.String stem(java.lang.String s)
Stem a word provided as a String. Returns the result as a String.

Specified by:
stem in interface Stemmer

stem

public boolean stem(char[] word)
Stem a word contained in a char[]. Returns true if the stemming process resulted in a word different from the input. You can retrieve the result with getResultLength()/getResultBuffer() or toString().


stem

public boolean stem(char[] wordBuffer,
                    int offset,
                    int wordLen)
Stem a word contained in a portion of a char[] array. Returns true if the stemming process resulted in a word different from the input. You can retrieve the result with getResultLength()/getResultBuffer() or toString().


stem

public boolean stem(char[] word,
                    int wordLen)
Stem a word contained in a leading portion of a char[] array. Returns true if the stemming process resulted in a word different from the input. You can retrieve the result with getResultLength()/getResultBuffer() or toString().


stem

public boolean stem()
Stem the word placed into the Stemmer buffer through calls to add(). Returns true if the stemming process resulted in a word different from the input. You can retrieve the result with getResultLength()/getResultBuffer() or toString().


stem

public boolean stem(int i0)

main

public static void main(java.lang.String[] args)
Test program for demonstrating the Stemmer. It reads a file and stems each word, writing the result to standard out. Usage: Stemmer file-name


Spieleck

Copyleft 2002 spieleck.de.