|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.combi.CombinationStrategy
A combination strategy combines sequential classifications. Instances of
this class are not thread-safe. Subclasses must also provide a constructor
that accepts a Set
of valid class names as single argument;
otherwise they cannot be loaded via reflection.
Field Summary | |
static String |
CONFIG_COMBINATION
Configuration key specifying the combination strategy to use. |
Constructor Summary | |
CombinationStrategy(Set theClasses)
Creates a new instance. |
Method Summary | |
abstract Set |
activeClasses()
Builds a set of class names (Strings) to pass to the classifier to consider for the next decision. |
abstract Set |
allClasses()
Returns an immutable set of all classes (Strings) that can possible occur during classification. |
static CombinationStrategy |
createStrategy(Set classNames)
Factory method that delegates to createStrategy(Set, TiesConfiguration) using the
standard configuration. |
static CombinationStrategy |
createStrategy(Set classNames,
TiesConfiguration config)
Factory method that creates a combination strategy based on the CONFIG_COMBINATION key in the provided configuration.
|
protected Set |
getValidClasses()
Returns the set of valid class names. |
void |
reset()
Resets the state() of this instance to the initial value
CombinationState.OUTSIDE . |
CombinationState |
state()
The current state (state of the last item). |
String |
toString()
Returns a string representation of this object. |
abstract String |
translateCurrentState(CombinationState currentState)
Translates an expected class in a class name to feed to the classifier in training mode. |
abstract CombinationState |
translateResult(String predictedClass)
Translates the class predicted by the classifier in a decision for the caller. |
void |
updateState(CombinationState newState)
Updates the current state (the class of the last item). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String CONFIG_COMBINATION
Constructor Detail |
public CombinationStrategy(Set theClasses)
theClasses
- a set of valid class names (String)Method Detail |
public static CombinationStrategy createStrategy(Set classNames) throws IllegalArgumentException
createStrategy(Set, TiesConfiguration)
using the
standard configuration.
classNames
- a set of valid class names (String)
IllegalArgumentException
- if the value of the
CONFIG_COMBINATION
key is missing or invalidpublic static CombinationStrategy createStrategy(Set classNames, TiesConfiguration config) throws IllegalArgumentException
CONFIG_COMBINATION
key in the provided configuration.
Currently supported values:
"BIA" for BeginAfterStrategy
,
"BIE" for OpenCloseStrategy
,
"IOB1" for InsideOutsideStrategy
with
InsideOutsideStrategy.isBStartingAll()
set to false
,
"IOB2" for InsideOutsideStrategy
with
InsideOutsideStrategy.isBStartingAll()
set to true
.
Otherwise the value must be the qualified name of a
CombinationStrategy subclass accepting a Set
(of valid class
names) as single argument.
classNames
- a set of valid class names (String)config
- the configuration to use
IllegalArgumentException
- if the value of the
CONFIG_COMBINATION
key is missing or invalidpublic abstract Set activeClasses()
allClasses()
.
public abstract Set allClasses()
public abstract String translateCurrentState(CombinationState currentState) throws IllegalArgumentException
translateResult(String)
.
The return value can be feed to the classifier for training it.
currentState
- the current state
IllegalArgumentException
- if the specified argument is invalid
(non-empty string that is not in the set of valid classes, or empty
string when null
was given in the preceding call)public abstract CombinationState translateResult(String predictedClass) throws IllegalArgumentException
predictedClass
- the class predicted by the classifier
IllegalArgumentException
- if the specified argument was invalid
(not in the set of currently active classes
protected Set getValidClasses()
public void reset()
state()
of this instance to the initial value
CombinationState.OUTSIDE
.
public CombinationState state()
public String toString()
public void updateState(CombinationState newState) throws IllegalArgumentException
translateResult(String)
and/or training translateCurrentState(CombinationState)
an item.
newState
- the state of the last item
IllegalArgumentException
- if the
type of the argument is invalid
(not in the set of valid classes or
null
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |