I have some text manipulation to do, here’s a for loop that does it:
for p in paras[:]:
pidx = paras.index(p)
for sent in p:
sidx = p.index(sent)
sent = ' '.join(w[0] for w in sent)
paras[pidx][sidx] = sent
paras[pidx] = 'start' + ' '.join(paras[pidx]) + 'end'
Here is my list comprehension:
[' '.join(w[0] for w in sent) for p in paras for sent in p]
This returns one large list of sentences and I need separate lists based on the paragraph (p) or have some way to signify where the end of each para is. Is there some sexy way to do this?
A nested LC
should give each para as a separate list