The only way to win is not to play.
Consider the following sentence:
"Edward II was one of only a handful monarchs to give birth to a recorded bastard."
Bastard is a border line swear-word but in this context it is a completely sensible term.
Consider also:
- "The molten slag fell out of the
cruciable."
- "The bitch sniffed the other dog's backside."
You are never going to be able to build a parser that is capable of working out whether the usage is correct. Even if you decided to go ahead anyway and just star out those words, they're easily subverted anyway.
Ask yourself, Is "Tw*t" really that much less offensive than "twat"? Everyone knows what word you're pointing to and everyone understands what it means.
Ultimately, the solution to this problem is not technological. Really, you want to use a human moderator of some sort to get rid of the people who swear. A human moderate has a facility that algorithms never will: it can exercise judgement. Using this judgement is far more useful than throwing computer-science at the problem.
This is discussed at length in other answer to this question.