Java Reference
In-Depth Information
The tag method is then used to find those parts of speech, which stored the results in an
array of strings:
String[] tags = tagger.tag(tokens);
The tokens and their corresponding tags are then displayed:
for(int i=0; i<tokens.length; i++) {
System.out.print(tokens[i] + "[" + tags[i] + "] ");
}
When executed, the following output will be produced:
POS[NNP] processing[NN] is[VBZ] useful[JJ] for[IN]
enhancing[VBG] the[DT] quality[NN] of[IN] data[NNS]
sent[VBN] to[TO] other[JJ] elements[NNS] of[IN] a[DT]
pipeline.[NN]
Each token is followed by an abbreviation, contained within brackets, for its part of
speech. For example, NNP means that it is a proper noun. These abbreviations will be
covered in Chapter 5 , Detecting Parts of Speech , which is devoted to exploring this topic
in depth.
Search WWH ::




Custom Search