Splitting sentences using nltk.sent_tokenize, it does not provide correct result
<p>I am trying to split some customers' comments to sentences using <code>nltk.sent_tokenize</code>. I already tried to solve some of the problems using the following code: </p>

<pre><code>comment = comment.replace('?', '? ').replace('!', '! ').replace('..','.').replace('.', '. ')
</code></pre>

<p>But I do not know how to solve the following problems: </p>

<ol>
<li><p>Customer used several <code>"."</code> after some sentences. For example:</p>

<pre><code>Think tool is a huge factor in this....i have only
</code></pre></li>
<li><p>Customer used several <code>"!"</code> after some sentences, such as <code>auditory subject everyday!!!!!</code> </p></li>
<li><p>some of them used combination of <code>"!"</code> and <code>"."</code> at the end of sentences. </p></li>
<li><p>Because I already used <code>replace('.', '. ')</code>, it also causes the following problem:</p>

<p>Weight gain <code>(20lbs.)</code>, was split to <code>(20lbs.</code>  <code>)</code></p></li>
</ol>

<p>Any suggestion? I am using Python.</p>

<p>Try using the Punkt Sentence Tokenizer. It is pre-trained to split sentences effectively and can easily be pickled into your code.</p>

python nlp nltk