I am looking for a way to handle sentence tokenizing task well.
I have this text extracted from a human written review for a restaurant
Nevertheless, the soup enhances the prawns well.In contrast, the fish offered is fresh and well prepared.
Note that, the period that is the boundary of first sentence is not separated by space. It is result from human error in writing. There are many sentences that were written like this that I can't ignore this one case.
So far I tried nltk sentence tokenizer in python but does not work as expected.
>>>import nltk.data
>>>tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
>>>sentences = tokenizer.tokenize(text)
>>>sentences
['Nevertheless, the soup enhances the prawns well.In contrast, the fish offered is fresh and well prepared.']
My expectation is it should be able to split the text into two sentences
['Nevertheless, the soup enhances the prawns well.', 'In contrast, the fish offered is fresh and well prepared.']
Any help is appreciated in advance
re.sub(r'(.([A-Z]))', r'. \2', text)? - jonrsharpeThe soup didn't taste well at all! Please contact me at [email protected] to get a detailed report.- ComputerFellow{1,}can be replaced with+and{1}left out entirely (see regex101.com/r/pU4jK7/1). - jonrsharpe