467,077 Members | 1,022 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

Python based unacceptable language filter

Hi. Is anyone aware of any python based unacceptable language filter
code to scan and detect bad language in text from uploads etc.

Many thanks.
David
Oct 2 '05 #1
  • viewed: 1833
Share:
4 Replies
David Pratt wrote:
Hi. Is anyone aware of any python based unacceptable language filter
code to scan and detect bad language in text from uploads etc.

Many thanks.
David


You might be able to adapt languagetool.
http://www.danielnaber.de/languagetool/features.html

Later versions have been ported to Java, but the old python version of
languagetool is at http://tkltrans.sourceforge.net/#r03

His thesis paper is at
http://www.danielnaber.de/languageto...ar_checker.pdf

Mind you, given the poor language skills of many native english speakers
(not to mention those for whom english is a second language) relying on
automated filters to enforce 'good' language seems a trifle extreme. This
post for example would probably not pass.

Cheers,
Nigel

PS. For the humour impaired, this g*d d*mm post was a f*cking joke, OK! :-)

Mind you, the links are real.

--
Nigel Rowe
A pox upon the spammers that make me write my address like..
rho (snail) swiftdsl (stop) com (stop) au
Oct 3 '05 #2

"David Pratt" <fa*******@eastlink.ca> wrote in message
news:ma*************************************@pytho n.org...
Hi. Is anyone aware of any python based unacceptable language filter
code to scan and detect bad language in text from uploads etc.

Many thanks.
David


Look up Spambayes - if you can filter on terms like "dear friend" you can
filter on the inverse too, no? It needs samples to work with.
Oct 3 '05 #3

On Oct 2, 2005, at 9:45 PM, Nigel Rowe wrote:
David Pratt wrote:

Hi. Is anyone aware of any python based unacceptable language filter
code to scan and detect bad language in text from uploads etc.

Many thanks.
David


You might be able to adapt languagetool.
http://www.danielnaber.de/languagetool/features.html

Later versions have been ported to Java, but the old python version of
languagetool is at http://tkltrans.sourceforge.net/#r03

His thesis paper is at
http://www.danielnaber.de/languagetool/download/
style_and_grammar_checker.pdf

Mind you, given the poor language skills of many native english
speakers
(not to mention those for whom english is a second language)
relying on
automated filters to enforce 'good' language seems a trifle
extreme. This
post for example would probably not pass.

Cheers,
Nigel

PS. For the humour impaired, this g*d d*mm post was a f*cking joke,
OK! :-)

Mind you, the links are real.

--
Nigel Rowe
A pox upon the spammers that make me write my address like..
rho (snail) swiftdsl (stop) com (stop) au
--
http://mail.python.org/mailman/listinfo/python-list


I think he may be referring to "bad" words, and 'filthy' language. At
least that's what i got from the question.
There are many PHP implementations on the web, which could be adapted
to python fairly easily. Most of which are probably not the most
ideal solution and
involve alot of stuff like

for n in badwords:
texttofilter.replace(n, '<bad word deleted>')

If that's all you need though, maybe it's not so bad.
---
Andrew Gwozdziewycz
ap****@gmail.com
http://ihadagreatview.org
http://plasticandroid.org
Oct 3 '05 #4
Andrew Gwozdziewycz wrote:
I think he may be referring to "bad" words, and 'filthy' language. At
least that's what i got from the question.
There are many PHP implementations on the web, which could be adapted
to python fairly easily. Most of which are probably not the most
ideal solution and
involve alot of stuff like

for n in badwords:
texttofilter.replace(n, '<bad word deleted>')

If that's all you need though, maybe it's not so bad.


This is a no-op, since it replaces the text, but then discards it. You
meant:

for badWord in badWords:
textToFilter = textToFilter.replace(badWord, '<)!&%(#&)%>')

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
If anything is sacred, the human body is sacred.
-- Walt Whitman
Oct 3 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

699 posts views Thread by mike420@ziplip.com | last post: by
reply views Thread by Emile van Sebille | last post: by
68 posts views Thread by Lad | last post: by
9 posts views Thread by Alex | last post: by
34 posts views Thread by Ville Voipio | last post: by
267 posts views Thread by Xah Lee | last post: by
15 posts views Thread by Lorenzo Stella | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.