Bhavin Tandel

projects, blogs, about me

Github LinkedIn Medium Twitter

Exploring ML Tools - AWS Translate

According to one of the surveys there are roughly 6500 languages spoken in whole world. However, I am sure that actual number is definitely more. So, it 99.9% impossible to learn all the languages in the world, but we as human are always keen to know the unknowns. So ideally if we have a tool which can translate foreign language to the one that we know, then it would really take the pain away in understanding someone with foreign language. So, in this blog we will focus on an AWS tool names Translate that does what it says, that is, it translates one language to other.

AWS Translate on multiple services

Introduction

AWS Translate is the neural machine translation service which deliver fast and more accurate result than traditional rule-based approach. It supports wide number of languages along with custom terminology which allows you to specific names, organization and the way it gets translated. It supports batch translation for bulk/short text data and real time translation for short data like chats, messages etc.

How it Works?

aws translate translate-text \
            --source-language-code "en" \
            --target-language-code "hi" \
            --text "hello, world, How are you"

{
    "TranslatedText": "नमस्ते, दुनिया, आप कैसे हैं",
    "SourceLanguageCode": "en",
    "TargetLanguageCode": "hi"
}

Features

Usecase

Usage

You can perform translation via:

Input

Process

import boto3
translate_client = boto3.client('translate', use_ssl=True)

result = translate_client.translate_text(Text="नमस्ते, दुनिया, आप कैसे हैं", SourceLanguageCode='hi', TargetLanguageCode='en')

print('TranslatedText: ' + result.get('TranslatedText'))
print('SourceLanguageCode: ' + result.get('SourceLanguageCode'))
print('TargetLanguageCode: ' + result.get('TargetLanguageCode'))
TranslatedText: Hello, World, How are you
SourceLanguageCode: hi
TargetLanguageCode: en

Output

{
'TranslatedText': 'Pouvez-vous aider avec la connexion',
 'SourceLanguageCode': 'en',
 'TargetLanguageCode': 'fr',
 'ResponseMetadata': {'RequestId': '8408bf00-985d-4827-a266-15ece5fb8645',
  'HTTPStatusCode': 200,
  'HTTPHeaders': {'x-amzn-requestid': '8408bf00-985d-4827-a266-15ece5fb8645',
   'cache-control': 'no-cache',
   'content-type': 'application/x-amz-json-1.1',
   'content-length': '108',
   'date': 'Tue, 23 Jun 2020 20:13:13 GMT'},
  'RetryAttempts': 0}
}

Findings

Errors

Pricing

Bibliography

P.S. Will update the blog when the batch job testing is completed.

back