|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectopennlp.tools.util.Span
public class Span
Class for storing start and end integer offsets.
| Constructor Summary | |
|---|---|
Span(int s,
int e)
Initializes a new Span Object. |
|
Span(int s,
int e,
String type)
Initializes a new Span Object. |
|
Span(Span span,
int offset)
Initializes a new Span object with an existing Span which is shifted by an offset. |
|
| Method Summary | |
|---|---|
int |
compareTo(Span s)
Compares the specified span to the current span. |
boolean |
contains(int index)
Returns true if the specified index is contained inside this span. |
boolean |
contains(Span s)
Returns true if the specified span is contained by this span. |
boolean |
crosses(Span s)
Returns true is the specified span crosses this span. |
boolean |
equals(Object o)
Checks if the specified span is equal to the current span. |
CharSequence |
getCoveredText(CharSequence text)
Retrieves the string covered by the current span of the specified text. |
int |
getEnd()
Return the end of a span. |
int |
getStart()
Return the start of a span. |
String |
getType()
Retrieves the type of the span. |
int |
hashCode()
Generates a hash code of the current span. |
boolean |
intersects(Span s)
Returns true if the specified span intersects with this span. |
int |
length()
Returns the length of this span. |
static String[] |
spansToStrings(Span[] spans,
CharSequence s)
Converts an array of Spans to an array of Strings. |
static String[] |
spansToStrings(Span[] spans,
String[] tokens)
|
boolean |
startsWith(Span s)
Returns true if the specified span is the begin of this span and the specified span is contained in this span. |
String |
toString()
Generates a human readable string. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Span(int s,
int e,
String type)
s - start of span.e - end of span, which is +1 more than the last element in the span.type - the type of the span
public Span(int s,
int e)
s - start of span.e - end of span.
public Span(Span span,
int offset)
span - offset - | Method Detail |
|---|
public int getStart()
public int getEnd()
public String getType()
public int length()
public boolean contains(Span s)
s - The span to compare with this span.
public boolean contains(int index)
index - the index to test with this span.
public boolean startsWith(Span s)
s - The span to compare with this span.
public boolean intersects(Span s)
s - The span to compare with this span.
public boolean crosses(Span s)
s - The span to compare with this span.
public CharSequence getCoveredText(CharSequence text)
text -
public int compareTo(Span s)
compareTo in interface Comparable<Span>public int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectpublic String toString()
toString in class Object
public static String[] spansToStrings(Span[] spans,
CharSequence s)
Spans to an array of Strings.
spans - s -
public static String[] spansToStrings(Span[] spans,
String[] tokens)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||