Bullshit Generator
livibetter
livibetter at gmail.com
Sun Mar 29 19:16:26 EDT 2009
This is fun. I tried to add speech synthesis on Linux, hope you don't
mind.
If you have speech-dispatcher [1] worked normally, you can replace the
main program with
# --------------------------------------------------
# main program
# --------------------------------------------------
try:
import win32com.client
voice = win32com.client.Dispatch("sapi.SPVoice")
except:
try:
import speechd
voice = speechd.SSIPClient('bullshit.py')
# Choose one module you have on your system
voice.set_output_module('espeak')
voice.set_punctuation(speechd.PunctuationMode.SOME)
except:
voice = None
print "press <enter> to resume, 'q'+<enter> to quit\n"
while True:
print
for i in xrange(8):
generatedSentence = sentence.getString()
print generatedSentence,
if voice:
voice.speak(generatedSentence)
if raw_input().strip().lower() == "q":
voice.cancel()
import sys
sys.exit(0)
# End of Main Program
[1] http://cvs.freebsoft.org/doc/speechd/
More information about the Python-list
mailing list