opennlp.tools.coref.mention
Class MentionContext

java.lang.Object
  extended by opennlp.tools.coref.mention.Mention
      extended by opennlp.tools.coref.sim.Context
          extended by opennlp.tools.coref.mention.MentionContext
All Implemented Interfaces:
Comparable<Mention>

public class MentionContext
extends Context

Data structure representation of a mention with additional contextual information. The contextual information is used in performing coreference resolution.


Constructor Summary
MentionContext(Mention mention, int mentionIndexInSentence, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, HeadFinder headFinder)
          Constructs context information for the specified mention.
MentionContext(Span span, Span headSpan, int entityId, Parse parse, String extentType, String nameType, int mentionIndex, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, HeadFinder headFinder)
           
 
Method Summary
 Parse getFirstToken()
          Returns the parse for the first token in this mention.
 String getFirstTokenTag()
          Returns the pos-tag of the first token of this mention.
 String getFirstTokenText()
          Returns the text for the first token of the mention.
 GenderEnum getGender()
          Returns the gender of this mention.
 double getGenderProb()
          Returns the probability associated with the gender assignment.
 Parse getHead()
           
 String getHeadText()
           
 Parse getHeadTokenParse()
          Returns the parse of the head token for this mention.
 Span getIndexSpan()
          Returns a sentence-based token span for this mention.
 int getMaxNounPhraseSentenceIndex()
          Returns the index of the last noun phrase in the sentence containing this mention.
 Parse getNextToken()
           
 Parse getNextTokenBasal()
           
 int getNonDescriptorStart()
           
 int getNounPhraseDocumentIndex()
          Returns the index of the noun phrase for this mention in a document.
 int getNounPhraseSentenceIndex()
          Returns the index of the noun phrase for this mention in a sentence.
 NumberEnum getNumber()
          Returns the number of this mention.
 double getNumberProb()
          Returns the probability associated with the number assignment.
 Parse getPreviousToken()
           
 int getSentenceNumber()
          Returns the index of the sentence which contains this mention.
 Parse[] getTokenParses()
          Returns the parses for the tokens which are contained in this mention.
 void setGender(GenderEnum gender, double probability)
          Assigns the specified gender with the specified probability to this mention.
 void setNumber(NumberEnum number, double probability)
          Assigns the specified number with the specified probability to this mention.
 String toText()
          Returns the text of this mention.
 
Methods inherited from class opennlp.tools.coref.sim.Context
constructContexts, getHeadTokenIndex, getHeadTokenTag, getHeadTokenText, getSynsets, getTokens, parseContext, toString
 
Methods inherited from class opennlp.tools.coref.mention.Mention
compareTo, getHeadSpan, getId, getNameType, getParse, getSpan, setId, setParse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MentionContext

public MentionContext(Span span,
                      Span headSpan,
                      int entityId,
                      Parse parse,
                      String extentType,
                      String nameType,
                      int mentionIndex,
                      int mentionsInSentence,
                      int mentionIndexInDocument,
                      int sentenceIndex,
                      HeadFinder headFinder)

MentionContext

public MentionContext(Mention mention,
                      int mentionIndexInSentence,
                      int mentionsInSentence,
                      int mentionIndexInDocument,
                      int sentenceIndex,
                      HeadFinder headFinder)
Constructs context information for the specified mention.

Parameters:
mention - The mention object on which this object is based.
mentionIndexInSentence - The mention's position in the sentence.
mentionsInSentence - The number of mentions in the sentence.
mentionIndexInDocument - The index of this mention with respect to the document.
sentenceIndex - The index of the sentence which contains this mention.
headFinder - An object which provides head information.
Method Detail

getHeadTokenParse

public Parse getHeadTokenParse()
Returns the parse of the head token for this mention.

Returns:
the parse of the head token for this mention.

getHeadText

public String getHeadText()

getHead

public Parse getHead()

getNonDescriptorStart

public int getNonDescriptorStart()

getIndexSpan

public Span getIndexSpan()
Returns a sentence-based token span for this mention. If this mention consist of the third, fourth, and fifth token, then this span will be 2..4.

Returns:
a sentence-based token span for this mention.

getNounPhraseSentenceIndex

public int getNounPhraseSentenceIndex()
Returns the index of the noun phrase for this mention in a sentence.

Returns:
the index of the noun phrase for this mention in a sentence.

getNounPhraseDocumentIndex

public int getNounPhraseDocumentIndex()
Returns the index of the noun phrase for this mention in a document.

Returns:
the index of the noun phrase for this mention in a document.

getMaxNounPhraseSentenceIndex

public int getMaxNounPhraseSentenceIndex()
Returns the index of the last noun phrase in the sentence containing this mention. This is one less than the number of noun phrases in the sentence which contains this mention.

Returns:
the index of the last noun phrase in the sentence containing this mention.

getNextTokenBasal

public Parse getNextTokenBasal()

getPreviousToken

public Parse getPreviousToken()

getNextToken

public Parse getNextToken()

getSentenceNumber

public int getSentenceNumber()
Returns the index of the sentence which contains this mention.

Returns:
the index of the sentence which contains this mention.

getFirstToken

public Parse getFirstToken()
Returns the parse for the first token in this mention.

Returns:
The parse for the first token in this mention.

getFirstTokenText

public String getFirstTokenText()
Returns the text for the first token of the mention.

Returns:
The text for the first token of the mention.

getFirstTokenTag

public String getFirstTokenTag()
Returns the pos-tag of the first token of this mention.

Returns:
the pos-tag of the first token of this mention.

getTokenParses

public Parse[] getTokenParses()
Returns the parses for the tokens which are contained in this mention.

Returns:
An array of parses, in order, for each token contained in this mention.

toText

public String toText()
Returns the text of this mention.

Returns:
A space-delimited string of the tokens of this mention.

setGender

public void setGender(GenderEnum gender,
                      double probability)
Assigns the specified gender with the specified probability to this mention.

Parameters:
gender - The gender to be given to this mention.
probability - The probability associated with the gender assignment.

getGender

public GenderEnum getGender()
Returns the gender of this mention.

Returns:
The gender of this mention.

getGenderProb

public double getGenderProb()
Returns the probability associated with the gender assignment.

Returns:
The probability associated with the gender assignment.

setNumber

public void setNumber(NumberEnum number,
                      double probability)
Assigns the specified number with the specified probability to this mention.

Parameters:
number - The number to be given to this mention.
probability - The probability associated with the number assignment.

getNumber

public NumberEnum getNumber()
Returns the number of this mention.

Returns:
The number of this mention.

getNumberProb

public double getNumberProb()
Returns the probability associated with the number assignment.

Returns:
The probability associated with the number assignment.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.