de.fu_berlin.ties.combi
Class InsideOutsideStrategy

java.lang.Object
  extended byde.fu_berlin.ties.combi.CombinationStrategy
      extended byde.fu_berlin.ties.combi.InsideOutsideStrategy

public class InsideOutsideStrategy
extends CombinationStrategy

A combination strategy using inside/outside tagging. Classes are prefixed with "I-" (in this class) or "B-" (begin of a new instance of this class), "O" is used for other/outside of any class.

CombinationState.isEnd() is not supported by this class and will always return false.

Version:
$Revision: 1.3 $, $Date: 2004/04/01 13:34:28 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
 
Fields inherited from class de.fu_berlin.ties.combi.CombinationStrategy
CONFIG_COMBINATION
 
Constructor Summary
InsideOutsideStrategy(Set theClasses)
          Creates a new instance, using "O/I/B" mode: the "B-" is only used where required for disambiguation, otherwise the "I-" prefix is used.
InsideOutsideStrategy(Set theClasses, boolean bStartingAllClasses)
          Creates a new instance, using "O/I/B" mode (setting isBStartingAll() to false).
 
Method Summary
 Set activeClasses()
          Builds a set of class names (Strings) to pass to the classifier to consider for the next decision.
 Set allClasses()
          Returns an immutable set of all classes (Strings) that can possible occur during classification.
 boolean isBStartingAll()
          Whether the "B-" prefix is used for the first item of each instance ("O/B/I" mode) or only for the first item of instances immediately following an instance of the same class ("O/I/B" mode).
 String toString()
          Returns a string representation of this object.
 String translateCurrentState(CombinationState currentState)
          Translates an expected class in a class name to feed to the classifier in training mode. This method reverses the direction of CombinationStrategy.translateResult(String).

The return value can be feed to the classifier for training it.

 CombinationState translateResult(String predictedClass)
          Translates the class predicted by the classifier in a decision for the caller. The end information might be unreliably/absend for same classes.
 
Methods inherited from class de.fu_berlin.ties.combi.CombinationStrategy
createStrategy, createStrategy, getValidClasses, reset, state, updateState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InsideOutsideStrategy

public InsideOutsideStrategy(Set theClasses)
Creates a new instance, using "O/I/B" mode: the "B-" is only used where required for disambiguation, otherwise the "I-" prefix is used.

Parameters:
theClasses - a set of valid class names (String)

InsideOutsideStrategy

public InsideOutsideStrategy(Set theClasses,
                             boolean bStartingAllClasses)
Creates a new instance, using "O/I/B" mode (setting isBStartingAll() to false). In this mode, the "B-" is only used where required for disambiguation, otherwise the "I-" prefix is used.

Parameters:
theClasses - a set of valid class names (String)
bStartingAllClasses - if true, the "B-" prefix is used for the first item of each instance ("O/B/I" mode); otherwise it is used only for first item of instances immediately following an instance of the same class ("O/I/B" mode)
Method Detail

activeClasses

public Set activeClasses()
Builds a set of class names (Strings) to pass to the classifier to consider for the next decision. This implementation returns the classes in alphabetic order (using a SortedSet).

Specified by:
activeClasses in class CombinationStrategy
Returns:
a set of class names

allClasses

public Set allClasses()
Returns an immutable set of all classes (Strings) that can possible occur during classification.

Specified by:
allClasses in class CombinationStrategy
Returns:
an immutable set of class names

isBStartingAll

public boolean isBStartingAll()
Whether the "B-" prefix is used for the first item of each instance ("O/B/I" mode) or only for the first item of instances immediately following an instance of the same class ("O/I/B" mode).

Returns:
the value of the attribute

translateCurrentState

public String translateCurrentState(CombinationState currentState)
                             throws IllegalArgumentException
Translates an expected class in a class name to feed to the classifier in training mode. This method reverses the direction of CombinationStrategy.translateResult(String).

The return value can be feed to the classifier for training it.

Specified by:
translateCurrentState in class CombinationStrategy
Parameters:
currentState - the current state
Returns:
the class to feed to the classifier for training
Throws:
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)

translateResult

public CombinationState translateResult(String predictedClass)
                                 throws IllegalArgumentException
Translates the class predicted by the classifier in a decision for the caller. The end information might be unreliably/absend for same classes.

Specified by:
translateResult in class CombinationStrategy
Parameters:
predictedClass - the class predicted by the classifier
Returns:
the translated result
Throws:
IllegalArgumentException - if the specified argument was invalid (not in the set of currently active classes

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class CombinationStrategy
Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.