System.speech, please do not say the area code

I use simple C # code to talk to a program

if (checkBox1.Checked == true) { SpeechSynthesizer speaker = new SpeechSynthesizer(); speaker.Rate = 1; speaker.Volume = 100; speaker.Speak(stringout); 

The problem is that the string contains sentences with numbers. And microsoft speach recognizes them as "area codes", for example, instead of saying

sample 90 123 40

I hear:

sample area code 90 123 40

How to stop this behavior?

+6
source share
1 answer

Try the following:

 speaker.SpeakSsml("sample <say-as interpret-as=\"string\" format=\"digit string\" detail=\"string\">90 123 40<say-as>"); 

If this works, replace RegEx with your string to wrap the numbers in that string.

+1
source

Source: https://habr.com/ru/post/920235/


All Articles