Alexa Skill - define the pronunciation of a custom slot example - alexa-skills-kit

I've created a skill with an intent containing a custom slot.
I've defined the custom slot and have added various examples.
One of the examples is a branch name which is not pronounced correctly by Alexa.
Is there a way to define the pronunciation of a custom slot example?
For example, can we change the pronunciation of backpack (if it were a brand name)?

All you can do is change the spelling of the word to better match the pronunciation that you want to match.

To clarify a bit more what Tom said, all you can do to help Alexa understand what Alexa hears in slots as shown in your example is provide additional spellings.
To help what Alexa says though, you can use SSML such as the "say-as" tag.

Related

How to define google_tag_params in Google Tag Manager?

i want to create a dynamic remarketing campaign in Google Ads, but i have to let GTM know where to extract the information for ecomm_prodid, ecomm_pagetype, ecomm_totalvalue and ecomm_category from my website. I understand that i have to create a Data Layer Variable but i just don't know how to make those tags extract the necessary info from my website. I also know that you should be able to see in Google Tag Assistant the Metadata for your products (price, brand, category etc) in the Dynamic Remarketing Tag. Unfortunately i cannot add code to my website as it was created on a platform that doesn't allow custom code, so i have to use GTM.
For example the class for the price is: fPrice -g-product-final-price-258. Shouldn't ecomm_totalvalue take info from this class? I tried reading Help pages from google but they are soooo confusing, i cannot understand them.
If anyone would help me with this i would be very grateful.
Thanks
I know this is 10 months late but this might help you or lead someone arriving here to hopefully the right direction and/or solution. I came across your question unanswered when looking for something else. It seems you have two questions so I'll try to answer both.
For starters you might want to have a quick look at the GTM Dynamic Remarketing Documentation.
Question 1: Where to extract the information for [variables] ?
You are on the right track with the dataLayer here. Usually you need to implement that with custom Javascript on your website (which in your case you can't do / see below for that). You would usually populate a events & variables with dataLayer.push() function.
Here is a sample of how that could look:
dataLayer.push({
'event': 'your_event_name',
'a_container_name' : {
'key1' : key_var_1,
'key2' : key_var_2, }
})
You can also do inner structures within those structures (nested dictionary).
Once those are populated you can create variables in Google Tag Manager (GTM) and simply pick up the values with the naming convention you've used separated by a "." (dot). For the above you could for example do: "a_container_name.key1" which would then populate the variable in GTM with the value of "key_var_1".
You can use the event name (here: 'your_event_name') as the trigger for the Tag in GTM to fire your Tag.
So in your case you would usually want the variable "ecomm_prodid" taken from the webpage with a bit of javascript and pushed into the dataLayer for you to pick up in GTM as described.
Question 2: I cannot add code to my website, what can I do ?
While this is entirely possible it is unfortunately a bit more tedious and potentially much more error prone. In this case you have to read the values you want directly from your website through GTM.
You can use custom javascript inside variables in GTM. To do so click on "variables", then click on "New" and select "Custom Javascript". You can then use pretty much any javascript here to basically scrape the value off your website based on id, class or any other HTML identifiers. There are tons of options on how to do that. You have to use what works best for you.
However this is potentially very error prone. Here is why:
You've stated that your class for the price is "fPrice -g-product-final-price-258". This looks to me very much like an auto generated identifier. Next time you look at that product or pick another one it is most likely different. So your option is to take either another unique identifier or use a sub-string of that one (e.g.: fPrice -g-product-final-price only). But keep in mind if your website ever updates or changes those class names the javascript you wrote instantly will not work any longer.
So it is important to pick some robust form of identifier or write the javascript code so that it will last. As mentioned, the jvascript to scrape or read directly off your website can be as custom as you like. Here is a crude example of how this would look like.
var text = ''; // empty value placeholder
if (document.getElementsByClassName("YOUR_SPECIFIC_CLASS_NAME")) {
....loop through returned elements if applicable....
....do stuff here or check stuff here...
text = SOME_ELEMENT.innerHTML;
console.log(text) // helps to debug your code
}
return text
Again this is only a crude example but if you get this to work then you can simply use the populated variable in your Tag in any field that supports variable with the double curly brackets: {{YOU_TAG_MANAGER_VARIABLE_NAME}}
I hope this helps and gives you a bit on an insight. Good luck!
PS: By the way. If you can't edit your code because of your website provider or website engine then I would strongly recommend moving away from it. As you can see it would save you a ton of headache. For smaller to mid sites and smaller e-commerce stores use Wordpress. For larger stuff there are other solutions. In any case there are some website builders out there that are simply really bad but at the same time very misleading. Basically leading you to the problems as you've described. Don't use them :)

Amazon Alexa Recording custom words

Do you guys know if Alexa can register a custom user said word that is no a AMAZON.Something, now that AMAZON.literal (which was a catch all for any word) is deprecated.
For example for a skill like "wikipedia". Whereby I want to be able to say "Hey alexa, wikipedia {word}" without having to have a custom slot type with all words on wikipedia. Would that be possible ?
That is a common concern, so Amazon published this blog post to address it:
Why a Custom Slot is the Literal Solution (November 25, 2016)
https://developer.amazon.com/blogs/post/Tx3IHSFQSUF3RQP/Why-a-Custom-Slot-is-the-Literal-Solution

Alexa - build custom slot for addresses

I am creating in which a user can say an address (for further processing). An address can be anything from "New York" to "123 First Avenue Washington" to "Seattle Harbor". Basically like something you can enter at Google Maps - it will recognize more or less everything :)
So now of course comes the problem on how to create a custom slot for this? LITERAL is deprecated PLUS I am working on a German language skill.
Should I actually try to fill the 50,000 lines I got available for a custom skill with as many enumerations of addresses as I can come up with? I'm afraid that even if I go down that road, Alexa will still try to map any input that's not in that list to one that is - and thereby rendering my skill a bit mood :(
Thanks for any advise!
As you suggest, using a custom slot with 50K sample addresses wouldn't really work. Something as complicated as an address really needs a built-in slot type, and there is one for US skills:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference#postaladdress
But you noted that you are targeting a German language skill and as far as I know there isn't a German language or address version of the above built-in slot yet.
The fact that they have done it for US suggests that they will add it for Germany at some point, but counting on that is risky, of course, so you are in a difficult position. In the mean-time I would suggest you go to the feature request space and add a request for a German version of the above:

Is there a way to define a custom skills values each time the skill gets invoked?

I am attempting to make a skill which can select files, Unfortunately the AMAZON.LITERAL type is being deprecated and I need to update my skill to a custom skill type. I already have code that generates keywords for selectable files, is there a way to overwrite or append the custom skill keywords automatically with each invocation? Or at least a way to trick Alexa into collecting semi free form speech?
Is there a way to update the custom skill keywords (the custom slot value item list) with each invocation?
No. For each custom slot you must specify a static list when you define your skill. (Here's a feature request to make the list dynamic.
Or at least a way to trick Alexa into collecting semi free form speech?
Sort of. In response to developer's dissapointment about the loss of the literal type Amazon has recently been emphasizing that the list of items you supply for the custom slot is just a guide, and that the custom slot can still act a fair bit like the literal slot. See this blog post for details...
Why a Custom Slot is the Literal Solution

Gherkin: How many preconditions should a scenario have?

I am new to Gherkin and BDD.
We are doing BDD regression tests with Squish.
Our application is very complex - similar to a flight simulator.
Now I ask myself how to write the tests in Gherkin.
As we have a large number of variables as preconditions to a certain situation I would normally put a lot of
Given some precondition
And some other precondition
into my tests.
My natural feeling is that I should avoid this because it would make things unnecessarily complex.
Is there a rule of thumb for how many preconditions there should be?
Should I try to reduce it to only one?
The general rule is to have as few as possible while still making the tests useful. How many that is will depend on the audience for your scenarios.
If you are using gherkin scenarios for actual BDD (Behaviour Driven Development) then you will have to write the scenarios in such a way that your stakeholders can make sense of them. If this means that you have to write many Given, And, And steps then that is the way it has to be. If it means that you can put several of these steps into one more general set up step then that is better.
If you are using the Gherkin scenarios only as a way of automating tests then do whatever is good for your dev team. The rule about having as few steps as possible comes from trying to make sure everyone, technical and non technical understands what is meant by the scenario (i.e. that they are as clear AND concise as possible. If it is only the technical team that needs to understand it then as above you can use many steps if that is what is necessary for your team to understand it, or you can use fewer steps that contain more code.
For your case of having a very complex system to get into the correct state for testing, I wouldn't be worried about having may set up steps, so long as the scenarios you end up with are clear and as short as possible. There wouldn't be any point in having a smaller neater scenario that no one really understood without looking at the code!
When you are writing scenarios, you can make the code behind the steps do whatever you need to set the application in a state that is needed for testing. Thre is a pretty good article explaining the point here.
I find that if you can be more descriptive in your steps, then your tests will make more sense when you need to go back to reference them. If your steps are just Given, click, click, click, Then .. you can easily lose track of the point of the test. Your tests should be about system behaviors not step by step instructions for using the system.
So as far as preconditions are concerned. You need to do whatever it takes to get the application in the state that you wish to test.
Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.
Gherkin serves two purposes: serving as your project’s documentation and automated tests. Gherkin’s grammar is defined in the Treetop grammar that is part of the Cucumber codebase.
To understand Gherkin in a better way, please take a look at simple scenario mentioned below:
Feature: As a existing facebook user, I am able to post a birthday greeting on any other existing user's facebook page
Scenario: Verify that Joe Joseph can post a birthday greeting on Sam Joseph's facebook page
Given Joe Joseph is an existing facebook user
Given Sam Joseph is an existing facebook user
Given Joe Joseph is on login page of facebook
Given Joe Joseph logs into his facebook account
When Joe Joseph opens Sam Joseph's facebook page
And Joe Joseph writes "Happy Birthday Sam" on Sam Joseph's facebook page
And Joe Joseph clicks on Post button
Then Joe Joseph verifies that "Happy Birthday Sam" is successfully posted on Sam Joseph's facebook page
In the above scenario, all the statements that starts with "Given" are my preconditions.
So, as far as precondictions are concerned, you can use as many preconditions which is required for the test.
Gherkin is the language that Cucumber understands. It is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented More here
From above statement my understanding is. You don't need to add precondition every time as who is using scenario knows how to write and understand Gherkin language.
Here is example:
When I take login as system admin
And I click on new user
And I enter new user details
Then new user is created successful
Here I don't need to mention where I am and other precondition like URL opened or not ?
First precondition is URL opened or not.
Given I opened URL "http://www.stackoverflow.com"
And I enter system admin details
And I click on new user
When I enter new user details
Then new user is created successfully
Second Condition New User Details form have all the required field. This can be separate scenario.
Goal is tell business and team that we are testing this scenario. It is not test case. You don't need to create tons of document for testing purpose.
Like YAML or Python, Gherkin is a line-oriented language that uses indentation to define structure. Line endings terminate statements (called steps) and either spaces or tabs may be used for indentation. Finally, most lines in Gherkin start with a special keyword:
Sample
Feature: Some terse yet descriptive text of what is desired
In order to realize a named business value
As an explicit system actor
I want to gain some beneficial outcome which furthers the goal
Scenario: Some determinable business situation
Given some precondition
And some other precondition
When some action by the actor
And some other action
And yet another action
Then some testable outcome is achieved
And something else we can check happens too
Scenario: A different situation
...
The parser divides the input into features, scenarios and steps. Let’s walk through the above example:
Feature: Some terse yet descriptive text of what is desired starts the feature and gives it a title.
Scenario: Some determinable business situation starts the scenario, and contains a description of the scenario.
The next 7 lines are the scenario steps, each of which is matched to a regular expression defined elsewhere.
Scenario: A different situation starts the next scenario, and so on.
When you’re executing the feature, the trailing portion of each step (after keywords like Given, And, When, etc) is matched to a regular expression
Also note, if you have precondition like Given I opened URL "http://www.stackoverflow.com" as mentioned my #Boston. It is recomended to use it as Background.
Example
Feature: This is test feature
Background: background scenario
Given I opened URL "http://www.stackoverflow.com"
Scenario: access first senario
Given: I should see this
...
Scenario: access second scenario
Given: I should see that
...
The background will execute before every scenario.
Reference:
https://github.com/cucumber/cucumber/wiki/Gherkin

Resources