<p>我想把一个字符串中的句子列出来,然后打印出来。我不想用NLTK来做这个。因此,它需要在句子末尾的句号上进行拆分,而不是在小数、缩写或名称的标题上,或者如果句子有一个.com,这是在regex上的尝试,但不起作用。</p>
<pre><code>import re
text = """\
Mr. Smith bought cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it. Did he mind? Adam Jones Jr. thinks he didn't. In any case, this isn't true... Well, with a probability of .9 it isn't.
"""
sentences = re.split(r' *[\.\?!][\'"\)\]]* *', text)
for stuff in sentences:
print(stuff)
</code></pre>
<p>它应该是什么样子的示例输出</p>
<pre><code>Mr. Smith bought cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it.
Did he mind?
Adam Jones Jr. thinks he didn't.
In any case, this isn't true...
Well, with a probability of .9 it isn't.
</code></pre>