opennlp.tools.coref.resolver
Class AbstractResolver

java.lang.Object
  extended by opennlp.tools.coref.resolver.AbstractResolver
All Implemented Interfaces:
Resolver
Direct Known Subclasses:
MaxentResolver, PerfectResolver

public abstract class AbstractResolver
extends Object
implements Resolver

Default implementation of some methods in the Resolver interface.


Field Summary
protected  CountedSet<Integer> distances
          Debugging variable which holds statistics about mention distances during training.
protected  int numEntitiesBack
          The number of previous entities that resolver should consider.
protected  int numSentencesBack
          The number of sentences back this resolver should look for a referent.
protected  boolean showExclusions
          Debugging variable which specifies whether error output is generated if a class excludes as possibly coreferent mentions which are in-fact coreferent.
 
Constructor Summary
AbstractResolver(int neb)
           
 
Method Summary
protected  boolean excluded(MentionContext mention, DiscourseEntity entity)
          Excludes entities which you are not compatible with the entity under consideration.
protected  String featureString(MentionContext mention)
          Returns the string of "_" delimited tokens for the specified mention.
protected  Parse getHead(MentionContext mention)
          Returns the head parse for the specified mention.
protected  int getHeadIndex(MentionContext mention)
          Returns the index for the head word for the specified mention.
protected  String getHeadString(MentionContext mention)
          Returns the text of the head word for the specified mention.
protected  int getNumEntities()
          Returns the number of previous entities that resolver should consider.
protected  int getNumEntities(DiscourseModel dm)
          The number of entities that should be considered for resolution with the specified discourse model.
protected  boolean outOfRange(MentionContext mention, DiscourseEntity entity)
          Determines if the specified entity is too far from the specified mention to be resolved to it.
 DiscourseEntity retain(MentionContext mention, DiscourseModel dm)
          Uses the specified mention and discourse model to train this resolver.
 void setNumberSentencesBack(int nsb)
          Specifies the number of sentences back this resolver should look for a referent.
 void train()
          Retrains model on examples for which retain was called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface opennlp.tools.coref.resolver.Resolver
canResolve, resolve
 

Field Detail

numEntitiesBack

protected int numEntitiesBack
The number of previous entities that resolver should consider.


showExclusions

protected boolean showExclusions
Debugging variable which specifies whether error output is generated if a class excludes as possibly coreferent mentions which are in-fact coreferent.


distances

protected CountedSet<Integer> distances
Debugging variable which holds statistics about mention distances during training.


numSentencesBack

protected int numSentencesBack
The number of sentences back this resolver should look for a referent.

Constructor Detail

AbstractResolver

public AbstractResolver(int neb)
Method Detail

getNumEntities

protected int getNumEntities()
Returns the number of previous entities that resolver should consider.

Returns:
the number of previous entities that resolver should consider.

setNumberSentencesBack

public void setNumberSentencesBack(int nsb)
Specifies the number of sentences back this resolver should look for a referent.

Parameters:
nsb - the number of sentences back this resolver should look for a referent.

getNumEntities

protected int getNumEntities(DiscourseModel dm)
The number of entities that should be considered for resolution with the specified discourse model.

Parameters:
dm - The discourse model.
Returns:
number of entities that should be considered for resolution.

getHead

protected Parse getHead(MentionContext mention)
Returns the head parse for the specified mention.

Parameters:
mention - The mention.
Returns:
the head parse for the specified mention.

getHeadIndex

protected int getHeadIndex(MentionContext mention)
Returns the index for the head word for the specified mention.

Parameters:
mention - The mention.
Returns:
the index for the head word for the specified mention.

getHeadString

protected String getHeadString(MentionContext mention)
Returns the text of the head word for the specified mention.

Parameters:
mention - The mention.
Returns:
The text of the head word for the specified mention.

outOfRange

protected boolean outOfRange(MentionContext mention,
                             DiscourseEntity entity)
Determines if the specified entity is too far from the specified mention to be resolved to it. Once an entity has been determined to be out of range subsequent entities are not considered. To skip intermediate entities @see excluded.

Parameters:
mention - The mention which is being considered.
entity - The entity to which the mention is to be resolved.
Returns:
true is the entity is in range of the mention, false otherwise.

excluded

protected boolean excluded(MentionContext mention,
                           DiscourseEntity entity)
Excludes entities which you are not compatible with the entity under consideration. The default implementation excludes entities whose last extent contains the extent under consideration. This prevents possessive pronouns from referring to the noun phrases they modify and other undesirable things.

Parameters:
mention - The mention which is being considered as referential.
entity - The entity to which the mention is to be resolved.
Returns:
true if the entity should be excluded, false otherwise.

retain

public DiscourseEntity retain(MentionContext mention,
                              DiscourseModel dm)
Description copied from interface: Resolver
Uses the specified mention and discourse model to train this resolver. All mentions sent to this method need to have their id fields set to indicate coreference relationships.

Specified by:
retain in interface Resolver
Parameters:
mention - The mention which is being used for training.
dm - the discourse model.
Returns:
the discourse entity which is referred to by the referring expression or null if no discourse entity is referenced.

featureString

protected String featureString(MentionContext mention)
Returns the string of "_" delimited tokens for the specified mention.

Parameters:
mention - The mention.
Returns:
the string of "_" delimited tokens for the specified mention.

train

public void train()
           throws IOException
Description copied from interface: Resolver
Retrains model on examples for which retain was called.

Specified by:
train in interface Resolver
Throws:
IOException


Copyright © 2010. All Rights Reserved.