【发布时间】:2018-11-16 23:57:23
【问题描述】:
我知道我可以使用这样的东西
theText='She loves music. Her favorit instrument is the piano.\n\n However, \n\n she does not play it.'
paragraphs = [p for p in theText.split('\n\n') if p]
for i,p in enumerate(paragraphs):
print(i,p)
将文本分成段落。
但是,我想添加一个附加条件,即下一个句子不能以小写字母开头。 实际代码提供
0 She loves music. Her favorit instrument is the piano.
1 However,
2 she does not play it.
我愿意
0 She loves music. Her favorit instrument is the piano.
1 However, she does not play it.
我认为我应该使用一些正则表达式,但我无法找出正确的结构。
【问题讨论】:
标签: regex string python-3.x nlp