gate.creole.ml.weka
Class StringToNominalFilter

java.lang.Object
  extended byweka.filters.Filter
      extended bygate.creole.ml.weka.StringToNominalFilter
All Implemented Interfaces:
weka.core.OptionHandler, Serializable

public class StringToNominalFilter
extends weka.filters.Filter
implements weka.core.OptionHandler

This filter converts one or more string attributes from the input dataset into nominal attributes.

See Also:
Serialized Form

Field Summary
static String FREQUENCY
          Constant for conversion method.
static String TFIDF
          Constant for conversion method.
 
Constructor Summary
StringToNominalFilter()
          Anonymous constructor.
 
Method Summary
 boolean batchFinished()
          Signifies that this batch of input to the filter is finished.
 String[] getOptions()
           
 boolean input(weka.core.Instance instance)
          Input an instance for filtering.
 Enumeration listOptions()
           
static void main(String[] args)
           
 boolean setInputFormat(weka.core.Instances instanceInfo)
          Sets the format of the input instances.
 void setOptions(String[] options)
           
 
Methods inherited from class weka.filters.Filter
batchFilterFile, filterFile, getOutputFormat, inputFormat, isOutputFormatDefined, numPendingOutput, output, outputFormat, outputPeek, useFilter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREQUENCY

public static final String FREQUENCY
Constant for conversion method.

See Also:
Constant Field Values

TFIDF

public static final String TFIDF
Constant for conversion method.

See Also:
Constant Field Values
Constructor Detail

StringToNominalFilter

public StringToNominalFilter()
Anonymous constructor.

Method Detail

setInputFormat

public boolean setInputFormat(weka.core.Instances instanceInfo)
                       throws Exception
Sets the format of the input instances.

Parameters:
instanceInfo - an Instances object containing the input instance structure (any instances contained in the object are ignored - only the structure is required).
Returns:
false as this filter needs to see all the instances before being able to convert the input.
Throws:
weka.core.UnsupportedAttributeTypeException - if the selected attribute is not a string attribute.
Exception

input

public boolean input(weka.core.Instance instance)
Input an instance for filtering. The instance is processed and made available for output immediately.

Parameters:
instance - the input instance.
Returns:
true if the filtered instance may now be collected with output().
Throws:
IllegalStateException - if no input structure has been defined.

batchFinished

public boolean batchFinished()
Signifies that this batch of input to the filter is finished. If the filter requires all instances prior to filtering, output() may now be called to retrieve the filtered instances.

Returns:
true if there are instances pending output.
Throws:
IllegalStateException - if no input structure has been defined.

main

public static void main(String[] args)

listOptions

public Enumeration listOptions()
Specified by:
listOptions in interface weka.core.OptionHandler

setOptions

public void setOptions(String[] options)
                throws Exception
Specified by:
setOptions in interface weka.core.OptionHandler
Throws:
Exception

getOptions

public String[] getOptions()
Specified by:
getOptions in interface weka.core.OptionHandler