Clean sentences

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
znoopy
Forum Newbie
Posts: 1
Joined: Thu Sep 09, 2010 11:58 am

Clean sentences

Post 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
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Clean sentences

Post by JakeJ »

You could try adapting this: http://www.languagetool.org/
Post Reply