Configure Language Model for Multiple English Variants

language-model

#1

I have a skill in en-US English and want to make it available worldwide for all English variants: en-AU, en-CA, en-GB, en-IN

I have a single en-US.json file under models/en-US.json which when built gets added to platforms/alexaSkill/models/en-US.json.

I’m using i18n and have set the fallback in config:

    i18n: {
        returnNull: false,
        fallbackLng: 'en-US',
    },

So everything should be OK for how Alexa responds, but need to make sure things such as invocation name, store info, and interaction model are set.

Do I need to create a new interaction model file for each English variant or can I get by with a single en.json file in both models/en-US.json and platforms/alexaSkill/models/en-US.json?

How should I handle overrides in the project.js file that involve the languageModel including: invocation, name, examplePhrases, summary, keywords, description, icons, termsOfUseUrl, and privacyPolicyUrl?

Anything special to consider when doing multiple stages?

Thanks,

Mark


#2

Does the lang property not work in the project.js?

module.exports = {
    alexaSkill: {
       nlu: 'alexa',
       lang: {
        en: ['en-US', 'en-GB', 'en-IN', 'en-CA', 'en-AU'],
       },
...

Thought that this would allow me to have a single en.json file under models and then when I did a jovo build that it would create multiple language model files under `platforms/alexaSkill/models’.

Can’t find any docs on lang and what it does.


#3

Hi @marktucker, thanks for the great question!

Here’s my sketch of the project.js file of a locale- and stage-specific Skill setup:

module.exports = {
   alexaSkill: {
       nlu: 'alexa',
       lang: {
           en: [
               'en-US',
               'en-CA',
               'en-GB',
               'en-IN',
           ]
       }
   },
   googleAction: {
       nlu: 'dialogflow',
   },
   endpoint: '${JOVO_WEBHOOK_URL}',
   stages: {
       dev: {
           alexaSkill: {
               manifest: {
                  publishingInformation: {
                     locales: {
                        'en-US': {
                           name: 'United States Test Skill'
                        },
                        'en-CA': {
                           name: 'Canada Test Skill'
                        },
                        'en-GB': {
                           name: 'Great Britain Test Skill'
                        },
                        'en-IN': {
                           name: 'India Test Skill'
                        },
                     },
                  },
               },
               endpoint: '<your-lambda-dev-arn>',
               languageModel: {
                   'en-US': {
                       invocation: 'america test',
                   },
                   'en-CA': {
                       invocation: 'canada test',
                   },
                   'en-GB': {
                       invocation: 'england test',
                   },
                   'en-IN': {
                       invocation: 'india test',
                   },
               }
           },
           googleAction: {
               dialogflow: {
                   endpoint: '<your-api-gateway-dev-link>',
               },
           },
       },
       prod: {
           alexaSkill: {
               manifest: {
                  publishingInformation: {
                     locales: {
                        'en-US': {
                           name: 'United States Live Skill'
                        },
                        'en-CA': {
                           name: 'Canada Live Skill'
                        },
                        'en-GB': {
                           name: 'Great Britain Live Skill'
                        },
                        'en-IN': {
                           name: 'India Live Skill'
                        },
                     },
                  },
               },
               endpoint: '<your-lambda-prod-arn>',
               languageModel: {
                   'en-US': {
                       invocation: 'america live',
                   },
                   'en-CA': {
                       invocation: 'canada live',
                   },
                   'en-GB': {
                       invocation: 'england live',
                   },
                   'en-IN': {
                       invocation: 'india live',
                   },
               },
           },
           googleAction: {
               dialogflow: {
                   endpoint: '<your-api-gateway-prod-link>',
               },
           },
       },
   },
};

I’ll have to verify this later though. Is this similar to how you have set things up for your project?


#4

I found my mistake. I need to nest lang under nlu:

  alexaSkill: {
    nlu: {
      name: 'alexa',
      lang: {
        en: ['en-US', 'en-GB', 'en-IN', 'en-CA', 'en-AU'],
      },
    },
  },
  googleAction: {
    nlu: {
      name: 'dialogflow',
      version: 2,
    },
  },