I have a bunch of strings in my database like this:
driving home from work. The dog leaped of the sofa to great his master at the door. He licked his face clean.
The strings start off in the middle of a sentence. I'd like figure a way to cut off the initial incomplete sentence and just return from "The dog leaped of the sofa to great his master at the door. He licked his face clean."
How would I do this?
The problem is how to define incomplete sentence. We can make an assumption that all sentences which begins with upcased character is complete sentences. If so code may look like this
str = 'driving home from work. The dog leaped of the sofa to great his master at the door. He licked his face clean.'
sentences = str.split('.')
sentences.shift if sentences[0][0].downcase == sentences[0][0]
sentences.join('.').strip << '.'
A little bit tricky but works.