As an Italian Java developer, Codemotion has always been one of the main tech conferences. And Milan is still the city that I occasionally call home, even after many years away. So I am very very excited to be back in October and be a speaker at Codemotion Milan 2019. I am looking forward to discuss a topic I am very passionated about, software development and territorial disputes
The talk will be in English, the abstract is below.
Hey, where is my country? Software development and territorial disputes
Many airlines were forced recently to change the name of Taiwan on their booking systems. Hotel chain website where banned in mainland China for labelling Tibet as an independent country. Ukrainian users were upset because Crimea was removed from the map of their land. “What is the capital of Israel?” is a question that has triggered different answers from voice virtual assistants. We will go on a virtual tour around the world to see how disputed territories or partially recognized states are handled by online services and understand the impacts and the challenges of geolocation services.
The status of Jerusalem has been in the news a lot in the last few weeks, since Donald Trump confirmed the US now recognize the city as capital of Israel. And the recent UN voting on rejecting the recognition.
If maps and location-based services present unexpected challenges in a disputed territory to the developer who targets an international audience, voice services are the new frontier.
While preparing a few examples for my talk at Codemotion Berlin last October, I asked Alexa (in German) the question “Alexa, what is the capital of Israel?”
And on October 3rd, the answer was
Die Hauptstadt von Israel ist Jerusalem
that translates in a short, direct but controversial
The capital of Israel is Jerusalem
An answer that might upset a significant number of users of the Amazon service. Apparently while Mr Trump followed the advice from Alexa, Amazon rectified the answer in the meantime. Asking the very same question today, you have a longer
Israel hat Jerusalem zu seiner Hauptstadt erklaert, diese wird jedoch nicht von allen Staaten anerkannt
that translates in
Israel has declared Jerusalem to be its capital, but it is not recognized by all states
Someone might argue that actually most states do not recognize it but it is definitely a more accurate answer than the initial one and that targets a wider audience.
The sound is not as good as a Bose speaker. I sadly had to remove a few broken valves to make space for a working audio device. But setting up Alexa and testing my Big World skill on Grandma’s radio is priceless. Next step, setting it up inside the radio.
As the focus of this blog is AWS technologies, what about Amazon and their location-based services? Any way to keep those geolocation issues under control?
First of of all let’s see which services Amazon offers that include geolocation capabilities.
AWS offers almost nothing. If we compare the products from AWS with Google Maps API or GeoNames, there is nothing yet that has geolocation capabilities. Of course you can run a third party AMI from the Marketplace, like MaxMind – GeoIP or IP2Location Geolocation. But that is just taking advantage of an EC2 instance, it is not a service directly provided from AWS.
Even Amazon Rekognition, a deep learning-based image analysis, does not offer the full set features that Google Vision has and that could potentially trigger location-based issues. If you upload a picture on Google Vision, thanks to Landmark Detection, you might end up with a location or a questionable place on the Earth. But if you upload a picture of the Eiffel Tower on Amazon Rekognition, you have as a result a disappointing but very safe 99.2% tower.
And you have something similar with a picture of the Western Wall in the the Old City of Jerusalem. Definitely not so accurate, but not a result that can create many controversies.
What about Amazon user interfaces and products for end users? Many photo sharing and storage services like Google Photos or Apple Photos or OneMediaHub (a white label solution provided by Funambol) create tags according to the GPS coordinates (EXIF data) of the pictures uploaded by a user. With the challenges of defining the best tag for Hong Kong or determine if Crimea is a Russian or Ukrainian territory. Prime Photos from Amazon does not. No feature, no issues.
Really nothing on Amazon or AWS?
Amazon of course still has to provide a user interface and a chance for the user to add and validate an address. They have their own interesting choices (no Kosovo, for example) and there might be some entries in the list that might be disputed by some users as countries – somehow the approach of Google of calling the drop-down location and not country feels safer. But that is hardly interesting for a developer.
To summarize, I never had to deal in the past with geolocation issues or controversies while working directly with AWS services or the Amazon platform.
But there is something new that might pose a potential challenge, the Alexa SDK and the built -in slot types that define how data in the slot is recognized and handled. And Amazon Lex, the “conversational interfaces for your applications, powered by the same deep learning technologies as Alexa”.
Alexa relies on slots, that are list of values with many of them predefined by Amazon. For example, the slot AMAZON.Country is a ready list of (English) names of countries around the world. Or AMAZON.DE_CITY provides recognition for German and world cities commonly used by speakers in Germany and Austria.
Anything to be worried about? Let’s test it first.
Big World: Alexa and geolocation
After attending a presentation at Factory Berlin and a talk at the AWS summit, both from Memo Döring and both very inspiring, I decided to build a simple dynamic skill for Alexa. The skill, called Big World, relies on data from Population.io, a project of the World Data Lab that aims to make demography accessible to a wider audience. The very simple skill, given a country name, returns today and tomorrow’s population and returns the values from the World Population API. Below are a screenshot and a short audio demo, the code is available on GitHub.
Going back to the topic of this post, the only challenge was to match the names from the built-in Alexa slot to the countries of the Population.io API. The backend supports only values such as Arab Rep of Egypt,Islamic Republic of Iran, West Bank and Gaza or Hong Kong SAR-China. Names that it’s very unlikely a user is going to say while talking to a voice assistant like Amazon Echo and that require mapping.
var PS = 'West Bank and Gaza';
But unless you type the name entirely wrong, there is really no big challenge and the answer still is not controversial as you are dealing only with the name and not the location itself. For example:
Q. Alexa ask Big World the population of Palestine.
A. You are not alone in this world. The population of West Bank and Gaza today is 4916233, tomorrow there will be 368 people more.
or in a simpler scenario:
Q. Alexa ask Big World how many people live in England.
A. The world population is growing as we speak. The population of United Kingdom today is 65473338, tomorrow there will be 1101 people more.
The answer might not be 100% accurate but it is the best approximation available using the data from Population.io. As for any vocal conversation, an audio interaction with a smart speaker is more forgiving than an incorrect point or country name on a website.
Of course some users might still not be able to find results for specific and perfectly valid country names but that is down to poor coding and logic in the Lambda function and not to the specific Alexa slot.
At the end…
Due to the lack of real location-based features, the services currently available on AWS do not currently present most of the challenges covered in the previous post. But for the very same reasons they do not provide a solution or any help to the developer to address or mitigate them.