de.fu_berlin.ties.extract.reestimate
Class Reestimator

java.lang.Object
  extended by de.fu_berlin.ties.extract.reestimate.Reestimator
Direct Known Subclasses:
LengthEstimator, LengthFilter

public abstract class Reestimator
extends Object

A re-estimator recalculates the probabilites of extractions in a suitable way. Re-estimators can be chained -- in this case each estimator will work on the extractions returned by the previous one.

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

Field Summary
static String CONFIG_REESTIMATORS
          Configuration key specifying the list of re-estimators to chain.
 
Constructor Summary
Reestimator(Reestimator precReestimator, TiesConfiguration config)
          Creates a new instance.
 
Method Summary
static Reestimator createReestimators()
          Factory method that delegates to createReestimators() using the standard configuration.
static Reestimator createReestimators(TiesConfiguration config)
          Factory method that creates a re-estimator chain based on the CONFIG_REESTIMATORS key in the provided configuration.
protected abstract  Extraction doReestimate(Extraction extraction)
          Re-estimates the probability of an extraction.
protected abstract  void doTrain(Extraction extraction)
          Trains this re-estimator on an extraction.
 Reestimator getPrecedingReestimator()
          Returns the preceding re-estimator used if this re-estimator is part of a chain.
 Extraction reestimate(Extraction extraction)
          Re-estimates the probability of an extraction.
 String toString()
          Returns a string representation of this object.
 void train(Extraction extraction)
          Trains this re-estimator on an extraction.
 void trainOtherToken(ContextDetails tokenDetails)
          Trains this re-estimator on a token that is notpart of any extraction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_REESTIMATORS

public static final String CONFIG_REESTIMATORS
Configuration key specifying the list of re-estimators to chain.

See Also:
Constant Field Values
Constructor Detail

Reestimator

public Reestimator(Reestimator precReestimator,
                   TiesConfiguration config)
Creates a new instance.

Parameters:
precReestimator - the preceding re-estimator to use if this re-estimator is part of a chain; null otherwise
config - the configuration to use
Method Detail

createReestimators

public static Reestimator createReestimators()
                                      throws IllegalArgumentException,
                                             ProcessingException
Factory method that delegates to createReestimators() using the standard configuration.

Returns:
the last estimator in the created estimator chain; or null is no estimators are specified (parameter value is null or empty)
Throws:
IllegalArgumentException - if the value of the CONFIG_REESTIMATORS key is invalid
ProcessingException - if an error occurred while creating the re-estimator

createReestimators

public static Reestimator createReestimators(TiesConfiguration config)
                                      throws IllegalArgumentException,
                                             ProcessingException
Factory method that creates a re-estimator chain based on the CONFIG_REESTIMATORS key in the provided configuration. This parameter must contain a list fully specified names of subclasses of this class) used in a chain.

Eeach specified re-estimator must provide a constructor accepting a preceding Reestimator as first argument and a TiesConfiguration as second argument.

Parameters:
config - the configuration to use
Returns:
the last re-estimator in the created re-estimator chain; or null is no re-estimator are specified (parameter value is null or empty)
Throws:
IllegalArgumentException - if the value of the CONFIG_REESTIMATORS key is invalid
ProcessingException - if an error occurred while creating the re-estimator

doReestimate

protected abstract Extraction doReestimate(Extraction extraction)
Re-estimates the probability of an extraction.

Parameters:
extraction - the extraction to re-estimate
Returns:
the re-estimated extraction; or null if the extraction should be deleted

doTrain

protected abstract void doTrain(Extraction extraction)
Trains this re-estimator on an extraction.

Parameters:
extraction - the extraction to train

getPrecedingReestimator

public Reestimator getPrecedingReestimator()
Returns the preceding re-estimator used if this re-estimator is part of a chain.

Returns:
the preceding re-estimator, if any; or null if this re-estimator is not part of a chain resp. is the first re-estimator in a chain

toString

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

Overrides:
toString in class Object
Returns:
a textual representation

reestimate

public Extraction reestimate(Extraction extraction)
Re-estimates the probability of an extraction. This method calls itself on the preceding re-estimator (if any) prior to delegating to the abstract doReestimate(de.fu_berlin.ties.extract.Extraction) method.

Parameters:
extraction - the extraction to re-estimate
Returns:
the re-estimated extraction; or null if the extraction should be deleted

train

public void train(Extraction extraction)
Trains this re-estimator on an extraction. This method calls itself on the preceding re-estimator (if any) prior to delegating to the abstract doTrain(de.fu_berlin.ties.extract.Extraction) method.

Parameters:
extraction - the extraction to train

trainOtherToken

public void trainOtherToken(ContextDetails tokenDetails)
Trains this re-estimator on a token that is notpart of any extraction. The default implementation does nothing, so all non-extraction tokens are ignored. Subclasses that need a different behavior can override this method.

Parameters:
tokenDetails - a ContextDetails containing all relevant information on the token and its context


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