Can I create a body from a rowset in NLTK?

Is there a way to create a case without having elements in the files. For example, I want to manipulate tweets or paragraphs that I extract from the Internet. Can i do something like

myCorpus = MyCorpus([
    ('id', 'item', 'category'), 
    ('id', 'item', 'category'),
    ('id', 'item', 'category'), 
    ... ])

or

myCorpus.add('id', 'item', 'category')

The goal is to manipulate the chassis with existing NLTK capabilities. I checked TextCollection, but it seems that it does not process categories.

+3
source share
1 answer

Why not just write the lines to a file or files and then treat them like a case?

-1
source

Source: https://habr.com/ru/post/1782298/


All Articles