eva uses large n-grams for music searches. these n-grams are pre-generated from a music library because they take a long time to build. the problem is MS does not programmatic APIs to build these grammars. they only provide APIs for GRXML. so i have to manually use graphical tools to build them. or i have to deploy dev tools to eva's server, and then i could automate the build process. but i really just want an API. the other option is to use the System.Speech.GrammarBuilder to programmatically create a grammar at runtime that behaves like an n-gram. i do this for audio books. the problem is its slow. it takes over a minute to build the audio book grammar, and that grammar is much smallar than my music grammars.
using Reflector, I've found the class Microsoft.SpeechServer.GrammarTools.GrammarBuilder. it takes a TrainingSet and outputs a byte . the TrainingSet is just an object representation of what the conversational grammar builder uses. so i can programmatically create a TrainingSet object, populate it with text samples, and call BuildCFG. save the byte stream to a .cfg file and it loads in System.Speech.SpeechRecognitionEngine and works! ... it's an n-gram. so that gives me an API on my dev machine. the problem is it uses Interop.SdkSpeechLib, which i can grab from \windows\assembly. but it depends on a COM lib from SpeechServer ... which would entail deploying Speech Server to eva's server. which i really dont want to do because eva uses System.Speech. so i decompiled Microsoft.SpeechServer.GrammarTools and tried building it against an Interop.SpeechLib COM wrapper which depends on SAPI 5.3 (Vista). that took a while, and i can almost get it to work, except for this version of SAPI is missing the command ConvertGrammar ... which sounds important. anyway, i have to try skipping that call and seeing if it really is important. the other option is to try installing UCMA 2.0 SDK to eva's server, which installs a server version of SAPI, and see if Interop.SdkSpeechLib will reference that. serious pain ...