Re: Speakable Item and SpeechRecognitionServer
Re: Speakable Item and SpeechRecognitionServer
- Subject: Re: Speakable Item and SpeechRecognitionServer
- From: Deivy Marck Petrescu <email@hidden>
- Date: Fri, 11 Dec 2009 16:18:07 -0500
On Dec 11, 2009, at 15:26, Bruce Robertson wrote:
On Dec 11, 2009, at 12:00 PM, Christopher Nebel wrote:
On Dec 8, 2009, at 6:47 PM, Bruce Robertson wrote:
The problem statement is to read an arbitrary string of numbers
and have them be recognized.
The string might be preceded by a known string ("Find phone" ) but
the solution must be able to recognize any following string of
four numbers.
There is no "set J"; it isn't known ahead of time.
The functionality that "listen for" exposes is pretty dead-simple
-- it is, as you've observed, a list of fixed phrases. (For a
sufficiently small set of numbers, you could generate all the
combinations, but that's hardly practical in this case.) The
underlying C API *can* do something like you're describing: it lets
you create a "language model", which is roughly equivalent in
expressive power to a basic regular expression, so you could set up
a model which is one of the words "one" through "nine", repeated
any number of times. However, that's only available to C clients,
and there are no plans to expose it in the scripting interface.
The best you can do is to effectively do the model logic yourself
-- in your case, sit in a loop recognizing single digits until you
decide you're done. However, I expect you'd have to speak very
slowly, since each digit is being recognized separately. (And I,
too, ran into trouble trying to call "listen for" twice.)
--Chris Nebel
AppleScript Engineering
Thanks. Your suggestion seems a little conflicting though. Any ideas
then about how to do the loop?
_______________________________________________
How about this:
<script>
set lista to {}
repeat with j from 0 to 9
set end of lista to "" & j
end repeat
set tel to ""
repeat with kk from 1 to 7
tell application "SpeechRecognitionServer" to set theWord to listen
for lista with prompt "say word number " & kk
set tel to tel & theWord
delay 1
end repeat
return tel
--->"6108886" -- not my phone by the way... :)
</script>
Tested in Leopard.
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden