public static class SubstringLabelerRules.SubstringLabelerMatchRule
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MATCH_PART_SEPARATOR
Separator for parts of the match specification
|
Constructor and Description |
---|
SubstringLabelerMatchRule()
Constructor
|
SubstringLabelerMatchRule(java.lang.String setup)
Constructor
|
SubstringLabelerMatchRule(java.lang.String match,
boolean regex,
boolean ignoreCase,
java.lang.String selectedAtts)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
apply(Instance inst)
Apply this rule to the supplied instance
|
java.lang.String |
getAttsToApplyTo()
Get the attributes to apply the rule to
|
boolean |
getIgnoreCase()
Get whether to ignore case when matching
|
java.lang.String |
getLabel()
Get the label to assign if this rule matches, or empty string if binary
flag attribute is being created.
|
java.lang.String |
getMatch()
Get the string/regex to use for matching
|
boolean |
getRegex()
Get whether this is a regular expression match or not
|
void |
init(Environment env,
Instances structure)
Initialize this match rule by substituting any environment variables in
the attributes, match and label strings.
|
void |
setAttsToApplyTo(java.lang.String a)
Set the attributes to apply the rule to
|
void |
setIgnoreCase(boolean ignore)
Set whether to ignore case when matching
|
void |
setLabel(java.lang.String label)
Set the label to assign if this rule matches, or empty string if binary
flag attribute is being created.
|
void |
setMatch(java.lang.String match)
Set the string/regex to use for matching
|
void |
setRegex(boolean regex)
Set whether this is a regular expression match or not
|
java.lang.String |
toString()
Return a textual description of this match rule
|
java.lang.String |
toStringInternal()
Get the internal representation of this rule
|
public static final java.lang.String MATCH_PART_SEPARATOR
public SubstringLabelerMatchRule()
public SubstringLabelerMatchRule(java.lang.String setup)
setup
- an internally encoded representation of all the match
information for this rulepublic SubstringLabelerMatchRule(java.lang.String match, boolean regex, boolean ignoreCase, java.lang.String selectedAtts)
match
- the match stringregex
- true if this is a regular expression matchignoreCase
- true if case is to be ignoredselectedAtts
- the attributes to apply the rule topublic void setMatch(java.lang.String match)
match
- the match stringpublic java.lang.String getMatch()
public void setLabel(java.lang.String label)
label
- the label string or empty stringpublic java.lang.String getLabel()
public void setRegex(boolean regex)
regex
- true if this is a regular expression matchpublic boolean getRegex()
public void setIgnoreCase(boolean ignore)
ignore
- true if case is to be ignoredpublic boolean getIgnoreCase()
public void setAttsToApplyTo(java.lang.String a)
a
- the attributes to apply the rule to.public java.lang.String getAttsToApplyTo()
public void init(Environment env, Instances structure)
env
- the environment variablesstructure
- the structure of the incoming instancespublic java.lang.String apply(Instance inst)
inst
- the instance to apply topublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringInternal()