Save This Page
Home » lucene-2.3.2-src » org.apache » lucene » analysis » [javadoc | source]
org.apache.lucene.analysis
class: PorterStemmer [javadoc | source]
java.lang.Object
   org.apache.lucene.analysis.PorterStemmer
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.
Constructor:
 public PorterStemmer() 
Method from org.apache.lucene.analysis.PorterStemmer Summary:
add,   getResultBuffer,   getResultLength,   main,   r,   reset,   setto,   stem,   stem,   stem,   stem,   stem,   stem,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.analysis.PorterStemmer Detail:
 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.
 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.
 public int getResultLength() 
    Returns the length of the word resulting from the stemming process.
 public static  void main(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
  void r(String s) 
 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.
  void setto(String s) 
 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().
 public String stem(String s) 
    Stem a word provided as a String. Returns the result as a String.
 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().
 public boolean stem(int i0) 
 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().
 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().
 public 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.)