def termdocumentmatrix_example():
    doc1 = 'John and Bob are brothers.'
doc2 = 'John went to the store. The store was closed.'
doc3 = 'Bob went to the store too.'
tdm = textmining.TermDocumentMatrix()
tdm.add_doc(doc1)
tdm.add_doc(doc2)
tdm.add_doc(doc3)
tdm.write_csv('matrix.csv', cutoff=1)
for row in tdm.rows(cutoff=1):
    print(row)
termdocumentmatrix_example()
эффективная матрица срочных документов с NLTK