I have a Data-set consisting of a 1000 rows containing a given author and a large corpus of text belonging to said author. What I am ultimately trying to achieve is to explode the text rows into multiple rows containing the same number of words, as in:
Author - - - - - - - - text
Jack - - - - - - -- - -"This is a sentence that contains eight words"
John - - - - - - - - -"This is also a sentence containing eight words"
So if I wanted to do it for 4-word chunks it would be:
Author- - - - - - text
Jack- - - - - - - "This is a sentence"
Jack- - - - - - -"that contains eight words"
John- - - - - - - "This is also a"
John- - - - - - - "sentence containing eight words"
I can already do it by number of characters using textwrapper, but ideally I would want to do it by number of words. Any help that can lead to that will be highly appreciated, Thanks!