Package opennlp.tools.util
Klasse Span
java.lang.Object
opennlp.tools.util.Span
- Alle implementierten Schnittstellen:
- Serializable,- Comparable<Span>
- Bekannte direkte Unterklassen:
- LinkedSpan,- MascSentence,- MascToken,- MascWord
Class for storing start and end integer offsets.
- Siehe auch:
- 
KonstruktorübersichtKonstruktoren
- 
MethodenübersichtModifizierer und TypMethodeBeschreibungintCompares the specifiedSpanto the current span.booleancontains(int index) An index with the value of end is considered outside theSpan.booleanIdenticalspansare considered to contain each other.booleanChecks if the specifiedSpancrosses this span.booleangetCoveredText(CharSequence text) intgetEnd()Note: that the returned index is one past the actual end of the span in the text, or the first element past the end of the span.doublegetProb()intgetStart()getType()inthashCode()booleanintersects(Span s) Checks if the specifiedSpanintersects with this span.intlength()static String[]spansToStrings(Span[] spans, CharSequence s) static String[]spansToStrings(Span[] spans, String[] tokens) booleanstartsWith(Span s) toString()trim(CharSequence text) 
- 
Konstruktordetails- 
SpanInitializes a newSpan. Sets the prob to0as default.- Parameter:
- s- The start position of a- Span. Must be equal to or greater than- 0. Must not be greater than- e.
- e- The end position of a- Span, which is- +1more than the last element in the span. Must be equal to or greater than- 0.
- type- the type of the span
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
- 
SpanInitializes a newSpan.- Parameter:
- s- The start position of a- Span. Must be equal to or greater than- 0. Must not be greater than- e.
- e- The end position of a- Span, which is- +1more than the last element in the span. Must be equal to or greater than- 0.
- type- The type of the- Span
- prob- The probability of the- Span.
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
- 
Spanpublic Span(int s, int e) Initializes a newSpan. Sets the prob to0as default.- Parameter:
- s- The start position of a- Span. Must be equal to or greater than- 0. Must not be greater than- e.
- e- The end position of a- Span, which is- +1more than the last element in the span. Must be equal to or greater than- 0.
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
- 
Spanpublic Span(int s, int e, double prob) Initializes a newSpan. Sets the prob to0as default.- Parameter:
- s- The start position of a- Span. Must be equal to or greater than- 0. Must not be greater than- e.
- e- The end position of a- Span, which is- +1more than the last element in the span. Must be equal to or greater than- 0.
- prob- The probability of the- Span
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
- 
Span- Parameter:
- span- The existing- Span.
- offset- The positive or negative shift offset.
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
- 
SpanCreates a new immutableSpanbased on an existingSpan, where the existingSpandid not include the probability.- Parameter:
- span- The- Spanthat has no prob or the prob is incorrect and a new- Spanmust be generated.
- prob- The probability of the- Span.
- Löst aus:
- IllegalArgumentException- Thrown if given parameters are invalid.
 
 
- 
- 
Methodendetails- 
getStartpublic int getStart()- Gibt zurück:
- Retrieves the start of a Span. Guaranteed to be greater than0.
 
- 
getEndpublic int getEnd()Note: that the returned index is one past the actual end of the span in the text, or the first element past the end of the span.- Gibt zurück:
- Retrieves the end of a Span. Guaranteed to be greater than0.
 
- 
getType- Gibt zurück:
- Retrieves the type of a Spanornullif not set.
 
- 
lengthpublic int length()- Gibt zurück:
- Returns the length of a Span. Guaranteed to be greater than0.
 
- 
containsIdenticalspansare considered to contain each other.
- 
containspublic boolean contains(int index) An index with the value of end is considered outside theSpan.- Parameter:
- index- the index to test with this- Span.
- Gibt zurück:
- trueif the span contains this specified index,- falseotherwise.
 
- 
startsWith- Parameter:
- s- The- Spanto compare with this span.
- Gibt zurück:
- trueif the specified span starts with this span and is contained in this span,- falseotherwise
 
- 
intersectsChecks if the specifiedSpanintersects with this span.- Parameter:
- s- The- Spanto compare with this span.
- Gibt zurück:
- trueis the spans overlap,- falseotherwise.
 
- 
crossesChecks if the specifiedSpancrosses this span.
- 
getCoveredText- Parameter:
- text- The- textto analyze.
- Gibt zurück:
- Retrieves the (sub)string covered by the current Spanof the specified text.
- Löst aus:
- IllegalArgumentException- Thrown if parameters violated a constraint.
 
- 
trim
- 
compareToCompares the specifiedSpanto the current span.- Angegeben von:
- compareToin Schnittstelle- Comparable<Span>
- Parameter:
- s- The- Spaninstance to compare against.
- Siehe auch:
 
- 
hashCodepublic int hashCode()
- 
equals
- 
toString
- 
spansToStrings- Parameter:
- spans- The array used as input.
- s- The- CharSequenceused to compute covered text.
- Gibt zurück:
- The converted array of strings.
 
- 
spansToStrings
- 
getProbpublic double getProb()- Gibt zurück:
- Retrieves the probability represented by a Span.
 
 
-