Use Google Places autocomplete vs nearbysearch with rankby=distannce - autocomplete

I am looking to use Google Places autocomplete to help user search for places near him/her. When using autocomplete in the example below, I get establishment that are very far from the location.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=pizza&types=establishment&location=37.340871,%20-122.029642&rankby=distance&key=mykey
I assume Google considers the popularity of the establishment in the result set. My question: is there a way to get back the list sorted by proximity to the location, i.e. "turn off" the popularity index? (and to get similar functionality to the nearbysearch with autocomplete) ?
Why not just using nearbysearch? because nearbysearch does not perform well when only part of the name is entered as keyword ( I assume nearbysearch assume the 'keyword' parameter is the complete word).
Thanks for your help!

Related

How do i stop my Watson Assistant from auto-correcting the user input

Can anyone help me solve this issue
The screenshot attached below is self explanatory
It is auto-correcting sufyan to Susan
The value for the context variable is
"<? input.text.substring(0, 1).toUpperCase() + input.text.substring(1) ?>"
The motive here is to simply convert lowercase name sufyan to Sufyan
or for that case any Indian name.
But the auto-correct has now become a hindrance.
I want the assistant to interact with the user in the later part using his/her name.
You can configure autocorrection in your bot settings.
Along with Henrik’s answer, it’s good to learn about fuzzy matching in Watson Assistant as it runs before autocorrection
How is spelling autocorrection related to fuzzy matching?
Fuzzy matching helps your assistant recognize dictionary-based entity mentions in user input. It uses a dictionary lookup approach to match a word from the user input to an existing entity value or synonym in the skill's training data. For example, if the user enters boook, and your training data contains a #reading_material entity with a book value, then fuzzy matching recognizes that the two terms (boook and book) mean the same thing.
When you enable both autocorrection and fuzzy matching, the fuzzy matching function runs before autocorrection is triggered. If it finds a term that it can match to an existing dictionary entity value or synonym, it adds the term to the list of words that belong to the skill, and does not correct it.
Check the complete documentation here before turning of autocorrection
You can use the following context variable:
"<? input.original_text.substring(0,1).toUpperCase() + input.original_text.substring(1) ?>"

Is it possible to use INTENT instead of STRING as List Title in Google Action?

Some Background:
I use Lists a lot for a Google Action with a NodeJS fulfillment backend. The Action is primarily Voice-based. The reason for using List is that I can encode information in List's key and use it later to make a decision. Another reason is that Google Assistant will try to fuzzy match the user's input with the Title of the List's items to find the closest matched option. This is where thing's get a bit hard for me. Consider the following example:
{
JSON.stringify(SOME_OBJECT): {
title: 'Yes'
},
JSON.stringify(ANOTHER_OBJECT): {
title: 'No'
}
}
Now if I say Yes / No, I can get the user's choice and do something with information stored as stringified JSON in the choice's Key.
But, the users may say Sure or Yup or OK as they basically mean the same thing as saying Yes. But as those words don't match Yes, Google Assistant will ignore the "Yes" option. But all of these words belong to the smalltalk.confirmation.yes built-in intent. So, if I could use this intent instead of hardcoding the string Yes then I would be able to capture all of the inputs that mean Yes.
I know I could do this with a Synonyms list or Confirmation intent. But they also have some problems.
Using Synonyms would require me finding every word which is similar. Besides, I would also need to localize these synonyms to all the supported language.
With Confirmation intent, I won't be able to show some information to the user before asking them to choose an option. Besides, it also doesn't support encoding the options as I can do in List's key.
So, List is a good choice for me in this case.
So, is there any way to leverage the built-in intents for this purpose? What do you do in this situation?

Retrive all districts based on city name from REST query

I've searched for solution for that problem on here-api documentation but I can't really find it out ! I'm starting doubt if this even possible.
Ok so basicly what i need to know for now:
1. Is this even possible on this platform ?
2. Using exactly which 'module' (eg. PLATFORM DATA EXTENSION,BATCH GEOCODER)
There is no straight solution to get all districts in a city since district concept varies from one place to another(country-specific). Still you can try one of the below options:
administrative-areas-buildings category in places api
city-town-village category in places api
retrieveAreas mode in geocoder api (apply bbox or increase the radius of prox parameter and see if it works for your location)
Search Text in geocoder can also be used if you are search for districts which match a regex
You can check if the above 1) and 2) are applicable to your location using https://places.demo.api.here.com/places/v1/categories/places?at=41.8369%2C-87.684&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

Twitter advanced search by date AND location for research purposes

I'm trying to research a topic and I need to get all tweets within 2013 and 2015 and a specific location for two keywords.
I tried to get the results via Advanced Search but I allways get no results.
I tried:
cannabis near:"España" within:15mi since:2013-10-07 until:2015-01-01
cannabis near:"Spain" within:15mi since:2013-10-07 until:2015-01-01
Basically, I have a database of scraped press articles sorted by date from a bunch of sources, and I want to know how the agenda of this news sources have an impact on the social media conversation.
I could do it over Reddit if it was the case for the US, but there's no Spanish alternative (well, we have Meneame, but the user base is very left-leaning and I think it will be very narrow).
So I wanted to either scrape the search results or get them via API, but It's not working, and AFAIK I can't do anything similar with Facebook.
One way to achieve this is by using Twitter's geocode operator. In the example below i took Madrid as a center and covered a radius of 600km around it like this:
(canabis OR cannabis) geocode:40.4381311,-3.8196196,600km since:2013-10-07 until:2015-12-31
Try it...
The syntax is as follows:
([your_boolean_search_query]) geocode:[latitude],[longitude],[radius]km since:[] until:[]
one easy way to find latitudes and longitudes of locations is to use Google Maps. Simply navigate to a place using the search box and then copy the latitude and longitude element from the URL line in the browser. Here it is for Madrid. The latitude and longitude are right after the # sign, separated by a comma:
https://www.google.com/maps/place/Madrid,+Spain/#40.4381311,-3.8196196,54451m/data=!3m2!1e3!4b1!4m5!3m4!1s0xd422997800a3c81:0xc436dec1618c2269!8m2!3d40.4167754!4d-3.7037902?hl=en
Try it...

How to use keywords include ampersand(&) in Facebook Search API

I want to use some keywords that include special characters like & in Facebook search api. I tried the query below but I cannot get useful results. Is there any chance for this usage in search api? How should I build my search query?
My example queries and keywords are "H&M", "marks & spencer",
http://graph.facebook.com/search?type=post&limit=25&q="H&M"
http://graph.facebook.com/search?type=post&limit=25&q="marks & spencer"
My team worked on this forever, ended up finding this as a solution that provides relevant results for a query with an ampersand, such as 'H&M'.
%26amp%3b
This is the hex equivilent to &
So your example link would be
http://graph.facebook.com/search?type=post&limit=25&q="H%26amp%3bM"
We found the solution thanks to Creative Jar
You want %26 which is the URL encode for ampersand so
http://graph.facebook.com/search?type=post&limit=25&q="H%26M" http://graph.facebook.com/search?type=post&limit=25&q="marks %26 spencer"
Depending on your language, it may have a URL encoding function or you can just use string replacement.
It seems, that all of solutions suggested here are not working any more.
Searching for q=H%26%bM returns empty data set. The same for q=H%26M.
It must have changed recently, in last 2 months.
If you try to search for postings about H&M on Facebook site (type H&M in search, then "Show me more results" on the bottom of list and then public posts on menu on the left side) the list is empty.
The only query that returns any results is q=H&M but it is not helpful, as the results are irrelevant for that query.