public class RenameAttribute extends SimpleStreamFilter implements WeightedInstancesHandler, WeightedAttributesHandler
-find <regexp> The regular expression that the attribute names must match. (default: ([\s\S]+))
-replace <string> The string to replace the regular expression of matching attributes with. Cannot be used in conjunction with '-remove'. (default: $0)
-remove In case the matching string needs to be removed instead of replaced. Cannot be used in conjunction with '-replace <string>'. (default: off)
-all Replaces all occurrences instead of just the first. (default: only first occurrence)
-R <range> The attribute range to work on. This is a comma separated list of attribute indices, with "first" and "last" valid values. Specify an inclusive range with "-". E.g: "first-3,5,6-10,last". (default: first-last)
-V Inverts the attribute selection range. (default: off)
| Modifier and Type | Field and Description |
|---|---|
protected Range |
m_AttributeIndices
the attribute range to work on.
|
protected java.lang.String |
m_Find
the regular expression that the attribute names have to match.
|
protected java.lang.String |
m_Replace
the regular expression to replace the attribute name with.
|
protected boolean |
m_ReplaceAll
whether to replace all occurrences or just the first.
|
m_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
RenameAttribute() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
attributeIndicesTipText()
Returns the tip text for this property.
|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based on the input format and returns this.
|
java.lang.String |
findTipText()
Returns the tip text for this property.
|
java.lang.String |
getAttributeIndices()
Gets the current range selection.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
java.lang.String |
getFind()
Returns the current regular expression for .
|
boolean |
getInvertSelection()
Gets whether to invert the selection of the attributes.
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter.
|
java.lang.String |
getReplace()
Returns the regular expression to replace matching attribute names with.
|
boolean |
getReplaceAll()
Returns whether all occurrences are replaced or just the first one.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
globalInfo()
Returns a string describing this filter.
|
java.lang.String |
invertSelectionTipText()
Returns the tip text for this property.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
Main method for executing this filter.
|
protected Instance |
process(Instance instance)
processes the given instance (may change the provided instance) and returns
the modified version.
|
java.lang.String |
replaceAllTipText()
Returns the tip text for this property.
|
java.lang.String |
replaceTipText()
Returns the tip text for this property.
|
void |
setAttributeIndices(java.lang.String value)
Sets which attributes are to be acted on.
|
void |
setFind(java.lang.String value)
Sets the regular expression that the attribute names must match.
|
void |
setInvertSelection(boolean value)
Sets whether to invert the selection of the attributes.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setReplace(java.lang.String value)
Sets the regular expression to replace matching attribute names with.
|
void |
setReplaceAll(boolean value)
Sets whether to replace all occurrences or just the first one.
|
batchFinished, hasImmediateOutputFormat, input, preprocess, processreset, setInputFormatbatchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapperprotected java.lang.String m_Find
protected java.lang.String m_Replace
protected Range m_AttributeIndices
protected boolean m_ReplaceAll
public java.lang.String globalInfo()
globalInfo in class SimpleFilterpublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Filterpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-find <regexp> The regular expression that the attribute names must match. (default: ([\s\S]+))
-replace <string> The string to replace the regular expression of matching attributes with. Cannot be used in conjunction with '-remove'. (default: $0)
-remove In case the matching string needs to be removed instead of replaced. Cannot be used in conjunction with '-replace <string>'. (default: off)
-all Replaces all occurrences instead of just the first. (default: only first occurrence)
-R <range> The attribute range to work on. This is a comma separated list of attribute indices, with "first" and "last" valid values. Specify an inclusive range with "-". E.g: "first-3,5,6-10,last". (default: first-last)
-V Inverts the attribute selection range. (default: off)
setOptions in interface OptionHandlersetOptions in class Filteroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Filterpublic void setFind(java.lang.String value)
value - the regular expressionpublic java.lang.String getFind()
public java.lang.String findTipText()
public void setReplace(java.lang.String value)
value - the regular expressionpublic java.lang.String getReplace()
public java.lang.String replaceTipText()
public void setReplaceAll(boolean value)
value - if true then all occurrences are replacepublic boolean getReplaceAll()
public java.lang.String replaceAllTipText()
public void setAttributeIndices(java.lang.String value)
value - a string representing the list of attributes. Since the string
will typically come from a user, attributes are indexed from1. public java.lang.String getAttributeIndices()
public java.lang.String attributeIndicesTipText()
public void setInvertSelection(boolean value)
value - if true then the selection is invertedpublic boolean getInvertSelection()
public java.lang.String invertSelectionTipText()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiesprotected Instances determineOutputFormat(Instances inputFormat) throws java.lang.Exception
determineOutputFormat in class SimpleStreamFilterinputFormat - the input format to base the output format onjava.lang.Exception - in case the determination goes wrongSimpleStreamFilter.hasImmediateOutputFormat(),
SimpleStreamFilter.batchFinished(),
SimpleStreamFilter.preprocess(Instances)protected Instance process(Instance instance) throws java.lang.Exception
process in class SimpleStreamFilterinstance - the instance to processjava.lang.Exception - in case the processing goes wrongpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(java.lang.String[] args)
args - the arguments to the filter: use -h for help