Speech processing library in Python for speech to text

百般思念 提交于 2019-11-29 09:35:36

问题


Hey I am looking to build a code in python which will recognise what i speak through the micrphone and convert to speech, can you please give me few effcient speech processing libraries for achieving the same??


回答1:


See pyspeech (python) - Transcribe mp3 files?

which talks about http://code.google.com/p/pyspeech/. You may also want to look at http://code.google.com/p/dragonfly/




回答2:


The dragonfly sample code misses out on a snippet while providing the code example at https://pythonhosted.org/dragonfly/

from dragonfly.all import Grammar, CompoundRule

# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
    spec = "do something computer"                  # Spoken form of command.
    def _process_recognition(self, node, extras):   # Callback when command is spoken.
        print "Voice command spoken."

# Create a grammar which contains and loads the command rule.
grammar = Grammar("example grammar")                # Create a grammar to contain the        command rule.
grammar.add_rule(ExampleRule())                     # Add the command rule to the grammar.
grammar.load()                                      # Load the grammar.

should be followed by

import time
import pythoncom
while True:
    pythoncom.PumpWaitingMessages()
    time.sleep(.1)

as mentioned here - http://dragonfly.googlecode.com/svn-history/r46/trunk/dragonfly/examples/dragonfly-main.py



来源:https://stackoverflow.com/questions/4873982/speech-processing-library-in-python-for-speech-to-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!