com.languagecomputer.api.text
Class DefaultMentionChain

java.lang.Object
  extended by com.languagecomputer.api.text.DefaultText
      extended by com.languagecomputer.api.text.DefaultMentionChain
All Implemented Interfaces:
MentionChain, Text

public class DefaultMentionChain
extends DefaultText
implements MentionChain

Default implementation of an MentionChain.

Since:
1.0
Author:
Kirk Roberts
See Also:
DefaultText

Field Summary
 
Fields inherited from interface com.languagecomputer.api.text.MentionChain
TYPE
 
Constructor Summary
DefaultMentionChain()
          Creates a new DefaultMentionChain.
 
Method Summary
 void addMention(Text text)
          Adds a new mention to the DefaultMentionChain.
 int getEndCharOffset()
          Returns the (exclusive) end character offset for this Text object within the (processed) Document. This offset does not necessarily line up with the start character offset from the unprocessed document/file.
 List<Text> getMentions()
          Returns the mentions in this chain.
 int getStartCharOffset()
          Returns the start character offset for this Text object within the (processed) Document. This offset does not necessarily line up with the start character offset from the unprocessed document/file.
 void setAnnotationType(AnnotationType annType)
          Not necessary: defaults to MentionChain.TYPE.
 void setEndCharOffset(int endOffset)
          Not allowed: getEndCharOffset() can only return Text.getEndCharOffset()
 void setStartCharOffset(int startOffset)
          Not allowed: getStartCharOffset() can only return 0.
 String toString()
          Returns a String representation of a DefaultMentionChain.
 
Methods inherited from class com.languagecomputer.api.text.DefaultText
getAnnotationType, getCongruentAnnotations, getDocument, getDocumentID, getIntersectingAnnotations, getRawString, getSubAnnotations, getSuperAnnotations, setDocument, setRawString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.languagecomputer.api.text.Text
getAnnotationType, getCongruentAnnotations, getDocument, getDocumentID, getIntersectingAnnotations, getRawString, getSubAnnotations, getSuperAnnotations
 

Constructor Detail

DefaultMentionChain

public DefaultMentionChain()
Creates a new DefaultMentionChain.

Method Detail

setAnnotationType

public void setAnnotationType(AnnotationType annType)
Not necessary: defaults to MentionChain.TYPE.

Overrides:
setAnnotationType in class DefaultText
Parameters:
annType - AnnotationType to use for this DefaultMentionChain.
See Also:
Text.getAnnotationType(), AnnotationType

setStartCharOffset

public final void setStartCharOffset(int startOffset)
Not allowed: getStartCharOffset() can only return 0.

Overrides:
setStartCharOffset in class DefaultText
Parameters:
startOffset - (ignored)
Throws:
UnsupportedOperationException - Cannot be called.
See Also:
Text.getStartCharOffset()

getStartCharOffset

public int getStartCharOffset()
Returns the start character offset for this Text object within the (processed) Document. This offset does not necessarily line up with the start character offset from the unprocessed document/file.

Specified by:
getStartCharOffset in interface Text
Overrides:
getStartCharOffset in class DefaultText
Returns:
The inclusive start offset.

setEndCharOffset

public final void setEndCharOffset(int endOffset)
Not allowed: getEndCharOffset() can only return Text.getEndCharOffset()

Overrides:
setEndCharOffset in class DefaultText
Parameters:
endOffset - (ignored)
Throws:
UnsupportedOperationException - Cannot be called.
See Also:
Text.getEndCharOffset()

getEndCharOffset

public int getEndCharOffset()
Returns the (exclusive) end character offset for this Text object within the (processed) Document. This offset does not necessarily line up with the start character offset from the unprocessed document/file.

Specified by:
getEndCharOffset in interface Text
Overrides:
getEndCharOffset in class DefaultText
Returns:
The exclusive end offset.

addMention

public void addMention(Text text)
Adds a new mention to the DefaultMentionChain.

Parameters:
text - The mention Text to add to this DefaultMentionChain.
See Also:
getMentions()

getMentions

public List<Text> getMentions()
Returns the mentions in this chain. The returned list should be in a sorted order based on appearance within the Document. In future revisions, there might be a getBestMention method that identifies the most explicit mention, but for now a good heuristic is just to take the first item (or the biggest item) in the returned list.

Specified by:
getMentions in interface MentionChain
Returns:
A List of mentions that all refer to the same thing.

toString

public String toString()
Returns a String representation of a DefaultMentionChain.

Overrides:
toString in class DefaultText


Copyright © 2009. All Rights Reserved.