Inconsistent translation of dollar amounts - google-translate

Easy to replicate: Either using API or Google translate from web browser, translate the following text from English to Spanish:
For plan year 2020: Your Flexible Spending Account balance is $800.00. Your Dependent Care Account balance is $200.00.
Currently returns:
Para el año del plan 2020: el saldo de su cuenta de gastos flexible es de $ 800,00. El saldo de su cuenta de cuidado de dependientes es $ 200.00.
That's right. In the first amount, it translates the decimal point as a comma. In the second amount, it translates it as a decimal point. In playing with this, it seems like depending on the words leading up to balance is, it chooses either the comma or decimal point.
Is there something I can set to force it one way or the other?

I was able to reproduce the behaviour you are presenting and noted the following insight:
The format: $XXX.XX. will be translated as $XXX,XX. For example: $500.10. Will translate as $500,10. Also, $1050.100. Will be translated as $1050,00.
I have tried with other formats as $XXX,XX., $XXX,XXX. And they are translated with the same format. Also, since Google Translate and Cloud Translation API are based on machine learning algorithms, thus, the quality of the translation may vary according to different aspects.
Having said that, my recommendation for improving machine learning algorithms is by retrieving feedback from Translation and use the pencil icon to suggest a better translation. Also, you could suggest feedback of Google Translation within the Translate Community.

Related

Which natural languages does Google Cloud DLP support?

I'm considering using Cloud DLP to help me anonymize my data. However, I can't seem to find explicit mention of what languages are supported. AWS Comprehend's detect PII API only supports English so looking for an alternative.
In the detectors reference page you can find the detectors per country
https://cloud.google.com/dlp/docs/infotypes-reference
For global detectors as PHONE_NUMBER there is no information about the languages supported, but you can test the support for your language in the demo page
https://cloud.google.com/dlp/demo/#!/
For example if you write in Spanish Mi teléfono es 600111222 (my phone is 600111222) it detects a PHONE_NUMBER with LIKELY likelihood, but if you write Me puedes llamar al 600111222 (You can call me at 600111222) it detect just a GENERIC_ID with LOW likelihood.
Also, if in the previous examples, you add the country prefix (+34600111222), the likelihood increases to VERY_LIKELY in the first one and the second one detects a PHONE_NUMBER as POSSIBLE
In summary, it works with other languages and uses the context to improve the matches, but you should play with some samples to check the accuracy in your specific use case

