Creating a categorized chunk corpus reader
NLTK provides a
CategorizedTaggedCorpusReader class, but there's no categorized corpus reader for chunked corpora. So in this recipe, we're going to make one.
Refer to the earlier recipe, Creating a chunked phrase corpus, for an explanation of
ChunkedCorpusReader, and refer to the previous recipe for details on
CategorizedTaggedCorpusReader, both of which inherit from
How to do it...
We'll create a class called
CategorizedChunkedCorpusReader that inherits from both
ChunkedCorpusReader. It is heavily based on the
CategorizedTaggedCorpusReader class, and also provides ...