question

scooterf avatar image
scooterf asked

handling DATES

Hi - utterances for my skill include a for date - month, day and year. AMAZON.DATE seems to work only when you say the name of the month, and the full year. In other words you have to say "December thirty first, nineteen ninety six" - you can't say "twelve thirty-one ninety-six". I'd like to implement support for the latter, if I can, and am looking for suggestions as to how to do so.

1. I've tried creating slots of type AMAZON.NUMBER for the month, day and year, and using the sample utterance: myIntent the date is {month}{day}{year}.

This won't even save/compile - I get an error saying the sample utterance is invalid.

2. I've tried using a single AMAZON.NUMBER slot for the whole date: myIntent the date is {numericDate}

This sort of works - "twelve thirty one ninety six" correctly gives me a slot value of 123196. The problem is, I can't always accurately parse that result. 11/1/96 would give me 11196, for example. Is that November 1 or Jan 11?

3. I've tried a custom slot, "date" with values of 1 through 99, and sample utterance: myIntent the date is {date}

In this case "twelve thirty one ninety six" returns "12 3,196". I don't think I can use that.

4. My next attempt will be to try to do something with AMAZON.LITERAL, though I've never used that. Not sure how it will go.

Thanks for any suggestions...

Scott

alexa skills kitvoice-user interface
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
>sample utterance: >myIntent the date is {month}{day}{year}. Yes, no spaces between slots is not going to work. In general, two slots together with no fixed text between them does not work well with Alexa. It is, however, highly awkward to put text between most of the time. You would end up with: [code]myIntent the date is the {day} of {month} in the year of our lord {year}.[/code] The alternative, in having a discursive workflow, is almost as bad: A: What is the month? U: April A: I heard the month 'April'. If that is correct, say the day of the month. If not, say no. U: Twenty seven A: I heard the day of month '20'. If that is correct, say the year. If not, say no. U: No. A: OK. Please say the day of the month. U: Twenty seven etc. None of these is idea. But it's what you have to work with. Personally, I would just go with AMAZON.DATE. If they are a frequent user of Alexa skills, they will eventually learn how Alexa expects you to say the date and conform to it. Sure, you want to make things as usable as you can. But, ultimately, it's just another computer interface and users learn to adapt to what it expects. [For Starlanes, there are many alternatives to each command. But after experimentation, people mostly end up using the single word invocations. Alexa isn't quite up to true conversation yet.]
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
Have you tried creating custom slots for days (first, second, third), months (january, february, etc) and years? Then the utterance samples will look like: yourIntent do something {january|Month} {first|Day} {two thousand and fifteen|Year} jjaquinta is right that the parsing works best if there's some (standard) text between slots. But, if you use pretty confined custom slots, it's not so bad. You can then do the conversion to the numeric date format you like on your end. Steve
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
Sorry... Your utterance samples would look like: yourIntent {Day} {Month} {Year} yourIntent {Month} {Day} {Year} As long as the custom slots are constrained, and there's no overlap in the values, you might get pretty far with this approach. Steve
10 |5000

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

scooterf avatar image
scooterf answered
thanks for the replies. I had tried separating the values with commas -i.e. {month},{day},{year}, and it wasn't happy - I got the same error as with {month}{day}{year}. I guess I didn't try spaces. I'll give that a shot.
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
No, no, no. Putting commas or spaces won't make any difference. (Commas will cause an error, in fact.) You are missing the point. You need to put something [i]spoken[/i] between so Alexa can work out which slot is which. If you say "blah blah blah", for a "{one} {two} {three}" intent, Alexa has problems working out if that is "one=blah, two=blah, three=blah" or "one=blah blah blah, two=, three=" or "one=blah blah, two=blah, three=", etc. If instead you say "blah wiggle blah wobble blah", for a "{one} wiggle {two} wobble {three}" intent, Alexa will more often return "one=blah, two=blah, three=blah".
10 |5000

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