Java Reference
In-Depth Information
The dictionaryChunker object is used with each sentence, as shown in the follow-
ing code sequence. We will use the displayChunkSet method as developed in the
Using LingPipe's RegExChunker class section earlier in this chapter:
for (String sentence : sentences) {
System.out.println("\nTEXT=" + sentence);
displayChunkSet(dictionaryChunker, sentence);
}
On execution, we get the following output:
TEXT=Joe was the last person to see Fred.
Type: PERSON Entity: [Joe] Score: 1.0
Type: PERSON Entity: [Fred] Score: 1.0
TEXT=He saw him in Boston at McKenzie's pub at 3:00 where
he paid $2.45 for an ale.
Type: PLACE Entity: [Boston] Score: 1.0
Type: PLACE Entity: [pub] Score: 1.0
TEXT=Joe wanted to go to Vermont for the day to visit a
cousin who works at IBM, but Sally and he had to look for
Fred
Type: PERSON Entity: [Joe] Score: 1.0
Type: PLACE Entity: [Vermont] Score: 1.0
Type: ORGANIZATION Entity: [IBM] Score: 1.0
Type: PERSON Entity: [Sally] Score: 1.0
Type: PERSON Entity: [Fred] Score: 1.0
This does a pretty good job but it requires a lot of effort to create the dictionary for a large
vocabulary.
Search WWH ::




Custom Search