edu.cmu.minorthird.classify
Class ExampleSchema

java.lang.Object
  extended by edu.cmu.minorthird.classify.ExampleSchema
All Implemented Interfaces:
java.io.Serializable

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

Defines legal formats for examples. Currently this just checks that the class labels are in some legal set.

Author:
William Cohen
See Also:
Serialized Form

Field Summary
static ExampleSchema BINARY_EXAMPLE_SCHEMA
          Schema for binary examples.
static java.lang.String NEG_CLASS_NAME
           
static java.lang.String POS_CLASS_NAME
           
 
Constructor Summary
ExampleSchema(java.lang.String[] validClassNames)
          Create a new scheme with the given list of validClassNames
 
Method Summary
 boolean equals(java.lang.Object o)
           
 void extend(java.lang.String newClassName)
          Added extend method to extend the schema with new class label value
 int getClassIndex(java.lang.String name)
          Return index of this class name, or -1 if it's not valid.
 java.lang.String getClassName(int i)
          Return i-th valid class name.
 int getNumberOfClasses()
          Return number of valid class names
 boolean isValid(ClassLabel label)
          Determine if a ClassLabel is valid with respect to the schema.
 boolean isValid(Example e)
          Determine if an example is valid with respect to the schema.
 java.lang.String toString()
           
 java.lang.String[] validClassNames()
          Get an array of all valid class names.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POS_CLASS_NAME

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

NEG_CLASS_NAME

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

BINARY_EXAMPLE_SCHEMA

public static final ExampleSchema BINARY_EXAMPLE_SCHEMA
Schema for binary examples.

Constructor Detail

ExampleSchema

public ExampleSchema(java.lang.String[] validClassNames)
Create a new scheme with the given list of validClassNames

Method Detail

extend

public void extend(java.lang.String newClassName)
Added extend method to extend the schema with new class label value


validClassNames

public java.lang.String[] validClassNames()
Get an array of all valid class names.


getNumberOfClasses

public int getNumberOfClasses()
Return number of valid class names


getClassName

public java.lang.String getClassName(int i)
Return i-th valid class name.


getClassIndex

public int getClassIndex(java.lang.String name)
Return index of this class name, or -1 if it's not valid.


isValid

public boolean isValid(ClassLabel label)
Determine if a ClassLabel is valid with respect to the schema.


isValid

public boolean isValid(Example e)
Determine if an example is valid with respect to the schema.


equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

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