Java Reference
In-Depth Information
StanfordCoreNLP pipeline = new StanfordCoreNLP(properties);
Next, an Annotation instance is created, which uses the text as its argument:
Annotation annotation = new Annotation(
"The meaning and purpose of life is plain to see.");
Apply the annotate method against the pipeline object to process the annotation
object. Finally, use the prettyPrint method to display the result of the processing:
pipeline.annotate(annotation);
pipeline.prettyPrint(annotation, System.out);
The output of this code is shown as follows:
Sentence #1 (11 tokens):
The meaning and purpose of life is plain to see.
[Text=The CharacterOffsetBegin=0 CharacterOffsetEnd=3
PartOfSpeech=DT] [Text=meaning CharacterOffsetBegin=4
CharacterOffsetEnd=11 PartOfSpeech=NN] [Text=and
CharacterOffsetBegin=12 CharacterOffsetEnd=15
PartOfSpeech=CC] [Text=purpose CharacterOffsetBegin=16
CharacterOffsetEnd=23 PartOfSpeech=NN] [Text=of
CharacterOffsetBegin=24 CharacterOffsetEnd=26
PartOfSpeech=IN] [Text=life CharacterOffsetBegin=27
CharacterOffsetEnd=31 PartOfSpeech=NN] [Text=is
CharacterOffsetBegin=32 CharacterOffsetEnd=34
PartOfSpeech=VBZ] [Text=plain CharacterOffsetBegin=35
CharacterOffsetEnd=40 PartOfSpeech=JJ] [Text=to
CharacterOffsetBegin=41 CharacterOffsetEnd=43
PartOfSpeech=TO] [Text=see CharacterOffsetBegin=44
CharacterOffsetEnd=47 PartOfSpeech=VB] [Text=.
CharacterOffsetBegin=47 CharacterOffsetEnd=48
PartOfSpeech=.]
(ROOT
(S
(NP
(NP (DT The) (NN meaning)
(CC and)
Search WWH ::




Custom Search