What is meant by speech bias and how to use speechBiasHints in google-actions appResponse

瘦欲@ 提交于 2019-12-11 07:39:26

问题


I've build an app in "Actions on google" using actions SDK. App request and App response works fine, earlier i've created expectedInput section in AppResponse without using speechBiasingHints, but now i want to use it, and i can't find any information about speechBiasHints.

I mean i need info on:

  • What is meant by speech bias

  • Can you provide an example on how to use speechBiasingHints


回答1:


Speech biases are influencing the speech to text recognition. So you can for example add here names and other slots etc.

For example you have a Hotel named King Thegeorge you can add it. So google will try to recognize it and deliver the String to you.

but one question, how you use the rest of the inspected input? Do you found a way to give him the possible intents and got them in the request after your response?

you can use them like that (slots is an array, message a string):

function answerWithMessage(message,slots){
  let token = {
    "state":null,
    "data":{}
  };

  let jsonResponse = {
        conversationToken: JSON.stringify(token),
        expectUserResponse: true,
        expectedInputs: [
            {
                inputPrompt: {
                    initialPrompts: [
                        {
                            textToSpeech: message
                        }
                    ],
                    noInputPrompts: []
                },
                possibleIntents: [
                    {
                        intent: "actions.intent.TEXT"
                    }
                ],
                speechBiasingHints: slots
            }
        ]
    };
  return JSON.stringify(jsonResponse,null, 4);
}

if you create the json response by yourself



来源:https://stackoverflow.com/questions/47264839/what-is-meant-by-speech-bias-and-how-to-use-speechbiashints-in-google-actions-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!