Martin Borthiry
Martin Borthiry

Reputation: 5326

How Google is charging the language detection

Background

We have an application that is using Google Translation API in order to translate some data to a target language. For that, we use the /language/translate/v2 call without specifying the source language and Google is detecting the source language and translating in the same call.

Issue

Most of the time we are sending to translate text in the same language that is our target. In example: we receive a row in English (we don't know the source lang) and it needs to be translated into English.

Questions

  1. We know that Google is charging by characters and operation. But, is Google charging double we you call /translate and it has to perform both operations?
  2. Is Google performing a translation when the target lang is the same that was detected?
  3. If so, is Google charging when the source lang is the same that the target lang?

Upvotes: 1

Views: 2042

Answers (2)

Adam Bittlingmayer
Adam Bittlingmayer

Reputation: 1277

We know that Google is charging by characters and operation. But, is Google charging double we you call /translate and it has to perform both operations?

No.

Is Google performing a translation when the target lang is the same that was detected?

No.

If so, is Google charging when the source lang is the same that the target lang?

Good question, I assume so, but cannot say.

It may seem a bit unfair, but much of their cost is development and then handling requests at scale. This goes back to their original motivation for making the API paid - people were calling it in very inefficient ways, for example every time a webpage loaded, which risked making it unstable for other developers or unsustainable for Google.

Similarly, they do not charge twice for translation between two languages that are not English, even though usually they are translating twice under the hood - from the source language to English, and English to the target language. So most of the time, it works in the client's favour.

Personally, if I knew that most of my queries will be no-ops, I would run a client-side lang id library first. Then you can set a threshold, to balance cost and risk. In fact, you could send multiple requests if lang id gives a high score for multiple languages.

Besides the API cost there is latency and machine cost and network cost, and I also bet that you can do better than Google Translate's detection by tuning a bit for your content, assuming it's not open domain.

Upvotes: 2

Andrei Cusnir
Andrei Cusnir

Reputation: 2805

You might already know about the Cloud Translation API > Documentation > Pricing section of the documentation, however I am posting it here so everyone could access.

As it is mentioned in the documentation * Price is per character sent to the API for processing, including whitespace characters. Empty queries are charged for one character.. Which means that Google is charging per character that is sent to the API.

However, it is also specified that Google does not charge extra for language detection when you do not specify the source language for the translate method; the Language Detection price applies to detect method calls.. Which also means that if you don't specify the source language, you will be charged only for the translation process and not the language detection.

Upvotes: 4

Related Questions