You are right that it is rather difficult to find documentation for the book.py module. Therefore, we must contaminate our hands and look at the code (see here ). Looking at book.py to do the concordance and all the fancy stuff with the book module:
First, you need your raw texts to be placed in the nltk corpus class, see Creating a new body with NLTK for more details,
Secondly, you read the words corpus in the NLTK Text class. Then you can use the functions that you see at http://nltk.org/book/ch01.html
from nltk.corpus import PlaintextCorpusReader from nltk.text import Text
NOTE. you can use other NLTK CorpusReaders and even specify custom attributes and encoding for the paragraph / sentence / word, but now we will stick to the standard
alvas source share