0

我已经安装了 Dragon Naturally speak 14、dragonfly、最新的 natlink(4.1 或其他)、pywin32、python 2.7 和 wxpython

我在 natlink 设置的“用户配置目录”中有一个包含此文件的 python 文件

当 Dragon Naturally speak 开始时,我收到 natlink 弹出消息,告诉我它正在工作。我重置了 DNS 14 以确保我的“宏”(dosomething.py)已加载。

这是我的 dosomething.py 中的代码

from dragonfly 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.

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

但是,当我启动并激活 DNS 并使用听写和命令模式或只是命令模式说“做某事计算机”时,会弹出转录框,我如何判断它是否正常工作?我不认为它是。应该发生什么?我是 python 新手,我在 cmd 窗口中启动了解释器,没有像“语音命令”这样的提示。当我说语音命令时会生成。这是应该发生的事情吗?

4

1 回答 1

0

加载 Dragonfly 语法有两种方法:通过 Natlink 和通过 Windows 语音识别。WSR 要求您使用 放入该 while 循环pythoncom.PumpWaitingMessages(),但这不适用于 Natlink。你应该把它注释掉。

如果设置正确,您将不会看到“语音命令”。在任何 cmd 提示符下——您将在 Natlink 窗口中看到它。

于 2016-01-27T10:48:17.023 回答