Greetings Monks,
I've been programming perl for over 5 years, but I'm just starting to move into OOP. The going has been rough. I'm doing this mostly out of necessity, to interface with Win32::OLE objects, but also because I do understand it leads to better code, especially for large projects.
I'm running into a problem trying to get speech recognition working in Win32 with perl. I posted this question
before, and only got one response, so I'm going to try asking it again in a more general context. I was really hoping to find a "hello world" perl speech recognition example using Google, but there were none to be found. So, the closest I could come was translating code from simple examples in other languages. Here is a concise python example:
http://www.surguy.net/articles/simple-speech-recognition.py
And a less concise C++ example:
www.generation5.org/aisolutions/sr00.shtml
Okay, the python code doesn't look too bad. Should be no problem to convert to perl.
The code snippet I'm trying to run is very simple:
use strict;
use warnings;
use Win32::OLE;
my $ear = Win32::OLE->new('SAPI.SpSharedRecognizer');
my $context = $ear->CreateRecoContext();
All I want to do here is create a Recognizer (an ear), and then use that recognizer to create a context. This format is similar in both the Python example, and the C++ example. I've checked the SAPI5.1 docs, and there is definitely a CreateRecoContext method for the SpSharedRecognizer class. When I run this code, I get the following error:
Win32::OLE(0.1403) error 0x80040154: "Class not registered"
in METHOD/PROPERTYGET "CreateRecoContext" at ear.pl line 6
What exactly does this error mean? Is there something wrong with the syntax I'm using to call the method? I have the horrible feeling I'm missing something very simple here. Any help is greatly appreciated.
Run environment info:
ActivePerl-5.8.4.810 running on Windows XP with SP1
SAPI5.1 is installed, and I can call the text-to-speech API in perl with no problem.
One other question. When I posted this request before, Jouke Visser was kind enough to point me to his Win32::SAPI5 module. However, I don't understand the need for this module. Shouldn't I be able to access all the methods defined in Win32::SAPI5 using Win32::OLE directly?
When I get this working, I'll add it to the Win32::OLE CPAN-Specific tutorials, in case anyone else out there wants to use speech recognition in their perl scripts.
Thanks,
TROGDOR
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.