Class PorterStemmer
- java.lang.Object
-
- smile.nlp.stemmer.PorterStemmer
-
- All Implemented Interfaces:
- Stemmer
public class PorterStemmer extends java.lang.Object implements Stemmer
Porter's stemming algorithm. The stemmer is based on the idea that the suffixes in the English language are mostly made up of a combination of smaller and simpler suffixes. This is a linear step stemmer. Specifically it has five steps applying rules within each step. Within each step, if a suffix rule matched to a word, then the conditions attached to that rule are tested on what would be the resulting stem, if that suffix was removed, in the way defined by the rule. Once a Rule passes its conditions and is accepted the rule fires and the suffix is removed and control moves to the next step. If the rule is not accepted then the next rule in the step is tested, until either a rule from that step fires and control passes to the next step or there are no more rules in that step whence control moves to the next step. For details, seeMartin Porter, An algorithm for suffix stripping, Program, 14(3), 130-137, 1980.
Note that this class is NOT multi-thread safe. The code is based on http://www.tartarus.org/~martin/PorterStemmer History: Release 1 Bug 1 (reported by Gonzalo Parra 16/10/99) fixed as marked below. The words 'aed', 'eed', 'oed' leave k at 'a' for step 3, and b[k-1] is then out outside the bounds of b. Release 2 Similarly, Bug 2 (reported by Steve Dyrdahl 22/2/00) fixed as marked below. 'ion' by itself leaves j = -1 in the test for 'ion' in step 5, and b[j] is then outside the bounds of b. Release 3 Considerably revised 4/9/00 in the light of many helpful suggestions from Brian Goetz of Quiotix Corporation (brian@quiotix.com). Release 4
-
-
Constructor Summary
Constructors Constructor and Description PorterStemmer()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Stringstem(java.lang.String word)Transforms a word into its root form.java.lang.StringstripPluralParticiple(java.lang.String word)Remove plurals and participles.
-
-
-
Method Detail
-
stem
public java.lang.String stem(java.lang.String word)
Description copied from interface:StemmerTransforms a word into its root form.
-
stripPluralParticiple
public java.lang.String stripPluralParticiple(java.lang.String word)
Remove plurals and participles.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG