de.fu_berlin.ties.combi
Class OpenCloseStrategy

java.lang.Object
  extended by de.fu_berlin.ties.combi.CombinationStrategy
      extended by de.fu_berlin.ties.combi.OpenCloseStrategy

public class OpenCloseStrategy
extends CombinationStrategy

A combination strategy using open/close tagging (also called "BIE" tagging due to the prefixed used). Classes are prefixed with "B-" (first element of an instance), "I-" (inner element of an instance), "E-" (last element of an instance). Optionally ("BIE2") tagging, a fourth type "BE-" is used to mark the extractions consisting in a single token (which is both begin and end); otherwise ("BIE1") these are simple tagged with the "B-" prefix. "A" is used for anything else/outside of any class.

Version:
$Revision: 1.16 $, $Date: 2006/10/21 16:04:01 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
 
Fields inherited from class de.fu_berlin.ties.combi.CombinationStrategy
CONFIG_COMBINATION
 
Constructor Summary
OpenCloseStrategy(Set<String> theClasses, boolean useBE)
          Creates a new instance.
 
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 array of immutable sets of all classes (Strings) that can possible occur during classification for each classifier.
 boolean isUsingBE()
          Whether a special "BE-" prefix is used as fourth type for single-token extractions ("BIE2" tagging).
 String[] translateCurrentState(CombinationState currentState)
          Translates an expected class to a class name to feed to the classifiers in training mode.
 CombinationState translateResult(PredictionDistribution[] predictions, TokenDetails details)
          Translates the classes predicted by the classifiers in a decision for the caller.
 
Methods inherited from class de.fu_berlin.ties.combi.CombinationStrategy
contextForReextractor, createStrategy, createStrategy, createStrategy, getValidClasses, initReextractor, reset, resetHook, state, toString, updateState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpenCloseStrategy

public OpenCloseStrategy(Set<String> theClasses,
                         boolean useBE)
Creates a new instance.

Parameters:
theClasses - a set of valid class names (String)
useBE - whether or not to use a fourth prefix type ("BE-") for single-token extractions (otherwise these are simple tagging with the begin prefix "B-")
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 array of immutable sets of all classes (Strings) that can possible occur during classification for each classifier. The "background" class (outside any extractions) should be the first member of each set.

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

isUsingBE

public boolean isUsingBE()
Whether a special "BE-" prefix is used as fourth type for single-token extractions ("BIE2" tagging).

Returns:
the value of the attribute

translateCurrentState

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

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

Specified by:
translateCurrentState in class CombinationStrategy
Parameters:
currentState - the current state
Returns:
the array of classes to feed to each 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(PredictionDistribution[] predictions,
                                        TokenDetails details)
                                 throws IllegalArgumentException
Translates the classes predicted by the classifiers in a decision for the caller. The end information might be unreliably/absent for same classes.

Specified by:
translateResult in class CombinationStrategy
Parameters:
predictions - array containing the prediction distributions of all classifier
details - details representing the classified token
Returns:
the translated result
Throws:
IllegalArgumentException - if the specified argument was invalid (not in the set of currently active classes


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