3

音声認識に Microsoft の Speech SDK を使用するソフトウェア用の GRXML 文法を構築しています。

タグは、特定のドキュメントが見つからなかったタグ形式「properties-ms/1.0」に従う必要があります(私の質問に答えないMSDNは別として)。

私の主な関心事は、「1 2 3 4」のような認識されたテキストを数字「1234」に変換するために数字にタグを付けることです。これがアイデアです:

<rule id="CODE">
    <item repeat="4">
        <ruleref uri="#DIGIT"/>
    </item>
</rule>

<rule id="DIGIT">
    <one-of>
        <item>
            one
            <tag>"1"</tag>
        </item>
        <item>
            two
            <tag>"2"</tag>
        </item>
        <item>
            three
            <tag>"3"</tag>
        </item>
        <item>
            four
            <tag>"4"</tag>
        </item>
        <item>
            five
            <tag>"5"</tag>
        </item>
    </one-of>
</rule>

これは連結しませんが、少なくとも各桁のセマンティック値を取得します。

ただし、数字にこのようなルールを使用すると、実行時にプログラムが中断し、「ルール 'CODE' のセマンティック値は既に設定されており、変更できません。」という例外がスローされます。

セマンティック タグ付けを DIGIT ルールの「繰り返し」と一緒に機能させるにはどうすればよいですか? CODE ルールを 4 つの同一の項目に分割したくありません。それぞれが異なるセマンティック キーを持ちます。私の文法には、桁数が固定されていないケースが他にもあります。

また、数値の一般的な意味を提供するためにタグを連結する方法はありますか。

4

2 に答える 2

1

可能な解決策は次のようなものです

<rule id="numbers">
  <item repeat="4">
   <ruleref uri="#numbers_1to4"/>
   <tag>out += rules.numbers_1to4;</tag> 
  </item>
</rule>


<rule id="numbers_1to4">
    <one-of>
      <item>one<tag>out = "1"</tag></item>
      <item>two<tag>out = "2"</tag></item>
      <item>three<tag>out = "3"</tag></item>
      <item>four<tag>out = "4"</tag></item>
     </one-of>
  </rule>
于 2014-01-31T13:22:58.237 に答える
0

私はtag-formatMicrosoftのSpeechSDKで使用されているプロプライエタリに精通していませんが、標準の「semantics-1.0」形式でこれを実現する方法は次のとおりです。

<rule id="CODE">
   <tag>out.CODE = &quot;&quot;;</tag>
   <item repeat="4">
      <ruleref uri="#DIGIT"/>
      <tag>out.CODE += rules.latest();</tag>
   </item>
</rule>


<rule id="DIGIT">
   <one-of>
      <item>
         one
         <tag>out = &quot;1&quot;;</tag>
      </item>
      <item>
         two
         <tag>out = &quot;2&quot;;</tag>
      </item>
      <item>
         three
         <tag>out = &quot;3&quot;;</tag>
      </item>
      <item>
         four
         <tag>out = &quot;4&quot;;</tag>
      </item>
      <item>
         five
         <tag>out = &quot;5&quot;;</tag>
      </item>
</one-of>

于 2011-06-13T17:26:04.127 に答える