HERE Fleet Telematics API unsolved problems [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
The community reviewed whether to reopen this question 11 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
For reference, some related (not duplicate !) questions:
Fleet Telematics API fails to find route
Increasing search radius for way points in Here Maps Fleet Telematics API
How to increase search radius for a road link for a waypoint (Fleet Telematics API)
HERE Fleet Telematics API doesn't really optimize cost
First, some context. We're providing services for customers operating in Europe / North Africa.
The use case discussed here is to calculate truck routes with different possible goals, sometimes it's getting a cost-optimized route (including tolls or not), sometimes to get the fastest or (near) shortest, or a mix
Usually, we work with postcode/city locations, not full addresses
Initially, you had to use several different APIs to do that, now it's more or less fused into the Fleet Telematics API.
So, let's dive into the documentation: https://developer.here.com/documentation/fleet-telematics/api-reference.html
We're greeted with this introduction:
The HERE Fleet Telematics API is a set of REST resources for advanced
fleet telematics on top of the HERE Location Services. It supersedes
the services CLE, CRE, GFE, GFE-onMaps, PDE, RME, TCE, and WSE.
OK, the FT-API indeed rules them all. We're in the right place.
There are lots (LOTS) of different parameters you can play with, and it's working quite well, except that if you compare the routes to those of the competing services for truck routing, the optimization is often not very good, bordering on bad.
Then, at some point, you come across this strange couple of paragraphs at the end of the "Toll Cost & Cost Optimize" chapter in the Developer Guide:
https://developer.here.com/documentation/fleet-telematics/dev_guide/topics/calculation-considerations.html
Choosing a Toll Cost Routing Engine
Specify the parameter &rollup and/or &cost_optimize to get the route calculated by Routing API. Routing API itself doesn't cost/toll optimize, but provides the fastest and the shortest route and some more routes with different options. Fleet Telematics API then chooses the route which has the minimum sum of driver_cost, vehicle_cost, and toll cost. Hence, a (toll)cost-optimized route is usually found, but it is not always guaranteed.
Specify the parameter &rollups instead of &rollup, and don't specify &cost_optimize, to get the route computed within Fleet Telematics API. Fleet Telematics API ignores the shortest/fastest in the mode parameter. Instead, it minimizes the sum of driver_cost, vehicle_cost, and toll cost. This yields fully cost-optimized routes (within the limitation that routing doesn't consider the smallest roads when very far away from waypoints). But doesn't support all Routing API parameters and can show higher response times.
Ignoring the hackish way of unlocking the full-fat optimizing engine (why not a real parameter ?), the end phrase is quite ominous. Still, it's tempting to try to improve results after exhausting all the options of the Routing API.
Turns out the results are worth it, but with lots of caveats...
The first sign that we are entering uncharted territory is that we're told that it "doesn't support all Routing API" but we're left to discover which ones (trial & error ?).
What's trickier is that some parameter values can cause problems:
Let's go from HARELBEKE (Belgium) to LA MEZIERE (France)
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey=...&driver_cost=0&vehicle_cost=2&ignoreWaypointVehicleRestriction=20000;1;all;0&waypoint0=geo!50.85677,3.31078;2000&waypoint1=geo!48.21925,-1.7546;2000&mode=fastest;truck;traffic:disabled;motorway:0&legAttributes=shape,-links,-maneuvers&limitedWeight=44&trailersCount=1&excludecountries=CHE,AND&tollVehicleType=3&detail=1&mapMatchTolerance=2000&routelegattributes=li&routeattributes=gr&linkattributes=none,rt,fl&rollups=none,total,country
=> "Couldn't reach waypoint 1"
Turns out that changing only the parameter "driver_cost=0" to some other value is enough to make it work. And yes, "driver_cost=0" works with thousands of other routes, but not this one. Why?
Another set of weird cases is that some routes choices are hard to explain
Let's go from BORDEAUX (France) to PARIS (France)
Nailed it! The best route, 10/10
Then back to BORDEAUX from PARIS (same parameters of course)
https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey=...&driver_cost=20&vehicle_cost=2&ignoreWaypointVehicleRestriction=20000;1;all;0&waypoint0=geo!48.85717,2.3414;2000&waypoint1=geo!44.8367,-0.58107;2000&mode=fastest;truck;traffic:disabled;boatFerry:-2;railFerry:-2;motorway:0&legAttributes=shape,-links,-maneuvers&limitedWeight=44&trailersCount=1&excludecountries=CHE,AND&tollVehicleType=3&detail=1&mapMatchTolerance=2000&routelegattributes=li&routeattributes=gr&linkattributes=none,rt,fl&rollups=none,total,country
Disappointing result considering that you just have to take the same route back, 4/10
Moving on to the first big unsolved problem for us: boats
The documentation states that, for trucks, you can only cost-optimize. To go for shorter or faster routes, you have to tweak the values of vehicle_cost or driver_cost.
A minor issue is that you lose the "real" costs calculation but it's easy to calculate yourself, so no big deal. The major problem is that if you push the vehicle cost above a certain threshold, around 4€/km, and you're near a coast, the engine wants to take a ferry.
For instance: ERMELO, 3851, NLD => CHATRES, 77610, FRA
Live request here
Sure, going to London, great idea. 2/10 including 1 bonus point for creativity
The solution for this route is to to add the &tollPass=transponder parameter to be able to use highways w/tolls in Belgium for trucks (anything above 3.5t). That's only for FT-API, the Route-API doesn't need it (go figure). So if you do truck routing in Europe, that parameter is de facto mandatory. But for the next route, there's no known (to me) solution, you can't avoid the boat trips.
CESTAS, 33610, FRA => GIUSSANO, 20833, ITA
Live request here
FIVE sea trips! It's not a truck route, it's a touristic cruise! 3/10
Unfortunately, the parameter vehicleCostOnFerry= doesn't change the route - it computes the additional cost but still goes for the boat(s)
Last shot in the mode parameter: boatFerry:-2;railFerry:-2, but nope - still prefers the boat
Only option boatFerry:-3;railFerry:-3 but then you can't cross the sea when you have to
Second big unsolved problem: waypoint radius
The premise is that the exact waypoint is not always reachable with a truck, mainly because you don't always have the real address but a default position in a city or postcode.
To work around that in the Route API, you define a radius around the waypoint to make it fuzzier. That parameter is ignored by the FT-API.
See that question for an example: Increasing search radius for way points in Here Maps Fleet Telematics API
The suggested workaround is to set the routeMatch=1 parameter. At first, it seems to work, but that option hides some nasty surprises.
First surprise: no error but the engine drops one or more points with the warning "Ignoring Trace Point X/Y because it is far away from the neighbors"
Luckily, there's a solution: ignoreWaypointsFarFromNeighbors=false
Second surprise: no error but you're teleported from one location to another
BIGANOS, FRA => KOLDING, DNK
Live request here
There the warnings are:
"code": 1021, "message": "Ignoring tracepoints with too big distance to the main route"
"code": 1005, "message": "Tracepoint #1 (55.48637 / 9.47336) moved by 1676199 meter onto the route"
At that point, I just gave up on routeMatch=1 because I found no parameter to avoid that and no workaround.
To summarize, at the moment we use the FT-API by default (because it finds better routes), but with two limitations:
it's impossible to fully optimize for distance because there's a practical limit to the vehicle_cost parameter
we have to fall back to the Route-API engine when the FT-API fails because of unreachable waypoints
Does anybody have a solution or workaround for those remaining problems ?

