2

I want to store complete random sentence given by user. How can I take a complete random sentence as input in lex/alexa? What slot type should I use?

johndoe
  • 4,387
  • 2
  • 25
  • 40
prakhar kumar
  • 73
  • 1
  • 1
  • 6

1 Answers1

5

Alexa

AMAZON.SearchQuery slot type lets you capture less-predictable input that makes up the search query.

Ex:

{
  "intents": [
    {
      "name": "SearchIntent",
      "slots": [
        {
          "name": "Query",
          "type": "AMAZON.SearchQuery"
        },
        {
          "name": "CityList",
          "type": "AMAZON.US_CITY"
        }
      ],
      "samples": [
        "search for {Query} near me",
        "find out {Query}",
        "search for {Query}",
        "give me details about {CityList}"
      ]
    }
  ]
}

More on AMAZON.SearchQuery here

There is AMAZON.LITERAL slot that passes the recognized words for the slot value with no conversion. But, its's not recommended. You cannot use AMAZON.LITERAL in a skill configured with a dialog model.

Lex

Amazon Lex supports built-in slot types from the Alexa Skills Kit. You can create slots of these types in your intents.

Amazon Lex doesn't support the AMAZON.LITERAL or the AMAZON.SearchQuery built-in slot types.

Unlike Alexa, in Lex you would get the entire user input as inputTranscript.

Built slot reference here

johndoe
  • 4,387
  • 2
  • 25
  • 40
  • 3
    For Lex, you should also suggest the OP to use the `inputTranscript` from the Lex Request, which gives the entire User Input every time, so it doesn't matter what `slotType` is used. (Something I WISH Alexa would do!) – Jay A. Little Aug 29 '18 at 12:28
  • 1
    I thought of it, but in the question he mentioned what slot type to use. May be he wants just the random sentence. Anyway I will update my answer. – johndoe Aug 29 '18 at 12:36
  • @CicilThomas AMAZON.SearchQuery is not supported by Lex as well. I have no idea why it's not documented, but it's a fact. – Serhii Korol Nov 07 '18 at 18:12
  • 1
    @SergeyKorol The docs are updated now. https://docs.aws.amazon.com/lex/latest/dg/howitworks-builtins-slots.html – johndoe Dec 04 '18 at 12:37
  • @CicilThomas - so what slot type should be used and what utterance? In my experience with random sentences, the utterance is never matched, and so the intent is never triggered, so the lambda is never executed to get at the `inputTranscript`. I don't see how this answers the question for Lex – Don Cheadle Oct 12 '20 at 21:09
  • @DonCheadle Intents are match for matching utterances, and not for any random sentence. Have you considered FallbackIntent? – johndoe Oct 24 '20 at 10:38