edu.cmu.minorthird.classify
Class Feature

java.lang.Object
  extended by edu.cmu.minorthird.classify.Feature
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Feature>

public class Feature
extends java.lang.Object
implements java.lang.Comparable<Feature>, java.io.Serializable

A name for a feature. Features are hierarchical, so names are structured: each name is an array of names from the heirarchy.

Author:
William Cohen
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
Feature(java.lang.String name)
          Create a feature.
Feature(java.lang.String[] name)
          Create a feature.
Feature(java.lang.String[] name, int id)
          Create a feature with its feature ID.
Feature(java.lang.String name, int id)
          Create a feature.
 
Method Summary
 int compareTo(Feature other)
          Implements Comparable
 boolean equals(java.lang.Object object)
          Overrides equals
 int getID()
           
 java.lang.String[] getName()
           
 java.lang.String getPart(int i)
           
 int hashCode()
           
 int numericName()
          This is used for algorithms which only support a vector of features (such as SVM).
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Feature

public Feature(java.lang.String[] name,
               int id)
Create a feature with its feature ID.


Feature

public Feature(java.lang.String[] name)
Create a feature.


Feature

public Feature(java.lang.String name,
               int id)
Create a feature. The parts of this name are delimited by periods.


Feature

public Feature(java.lang.String name)
Create a feature. The parts of this name are delimited by periods.

Method Detail

compareTo

public int compareTo(Feature other)
Implements Comparable

Specified by:
compareTo in interface java.lang.Comparable<Feature>

equals

public boolean equals(java.lang.Object object)
Overrides equals

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

size

public int size()

getPart

public java.lang.String getPart(int i)

getName

public java.lang.String[] getName()

getID

public int getID()

numericName

public int numericName()
This is used for algorithms which only support a vector of features (such as SVM). The Factory is used to map each feature to a integer in an increasing by 1 sequence. The Factory ensures that the same feature name gets the same number within a single run.

Returns:
id integer for the feature