edu.stanford.nlp.international.morph
Class MorphoFeatures

java.lang.Object
  extended by edu.stanford.nlp.international.morph.MorphoFeatures
All Implemented Interfaces:
java.io.Serializable

public class MorphoFeatures
extends java.lang.Object
implements java.io.Serializable

Holds a set of morphosyntactic features for a given surface form

Author:
Spence Green
See Also:
Serialized Form

Field Summary
protected  java.lang.String altTag
           
protected  java.util.Map<MorphoFeatureSpecification.MorphoFeatureType,java.lang.String> fSpec
           
static java.lang.String KEY_VAL_DELIM
           
 
Constructor Summary
MorphoFeatures()
           
MorphoFeatures(MorphoFeatures other)
           
 
Method Summary
 void addFeature(MorphoFeatureSpecification.MorphoFeatureType feat, java.lang.String val)
           
 MorphoFeatures fromTagString(java.lang.String str)
          Assumes that the tag string has been formed using a call to getTag().
 java.lang.String getAltTag()
          An alternate tag form than the one produced by getTag().
 java.lang.String getTag(java.lang.String baseTag)
          Build a POS tag consisting of a base category plus inflectional features.
 java.lang.String getValue(MorphoFeatureSpecification.MorphoFeatureType feat)
           
 boolean hasFeature(MorphoFeatureSpecification.MorphoFeatureType feat)
           
 int numActiveFeatures()
           
 int numFeatureMatches(MorphoFeatures other)
           
 void setAltTag(java.lang.String tag)
           
 java.lang.String toString()
          values() returns the values in the order in which they are declared.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_VAL_DELIM

public static final java.lang.String KEY_VAL_DELIM
See Also:
Constant Field Values

fSpec

protected final java.util.Map<MorphoFeatureSpecification.MorphoFeatureType,java.lang.String> fSpec

altTag

protected java.lang.String altTag
Constructor Detail

MorphoFeatures

public MorphoFeatures()

MorphoFeatures

public MorphoFeatures(MorphoFeatures other)
Method Detail

addFeature

public void addFeature(MorphoFeatureSpecification.MorphoFeatureType feat,
                       java.lang.String val)

hasFeature

public boolean hasFeature(MorphoFeatureSpecification.MorphoFeatureType feat)

getValue

public java.lang.String getValue(MorphoFeatureSpecification.MorphoFeatureType feat)

numFeatureMatches

public int numFeatureMatches(MorphoFeatures other)

numActiveFeatures

public int numActiveFeatures()

getTag

public java.lang.String getTag(java.lang.String baseTag)
Build a POS tag consisting of a base category plus inflectional features.

Parameters:
baseTag -
Returns:
the tag

setAltTag

public void setAltTag(java.lang.String tag)

getAltTag

public java.lang.String getAltTag()
An alternate tag form than the one produced by getTag(). Subclasses may want to use this form to implement someone else's tagset (e.g., CC, ERTS, etc.)

Returns:
the tag

fromTagString

public MorphoFeatures fromTagString(java.lang.String str)
Assumes that the tag string has been formed using a call to getTag(). As such, it removes the basic category from the feature string.

Note that this method returns a new MorphoFeatures object. As a result, it behaves like a static method, but is non-static so that subclasses can override this method.

Parameters:
str -
Returns:

toString

public java.lang.String toString()
values() returns the values in the order in which they are declared. Thus we will not have the case where two feature types can yield two strings: -feat1:A-feat2:B -feat2:B-feat1:A

Overrides:
toString in class java.lang.Object


Stanford NLP Group