我们如何使用语音在编辑框中填充数字 [英] How we populate digits in an Edit Box using Speech
问题描述
我尝试开发了一个小型实验应用程序,该应用程序将语音转换为文本并在EditBox上填充相同内容.它的工作完全正常(感谢Codeproject !! :))
现在,我希望它填充我所说的数字.例如,如果我说"7",它应该在编辑框上填充7,而不是七个" ...对于点",逗号",连字符"也应如此,
有什么办法可以做到这一点.输入将不胜感激.
顺便说一句,我正在使用MS Speech SDK 5.1.
谢谢,
Hi,
I tried to develop a small experimental application which will convert Speech to text and populate the same on an EditBox. Its working absolutely fine(Thanks to Codeproject !! :))
Now I want it to populate digits what I say. for example if I say "7" it should populate 7 on the editbox and not "seven"...the same should go for "dot", "comma", "Hyphen", like this,
Is there any way to do this. Inputs would be highly appreciated.
By the way I am using MS Speech SDK 5.1.
Thanks,
推荐答案
好,创建一个关联的容器,例如std::map
( ^ ])以按其名称查找数字.像一个",两个"等单词将充当键的角色,数字将作为字符找到,因此您需要std::map<std::string, char>
.使用成员函数find
从语法中的已识别单词中查找数字;如果找不到数字,那么还有其他事情;将单词视为操作,标识符等.
—SA
Well, create an associated container such asstd::map
(http://en.wikipedia.org/wiki/Map_%28C%2B%2B%29[^]) to find digits by their names. The words like "one", "two"… will play the role of the keys, the digits will be found as characters, so you will needstd::map<std::string, char>
. Use member functionfind
to find a digit by a recognized word from your grammar; if the digits is not found, so something else; consider a word as a operation, identifier, etc.
—SA
这篇关于我们如何使用语音在编辑框中填充数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!