![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 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 Specs![]() |
| | #2 (permalink) |
| Guest | 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 Specs![]() |
| | #3 (permalink) |
| Guest | 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 Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Expose a .NET interface to COM as an interface | pierre.k | .NET General | 3 | 06-19-2008 06:45 AM |
| Expose properties of "sub controls" in control template | Matt Mitchell | Avalon | 2 | 03-04-2006 04:08 PM |
| Expose parameters for my user control in top level XAML Layout ? | Griff | Avalon | 3 | 01-10-2006 03:53 PM |