public class Span extends Object implements Comparable<Span>
| Constructor and Description |
|---|
Span(int s,
int e)
Initializes a new Span Object.
|
Span(int s,
int e,
double prob) |
Span(int s,
int e,
String type)
Initializes a new Span Object.
|
Span(int s,
int e,
String type,
double prob) |
Span(Span span,
double prob)
Creates a new immutable span based on an existing span, where the existing
span did not include the prob
|
Span(Span span,
int offset)
Initializes a new Span object with an existing Span which is shifted by an
offset.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Span s)
Compares the specified span to the current span.
|
static void |
concatenateSpans(List<Span> allSpans,
Span[] neSpans)
Concatenates two span lists adding the spans of the second parameter to the
list in first parameter.
|
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) |
String |
getCoveredText(String[] tokens) |
int |
getEnd()
Return the end of a span.
|
double |
getProb() |
int |
getStart()
Return the start of a span.
|
String |
getType()
Retrieves the type of the span.
|
static String[] |
getTypesFromSpans(Span[] spans,
String[] tokens)
Get an array of Spans and their associated tokens and obtains an array of
Strings containing the type for each 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 void |
postProcessDuplicatedSpans(List<Span> preList,
Span[] postList)
Removes spans from the preList if the span is contained in the postList.
|
void |
setType(String aType) |
static String[] |
spansToStrings(Span[] spans,
CharSequence s)
|
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.
|
Span |
trim(CharSequence text)
Return a copy of this span with leading and trailing white spaces removed.
|
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 spanpublic Span(int s,
int e,
String type,
double prob)
public Span(int s,
int e)
s - start of span.e - end of span.public Span(int s,
int e,
double prob)
s - the start of the span (the token index, not the char index)e - the end of the span (the token index, not the char index)prob - the probability scorepublic Span(Span span, int offset)
span - the spanoffset - the offsetpublic Span(Span span, double prob)
span - the span that has no prob or the prob is incorrect and a new Span
must be generatedprob - the probability of the spanpublic int getStart()
public int getEnd()
public String getType()
public void setType(String aType)
public int length()
public double getProb()
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 Span trim(CharSequence text)
text - the textpublic int compareTo(Span s)
compareTo in interface Comparable<Span>public int hashCode()
public boolean equals(Object o)
public String toString()
public CharSequence getCoveredText(CharSequence text)
public static String[] spansToStrings(Span[] spans, CharSequence s)
spans - the spans arrays - the stringspublic static String[] getTypesFromSpans(Span[] spans, String[] tokens)
spans - the array of Spanstokens - the array of tokenspublic static final void postProcessDuplicatedSpans(List<Span> preList, Span[] postList)
preList - the list of spans to be post-processedpostList - the list of spans to do the post-processingpublic static final void concatenateSpans(List<Span> allSpans, Span[] neSpans)
allSpans - the spans to which the other spans are addedneSpans - the spans to be added to allSpansCopyright © 2017 IXA pipes. All rights reserved.