Alexa Skill Custom slots - Currency - node.js

Created a Custom Slot Type
CURRENCIES
with values
USD
JPY
CNY
SGD
HKD
CAD
NZD
AUD
CLP
GBP
DKK
SEK
ISK
CHF
BRL
EUR
RUB
PLN
THB
KRW
TWD
tested successfully with Value INR, GBP, EUR.
However during Certification got feedback
When attempting to invoke the skill using an example present in the
example phrases or the skill’s description, the skill returns a non-
contextualized response or error. All customer facing example phrases
must function without error since these are interactions that users
are most likely to try.
Steps To Reproduce: [Second Example Phrase]
User: "Alexa, ask XXX to convert bitcoin to i n. r."
Skill: "I didn't quite get that. Please provide currency to get
bitcoin value?"
Please see test case 3.1 from our Submission Checklist for guidance on
example phrases.
When I run test case with i n. r. it fails.
How to map i n. r. with INR? Similar examples given in certification report g b. r. , e u. r.

Here is how I fixed this. Any other solutions?
var tmp= this.event.request.intent.slots.CURRENCY_TO.value;
if(tmp){
var curr= tmp.toUpperCase().replace(/[\W_]/g, "");
Custom Slots validations needs to be handle in code.
Reference - https://developer.amazon.com/docs/custom-skills/handle-requests-sent-by-alexa.html#input-errors

Related

Bixby command for currency converter

I wanted to try the currency converter feature of bixby where i ask it to convert the value from lets say USD to INR. This feature was in earlier updates of bixby. But when i tried it now, it wont work. If anyone could help me that would be great.
Thanks
Depending on how your questions is phrased, you should be presented a list of capsules that can address your use case.
For example, asking, "What is 50 Dollars in Indian Rupees" provides me with a list of two capsules that can serve this request. When I select one (I arbitrarily chose CNBC), I get the answer I requested, "50 U.S. dollars are equal to 3751.5 Indian rupees".

Dialogflow #sys.phone-number slot failing 90% of the time

I am building a voice commerce action for a big food chain and we expect to receive a massive load of orders via voice. The problem is that we haven't be able to figure out a safe way to capture the user's phone. We are currently trying with sys.phone-number and sys.any but it get the number wrong 90% of the time.
This solution is being deployed to Brazil with local number format xx-xxxxxxxx (2 numbers followed by 9 numbers - 0 to 9)
You may take the help of Regex. You can set a pattern and in the webhook check if the number matches your requirement else ask for input again.For example for a Bangladeshi contact number i have used my own custom entity using regex:
(01[3456789])(\d{8})
you can follow this example

Bixby natural language input - dollar amounts

I'm trying to allow users to say a dollar amount as input to a Bixby capsule.
So I made a concept of type money.Currency:
structure (Amt) {
role-of (money.Currency)
description (Amount to spend)
}
And then I gave some training examples using it:
[g:SomeGoal] I want to pay {[g:Amt] ($)[v:viv.money.PrefixSymbol:$](25.32)[v:viv.money.CurrencyValue]}
This works fine when the user enters their dollar amount in text, but it frequently fails if the user tries to speak the amount aloud to Bixby.
Example 1 (fails): The user says "I want to pay twenty-five dollars thirty-two cents." Bixby parses this as "I want to pay $25 32 cents" and populates the Amt field with just $25, leaving out the cents.
Example 2 (fails): The user says "I want to pay twenty-five thirty two." Bixby parses this as "I want to pay 2532" and populates the Amt field with $2532, again failing to fill in a value for the cents.
Example 3 (succeeds): The user says "I want to pay twenty-five point three two dollars." Bixby correctly parses this as "I want to pay $25.32" and fills in the Amt field with $25.32. This sounds very unnatural for English speakers though, and I do not think it will be easy to train users to speak this way.
Example 4 (sometimes succeeds): The user says "I want to pay twenty-five dollars and thirty-two cents." Bixby sometimes parses this correctly, other times as "I want to pay $25 in 32 cents" or other similar corruptions.
Anybody have suggestions for getting Bixby to consistently understand dollar amounts in natural language? I am okay with example 2 failing since it is ambiguous, but mainly I would like examples 1 and 4 to succeed consistently. I do have one idea for a workaround (a separate cents field that's manually added to the dollars field by an action), but I'd prefer to avoid that if possible since this seems like a common case that Bixby should be able to handle on its own.
Thank you for bringing this to our attention. I tried the following sentence "Pay one hundred dollars and 25 cents" multiple times and Bixby was able to transcribe it accurately every time.
But your use case (especially #1) is valid as some users tend to not use "and" to tie dollars and cents together. We will raise this internally with our team but I would suggest that you open a ticket with Bixby Developer Support so we can tie your ticket with the issue and keep you posted when its fixed.
Also, your workaround of using a second property to capture cents should work fine too. Let us know if you run into any issues.

Entity extraction from bank wire transactions ( like not-so-natural-text)

I am trying to extract entities ( name , address , organization) from not so natural text, like comment in bank wire transactions.
Obviously not getting good results , used NLTK , OpenNLP and CoreNLP.
Any idea how to improve the results?
the text can look like,
EVERITT 620122T NAT ABC INDIA LTD
REF ROBERT FINEMANN - REASON SHOP RENTAL
REF BY92 00 112233999 - REASON SPEEDING FINE
GEM SS HEUTIGEM SCHIENDLER
PENSION CH1234 CAB28
...
Reference to research work or existing products will also help
if you're using opennlp and know how to train, you should give 15000 examples in the training data which can look like
<START:name> EVERITT <END> <START:Address> 620122T NAT <END> <START:Organisation> ABC INDIA LTD <END>
.......
....(15000 lines)
and then you can expect some good results!
It seem to me you'll have to use a dictionary/database.
You could try growing one using a procedure like this: http://www.cs.columbia.edu/~mcollins/papers/eacl2014.pdf
But you'll still need to have a way of defining candidate "phrases" -- examples from the paper, e.g. capitalized words, won't work here obviously.

Amazon MWS API - Currency

I am having a problem with Amazons selling API. I have an account with amazon.co.uk and send over products fine. I have a new account with amazon.de and everything is also fine apart from currency.
I have a product that retails at £10(GBP), I send to amazon.de as:
<StandardPrice currency="GBP">10.00</StandardPrice>
But when I go into Amazon.de's backend, it has listed at €10(EUR).
Am I missing something here? Surely Amazon should convert the GBP to EUR if I'm sending to a german account. Otherwise whats the point of the "currency" option?
Any ideas?
Thanks
Mike
As far as I can see, Amazon MWS doesn't do currency conversion when it comes to product pricing - I couldn't find any reference to exchange rates in the docs. So you will have to set those prices yourself by explicitly setting a EUR price. That also gives you the opportunity to decide when to react to exchange rates and to pick a good price point. Today (Feb 21st 2013), 10 GBP = 11.55 EUR - it's totally up to you to go for 11 EUR, 12 EUR or may be 11.99 EUR. After all, you're targeting a different market by submitting your data Amazon.de - deciding upon price points is a very important step in doing so, apart from providing German descriptions, international shipping and support.
At the same time, I think that Amazon MWS should have probably rejected your price by giving an error or at least left the EUR price empty, but not silently "convert" it to EUR. I'd consider this to be a bug.
Edit: It seems there is only one way to find out which currency is expected by the MWS system, which is through the ListMarketplaceParticipations call. It will return a default country code, a default currency and a default language code along with the associated Amazon domain name.
For Amazon.com it should return US, USD, en_US and www.amazon.com
For Amazon.co.uk it should return GB, GBP, en_GB and www.amazon.co.uk
For Amazon.de it should return DE, EUR, de_DE and www.amazon.de
... etc ...
Unfortunately, you'll have to hard code the associated MWS data endpoints into your software:
CA - Canada : https://mws.amazonservices.ca
CN - China : https://mws.amazonservices.com.cn
DE - Germany : https://mws-eu.amazonservices.com
ES - Spain : https://mws-eu.amazonservices.com
FR - France : https://mws-eu.amazonservices.com
IN - India : https://mws.amazonservices.in
IT - Italy : https://mws-eu.amazonservices.com
JP - Japan : https://mws.amazonservices.jp
UK - United Kingdom : https://mws-eu.amazonservices.com
US - USA : https://mws.amazonservices.com

Resources