RE: Type and Amazon Specific Intents


#1

Hello,

I am building a voice application that, in part, acts as a search function for a libraries media. For dialogflow, I am using the @sys.any type. There does not seem to be a perfect equivalent for Alexa. After trying a few things, I decided to make a few different intents with specific amazon slot types as a work around. The relevant portion of my language model is displayed below:

"alexa": {
		"interactionModel": {
			"languageModel": {
				"intents": [
					{
						"name": "BookSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.Book" 
								}
							}
						]
					},
					{
						"name": "BookSeriesSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.BookSeries" 
								}
							}
						]
					},
					{
						"name": "AuthorSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.Author" 
								}
							}
						]
					},
					{
						"name": "CharacterSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.FictionalCharacter" 
								}
							}
						]
					},
					{
						"name": "FilmSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.Movie" 
								}
							}
						]
					},
					{
						"name": "FilmSeriesSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.MovieSeries" 
								}
							}
						]
					},
					{
						"name": "DirectorSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}",
							"{searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.Director" 
								}
							}
						]
					},
					{
						"name": "ActorSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}",
							"{searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.Actor" 
								}
							}
						]
					},
					{
						"name": "VideoGameSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}",
							"{searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.VideoGame" 
								}
							}
						]
					},
					{
						"name": "TVSeriesSearchIntent",
						"phrases": [
							"I want {searchPhrase}", 
							"{searchPhrase}", 
							"I want to search for {searchPhrase}",
							"to search for {searchPhrase}",
							"I want to look for {searchPhrase}",
							"to look for {searchPhrase}",
							"I want to find {searchPhrase}", 
							"to find {searchPhrase}", 
							"I want to get {searchPhrase}",
							"to get {searchPhrase}", 
							"I am looking for {searchPhrase}", 
							"I am searching for {searchPhrase}", 
							"I want to find {searchPhrase}"
						],
						"inputs": [
							{
								"name": "searchPhrase",
								"type": {
									"alexa": "AMAZON.TVSeries" 
								}
							}
						]
					},
					{
						"name": "AMAZON.FallbackIntent",
						"samples": []
					},
					{
						"name": "AMAZON.CancelIntent",
						"samples": []
					},
					{
						"name": "AMAZON.HelpIntent",
						"samples": []
					},
					{
						"name": "AMAZON.StopIntent",
						"samples": []
					},
					{
						"name": "AMAZON.NavigateHomeIntent",
						"samples": []
					}
				]
			}
		}
	},

I haven’t changed sample dialogue, but I intend to. Here is the code in my src file.

DialogFlowSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    BookSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    BookSeriesSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    AuthorSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    CharacterSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    FilmSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    FilmSeriesSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    DirectorSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    ActorSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    VideoGameSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },

    TVSeriesSearchIntent() {
        return this.toStateIntent('MediaSearchState', 'GenericSearchIntentProcessor');
    },



    MediaSearchState:
    {
        async GenericSearchIntentProcessor() {
            let contentTitle = this.$inputs.searchPhrase.value;
            let data = await searchMedia(contentTitle);
            iter = new MediaIterator(data);

            if (iter.HasNext()) {
                iter.Next();
                let reprompt = "To navigate search results say, next, repeat, previous. To cancel say cancel.  ";
                let response = iter.FormatForSpeech();
                response = reprompt + response;
                this.ask(response, reprompt);
            }
            else {
                this.tell("Sadly, your search did not turn up any results.")
            }
        },

I understand that the, let contentTitle = this.$inputs.searchPhrase.value; line might not map to the correct “searchPhrase”, but the issue I am currently having is the Alexa intents are not being recognized at all. Am I just defining the Alexa intents incorrectly in the language model? I also have a dialogflow specific intent for searching, is it possible that there is interference?


#2

I think this might be difficult because you’re using the same utterances for different intents.

Does the Alexa Developer Console show anything in the utterance conflicts?