Discussion:
C# 3.5 and SAPI 5.1 on german WinXP Pro
(too old to reply)
Damien80
2007-12-16 20:22:00 UTC
Permalink
Hi,

I have an application written in C# (.NET 3.5) that uses SAPI 5.1 for voice
recognition. The app runs on Windows XP Pro SP2.

On an english installation everything is fine but on a german XP I get an
exception that tells me that recognizer and grammar use different languages.
The recognizer is set to english in the control pannel so I guess the problem
is that the application somehow reads the XP language settings and assumes
that german is the language it should use.

Is there a way I can tell the recognizer explicitely that it should use
english (as far as I know there is no german language recognition support for
XP anyway...).

Thanks for your help

Sebastian
Aziz El Ouaqid[msft]
2007-12-21 05:12:53 UTC
Permalink
Hi Sebastian,

If you are using Grammar builder to create the grammar, it will default to
the OS system local you are using.
You can use Microsoft.Speech.Recognition.GrammarBuilder.Culture to override
this behavior if you are using an SR engine that does not match your system
locale.

If you are loading grammars from file, then each of these files has a
language tag.
Try changing this to match the recognizer you are loading them into.

e.g.

<?xml version="1.0" encoding="UTF-16" ?>
- <grammar version="1.0" xml:lang="en-US"
xmlns="http://www.w3.org/2001/06/grammar" tag-format="semantics-ms/1.0"
root="AltsOfTwo">
- <rule id="AltsOfTwo" scope="public">
- <one-of>
<item>two</item>
<item>2</item>
<item>too</item>
<item>true</item>
<item>to</item>
</one-of>
</rule>
</grammar>

Hope that helps,

Aziz
Post by Damien80
Hi,
I have an application written in C# (.NET 3.5) that uses SAPI 5.1 for voice
recognition. The app runs on Windows XP Pro SP2.
On an english installation everything is fine but on a german XP I get an
exception that tells me that recognizer and grammar use different languages.
The recognizer is set to english in the control pannel so I guess the problem
is that the application somehow reads the XP language settings and assumes
that german is the language it should use.
Is there a way I can tell the recognizer explicitely that it should use
english (as far as I know there is no german language recognition support for
XP anyway...).
Thanks for your help
Sebastian
Damien80
2007-12-21 05:55:00 UTC
Permalink
Hi Aziz,

thanks for your help. I found a way to solve my problem by setting the
culture of the application using
Thread.CurrentThread.CurrentCulture to en-US

Your way looks more elegant though, I'll give it a try too.

Thanks again

Sebastian
Post by Aziz El Ouaqid[msft]
Hi Sebastian,
If you are using Grammar builder to create the grammar, it will default to
the OS system local you are using.
You can use Microsoft.Speech.Recognition.GrammarBuilder.Culture to override
this behavior if you are using an SR engine that does not match your system
locale.
If you are loading grammars from file, then each of these files has a
language tag.
Try changing this to match the recognizer you are loading them into.
e.g.
<?xml version="1.0" encoding="UTF-16" ?>
- <grammar version="1.0" xml:lang="en-US"
xmlns="http://www.w3.org/2001/06/grammar" tag-format="semantics-ms/1.0"
root="AltsOfTwo">
- <rule id="AltsOfTwo" scope="public">
- <one-of>
<item>two</item>
<item>2</item>
<item>too</item>
<item>true</item>
<item>to</item>
</one-of>
</rule>
</grammar>
Hope that helps,
Aziz
Post by Damien80
Hi,
I have an application written in C# (.NET 3.5) that uses SAPI 5.1 for voice
recognition. The app runs on Windows XP Pro SP2.
On an english installation everything is fine but on a german XP I get an
exception that tells me that recognizer and grammar use different languages.
The recognizer is set to english in the control pannel so I guess the problem
is that the application somehow reads the XP language settings and assumes
that german is the language it should use.
Is there a way I can tell the recognizer explicitely that it should use
english (as far as I know there is no german language recognition support for
XP anyway...).
Thanks for your help
Sebastian
Microwind
2009-04-25 14:09:01 UTC
Permalink
Hi i this is my method while i face same problems with you

Mine simply code behind like this...

-----------------------------------------------
GrammarBuilder grammar = new GrammarBuilder();
CultureInfo targetculture = new CultureInfo("en-US");
grammar.Culture = targetculture;
-----------------------------------------------


and the CultureInfo is defined in System.Globalization;

hope this help....

:')
Post by Damien80
Hi,
I have an application written in C# (.NET 3.5) that uses SAPI 5.1 for voice
recognition. The app runs on Windows XP Pro SP2.
On an english installation everything is fine but on a german XP I get an
exception that tells me that recognizer and grammar use different languages.
The recognizer is set to english in the control pannel so I guess the problem
is that the application somehow reads the XP language settings and assumes
that german is the language it should use.
Is there a way I can tell the recognizer explicitely that it should use
english (as far as I know there is no german language recognition support for
XP anyway...).
Thanks for your help
Sebastian
Loading...