Chunking and chinking with regular expressions
Using modified regular expressions, we can define chunk patterns. These are patterns of part-of-speech tags that define what kinds of words make up a chunk. We can also define patterns for what kinds of words should not be in a chunk. These unchunked words are known as chinks.
A ChunkRule
class specifies what to include in a chunk, while a ChinkRule
class specifies what to exclude from a chunk. In other words, chunking creates chunks, while chinking breaks up those chunks.
Getting ready
We first need to know how to define chunk patterns. These are modified regular expressions designed to match sequences of part-of-speech tags. An individual tag is specified by surrounding angle brackets, such as <NN>
to match a noun tag. Multiple tags can then be combined, as in <DT><NN>
to match a determiner followed by a noun. Regular expression syntax can be used within the angle brackets to match individual tag patterns, so you can do <...