All of us are aware of  Google Translate. Today, we will provide examples of how we can use the  googletrans which is a free and unlimited python library that implemented Google Translate API. This uses the Google Translate Ajax API to make calls to such methods as **detect **and **translate **.

The first thing that we need to do is to install the googletrans library. I suggest to use the conda install command.

conda install -c conda-forge googletrans

How to get the supported languages

Google Translate supports more than 100 languages. Below, we give an example of how you can get the supported language and their corresponding code:

import pandas as pd
import googletrans
from googletrans import Translator

pd.set_option('max_colwidth', 300)
## how to get the supported language and their corresponing code
lang_df = pd.DataFrame.from_dict(googletrans.LANGUAGES,  orient='index', columns=['Language'])

Image for post

#data-science #machine-learning #google-translate #python #nlp

Google Translate in Python
9.65 GEEK