Popular recipes by Michael http://code.activestate.com/recipes/users/4166101/2008-09-17T11:25:48-07:00ActiveState Code RecipesVersion-specific import (Python)
2008-09-17T11:25:48-07:00Michaelhttp://code.activestate.com/recipes/users/4166101/http://code.activestate.com/recipes/576508-version-specific-import/
<p style="color: grey">
Python
recipe 576508
by <a href="/recipes/users/4166101/">Michael</a>
(<a href="/recipes/tags/import/">import</a>, <a href="/recipes/tags/versioning/">versioning</a>, <a href="/recipes/tags/versions/">versions</a>).
Revision 5.
</p>
<p>Let's say you're at a company and you're deploying a package called "tools" on all production boxes. Normally, code on these boxes could "import tools" to use this package.</p>
<p>However, over time the API to tools will evolve as you release new versions that add functionality and fix bugs. If there's lots of company code that "imports tools", then you're stuck with backward compatibility forever.</p>
<p>This recipe presents a method for letting client code specify on one line which version of "tools" they wish to use -- and then import from the tools package as normal. Behind the scenes, the recipe is making sure that the client works with the version of the package that they requested. If the client ever wants to change versions, it's a one-line change at the top of their code.</p>
Speech recognition and voice synthesis in Python for Windows (Python)
2008-08-14T16:57:43-07:00Michaelhttp://code.activestate.com/recipes/users/4166101/http://code.activestate.com/recipes/576412-speech-recognition-and-voice-synthesis-in-python-f/
<p style="color: grey">
Python
recipe 576412
by <a href="/recipes/users/4166101/">Michael</a>
(<a href="/recipes/tags/speech/">speech</a>, <a href="/recipes/tags/speech_recognition/">speech_recognition</a>, <a href="/recipes/tags/text_to_speech/">text_to_speech</a>, <a href="/recipes/tags/tts/">tts</a>, <a href="/recipes/tags/voice/">voice</a>, <a href="/recipes/tags/voice_recognition/">voice_recognition</a>).
Revision 10.
</p>
<p>How to use the speech module to use speech recognition and text-to-speech in Windows XP or Vista.</p>
<p>The voice recognition system can listen for specific phrases, or it can listen for general dictation.</p>
<p>You can use speech.input() like you would use raw_input(), to wait for spoken input and get it back as a string. Or, you can set up a callback function to be run on a separate thread whenever speech events are heard. Multiple callbacks can be set up for multiple speech recognition events.</p>
<p>Uses the Python speech module: <a href="http://pyspeech.googlecode.com" rel="nofollow">http://pyspeech.googlecode.com</a> .</p>