How to recognize text with SAPI? - c#

How can I recognize text with SAPI, using C#?
Where can I find sample code?

Use the System.Speech.Recognition namespace. There's little point in battling the SAPI COM interfaces yourself, the SpeechRecognizer class lets you do anything you can do in SAPI. Point your browser to the MSDN Library topics for that namespace, you'll find plenty of examples.

they only thing I couldn't get system speech to do was to switch on/off a shared recognizer you can only get the state although in SAPI you can do this as the property isn't read only.
To get around this I use both SAPI (SpeechLib) and System.Speech.Recognition together. I noticed the shared recognizer follows the singleton design pattern which means that if it's already open you get a reference to the existing SAPI instance back rather then creating a new one.
This means that I could have a reference SAPI though the system.speech.recognition library and SpeechLib.dll.
(You get the best of both)
Kiran ;)

Related

MAUI/Xamarin.iOS: How to let user pick a file to save now that documentPickerMode is deprecated?

I have tried going through StackOverflow and the picker doc. Unfortunately, all the answer for my need use documentPickerMode which is deprecated since iOS 14.
Looking at Apple documentation on UIDocumentPickerViewController I know I need to use init(forExporting: [URL]). However, I cannot find any similar binding in Xamarin.
My question is:
How do I create such UIDocumentPickerViewController? I have successfully make a open dialog but not a save dialog.
In the future, if I read Apple documentation, how can I find the equivalent class in C#? I do not know Swift well yet and apparently parameter name is part of their signature? In that case how does the Xamarin.iOS team translate it into C# considering there maybe multiple overloads with the same signature? Also I am assuming Swift init is C# constructor, is it correct?
google xamarin ios UIDocumentPickerViewController has link .Net / .. / UIKit / UIDocumentPickerViewController Class.
So far the class API documentation says Xamarin.iOS; so my comment above about rebranding to .Net for iOS is not relevant. Easier to find what you need as xamarin. TBD exactly what Microsoft will decide.
Usually the corresponding C# method is easily found. If not obvious from doc page, add Apple's method name to the google query:
xamarin ios UIDocumentPickerViewController SOMEMETHODHERE.
However, those init... methods Microsoft implements as Constructors; I think you want UIDocumentPickerViewController(NSUrl, UIDocumentPickerMode) on that page.

How to convert a set of arabic numbers (order numbers) to speech in c#.net?

To make my question clear, I don't want to use System.Speech.Synthesis library by Microsoft, since it does not support Arabic at all ..
and I tried looking for other TTS engines but couldn't find anything helpful ..
so I figured there should be another way without using TTS .. like playing a set of audio files corresponding with my numbers.
in short, its a call system that calls for numbers in a queue .. can any one with enough experience in this area show me a good start to go on ? or if there are good libraries out there that could be used with the .net framework that already does my thing?

Add words to DictationGrammar in C# Speech Recognition?

This is something that has bugged me for a while. I'm developing a C# application that uses voice control, and I was wondering if there is any possible way to load a DictationGrammar and then add words to it to improve accuracy. For instance: I'm trying to use it to search google and bing. It barely recognizes the word 'google' and has never recognized the word 'bing'. Is there any way to do this? DictationGrammar is not very accurate at all (it keeps adding words). Currently, I'm loading the grammar like this:
PACSREC.LoadGrammarAsync(new DictationGrammar());
You can add words to the user lexicon, and the DictationGrammar will implicitly add those words.
Unfortunately, the Lexicon APIs aren't exposed via the System.Speech.Recognition APIs; instead, you'll have to use the SpeechLib (automation-compatible) APIs to do so. See this question for examples.

Microsoft Speech Platform - how to update rules at runtime

I am using the System.Speech to build a C# application with voice recognition capabilities.
I read this post http://msdn.microsoft.com/en-us/library/jj127913.aspx that mentions how to update rules dynamically at runtime.
I wonder how I can do the same trick with the C# System.Speech API.
Do you have any idea?
Thank you
System.Speech is a bit different from the SAPI described under this link, however, it's even easier to construct grammars in runtime, you can use GrammarBuilder class for that. You can add any structure of choices and rules to construct the language you need to recognize.
Once you updated the grammar you can load the grammar into recognizer recognizer with LoadGrammar

Question on Speech Recognition classes in .NET

Is it possible to have an application built using the .NET speech recognition classes and pass in a WAV file for it to go through and create a text representation of it. For example, this what I'm trying to do:
We have a QA department at my office and they have to listen to hundreds of calls a day which is quite impossible, and there's not enough people listening to everything to keep up. What I want to do is have the audio file uploaded to our server and have the server parse it and create a transcript of it. It doesn't matter if it's not perfect, but just a base which would be easier to skim through a couple of dozen lines of text than listen to a 2 hour recording.
Based on a saved transcript I can implement full-text search in the database and also run checks against the transcript if someone is saying something that's a misrepresentation.
So, is it possible to create an application using the .NET speech recognition classes and just pass the WAV file to it and it spit out a rough transcript?
I've dug around MSDN on the Speech classes briefly while thinking up the idea, so I don't have that much knowledge if it's possible to be done.
If possible, I would appreciate any examples in C#. Topic 1055347 is similar to the question I'm having, and was provided links, the most specific of which is in C++. I'm not a C++ developer, nor have I ever went to school for programming, I'm all self though C#, so I would like to stay in the language that I know.
Thanks in advance!
This sounds like you've got a call center type of application. Microsoft Speech Server has a SR engine optimized for telephony (8000 Hz sample rate), which will generate much better recognitions than the desktop SR engine. However, the engine isn't really designed for transcription (although it can do it), and the transcriptions definitely need to be reviewed before further processing occurs. Microsoft Exchange Unified Communications uses the SR engine to generate transcripts of voice mail, and while it's better than nothing, it often generates amusing nonsense.
With areas like speech recognition you are likely to either find a stand alone EXE or an API in c/c++.
For the links in the other topic, you can use a tool like P Interop Assistant to generate C# code. The C# code acts like a wrapper around the unmanaged dll, so you can call it from c#.
This is likely to be the best way to get the functionality you are looking for.
Yes.
I did such an application a few years ago on the Tablet PC; you can read about it at http://web.archive.org/web/20060615192119/www.devx.com/TabletPC/Article/30761 (At the time, I spoke of using Interop to access the libraries, but I believe that the programming model has remained the same, just with a managed wrapper.)
At the time, the results were very poor, but maybe for your use-case better than nothing.
How about route the calls to Google Voice? I'm sure there are similar services. I have been amazed at its accuracy so far, plus you can click and listen to it if required. Google Voice will forward voice calls to SMS or email.
UPDATE: On reread, maybe since you are recording calls it won't work as I yous the voice message left.

Categories