Fixing Language Pronunciation

If you were to deploy the skill at this point and try it out, either with an actual device or through the testing tool in the developer console, you might be amused at how Alexa pronounces some of the Spanish words. When Alexa speaks the text in the response, she assumes wrongly that all of the words are English words and tries to say them using English pronunciation. The result can be kind of bizarre.

As a small example of how Alexa may mispronounce Spanish words, try out the following SSML in the text-to-speech simulator in the developer console:

 <speak>
  Manzanas y naranjas
 </speak>

What you’ll hear is Alexa pronounce the first “a” in “manzanas” as a short “a”, pronounce “y” as “why”, and pronounce the “j” in “naranjas” as a hard “j”. What you should’ve heard, however, when properly pronounced is the “a” pronounced as “aw”, the “y” as “e”, and the “j” should have an “h” sound.

We can help Alexa by adding a little SSML. The <lang> tag can be used to wrap text to tell Alexa to pronounce words for a different locale. Applying the <lang> tag to the “Manzanas y naranjas” example, we get:

 <speak>
  <lang xml:lang=​"es-ES"​>
  Manzanas y naranjas
  </lang>
 </speak>

The xml:lang attribute specifies the locale that Alexa should use for pronunciation. In this case, “es-ES” tells Alexa to pronounce the words as Spanish words. Not all locales are supported by the <lang> tag, but the following are valid choices:

  • en-US
  • en-GB
  • en-IN
  • en-AU
  • en-CA
  • de-DE
  • es-ES
  • hi-IN
  • it-IT
  • ja-JP
  • fr-FR

Although not all Spanish locales are supported, “es-ES” will work fine even if the user’s locale is “es-MX” or “es-US”.

Now try the new <lang>-wrapped SSML in the text-to-speech simulator. Comparing the results to the original SSML should be like comparing apples and oranges. Alexa will properly pronounce the Spanish words and will sound a lot less bizarre.

We can apply the <lang> tag the same way in all of our translated text used in our skill. In languageStrings.js, for example, the WELCOME_MSG_PERSONAL string could be wrapped with SSML and the <lang> tag like this:

 WELCOME_MSG_PERSONAL:
 '<speak><lang xml:lang="es-ES">'​ +
 '¡Bienvenido de nuevo a Star Port 75 Travel, {{givenName}}! '​+
 '¿Como puedo ayudarte?'​ +
 '</lang></speak>'​,

Even though the <lang> tag helped Alexa pronounce the Spanish words much more correctly, she still doesn’t have a Spanish accent and she uses English sounds to pronounce the Spanish words. As a result, her pronunciation may still be a little off for some words. Before we wrap up the localization of our skill, let’s look at a way to change Alexa’s voice so that she speaks as if she’s a native Spanish speaker.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset