Profanity alert!

I wrote a program to check the curse words and let you know when you are talking! (Profanity alert)

Speech works on Windows: https://pypi.python.org/pypi/speech/0.5.2

Talk:
You said We are talking about image processing
This documents has no curse words!
Talk:You said Our system
This documents has no curse words!
Talk:
You said And now we are talking about speech processing This documents has no curse words!
Talk:
You said Great This documents has no curse words!
Talk:

import string
import speech
import urllib

def check_profanity(text_to_check):
    connection= urllib.urlopen("http://www.wdyl.com/profanity?q="+text_to_check)
    output= connection.read()
    #print(output)
    connection.close()
    if "true" in output:
        print("Profanity Alert!")
    elif "false" in output:
        print("This documents has no curse words!")
    else:
        print("Couldn't scan the documents!")
while True:
    print "Talk:"
    phrase = speech.input()
    speech.say("You said %s" % phrase)
    print "You said {0}".format(phrase)
    check_profanity(phrase)
    #if phrase == "turn off":
    if phrase.lower() == "goodbye":
        break

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.