com.aliasi.coref
Class AbstractMentionChain

java.lang.Object
  extended by com.aliasi.coref.AbstractMentionChain
All Implemented Interfaces:
MentionChain
Direct Known Subclasses:
MentionChainImpl

public abstract class AbstractMentionChain
extends Object
implements MentionChain

An abstract implementation of a mention chain in terms of matching and killing functions. Concrete subclasses need onnly implement matchers() and killers(). This class manages the fixed identifier, fixed entity type, variable maximum sentence offset, and variable collection of mentions. When mentions are added through add(Mention,int), the maximum sentence offset and set of mentions are maintained. Subclasses may override add, but should always call it.

Since:
LingPipe1.0
Version:
3.9.1
Author:
Bob Carpenter

Field Summary
protected  String mEntityType
          Deprecated. Use entityType() or setEntityType(String) instead.
protected  String mGender
          Deprecated. Use gender() or setGender(String) instead.
protected  HashSet<String> mHonorifics
          Deprecated. Use honorifics() or addHonorific(String) instead.
 
Constructor Summary
AbstractMentionChain(Mention mention, int offset, int identifier)
           
 
Method Summary
protected  void add(Mention mention)
          Adds the specified mention appearing at the specified sentence offset to this mention chain.
 void add(Mention mention, int sentenceOffset)
          Adds the specified mention appearing at the specified sentence offset to this mention chain, and calls the method add(Mention), which may be overridden by subclasses to carry out additional bookkeeping when new mentions are added.
 void addHonorific(String honorific)
          Add the specified honorific to the set of honorifics for this chain.
 String entityType()
          Returns the entity type associated with this mention chain.
 boolean equals(MentionChain that)
          Returns true if the specified mention chain is equal to this mention chain.
 boolean equals(Object that)
          Returns true if the specified object is a mention chain that is equal to this mention chain.
 String gender()
          Returns the gender of this mention chain.
 int hashCode()
          Returns the hash code for this mention chain.
 Set<String> honorifics()
          Returns the set of honorifics for this mention chain.
 int identifier()
          Returns the unique identifier for this mention chain.
 boolean killed(Mention mention)
          Returns true if there is a killing function that defeats the match of the mention against the mention chain.
abstract  Killer[] killers()
          The killing functions defined for this mention chain.
abstract  Matcher[] matchers()
          The matching functions defined for this mention chain.
 int matchScore(Mention mention)
          Returns the best match score of the mention versus the mention chain according to the matching functions determined by the antecedent.
 int maxSentenceOffset()
          Offset of the last sentence in which a mention belonging to this mention chain appears.
 Set<Mention> mentions()
          Returns the set of mentions underlying this mention chain.
 void setEntityType(String entityType)
          Set the entity type of this mention chain to the specified value.
 void setGender(String gender)
          Set this chain's gender to the specified value.
 String toString()
          Returns a string representation of this mention chain.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mEntityType

@Deprecated
protected String mEntityType
Deprecated. Use entityType() or setEntityType(String) instead.
The entity type assigned to this mention chain.


mHonorifics

@Deprecated
protected final HashSet<String> mHonorifics
Deprecated. Use honorifics() or addHonorific(String) instead.
The set of honorifics for this mention chain. Subclasses may add honorifics.


mGender

@Deprecated
protected String mGender
Deprecated. Use gender() or setGender(String) instead.
The gender is initially set to the mention's gender, but it may be changed by subclasses as a result of adding new mentions.

Constructor Detail

AbstractMentionChain

public AbstractMentionChain(Mention mention,
                            int offset,
                            int identifier)
Method Detail

setGender

public void setGender(String gender)
Set this chain's gender to the specified value.

Parameters:
gender - Value of gender.

addHonorific

public void addHonorific(String honorific)
Add the specified honorific to the set of honorifics for this chain.

Parameters:
honorific - Honorific to add.

mentions

public final Set<Mention> mentions()
Returns the set of mentions underlying this mention chain. These are collected with the constructor and as mentions are added.

Specified by:
mentions in interface MentionChain
Returns:
Set of mentions underlying this mention chain.

honorifics

public final Set<String> honorifics()
Returns the set of honorifics for this mention chain. These are collected with the constructor and as mentions are added.

Specified by:
honorifics in interface MentionChain
Returns:
Set of honorifics for this mention chain.

gender

public final String gender()
Returns the gender of this mention chain.

Specified by:
gender in interface MentionChain
Returns:
The gender of this mention chain.

maxSentenceOffset

public final int maxSentenceOffset()
Offset of the last sentence in which a mention belonging to this mention chain appears.

Specified by:
maxSentenceOffset in interface MentionChain
Returns:
Offset of last sentence containing a mention in this chain.

entityType

public String entityType()
Returns the entity type associated with this mention chain.

Specified by:
entityType in interface MentionChain
Returns:
Entity type associated with this mention chain.

setEntityType

public void setEntityType(String entityType)
Set the entity type of this mention chain to the specified value.

Parameters:
entityType - New type for this mention chain.

add

public final void add(Mention mention,
                      int sentenceOffset)
Adds the specified mention appearing at the specified sentence offset to this mention chain, and calls the method add(Mention), which may be overridden by subclasses to carry out additional bookkeeping when new mentions are added.

Specified by:
add in interface MentionChain
Parameters:
mention - Mention to add to this chain.
sentenceOffset - Offset of mention added.

add

protected void add(Mention mention)
Adds the specified mention appearing at the specified sentence offset to this mention chain. Called by add(Mention,int) when a mention is added.

The implementation provided here does nothing, but subclasses may override it to carry out additional bookkeeping when new mentions are added.

Parameters:
mention - Mention to add to this chain.

identifier

public final int identifier()
Returns the unique identifier for this mention chain. Uniqueness is guaranteed within a document, not across documents.

Specified by:
identifier in interface MentionChain
Returns:
Unique identifier for this mention chain in a document.

killed

public final boolean killed(Mention mention)
Returns true if there is a killing function that defeats the match of the mention against the mention chain. A true return means that the mention will not be allowed to match against the antecedent no matter what other matching functions return.

Specified by:
killed in interface MentionChain
Parameters:
mention - Mention to test against antecedent.
Returns:
true if there is a killing function that defeats the match of the mention against the mention chain.

matchScore

public final int matchScore(Mention mention)
Returns the best match score of the mention versus the mention chain according to the matching functions determined by the antecedent. A score of Matcher.NO_MATCH_SCORE indicates that all matching functions failed. Otherwise, the score will fall in the range 0 to Matcher.MAX_SCORE, with a lower score being better.

Specified by:
matchScore in interface MentionChain
Parameters:
mention - Mention to score against antecedent.
Returns:
Best matching score between mention and antecedent.

equals

public boolean equals(Object that)
Returns true if the specified object is a mention chain that is equal to this mention chain.

Overrides:
equals in class Object
Parameters:
that - Object to test for equality with this mention chain.
Returns:
true if the mention chains are equal.

equals

public boolean equals(MentionChain that)
Returns true if the specified mention chain is equal to this mention chain.

Parameters:
that - Mention chain to test for equality with this mention chain.
Returns:
true if the mention chains are equal.

hashCode

public int hashCode()
Returns the hash code for this mention chain.

Overrides:
hashCode in class Object
Returns:
Hash code for this mention chain.

toString

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

Overrides:
toString in class Object
Returns:
A string representation of this mention chain.

matchers

public abstract Matcher[] matchers()
The matching functions defined for this mention chain.

Returns:
The matching functiosn for this mention chain.

killers

public abstract Killer[] killers()
The killing functions defined for this mention chain.

Returns:
The killing functions for this mention chain.