edu.illinois.cs.cogcomp.lbj.coref.ir
Class Entity

java.lang.Object
  extended by edu.illinois.cs.cogcomp.lbj.coref.ir.Entity
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Entity>

public class Entity
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Entity>

An entity is a collection of mentions that are coreferential, combined with some metadata about them.

Author:
Eric Bengtson
See Also:
Serialized Form

Field Summary
private  java.lang.String m_id
           
private  java.util.List<Mention> m_mentions
           
private  java.util.List<Chunk> m_names
           
private  java.util.List<Mention> m_sortedMentions
           
private  java.lang.String m_specificity
           
private  java.lang.String m_subtype
           
private  java.lang.String m_type
           
private static long serialVersionUID
           
 
Constructor Summary
Entity()
          Basic constructor.
Entity(java.lang.String id, java.lang.String type, java.lang.String subtype, java.lang.String specificity)
          Creates an empty entity (containing no mentions)
Entity(java.lang.String id, java.lang.String type, java.lang.String subtype, java.lang.String specificity, java.util.List<Mention> mentions, java.util.List<Chunk> names)
          Creates an entity with the specified mentions.
 
Method Summary
 void addMention(Mention m)
          Adds a mention to the entity.
 void addNames(java.util.List<Chunk> entNames)
          Add all the chunks as names to the existing set of names.
 int compareTo(Entity e)
          Compare by short eID numerically, or lexicographically if same numbers.
 java.lang.String getID()
          Gets the ID of the entity.
 Mention getMention(int i)
          Gets the specified mention.
 java.util.List<Mention> getMentions()
          Gets a reference to the list of mentions.
 java.lang.String getShortID()
          Gets the short ID, which is the entity ID disregarding the DocID and the "-E".
 java.util.List<Mention> getSortedMentions()
          Gets a reference to the list of mentions sorted in their natural order defined by their compare function.
 java.lang.String getSpecificity()
          Gets the specificity (SPC or GEN).
 java.lang.String getSubtype()
          Gets the entity subtype.
 java.lang.String getType()
          Gets the entity type (PER, ORG, GPE, LOC, WEA, VEH, or FAC)
private  void initListsDefault()
           
 java.lang.String toString()
          Generate a string representation of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

m_id

private java.lang.String m_id

m_type

private java.lang.String m_type

m_subtype

private java.lang.String m_subtype

m_specificity

private java.lang.String m_specificity

m_mentions

private java.util.List<Mention> m_mentions

m_sortedMentions

private java.util.List<Mention> m_sortedMentions

m_names

private java.util.List<Chunk> m_names
Constructor Detail

Entity

public Entity()
Basic constructor. Not recommended.


Entity

public Entity(java.lang.String id,
              java.lang.String type,
              java.lang.String subtype,
              java.lang.String specificity)
Creates an empty entity (containing no mentions)

Parameters:
id - The entity ID.
type - The entity TYPE (PER, ORG, GPE, LOC, WEA, VEH, or FAC)
subtype - The entity SUBTYPE.
specificity - The specificity, specific (SPC) or generic (GEN) This is the attribute CLASS in an .apf.xml file.

Entity

public Entity(java.lang.String id,
              java.lang.String type,
              java.lang.String subtype,
              java.lang.String specificity,
              java.util.List<Mention> mentions,
              java.util.List<Chunk> names)
Creates an entity with the specified mentions.

Parameters:
id - The entity ID.
type - The entity TYPE (PER, ORG, GPE, LOC, WEA, VEH, or FAC)
subtype - The entity SUBTYPE.
specificity - The specificity, specific (SPC) or generic (GEN) This is the attribute CLASS in an .apf.xml file.
mentions - a list of Mentions.
names - a List of Chunks representing names.
Method Detail

initListsDefault

private void initListsDefault()

addMention

public void addMention(Mention m)
Adds a mention to the entity.

Parameters:
m - A mention.

getMentions

public java.util.List<Mention> getMentions()
Gets a reference to the list of mentions.

Returns:
A reference to the list of mentions.

getSortedMentions

public java.util.List<Mention> getSortedMentions()
Gets a reference to the list of mentions sorted in their natural order defined by their compare function. This will be cached for performance.


getMention

public Mention getMention(int i)
Gets the specified mention.

Parameters:
i - The position in the list of mentions.
Returns:
The specified mention.

getID

public java.lang.String getID()
Gets the ID of the entity.

Returns:
The entity ID.

getType

public java.lang.String getType()
Gets the entity type (PER, ORG, GPE, LOC, WEA, VEH, or FAC)

Returns:
The entity type.

getSubtype

public java.lang.String getSubtype()
Gets the entity subtype.

Returns:
the entity subtype.

getSpecificity

public java.lang.String getSpecificity()
Gets the specificity (SPC or GEN).

Returns:
The Specificity (e.g. the class)

addNames

public void addNames(java.util.List<Chunk> entNames)
Add all the chunks as names to the existing set of names.

Parameters:
entNames - The names to add.

toString

public java.lang.String toString()
Generate a string representation of this.

Overrides:
toString in class java.lang.Object
Returns:
This as a string.

getShortID

public java.lang.String getShortID()
Gets the short ID, which is the entity ID disregarding the DocID and the "-E".

Returns:
The shortened entity ID.

compareTo

public int compareTo(Entity e)
Compare by short eID numerically, or lexicographically if same numbers.

Specified by:
compareTo in interface java.lang.Comparable<Entity>