特定の Dragonfly コマンドのみを受け入れたい場合、Windows 音声認識 (WSR) の特定の側面を無効にすることはできますか? 組み込みの WSR とDragonflyを使用して、Python で (単純な) 音声制御の対話システムをプログラミングしています。WSR は、コマンドを理解できない場合は常に、ランダム テキストを挿入しようとします。
可能であれば、Python/Dragonfly 内で、このテキスト挿入およびその他の望ましくない組み込み (つまり、デフォルトの WSR アクティビティを伴うキーワード) をプログラムで無効にしたいと考えています。私の音声制御システムの最小限の機能例を以下に示します。
from dragonfly.all import Grammar, CompoundRule
import dragonfly, time, pythoncom
hablador = dragonfly.get_engine()
class TimeRule(CompoundRule):
spec = "what time is it"
def _process_recognition(self, node, extras):
hablador.speak(time.ctime()[11:16])
grammar = Grammar("example grammar")
grammar.add_rule(TimeRule())
grammar.load()
while True:
pythoncom.PumpWaitingMessages()
time.sleep(.1)