Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Expose _Text in Speech.Synthesis.Prompt

 
 
Old 06-03-2006   #1 (permalink)
Nathan


 
 

Expose _Text in Speech.Synthesis.Prompt

While the Text can be added via constructor, it cannot be reached even as
just Readonly.

I feel it would be beneficial to be able to retrieve the currently spoken
textToSpeak at the time the State changes to Speaking. It goes something like
this.

Global Synthesizer, Recognizer, LastSpokenPhrase

Synthesizer.Speak "There are " + number + " eggs in the basket. Do you want
to see them?"

{Synthesizer.StateChanged
e.Speaking
LastSpokenPhrase = Synthesizer.GetCurrentlySpokenPrompt
}


{Recognizer.SpeechRecognized
If regex.ismatch(LastSpokenPhrase._Text,"....")
If e.Result.Text == "Yes"
........
}

I think the value of exposing _Text from Prompt can be gained from this
pseudo-example.

Nathan

My System SpecsSystem Spec
Old 06-03-2006   #2 (permalink)
Nathan


 
 

RE: Expose _Text in Speech.Synthesis.Prompt

Wellll, digging a little deeper, I'm thinking it may not be necessary seeing
how SRGS works.

Nathan

"Nathan" wrote:

> While the Text can be added via constructor, it cannot be reached even as
> just Readonly.
>
> I feel it would be beneficial to be able to retrieve the currently spoken
> textToSpeak at the time the State changes to Speaking. It goes something like
> this.
>
> Global Synthesizer, Recognizer, LastSpokenPhrase
>
> Synthesizer.Speak "There are " + number + " eggs in the basket. Do you want
> to see them?"
>
> {Synthesizer.StateChanged
> e.Speaking
> LastSpokenPhrase = Synthesizer.GetCurrentlySpokenPrompt
> }
>
>
> {Recognizer.SpeechRecognized
> If regex.ismatch(LastSpokenPhrase._Text,"....")
> If e.Result.Text == "Yes"
> ........
> }
>
> I think the value of exposing _Text from Prompt can be gained from this
> pseudo-example.
>
> Nathan

My System SpecsSystem Spec
Old 06-04-2006   #3 (permalink)
Nathan


 
 

RE: Expose _Text in Speech.Synthesis.Prompt

Actually, looking more at it, I am still thinking it would be good to have
_Text exposed. I just turned to reflection to get at it.

Consider the following SRGS:
<?xml version="1.0" encoding="utf-8" ?>
- <grammar xml:lang="en-US" root="AppRoot" version="1.0"
xmlns="http://www.w3.org/2001/06/grammar">
- <rule id="AppRoot">
- <one-of>
- <item>
<ruleref uri="#CatchATrain" />
</item>
- <item>
<ruleref uri="#OrderAMeal" />
</item>
- <item>
<ruleref uri="#DateTime" />
</item>
</one-of>
</rule>
- <rule id="YesNo">
- <one-of>
<item repeat="0-1">Yes</item>
<item repeat="0-1">Yea</item>
<item repeat="0-1">Sure</item>
<item repeat="0-1">No</item>
<item repeat="0-1">Nope</item>
<item repeat="0-1">No Thanks</item>
</one-of>
</rule>
- <rule id="OrderAMeal">
- <one-of>
<item repeat="0-1">Pizza</item>
<item repeat="0-1">Pasta</item>
<item repeat="0-1">Cheese</item>
<item repeat="0-1">Wine</item>
<item repeat="0-1"><ruleref uri="#YesNo" /></item>
</one-of>
</rule>
- <rule id="CatchATrain">
- <one-of>
<item repeat="0-1">NewYork</item>
<item repeat="0-1">Missouri</item>
<item repeat="0-1">California</item>
<item repeat="0-1"><ruleref uri="#YesNo" /></item>
</one-of>
</rule>
- <rule id="Date">
- <one-of>
<item repeat="0-1">What date is it</item>
<item repeat="0-1">What's the date</item>
<item repeat="0-1">What month is it</item>
<item repeat="0-1">What's the month</item>
<item repeat="0-1">What year is it</item>
<item repeat="0-1">What's the year</item>
</one-of>
</rule>
- <rule id="Time">
- <one-of>
<item repeat="0-1">What time is it</item>
<item repeat="0-1">What's the time</item>
</one-of>
</rule>
- <rule id="DateTime">
- <one-of>
- <item>
<ruleref uri="#Date" />
</item>
- <item>
<ruleref uri="#Time" />
</item>
</one-of>
</rule>
</grammar>

