question

R. Hagan avatar image
R. Hagan asked

Asking Alexa to roll dice

I thought I'd start skills development with a simple dice roller skill. Unfortunately, I'm having a lot of trouble coming up with a voice interface that works here. I wanted to use the fairly common "X D Y" vernacular, for example 3 D 6, or 5 D 8, but that doesn't seem to work at all. My Sample Utterance for that looks something like "RollDice roll {three|NumDice} d {six|SidesOfDice}". When I say "Alexa, tell Dice Roller to roll two D four", it hears "Alexa, tell Dice Roller to roll to die for". Or "Alexa, tell Dice Roller to roll three D six", it hears "Alexa, tell Dice Roller to roll two eighty six". Other combinations of X D Y result in the same hilariously bad transcriptions, and thus incorrect or missing slots. So I tried a different way of asking. Something along the lines of "Roll X Y sided dice". My Sample Utterance for that looks something like "RollDice roll {two|NumDice} {four|SidesOfDice} sided dice". When I say "Alexa, tell Dice Roller to roll three six sided dice", it hears "Alexa, tell Dice Roller to roll three six thirteen". As above, other combinations are equally bad in their own way. So I figured I'd try to be as explicit as possible, and put some space around the numbers. Maybe the format of "roll a Y sided die X times" would result in better voice transcription. My Sample Utterance for that looks something like "RollDice roll a {six|SidesOfDice} sided die {three|NumDice} times". When I say "Alexa, tell Dice Roller to roll an eight sided die six times", it hears "Alexa, tell Dice Roller to roll eight four seven six ten". In all of the above examples, the values that get passed to my Intent are almost never one of the numbers in the transcription. For instance, that last example passed in the values four (SidesOfDice) and 72 (NumDice). Any suggestions on how to improve this? Alexa actually has some dice rolling capabilities built in that work fairly well. If you just ask it to "Roll three six sided dice" it seems to be pretty reliable. What am doing wrong here? Thanks for the help.
alexa skills kit
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
Did you try: "RollDice roll {three|NumDice} dee {six|SidesOfDice}"? (I.e. spell out the word.) Also, did you put several hundred utterances in to cover the normal combinations? Another (stupid) approach would be to made up a dummy slot and have "RollDice roll {three|NumDice} {dee|dummy} {six|SidesOfDice}". Sometimes it works better with a slot per word.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

R. Hagan avatar image
R. Hagan answered
Hi there, Thanks for the tips. I definitely get better performance spelling out "dee". And yes, I do have every combination of numDice and SidesOfDice in my utterances file. Now the biggest problem that I have is almost any number, followed by "dee" results in something like this. "Roll six dee eight" => "Roll sixty eight". Voice transcription seems hard. =)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Steve A avatar image
Steve A answered
I'm assuming that NumDice and SidesofDice slots are number slots, and not literals? I don't know for sure, but number slots might still work with a schemas like: RollDice {one|NumDice} {four sided|SidesofDice} die RollDice {roll three|NumDice} {dee six|SidesofDice} That might help Alexa distinguish which number goes in which slot. I wrote a calendar app that can take both start and ending days. I used DATE slots for both, and they worked fine with a schema like: {from Wednesday|StartDate} {to Saturday|EndDate} I suspect that without the "from" and "to" to distinguish starting and ending dates, Alexa would have harder time parsing the utterance.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nick Gardner avatar image
Nick Gardner answered
There has recently been a fix that should improve the detection of single numbers. This should help with the issues everyone has been seeing. You may need to re-save your utterances for these fixes to apply, but let us know if the issue seems fixed to you once you re-save. Thanks, Nick
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
If the fix went in between Monday and today, then maybe. I was having a lot of trouble yesterday with an utterance in the form "Blah ". It was so awful that I had to add in some stateful code so that if I, at least, got the number slot, I'd ask just for the literal slot. It does not seem nearly as bad today. I can't say it magically happened. I did change the logic, other code, utterances and training. But it may have helped.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

R. Hagan avatar image
R. Hagan answered
Thanks for the tips everyone. I've definitely made a lot of progress. I do think that the number parsing is a bit better for my application. The biggest problem that I'm still having is that "four dee" sounds a lot like "forty" to Alexa. That's completely understandable. I updated my utterances file for cases where that can happen to look like this: RollDice roll {forty|NumDice} {four|SidesOfDice} RollDice roll {sixty|NumDice} {six|SidesOfDice} etc. And then I just parse out "forty," "sixty," "seventy," "eighty," and "ninety" on the application side to be what they should be. Putting all of the advice here together, and then accepting some quirkiness from the voice transcription has resulted in a pretty stable app. Thanks for the help everyone!!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.