Python语音处理库,用于语音到文本

时间:2011-02-02 11:37:05

标签: python speech-recognition

喂 我想在python中构建一个代码,它将识别我通过micrphone讲话并转换为语音, 你能不能给我一些高效的语音处理库来实现同样的目标?

2 个答案:

答案 0 :(得分:4)

答案 1 :(得分:0)

蜻蜓示例代码在代码段中错过,同时在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.

后面应该是

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

如此处所述 - http://dragonfly.googlecode.com/svn-history/r46/trunk/dragonfly/examples/dragonfly-main.py