The Root AppRoot is like the menu system and inside you have 3 choices.
In the E.Result for SpeechRecognized, I would like the know which menu item
was called so I can pass the result to the appropriate function.

Currently the E.Result outputs:
- Result Recognized text: "Yes" System.Speech.Recognition.RecognitionResult
+ Alternates Count = 0 System.Collections.ObjectModel.ReadOnlyCollection(Of
System.Speech.Recognition.RecognizedPhrase)
+ Audio {System.Speech.Recognition.RecognizedAudio} System.Speech.Recognition.RecognizedAudio
Confidence 0.8468523 Single
+ Grammar Grammar: Identifier expected. System.Speech.Recognition.Grammar
HomophoneGroupId 0 Integer
+ Homophones Count = 0 System.Collections.ObjectModel.ReadOnlyCollection(Of
System.Speech.Recognition.RecognizedPhrase)
+ ReplacementWordUnits Count =
0 System.Collections.ObjectModel.Collection(Of
System.Speech.Recognition.ReplacementText)
- Semantics '"<ROOT>"'= Nothing - Children =
0 System.Speech.Recognition.SemanticValue
AKeys {Length=0} System.Speech.Recognition.SemanticValue()
+ Confidence 0.8468523 {Single} Object
+ Count 0 {Integer} Object
+ KeyName "<ROOT>" {String} Object
Value Nothing Object
Text "Yes" String
- Words Count = 1 System.Collections.ObjectModel.ReadOnlyCollection(Of
System.Speech.Recognition.RecognizedWordUnit)
- Items {Length=1} System.Speech.Recognition.RecognizedWordUnit
- (0) Text: "Yes" System.Speech.Recognition.RecognizedWordUnit
Confidence 0.8250141 Single
DisplayAttributes OneTrailingSpace
{4} System.Speech.Recognition.DisplayAttributes
LexicalForm "Yes" String
Pronunciation "jɛs" String
Text "Yes" String

As you can see, I would not know what Yes is being responded to.
Nathan

"Nathan" wrote:

> Wellll, digging a little deeper, I'm thinking it may not be necessary seeing
> how SRGS works.
>
> Nathan
>
> "Nathan" wrote:
>
> > While the Text can be added via constructor, it cannot be reached even as
> > just Readonly.
> >
> > I feel it would be beneficial to be able to retrieve the currently spoken
> > textToSpeak at the time the State changes to Speaking. It goes something like
> > this.
> >
> > Global Synthesizer, Recognizer, LastSpokenPhrase
> >
> > Synthesizer.Speak "There are " + number + " eggs in the basket. Do you want
> > to see them?"
> >
> > {Synthesizer.StateChanged
> > e.Speaking
> > LastSpokenPhrase = Synthesizer.GetCurrentlySpokenPrompt
> > }
> >
> >
> > {Recognizer.SpeechRecognized
> > If regex.ismatch(LastSpokenPhrase._Text,"....")
> > If e.Result.Text == "Yes"
> > ........
> > }
> >
> > I think the value of exposing _Text from Prompt can be gained from this
> > pseudo-example.
> >
> > Nathan

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Computer speech synthesis on Vista Vista performance & maintenance
Computer speech synthesis on Vista Vista music pictures video
Computer speech synthesis on Vista Vista installation & setup
Speech synthesis kits Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46