HttpModule for Dynamic Grammars

Published 2 June 6 5:58 PM | William

In a few minutes, I'm doing my presentation on Tips & Tricks with Speech Server. One of my new tricks is using a HttpModule to build a Dynamic Grammar.  Greg Young was the one that came up with the idea and he deserves *full credit* for it - it's a brilliant idea and well, pretty typical for Greg from what I can tell. Everything he recommended kicked butt and this is just one of many.  I'm talking to Marshall about it now and hopefully we can post some examples up on GotSpeech

Comments

# Greg Young said on June 2, 2006 4:47 PM:

I might be able to put up an example (have to check if the ok to open source). The way I did it could also be done easily with a HTTPHandler, we eventually moved to this a httphandler as it made more sense. Basically you register a certain file extension for the handler. The handler then has some pretty basic code.

Basically it goes through and parses the used url, (I used a generic parameter builder to build parameters but one could also use a specific one). The handler then called a factory to get the object that knew how to deal with the specific request (based upon the name of the file requested and a map in the web.config). The object it got back would build the grammar xml and return it (where it would write it back to the client).

One of the nice things about this methodology is that the grammar creation process gets moved off to plugins (I can add or manipulate them without recompiling the application).

A major improvement on this that I did not take the time to do but should be done for an example would be to create an abstraction for the grammer itself so the plugin returns a nice object graph as opposed to XML (the object graph could also verify that the grammar is valid). The main reason for this is testability.

Glad you liked the idea.

Cheers,

Greg

# Greg Young said on June 2, 2006 5:18 PM:

btw I was going to subscribe to this but ...

http://msmvps.com/Msgs/default.aspx?MessageID=29 it won't let me create an account to subscribe with :(

# Brandon Tyler said on June 3, 2006 8:01 AM:

Very nice.  I would be interested in seeing this!

# William said on June 3, 2006 8:12 PM:

Thanks for the original ideas and thanks for the further explanation.  You definitely came up with a great concept on this - hopefully we can have some more fun coming up w/ implementations

# Greg Young said on June 4, 2006 4:14 AM:

Actually combining some of Sara's thoughts here http://www.devx.com/dotnet/Article/29623 would work quite well ...

# Marshall Harrison said on June 4, 2006 10:04 AM:

On Thursday my wife (Chris) and I drove from Jacksonville Fl. down to Fort Lauderdale where I was to...

Search

This Blog

Tags

Community

Archives

News

  • William G Ryan William Ryan Bill Ryan W.G. Ryan Charles Mark Carroll Charles M Carroll
    My Blog Juice Microsoft MVP
    Bill Ryan W.G. Ryan William Ryan
    Cuckooz' MySpace Page View Bill Ryan's profile on LinkedIn
    My Profile on Twitter
    Please note that this is my personal blog and the opinions expressed are my own. Also, comment moderation is about one of the least important things in my life so please keep that in mind. I can't vouch for the authenticity of any of the posters so please don't hold me accountable. And whatever you do, don't pretend to be Noted Option Strict Off expert and AspFriend Charles Mark Carroll when you post. Doing so will lead him to become apoplectic and write absurd accusatory posts about me that are as coherent and thought out as they are factually correct. He does a stellar job proving his reputation is well deserved and he doesn't need any help from you making himself look foolish. If I have to listen to him banging his spoon off of his high chair one more time, I'm going to burst into flames so please don't make that happen!

    My other sites

    Cool Stuff

    Book Stuff

    Security

    ORM

    Data Access

    Funny Stuff

    Compact Framework Stuff

    Web Casts

    My KnowledgeBase Articles

    My MVP Profile

    Design Patterns

    Performance

    Debugging

    Remoting

    My Fellow Authors

    My Books

    LINQ

    Misc

    Speech

    Syndication

    Email Notifications