weixin_39616686
weixin_39616686
2020-11-25 08:14

utterance generation bug

-kruse There seems to be a bug in the server generation of utterance permutations. For example the following:

"utterances": ['{to|} set temperature to {64-80|number}']

generates utterances as follows:


setTempsIntent  to set temperature to {sixty four|number}
setTempsIntent  set temperature to {sixty five|number}
setTempsIntent  to set temperature to {sixty six|number}
setTempsIntent  set temperature to {sixty seven|number}
...

but what I believe should be generated is:


setTempsIntent  to set temperature to {sixty four|number}
setTempsIntent  set temperature to {sixty four|number}
setTempsIntent  to set temperature to {sixty five|number}
setTempsIntent  set temperature to {sixty five|number}
setTempsIntent  to set temperature to {sixty six|number}
setTempsIntent  set temperature to {sixty six|number}
setTempsIntent  to set temperature to {sixty seven|number}
setTempsIntent  set temperature to {sixty seven|number}
...

该提问来源于开源项目:alexa-js/alexa-app

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

9条回答

  • weixin_39616686 weixin_39616686 5月前

    Thanks, I'll take a look and see if I can repro in that repo.

    点赞 评论 复制链接分享
  • weixin_39616686 weixin_39616686 5月前

    Confirmed that this repros in the latest alexa-utterances. I don't have a fix yet but have a PR for a test case. #

    点赞 评论 复制链接分享
  • weixin_39616686 weixin_39616686 5月前

    OK, I was able to add a failing test case to alexa-utterances. I was then able to make that test case pass by requesting exhaustiveUtterances be generated. I've sent the PR for the test case to alexa-utterances in case that is a useful addition. I've closed the bug against alexa-server.

    I question, without knowing the answer, whether it makes sense that the default for alexa-app is to not generate exhaustive utterances. I can fix the bug I am seeing by this addition to my skill:

    app.exhaustiveUtterances = true;

    Can you share an example of where this would not be an appropriate default?

    点赞 评论 复制链接分享
  • weixin_39624980 weixin_39624980 5月前

    I think we should keep the default as suggested by the alexa-utterances package and document it better. Changing the default means creating unexpected outcomes for existing users, and is one more thing to worry about. It looks like that feature was very intentional to generate fewer permutations to ... save space I guess? Or, hopefully, there was a better reason?

    Today it builds a smaller list of utterances that has the full cartesian product of all shortcut values, with slot sample values filled in.

    Do you want to PR some additions to README here that explain what is happening today and how to change the default? We can then close this issue.

    点赞 评论 复制链接分享
  • weixin_39624980 weixin_39624980 5月前

    Oh and thanks for digging this up! I had no idea this existed.

    点赞 评论 复制链接分享
  • weixin_39616686 weixin_39616686 5月前

    I agree that it is probably best to maintain the current default to avoid unintended consequences for existing apps that update. And more than happy to work up a PR for the README. I need to explore this a little further as it might the case that we want to expose control at the app.intent definition stage rather than via a single app global.

    Regarding this statement:

    Today it builds a smaller list of utterances that has the full cartesian product of all shortcut values, with slot sample values filled in.

    I may need to do some more testing but believe my own example shows that a full Cartesian product is not created when exahuastiveUtterances is false.

    A full Cartesian product is defined as: for sets A and B, the Cartesian product A × B is the set of all ordered pairs (a, b) where a ∈ A and b ∈ B.

    The key piece in this case being all ordered pairs (a, b). With exhaustiveUtterances set to false the resulting set appears to generate a + b results instead of a * b. This results in a diagonal through the 2D matrix of results instead of the full matrix of results.

    At least that is my current understanding. Please let me know if I've missed something.

    点赞 评论 复制链接分享
  • weixin_39624980 weixin_39624980 5月前

    That does seem to make sense, but again that would be a bug in alexa-utterances, as always I suggest to write a test and fix it, there.

    点赞 评论 复制链接分享
  • weixin_39624980 weixin_39624980 5月前

    Moving this to https://github.com/alexa-js/alexa-utterances/pull/19.

    点赞 评论 复制链接分享
  • weixin_39624980 weixin_39624980 5月前

    check with the latest from https://github.com/mreinstein/alexa-utterances first? If you want to help, write a test/fix in that repo.

    点赞 评论 复制链接分享

相关推荐