如何区分对话流中语音响应的缩写

时间:2018-06-14 15:56:30

标签: chatbot actions-on-google dialogflow

我已将对话框流媒体代理与Google助手集成。有一个欢迎的意图,要求您选择任何选项

Choose any of the sports 1. NBA 2. NHL 3. FIH

它用单个单词(作为缩写)读取响应。但是当我在webhook的响应中产生相同的内容时,它不是用单个单词读取响应(或者不将响应视为缩写)并一起读取。我怎样才能做到这一点?我在回复中遗漏了什么吗?

2 个答案:

答案 0 :(得分:3)

您可能希望确保在回复中发回SSML,而不是发回文本并将其转换为语音,并使用<say-as>专门标记缩写标记并告诉它将内容解释为字符。

所以你可以把它发回给像:

<speak>
  Are you interested in learning more about 
  the <say-as interpret-as="characters">NBA</say-as>,
  the <say-as interpret-as="characters">NHL</say-as>
  or the <say-as interpret-as="characters">FIH</say-as>?
</speak>

答案 1 :(得分:0)

使用SSML和不使用SSML时,在发音上的微小差异都是严重的问题。我坚持一切发言。我也喜欢一个唯一的数字,并且有一个测试钩子可以判断语音是否“计数”,因此有一种方法可以测试事物。还有一个钩子,因此触发了“请重复”的意图:

重点是在所有普通情况下都使用sayUsual。

// Mostly SSML start char kit as globals
  const startSp = "<speak>", endSp = "</speak>";

// Handle "Can you repeat that ?" well
  var vfSpokenByMe = "";

// VF near globals what was said, etc
  var repeatPossible = {}; repeatPossible.vf = ""; repeatPossible.n = 0;

// An answer from this app to the human in text
  function absorbMachineVf( intentNumber, aKind, aStatement )
  {
    // Numbers reserved for 'repeats'
    if( intentNumber > 9000 ) { return; }

    // Machine to say this, a number for intents too
    repeatPossible.vf = aStatement; repeatPossible.n = intentNumber;
  }


// Usual way to say a thing
  function sayUsual( n, speechAgent, somethingToSay )
  {
    // Work with an answer of any sort
    absorbMachineVf( n, 'usual', somethingToSay );

    // Sometimes we are just pretending, so
    if( !testingNow )
    { speechAgent.add( startSp + somethingToSay + endSp ); }

    // Make what we said as an answer available 'for sure' to rest of code
    vfSpokenByMe = somethingToSay;                            // Even in simulation
  }