【发布时间】:2014-12-03 06:03:50
【问题描述】:
我正在使用 wsr 与 Dragon fly 一起做一个程序,它必须分析一个单词,任何匹配该单词的语音都应该输出“是的,它匹配”
如果我说“czechoslovakia”,那么即使对于这个世界上所有类似的匹配,它也必须打印为 true,例如“circle slovakia, cat on slavia,seko vakia...”的单词。
具体的方法,我应该使用什么方法?
我的程序
from dragonfly.all import *
import pythoncom
import time
# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
spec = "czechoslovakia|circle slovalia|sceko bakia|cat on ania" # 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.
while True:
pythoncom.PumpWaitingMessages()
time.sleep(.1)
【问题讨论】:
-
那你如何定义“相似”。你可能想详细说明一下。
标签: python speech-recognition speech python-dragonfly