If watson can return country code according to country name? - ibm-cloud

I have enabled watson assist sys-location entity, I want to get the country code when I enter country name, for example, after I entered Japan, then watson can recognize it and response JP to me, enter China then return CN, is that possible? thanks.

Watson Assistant does not return such a value by default, but you could use server actions or your app to look up those values. As an example, create a Cloud Function action to search in a list or database for the country code.
https://console.bluemix.net/docs/services/conversation/dialog-actions.html#dialog-actions

No it cant be done automatically.What you can do is train Watson entity with country codes.Its better way than searching in database.

Related

How can I format a local mobile phone number to a international one?

I am using the contact_service package for flutter to retrieve contacts from a device. But I noticed that when I look at the _contacts[index].phones it holds either mobile or other. I only take the contacts that have a mobiel phone number. But then when I look at the phonenumbers I see that they are all have a different format.
+31XXXXXXXX
+31 6 XXXXXXXX
06-XXXXXXXX
06 XXXXXXXX
6 XXXXXXXX
(045) XXXXXXXX
045 XXXXXXXX
Side Note: I am working on a android simulator with a google account
I would prefer to have them all with a country code so that I can compare them with my firebase auth phonenumber. So my question is what do I do?
Do I format the contact list phonenumber on the client side? Or do I just send it and use a cloud function to somehow figure it out? And how do I do that?
Do I format the contact list phonenumber on the client side?
Or do I just send it and use a cloud function to somehow figure it out?
Client side - a good idea. Especially given the fact that just a local phone number is not enough. You also need to guess the country. And that's easier on the client side where you have more context. It's also better for performance.
And how do I do that?
Probably, that's what you're looking for:
https://github.com/google/libphonenumber
https://pub.dev/packages/phone_number#-example-tab-
I would suggest the following:
Know what country your client is from.
Save the number as is with the name
Try to guess the country code through a process and save all versions
Do search using all versions
Trying to guess the correct number:
if it starts with + => it's good
else if it starts with 00 => replace 00 with +
else use the user's country code, in this case check if the contact name corresponds to other searched user
Or ask the user: do you know this person?
You can find countries key code here
I hope this helps,
Good luck.

Watson assistant what entity should I use to capture a complaint/request text with no format(any text)?

I have a use case to capture Complaint/Request from user. How can i define an entity for handling these slots(subject of request, description of request). Here I cant use regex because these two slots can be any text, How can i define and capture the request.
If you want to capture a complaint or request, you need to design if it is allowed anytime or only after prompting the user.
If you know that the input is a complaint or request, I would recommend taking the full input and store or handle it as complaint text. Watson Assistant allows access to the entire input text. It also provides location information for detected entities. If you define certain keywords, e.g. for specific complaint categories, the entity would be detected and could serve for tagging the complaint or filing it along with categories.
Why not create Entity as Complaint/Request and through a Skill pass the response from NodeMailer as an Email. It could we done through Skill's code. So user input be like My Complaint is () or Request is ().
And through Slots we can ask user for his Email address having 1 more entity as "Email" from where WA team can connect him.

Get country domain code

I have an app that I am making a basic built-in web browser for with pre-populated bookmarks.
But I want to get the country domain code of the device for example .com, .uk, .de etc. Is this possible?
I know how to get the country code using NSLocale but that gives GB instead of uk.
Use a if.
The country codes are defined in ISO-3166, and match the country code top level domains. The only exception is the United Kingdom, whose ISO-3166 is GB, but it keeps using the .uk domain defined before ISO-3166 was written.

About Yahoo weather condition description

I use yahoo weather api to build an app for notification in iPhone.
I record the api data everyday and I found an interesting thing.
Some weather conditions' description are different with the api list.
Such as today's weather description is : Thunderstorms Late
But in http://developer.yahoo.com/weather/ you couldn't find "Thunderstorms Late".
Because I should translate the weather description to Chinese so I need all conditions' description.
Besides,current condition's description are also can't be found in the api list.
I doubt that is there another api list of Yahoo weather?
There is no other API call to get just the list of conditions. My suggestion would be to translate the conditions as listed on the documentation page (codes 0-47). In the (hopefully rare) case of getting a condition not on the list, you can catch those programmatically and add translations over time.

Accessing the Yelp Api

In my application I have to add a button, and display the number of stars received from YELP as shown in this image: , and upon clicking it I should navigate to a new View that will show the Yelp reviews.
1.) I have read the Yelp API, and was unable to find a way to append the Store Name to get its ratings in Yelp.
For example: I need to get the YELP ratings of Agra Indian Restaurant, so how should I get the JSON return values pertaining to Agra Indian Restaurant?
Is there any tutorial or sample code that illustrates how I could get this done?
You can get some examples form here:https://github.com/Yelp/yelp-api/tree/master/v2/ .I used php examples.Since the Search Parameters doesn`t contain the store name, you can using the business name as the "term" query parameter and the full business address as the "location"
parameter.
It's worth noting that if you know the business you're looking for specifically, you're
better off using the Phone API to look up info directly.