Bing search API - How to localize results? - bing

How can I use Slovenian search results by default? Our server has German IP and Bing API automatically shows German results first. I have already tried some of the parameters as described in documentation and none of them worked so far.
Thanks

Have you tried to set the Market option?
According to this example page, you should try something like this (note &Market=sl-SL argument):
http://api.bing.net/json.aspx?AppId=your_AppId&Query=your_query&Sources=Web&Version=2.0&Market=sl-SL&Options=EnableHighlighting&Web.Count=10&Web.Offset=0&JsonType=callback&JsonCallback=SearchCompleted

First off, Slovenia is currently not a Bing Market or Country.
There are 2 mutually exclusive options to configure a localization.
Since Slovenia is not yet supported, you might want to use 2. to combine results from relevant markets.
Using mkt and setLang
The values for mkt - Market Code are here.
The query value setLang, "The language to use for user interface strings. Specify the language using the ISO 639-1 2-letter language code. For example, the language code for English is EN. The default is EN (English)."
https://api.cognitive.microsoft.com/bing/v7.0/search?q=microsoft&mkt=en-US&setLang=EN
Using cc and Accept-Language
The values for cc - Country Code are here.
This allows you to specify multiple languages via the header value Accept-Language.
https://api.cognitive.microsoft.com/bing/v7.0/search?q=microsoft&cc=US
True, setting the Accept-Language does very little for the actual
result. If you want to localize outside of a Bing market country, you'll like have to include a translation service.

Values for the Market parameter

Related

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?

How to restrict Bing Search API Queries by language & region

Using Bing Search API, is there any way to restrict searches by country? That is, an equivalent of Google Custom Search Engine's 'cr' parameter?
For instance, let's say I only want to find web pages from Spain that are available in English.
With Google Custom Search Engine I would use the parameters:
lr=lang_en # language = English
cr=countryES # country = Spain
However, the only related parameters I found for Bing Search API are
Markets, which seems to affect only the page's language
latitude & longitude: user's location (gl with Google), which weighs in location, but is not a strict filter.
The simplest way is not through the param, but rather modifying the search term (which is actually easier).
So let's say you want to search for the term London in Japanese> Simply do so by leveraging their advanced syntax and search for:
London language:ja
Where language:ja restricts the result to Japanese. You can see a list of language codes here.
If you want to include a region with it, add another advanced operator, loc:
London language:ja loc:es
The above search should return search for "London" written in Japanese, while being from Spain. The country code should be the same in the reference.

Use Google Places autocomplete vs nearbysearch with rankby=distannce

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!

Does Facebook's OpenGraph support language-only locales?

http://developers.facebook.com/docs/internationalization/ says "Facebook locales follow ISO language and country codes respectively, concatenated by an underscore.".
So would it accept "en" or is it mandatory to include "en-us" "en-gb" etc?
(I have some auto-detected languages where only the language, not the region, is known.)
Yes, you must use the ll_CC format. If you can't figure out which region the language belongs to, you can make an educated guess. See what regions are avaiable for that language by taking a look at the Translation XML file. You can even parse this at run-time if that works for your application.

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.