Created
August 13, 2008 05:57
-
-
Save llatzhar/5205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
context = WIN32OLE.new('SAPI.SpSharedRecoContext.1') | |
#context = WIN32OLE.new('SAPI.SpInProcRecoContext.1') | |
grammar = context.CreateGrammar(1) | |
grammar.DictationLoad() | |
grammar.DictationSetState(1) | |
event = WIN32OLE_EVENT.new(context, "_ISpeechRecoContextEvents") | |
event.on_event("Recognition") do |*e| | |
result = e[3].PhraseInfo.GetText | |
puts result | |
end | |
loop do | |
WIN32OLE_EVENT.message_loop | |
sleep(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment