edu.stanford.nlp.process
Class Stemmer

java.lang.Object
  |
  +--edu.stanford.nlp.process.Stemmer

public class Stemmer
extends Object

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 Summary
Stemmer()
           
 
Method Summary
 Object apply(Object word)
          Stems word (which must be a Word, or else a ClassCastException will be thrown, and returns stemmed Word.
static void main(String[] args)
          Test program for demonstrating the Stemmer.
 String stem(String s)
          Stems s and returns stemmed String.
 Word stem(Word w)
          Stems w and returns stemmed Word.
 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
 

Constructor Detail

Stemmer

public Stemmer()
Method Detail

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.)

Overrides:
toString in class Object

main

public static void main(String[] args)
Test program for demonstrating the Stemmer. It reads text from a a list of files, stems each word, and writes the result to standard output. Note that the word stemmed is expected to be in lower case: forcing lower case must be done outside the Stemmer class. Usage: Stemmer file-name file-name ...


stem

public String stem(String s)
Stems s and returns stemmed String.


stem

public Word stem(Word w)
Stems w and returns stemmed Word.


apply

public Object apply(Object word)
Stems word (which must be a Word, or else a ClassCastException will be thrown, and returns stemmed Word.



Stanford NLP Group