edu.cmu.minorthird.text
Interface Span

All Superinterfaces:
java.lang.Comparable<Span>
All Known Implementing Classes:
BasicSpan, SubSpan

public interface Span
extends java.lang.Comparable<Span>

A series of of adjacent Token's from the same document.

Author:
William Cohen

Method Summary
 java.lang.String asString()
          Find the string contained in a Span.
 Span charIndexProperSubSpan(int charLo, int charHi)
          Create a the largest Span containing TextToken's which are contained in the character boundaries charLo, charHi of this span.
 Span charIndexSubSpan(int charLo, int charHi)
          Create a new Span containing TextToken's which are as close as possible to the character boundaries charLo, charHi of thisspan.
 boolean contains(Span other)
          Check containment
 Span documentSpan()
          If this was a subspan, create a copy of its parent.
 int documentSpanStartIndex()
          Find the index of this span within its document.
 int getCharOffset()
           
 java.lang.String getDocumentContents()
          Return a string containing the entire content of the document that this span lives in.
 java.lang.String getDocumentGroupId()
          Return the id of the group of documents this span belongs to
 java.lang.String getDocumentId()
          Return the name of the document for these TextToken's.
 int getHiChar()
          Returns the Char index of where the span ends in the document
 Span getLeftBoundary()
          A length-zero span for the left boundary
 int getLoChar()
          Returns the Char index of where the span starts in the document
 int getLoTextToken()
          Returns the low text token
 Span getRightBoundary()
          A length-zero span for the left boundary
 TextToken getTextToken(int i)
          Access the i-th Token as a TextToken
 Token getToken(int i)
          Access the i-th Token.
 boolean overlaps(Span other)
          Check overlap
 void setCharOffset(int charOffset)
           
 int size()
          Number of TextToken's in the span.
 Span subSpan(int lo, int len)
          Create a new Span containing TextToken's lo, lo+1, ..., lo+len.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

size

int size()
Number of TextToken's in the span.


getToken

Token getToken(int i)
Access the i-th Token.


getTextToken

TextToken getTextToken(int i)
Access the i-th Token as a TextToken


subSpan

Span subSpan(int lo,
             int len)
Create a new Span containing TextToken's lo, lo+1, ..., lo+len.


charIndexSubSpan

Span charIndexSubSpan(int charLo,
                      int charHi)
Create a new Span containing TextToken's which are as close as possible to the character boundaries charLo, charHi of thisspan.


charIndexProperSubSpan

Span charIndexProperSubSpan(int charLo,
                            int charHi)
Create a the largest Span containing TextToken's which are contained in the character boundaries charLo, charHi of this span.


getDocumentId

java.lang.String getDocumentId()
Return the name of the document for these TextToken's.


documentSpan

Span documentSpan()
If this was a subspan, create a copy of its parent.


getDocumentGroupId

java.lang.String getDocumentGroupId()
Return the id of the group of documents this span belongs to


getDocumentContents

java.lang.String getDocumentContents()
Return a string containing the entire content of the document that this span lives in.

Note: this differs subtly from documentSpan().asString(), which returns the string between the beginning of the first token and the end of the last token in the containing document.


documentSpanStartIndex

int documentSpanStartIndex()
Find the index of this span within its document. In other words, a span can be copied with the code span.documentSpan().subSpan( span.documentSpanStartIndex(), span.length())


asString

java.lang.String asString()
Find the string contained in a Span.


getLeftBoundary

Span getLeftBoundary()
A length-zero span for the left boundary


getRightBoundary

Span getRightBoundary()
A length-zero span for the left boundary


contains

boolean contains(Span other)
Check containment


overlaps

boolean overlaps(Span other)
Check overlap


getLoTextToken

int getLoTextToken()
Returns the low text token


getLoChar

int getLoChar()
Returns the Char index of where the span starts in the document


getHiChar

int getHiChar()
Returns the Char index of where the span ends in the document


setCharOffset

void setCharOffset(int charOffset)

getCharOffset

int getCharOffset()