Class GroupExpression
- java.lang.Object
-
- weka.filters.unsupervised.instance.multirowprocessor.AbstractMultiRowProcessorPlugin
-
- weka.filters.unsupervised.instance.multirowprocessor.selection.AbstractRowSelection
-
- weka.filters.unsupervised.instance.multirowprocessor.selection.GroupExpression
-
- All Implemented Interfaces:
adams.core.GlobalInfoSupporter
,Serializable
,weka.core.OptionHandler
public class GroupExpression extends AbstractRowSelection
Identifies groups in strings using regular expressions. If the group attribute is numeric, then the values get turned into strings first.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_GROUP
protected static String
GROUP
protected static String
INDEX
protected String
m_Group
the group expression.protected WekaAttributeIndex
m_Index
the index to use for grouping.protected adams.core.base.BaseRegExp
m_RegExp
the regular expression for the nominal/string attribute.protected static String
REGEXP
-
Fields inherited from class weka.filters.unsupervised.instance.multirowprocessor.AbstractMultiRowProcessorPlugin
DEBUG, m_Debug
-
-
Constructor Summary
Constructors Constructor Description GroupExpression()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<int[]>
doSelectRows(weka.core.Instances data)
Returns the list of row indices generated from the data.protected WekaAttributeIndex
getDefaultIndex()
Returns the default index.protected adams.core.base.BaseRegExp
getDefaultRegExp()
Returns the default regular expression.String
getGroup()
Returns the replacement string to use as group (eg '$2').WekaAttributeIndex
getIndex()
Returns the attribute index to use for grouping.String[]
getOptions()
Gets the current settings of the classifier.adams.core.base.BaseRegExp
getRegExp()
Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').String
globalInfo()
Returns a string describing the row selection scheme.String
groupTipText()
Returns the tip text for this property.String
indexTipText()
Returns the tip text for this property.Enumeration
listOptions()
Returns an enumeration describing the available options.String
regExpTipText()
Returns the tip text for this property.void
setGroup(String value)
Sets the replacement string to use as group (eg '$2').void
setIndex(WekaAttributeIndex value)
Sets the attribute index to use for grouping.void
setOptions(String[] options)
Parses a given list of options.void
setRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').-
Methods inherited from class weka.filters.unsupervised.instance.multirowprocessor.selection.AbstractRowSelection
check, selectRows
-
Methods inherited from class weka.filters.unsupervised.instance.multirowprocessor.AbstractMultiRowProcessorPlugin
debugMsg, debugTipText, getDebug, reset, setDebug
-
-
-
-
Field Detail
-
INDEX
protected static String INDEX
-
m_Index
protected WekaAttributeIndex m_Index
the index to use for grouping.
-
REGEXP
protected static String REGEXP
-
m_RegExp
protected adams.core.base.BaseRegExp m_RegExp
the regular expression for the nominal/string attribute.
-
GROUP
protected static String GROUP
-
DEFAULT_GROUP
public static final String DEFAULT_GROUP
- See Also:
- Constant Field Values
-
m_Group
protected String m_Group
the group expression.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the row selection scheme.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractMultiRowProcessorPlugin
- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classAbstractMultiRowProcessorPlugin
- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options.- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classAbstractMultiRowProcessorPlugin
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classAbstractMultiRowProcessorPlugin
- Returns:
- an array of strings suitable for passing to setOptions
-
getDefaultIndex
protected WekaAttributeIndex getDefaultIndex()
Returns the default index.- Returns:
- the default index
-
setIndex
public void setIndex(WekaAttributeIndex value)
Sets the attribute index to use for grouping.- Parameters:
value
- the index
-
getIndex
public WekaAttributeIndex getIndex()
Returns the attribute index to use for grouping.- Returns:
- the index
-
indexTipText
public String indexTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultRegExp
protected adams.core.base.BaseRegExp getDefaultRegExp()
Returns the default regular expression.- Returns:
- the default
-
setRegExp
public void setRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').- Parameters:
value
- the expression
-
getRegExp
public adams.core.base.BaseRegExp getRegExp()
Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').- Returns:
- the expression
-
regExpTipText
public String regExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGroup
public void setGroup(String value)
Sets the replacement string to use as group (eg '$2').- Parameters:
value
- the group
-
getGroup
public String getGroup()
Returns the replacement string to use as group (eg '$2').- Returns:
- the group
-
groupTipText
public String groupTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
doSelectRows
protected List<int[]> doSelectRows(weka.core.Instances data) throws Exception
Returns the list of row indices generated from the data.- Specified by:
doSelectRows
in classAbstractRowSelection
- Parameters:
data
- the data to generate row selections from- Returns:
- the list of selections
- Throws:
Exception
- if checks or selection failed
-
-