What is the Translation API?

In Translation and proofreading


What is the Translation API? - read the full article about machine translation, Translation and proofreading and from Google Cloud Tech on Qualified.One
alt
Google Cloud Tech
Youtube Blogger
alt

PRIYANKA VERGADIA: How do I say Hello, World in Japanese? SPEAKER 1: [JAPANESE] PRIYANKA VERGADIA: And what about in Spanish? SPEAKER 2: [SPANISH] PRIYANKA VERGADIA: Well, stay with me as we explore the Translation API to make our apps global.

[MUSIC PLAYING] Welcome to "AI Adventures," where we explore the art, science, and tools of machine learning.

Im Priyanka Vergadia, and today, were talking about Translation API.

Have you ever typed "how do I say tomatoes in Hindi" in your Google Search? I bet you have.

Well, maybe not exactly that, but something similar, right? Then you have used Googles translation models.

But what if you could use the power of this translation model to translate your websites and apps, making them instantly usable across the world in multiple languages? Well, thats where Translation API comes in.

It is a high-quality pre-change translation model that can automatically identify more than 100 languages and translate them.

You can easily integrate your website or apps with it using the REST API.

Lets see how.

First, enable the Translation API in your project and create a service account for authentication.

Make sure you provide the Cloud Translation API editor role to your service account and generate a JSON key.

This will be used to authenticate our call.

I love Cloud Shells, so here, Im using curl from Cloud Shell to call the Translation API.

But you can use the language of your choice.

We authenticate the service using the key we downloaded earlier.

Now, lets say we want to translate "the weather is amazing today" into Hindi.

Here, we are setting both source and target, but the source is optional, since the API can autodetect the source language.

We pass this requester JSON file as a payload with our HTTP post request to the Translation API.

And we get the translation, [HINDI]..

This is great.

Lets try another example now.

"Google Cloud is an amazing technology." Even though this is technically a correct translation, it still feels weird.

This is because Google Cloud is a proper noun, and should not be translated.

In such cases, where you have product names, company names, and other proper nouns, you would like more control over how these specific words are translated.

Thats where Translation APIs Advanced Glossary feature comes in.

It is essentially a custom dictionary that the API uses to consistently translate your domain-specific terminology.

Heres how it works.

We create a glossary file with samples of our source and target language phrases and save it in Google Cloud Storage.

Then, we make a translation request using the glossary files.

Now, lets apply this to our example.

We create a glossary file, name it glossary.csv.

And you can also create them in TMX or TSV formats, if you want.

Lets add some examples here.

Google Cloud stays the same, Translation API stays the same, while technology translates.

Upload this file to a GCS bucket.

Before we start using the glossary, we need to register it and create a glossary ID, wherein the payload, we mention the source and target language, along with the location of the file.

And now, we are ready to translate the text using our glossary.

And here we see the translation now takes our glossary into account and considers Google Cloud as a proper noun.

So far, weve seen text translation for a single string.

But what if you wanted to translate multiple files in multiple languages? Thats where the Batch Translation feature comes in.

It is easy.

Upload the files you want to translate into Google Cloud Storage, request translations in multiple languages, and then store the translations in Google Cloud Storage.

Lets see how this works.

I have this sample text file that we will translate in a few different languages.

We define our request body in the three languages, Spanish, French, and Hindi.

Provide the path for the source and destination in Google Cloud Storage, then make a call to the API endpoint with Batch Translate text using our request body.

Now, lets go to our Google Cloud Storage bucket to see our translated files.

And they are available for us to use.

In this episode, we learned how Translation API works, and tried some advanced features, such as Batch Translation for batch translation needs and Glossary for correctly translating proper notes and product names.

I look forward to seeing you on the next episode of "AI Adventures," where we will explore custom domain-specific models using AutoML translation.

In the meantime, if you have enjoyed this video, click that Like button, and be sure to subscribe to get notified about the latest episodes right when they come.

Google Cloud Tech: What is the Translation API? - Translation and proofreading