Here REST API return special characters like "ß", even when the language=en parameter is set

I'm using Here REST API to geocode international addresses, and I'm working on some Germany addresses with a lot of Straße in the spreadsheet.
For example, address like Löderburger Straße 14, 39418 Staßfurt, Deutschland, what I expected is getting Loderburger Strasse 14, 39418 Stassfurt, Germany from the API return. But, the result from Here is Löderburger Straße 14, 39418 Staßfurt, Germany. The country name is converted into english, however, I still get ß when I add the language=en parameter when calling the API. Is there any other ways to get the results in english?
In HERE Map data, the address is coded in local language by default. If the local language is non-latin then there would be a transcription coded. In multi-lingual areas explicit translation are coded for street names as well depending on the languages used in the region. The English translation would be coded for Country / Bigger city names globally but rarely for street names.

Google Map API Direction Service steps shows Chinese letters

I am using direction services and I get response like the following:
"Head north on Piazza del Duomo toward Piazza S. Giovanni/圣若望广场/聖若望廣場"
I saw this several times for sites in Florence.
For example, between Florence Cathedral and Battistero but there are more.
Is there anything I can do to fix this?
Thanks,
Amir
It must be a bug(data-defect?).
These chinese characters seem to be a real translation of Piazza S. Giovanni(of course the translation should not be there).
When I e.g. set the language to german I even get more translations(russian, hebrew,hungarian,greek)
I'm afraid the only thing you can do so far is to send a bug-report: https://code.google.com/p/gmaps-api-issues/issues/entry?template=Directions%20API%20-%20Bug

Is it good idea to use google translation API for a few words?

I'm making websites for german clients atm and I would like to make it easier for my german colleague and have all texts in my CMS translated automaticly. I would only need to ask the API for the translation once, because I'm saving the translations in database.
So I found out that google charges $20 per 1 M characters, but I would only need a few words translated now and then, something like 1000 a week max.
So I'd like to know, if there are any restrictions, that I need to use some minimum number of translations, or a minimum price for those who don't fully use the api.
You can still use Google Translate for free through YQL
I think it starts from 1M only, anyway we can't believe the translation because it gets confuse in may cases so just try more tests otherwise it will currupt meaning of the line and sentance, think once again before use.

Resources