Page 1 of 1

Clean sentences

Posted: Thu Sep 09, 2010 12:40 pm
by znoopy
Hi

Im trying to figure out a good PHP way of cleaning up poorly formatted sentences. A regexp that:

Adds a space after punctuation and ()!?
Adds a space before capital letters, if that capital letter is followed by a lowercase letter (eg "aaaLOTSCAPS" becomes "aaa LOTSCAPS" and "aaaLotsCaps" becomes "aaa Lots Caps")

Any suggestions on available powerful sentence format cleaners out there much welcome!..

Thanks

Re: Clean sentences

Posted: Thu Sep 09, 2010 2:54 pm
by JakeJ
You could try adapting this: http://www.languagetool.org/