determines sentences in a text.
gem install rudge
passing keep_trailling_whitespace: true
to Rudge will allow to keep the whitespaces at the end of each sentence
require 'rudge'
Rudge.sentences("Here's to the crazy ones. The misfits. The rebels. The troublemakers.
The round pegs in the square holes. The ones who see things differently.")
# => ["Here's to the crazy ones.", "The misfits.", "The rebels.", "The troublemakers.",
"The round pegs in the square holes.", "The ones who see things differently."]
Rudge.sentences("First sentence, Mr. Frodo. Second sentence.", keep_trailling_whitespace: true)
# => ["First sentence, Mr. Frodo. ", "Second sentence."]
based on the work available here: http://www.pressure.to/ruby/
Rudge is released under the MIT License.