Help turning code into a module

dylpkls91 dylpkls91 at gmail.com
Tue Dec 20 23:57:40 EST 2005


Hi all,

I am working on a little program for home automation under the X10
protocol. I have given up using a Palm device for input, so I have
resorted to using voice recognition, which I knew nothing about.
However, I found a nice little script on the internet that does exactly
what I need, and it recognizes phrases with pretty much 100% accuracy.
The script can be found here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/93025

What I want to do is make this code into a module, so I can use it in
the future. For example:

import voicerecognition as vr
vr.StartRecognition(["one", "two", "three"])
result = vr.GetRecognized()
if result == "one":
     print "You said: one"
else:
     print "You did not say 'one'."

Any help would be appreciated. I have tried this, but IDLE keeps
freezing whenever I try to use the module with a test script.
Specifically, if anyone could actually turn this into a module for me,
I would be extremely grateful. Thank you!




More information about the Python-list mailing list