Package opennlp.tools.tokenize
Class TokenSample
java.lang.Object
opennlp.tools.tokenize.TokenSample
- All Implemented Interfaces:
- Serializable,- Sample
A 
TokenSample is text with token spans.- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionTokenSample(String text, Span[] tokenSpans) Initializes ainstance.TokenSample(Detokenizer detokenizer, String[] tokens) Initializes ainstancevia aDetokenizer.
- 
Method Summary
- 
Field Details- 
DEFAULT_SEPARATOR_CHARS- See Also:
 
 
- 
- 
Constructor Details- 
TokenSampleInitializes ainstance.- Parameters:
- text- The text which contains the tokens. Must not be- null.
- tokenSpans- The spans which mark the start and end of the tokens. Must not be- null.
 
- 
TokenSampleInitializes ainstancevia aDetokenizer.- Parameters:
- detokenizer- The text which contains the tokens. Must not be- null.
- tokens- The tokens to be processed. Must not be- null.
 
 
- 
- 
Method Details- 
getText- Returns:
- Retrieves the text.
 
- 
getTokenSpans- Returns:
- Retrieves the token spans.
 
- 
toString
- 
parseParses a string sample.- Parameters:
- sampleString- The sample to be parsed. Must not be- null.
- separatorChars- The characters to be considered separators. See- DEFAULT_SEPARATOR_CHARS. Must not be- null.
- Returns:
- A valid TokenSampleinstance.
 
- 
hashCodepublic int hashCode()
- 
equals
 
-