public class StemmingRule extends Object implements IStemmingRule
IStemmingRule interface.| Constructor and Description |
|---|
StemmingRule(String suffix,
String ending,
POS pos,
String... ignore)
Creates a new stemming rule with the specified suffix, ending, and
avoid set
|
| Modifier and Type | Method and Description |
|---|---|
String |
apply(String word)
Applies this rule to the given word.
|
String |
apply(String word,
String suffix)
Applies this rule to the given word, adding the specified suffix to the
end of the returned string.
|
String |
getEnding()
Returns the ending for this rule.
|
POS |
getPOS()
Returns the associated part of speech for this object.
|
String |
getSuffix()
Returns the suffix for this rule.
|
Set<String> |
getSuffixIgnoreSet()
Returns the set of suffixes that should be ignored when applying this
stemming rule.
|
public StemmingRule(String suffix, String ending, POS pos, String... ignore)
suffix - the suffix that should be stripped from a word; should not
be null, empty, or all whitespace.ending - the ending that should be stripped from a word; should not
be null, but may be empty or all whitespace.pos - the part of speech to which this rule applies, may not be
nullignore - the set of suffixes that, when present, indicate this rule
should not be applied. May be null or empty, but not
contain nulls or empties.NullPointerException - if the suffix, ending, or pos are null, or the ignore set
contains nullNullPointerException - if the suffix is empty or all whitespace, or the ignore
set contains a string which is empty or all whitespacepublic String getSuffix()
IStemmingRulenull,
empty, or all whitespace.getSuffix in interface IStemmingRulepublic String getEnding()
IStemmingRulenull ,
empty, or all whitespace.getEnding in interface IStemmingRulepublic Set<String> getSuffixIgnoreSet()
IStemmingRulenull, but it
may return an empty set. The ignore set will not include the string
returned by IStemmingRule.getSuffix().getSuffixIgnoreSet in interface IStemmingRulenull but possibly empty set of suffixes to be
ignoredpublic POS getPOS()
IHasPOSnull.public String apply(String word)
IStemmingRulenull, but may be empty. If the rule cannot be applied to the
word, this method returns null. This call is equivalent to
calling IStemmingRule.apply(String, String) with null as the
second argumentapply in interface IStemmingRuleword - the word to which the stemming rule should be applied.null if the rule cannot be
applied to this wordpublic String apply(String word, String suffix)
IStemmingRulenull.apply in interface IStemmingRuleword - the word to which the stemming rule should be applied.suffix - a suffix that should be appended to the root once it has been
derived; may be null.null if the rule cannot be
applied to this wordCopyright © 2018. All rights reserved.