我怎么能只加载语法数字[系统,语音] [英] How I can loadgrammar numbers only [system, speech]

查看:98
本文介绍了我怎么能只加载语法数字[系统,语音]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,这是我的代码!



SpeechRecognitionEngine sre = new SpeechRecognitionEngine();

Grammar gr = new DictationGrammar();

sre。 LoadGrammar(gr);



但是我希望它将音频转换为数字而不是字符串



i希望有人帮助我



Thx



我尝试过:



hello it's my code !

SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Grammar gr = new DictationGrammar();
sre.LoadGrammar(gr);

but i want it's convert audio to numbers only not string

i hope somebody helping me

Thx

What I have tried:

using System.Speech.Recognition;

推荐答案

无论如何都会得到一个字符串。您无法选择输出格式。但是,如果字符串包含数字,则可以使用Int.TryParse将输出字符串转换为数字,或者可以解析表示数字的字符串的字符串。
You get a string no matter what. You don't get to choose the output format. You CAN however, convert the output string to a number quite easily with Int.TryParse if the string contains numbers or you can parse the string for the words representing the number(s).


这篇关于我怎么能只加载语法数字[系统,语音]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