|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.utils.Stemmer
Stemmer, implementing the Porter Stemming Algorithm enhanced to give more accurate stems and variations as well.
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 | |
void |
add(char ch)
Add a character to the word being stemmed. |
void |
add(char[] w,
int wLen)
Adds wLen characters to the word being stemmed contained in a portion of a char[] array. |
static java.lang.String |
comparative(java.lang.String s)
comparative returns the comparative form -er Comparative tall + er |
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. |
java.util.Set |
getStemVariants(java.lang.String term)
Stem the word placed into the Stemmer buffer through calls to add(). |
java.util.Set |
getStemVariants(java.lang.String term,
boolean includeTerm)
|
java.lang.String |
getStemVariants(java.lang.String term,
java.lang.String delimiter)
Stem the word placed into the Stemmer buffer through calls to add(). |
static java.lang.String[] |
irregularPast(java.lang.String s)
irregularPast returns the irregular past tense(s) of a word |
static java.lang.String |
irregularPlural(java.lang.String s)
|
static java.lang.String |
irregularSingular(java.lang.String s)
|
static boolean |
isPlural(java.lang.String s)
|
static void |
main(java.lang.String[] args)
Test program for demonstrating the Stemmer. |
static java.lang.String |
past(java.lang.String s)
past returns the past tense of a word -ed Past walk + ed |
static java.lang.String |
plural(java.lang.String s)
plural returns the plural form of a word -s Plural dog + s -s 3rd sing Present sing + s |
static java.lang.String |
progressive(java.lang.String s)
progressive returns the progressive form -ing Progressive say + ing |
static java.lang.String |
singular(java.lang.String s)
|
void |
stem()
Stem the word placed into the Stemmer buffer through calls to add(). |
static java.lang.String[] |
stemPhrase(java.lang.String phrase)
|
static java.lang.String |
stemWord(java.lang.String word)
|
static java.lang.String |
superlative(java.lang.String s)
superlative returns the mostest form -est Superlative |
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 |
| Constructor Detail |
public Stemmer()
| Method Detail |
public static java.lang.String stemWord(java.lang.String word)
public static java.lang.String[] stemPhrase(java.lang.String phrase)
public void add(char ch)
public void add(char[] w,
int wLen)
public java.lang.String toString()
public int getResultLength()
public char[] getResultBuffer()
public java.util.Set getStemVariants(java.lang.String term)
public java.util.Set getStemVariants(java.lang.String term,
boolean includeTerm)
public java.lang.String getStemVariants(java.lang.String term,
java.lang.String delimiter)
public void stem()
public static java.lang.String plural(java.lang.String s)
public static boolean isPlural(java.lang.String s)
public static java.lang.String singular(java.lang.String s)
public static java.lang.String past(java.lang.String s)
public static java.lang.String[] irregularPast(java.lang.String s)
public static java.lang.String irregularPlural(java.lang.String s)
public static java.lang.String irregularSingular(java.lang.String s)
public static java.lang.String progressive(java.lang.String s)
public static java.lang.String comparative(java.lang.String s)
public static java.lang.String superlative(java.lang.String s)
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||