package morphology.parser; /** * Encapsulation of noun stem features. * * Project: NGSLT --> NLP --> Words --> Assignment #1 * @author Normunds Grūzītis, Gunta Nešpore, Baiba Saulīte * @date February 2006 */ public class NounStemFeature extends StemFeature { private String pos; private String decl; /** * Constructor. * @param pos part-of-speech. * @param decl declension. */ public NounStemFeature(String pos, String decl) { this.pos = pos; this.decl = decl; } /** * Gets part-of-speech of the stem. * @return POS code (e.g., 'N'). */ public String getPOS() { return pos; } /** * Gets inflectional paradigm of the stem. * @return code of the paradigm (e.g., 'D1', 'D2'). */ public String getParadigm() { return decl; } /** * Indicates whether some other feature is equal by content to this one. * @param obj the reference object with which to compare. * @return true if this feature is the same as the argument; false otherwise. */ public boolean equals(Object obj) { boolean isEqual = false; if (obj instanceof NounStemFeature) { NounStemFeature feature = (NounStemFeature)obj; if (feature.getPOS().equals(pos) && feature.getParadigm().equals(decl)) isEqual = true; } return isEqual; } /** * Gives string representation of this feature object. * @return feature string. */ public String toString() { return pos + " " + decl; } }