<p>我不明白,你问的句子,然后张贴代码分裂的话?我是不是误会了什么,我相信你在寻找这样的东西:</p>
<p>text=“”[复制粘贴示例文本]“”</p>
<pre><code>for possible_paragraph in text.split("\n"):
if len(possible_paragraph) != 0:
paragraphs.append(possible_paragraph)
sentences.append([])
for sentence in paragraphs[-1].split(". "):
if len(sentence) != 0:
sentences[-1].append(sentence)
</code></pre>
<p>最终结果如下</p>
<pre><code>>>> sentences[0]
[prints out first paragraph from "I couldn't decide..." to "which is a comparison you don't often see]
>>> sentences[1]
[prints out the 2nd paragraph "The bottom line is..."]
</code></pre>
<p>你得到了分句,也就是第一段的第一句:</p>
<pre><code>>>> sentences[0][0]
'"I couldn\'t decide between these three cameras (and their variants, the Sony HX30 and the Panasonic ZX20) because many of the reviews of each made the cameras sound very similar'
</code></pre>
<p>第二句第一段</p>
<pre><code>>>> sentences[0][1]
'So, I went out and bought (from merchants who accepted returns) one of each of these three cameras'
</code></pre>
<p>第一句第二段</p>
<pre><code>>>> sentences[1][0]
'"The bottom line is that these three cameras are very similar with a few minor differences.But those differences set them apart and may make you decide that you like one more than the other."'
</code></pre>
<p>等等</p>
<p>“然后我拿了……”不是第二段,因为它和前一句之间没有输入,或者是因为你的格式不好(不是会计所以呈现),或者是我对你需要什么/段落是什么的误解</p>