Package opennlp.tools.chunker
Class ChunkSample
java.lang.Object
opennlp.tools.chunker.ChunkSample
- All Implemented Interfaces:
- Serializable,- Sample
Class for holding chunks for a single unit of text.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionChunkSample(String[] sentence, String[] tags, String[] preds) Initializes aChunkSampleinstance.Initializes aChunkSampleinstance.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanSpan[]String[]getPreds()String[]String[]getTags()inthashCode()Creates a nice to read string for the phrases formatted as following:
 [NP Rockwell_NNP ] [VP said_VBD ] [NP the_DT agreement_NN ] [VP calls_VBZ ] [SBAR for_IN ] [NP it_PRP ] [VP to_TO supply_VB ] [NP 200_CD additional_JJ so-called_JJ shipsets_NNS ] [PP for_IN ] [NP the_DT planes_NNS ] ._.static Span[]phrasesAsSpanList(String[] aSentence, String[] aTags, String[] aPreds) Create arrays ofspansof phrases.toString()
- 
Constructor Details- 
ChunkSampleInitializes aChunkSampleinstance.- Parameters:
- sentence- The training sentence.
- tags- The POS tags for the- sentence.
- preds- The chunk tags in B-* I-* notation.
 
- 
ChunkSampleInitializes aChunkSampleinstance.- Parameters:
- sentence- The training sentence.
- tags- The POS tags for the- sentence.
- preds- The chunk tags in B-* I-* notation.
 
 
- 
- 
Method Details- 
getSentence- Returns:
- Retrieves the training sentence.
 
- 
getTags- Returns:
- Retrieves the POS Tags for the sentence.
 
- 
getPreds- Returns:
- Retrieves the chunk tags in B-* I-* notation.
 
- 
getPhrasesAsSpanList- Returns:
- the phrases as an array of spans.
 
- 
phrasesAsSpanListCreate arrays ofspansof phrases.- Parameters:
- aSentence- The training sentence.
- aTags- The POS tags for the- sentence.
- aPreds- The chunk tags in B-* I-* notation.
- Returns:
- the phrases as an array of spans
 
- 
nicePrintCreates a nice to read string for the phrases formatted as following:
 [NP Rockwell_NNP ] [VP said_VBD ] [NP the_DT agreement_NN ] [VP calls_VBZ ] [SBAR for_IN ] [NP it_PRP ] [VP to_TO supply_VB ] [NP 200_CD additional_JJ so-called_JJ shipsets_NNS ] [PP for_IN ] [NP the_DT planes_NNS ] ._.- Returns:
- A nice to read string representation of the chunk phases
 
- 
toString
- 
hashCodepublic int hashCode()
- 
equals
 
-