Microsoft语音识别-仅数字 [英] Microsoft Speech Recognition - numbers only

查看:208
本文介绍了Microsoft语音识别-仅数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以仅在听写模式下或在构建自定义语法XML文件时将语法限制为数字?显然我不能将所有数字都输入XML,但是必须有一种简单的方法.

Is there a way to limit the grammar to numbers only in either dictation mode or in constructing a custom grammar XML file? Obviously I can't enter all the numbers into the XML, but there has to be an easy way.

推荐答案

我很早以前就知道过这个问题,但是我有一个解决方案,以防您仍然需要它.这是我想出的文件.这要求用户仅讲一位数字,例如1到7(不是1到7,这将不起作用).您可以根据自己的需要进行尝试:

I know you asked this a long time ago, but I have a solution in case you still need it. Here is the file I came up with. This requires the user to speak single digits only, such as one five seven (not one fifty-seven, which will not work). You can play around with this to suit your needs:

<?xml version="1.0" encoding="utf-8" ?>
<grammar version="1.0" xml:lang="en-US" root="rootRule" xmlns="http://www.w3.org/2001/06/grammar">
  <rule id="rootRule">
    <item repeat="1-">
      <ruleref uri="#digit"></ruleref>
    </item>
  </rule>
  <rule id="digit">
    <one-of>
      <item>0</item>
      <item>1</item>
      <item>2</item>
      <item>3</item>
      <item>4</item>
      <item>5</item>
      <item>6</item>
      <item>7</item>
      <item>8</item>
      <item>9</item>
    </one-of>
  </rule>
</grammar>

这篇关于Microsoft语音识别-仅数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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