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 java.lang.Object
implements Resolver

Default implementation of some methods in the Resolver interface.


Field Summary
protected  CountedSet distances
          Debugging variable which holds statistics about mention distances durring training.
protected  int numEntitiesBack
          The number of previous entities that resolver should consider.
protected  int numSentencesBack
          The number of senteces 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  java.lang.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  java.lang.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 entites that should be considered for resolution with the specified discourse model.
static java.lang.String getPronounGender(java.lang.String pronoun)
          Returns a string representing the gender of the specifed pronoun.
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 senteces back this resolver should look for a referent.
protected  java.lang.String stripNp(MentionContext mention)
          Returns a string for the specified mention with punctuation, honorifics, designators, and determiners removed.
 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 distances
Debugging variable which holds statistics about mention distances durring training.


numSentencesBack

protected int numSentencesBack
The number of senteces 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 senteces back this resolver should look for a referent.

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

getNumEntities

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

Parameters:
dm - The discourse model.
Returns:
number of entites 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 java.lang.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 entties whose last extent contatins the extent under consideration. This prevents posessive pronouns from refering to the noun phrases they modify and other undesireable 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 refered to by the refering expression or null if no discourse entity is referenced.

featureString

protected java.lang.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.

stripNp

protected java.lang.String stripNp(MentionContext mention)
Returns a string for the specified mention with punctuation, honorifics, designators, and determiners removed.

Parameters:
mention - The mention to be striped.
Returns:
a normalized string representation of the specified mention.

train

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

Specified by:
train in interface Resolver
Throws:
java.io.IOException

getPronounGender

public static java.lang.String getPronounGender(java.lang.String pronoun)
Returns a string representing the gender of the specifed pronoun.

Parameters:
pronoun - An English pronoun.
Returns:
the gender of the specifed pronoun.


Copyright 2008 Jason Baldridge, Gann Bierner, and Thomas Morton. All Rights Reserved.