Hopefully this is a pretty straight-forward question. I have a transcript that i am trying to split into chunks of each speaker. The code I currently have is;
text = '''
Speaker 1: hello there
this is some text.
Speaker 2: hello there,
this is also some text.
'''
a = text.split('\nSpeaker')
This splits the text as i would want it to, however I miss the 'Speaker' identifier from the second utterance. I would need to keep this for identification purposes. Specifically, what i am trying to obtain is a result akin to the following;
['Speaker 1: hello there\n\nI am checking to see if this works. \n', ' Speaker2:
Hopefully it will, \n\nit seems pretty straightforward.\n']
Any suggestions are welcome
Thanks