This recipe will show you how to find simple noun phrases (NP) and verb phrases (VP). By "simple", we mean that there is no complex structure within the phrases. For example, the complex NP "The rain in Spain" will be broken into two simple NP chunks "The rain" and "Spain". These phrases are also called "basal".
This recipe will not go into the details of how the basal NPs/VPs are calculated but rather how to use the class—it can come in handy, and the source can be included if you want to sort out how it works.
Like many of the recipes, we will provide a command-line-interactive interface here:
Haul up the command line and type:
java -cp lingpipe-cookbook.1.0.jar:lib/lingpipe-4.1.0.jar: com.lingpipe.cookbook.chapter5.PhraseChunker INPUT> The rain in Spain falls mainly on the plain. The/at rain/nn in/in Spain/np falls/vbz mainly/rb on/in the/at plain/jj ./. noun(0,8) The rain noun(12,17) Spain verb(18,30) falls mainly noun(34,43...