![]() My_example = my_example.apply(lambda x: anslate(x, src='en', dest='it').text ) my_example = pd.DataFrame()Ġ Police in France say they have seized 140,000 face masks that were destined for sale on the black market.ġ Officers say they discovered the haul when they spotted a businessman unloading the masks from a lorry into a house in St Denis, north of Paris.Ģ Prime Minister Boris Johnson could possibly lead the daily news conference on Monday but, if not then, it will be pretty soon afterwards. ![]() Let’s provide a data frame with English documents. Let’s assume that you have the English documents in a pandas data frame, and you want to get the translation in Italian. How to translate multiple documents at once pronunciation: Pronunciation of the translated text.text: Translated text, which was ‘ I am seeking a permanent center of gravity‘ in our case.origin: Original text, that is ‘ Cerco un centro di gravità permanente‘ in our example.dest: Destination language, which is set to English (en).src: The source language, which is set to Italin (it).The object returned by the translate() method has the following attributes: I am seeking a permanent center of gravity my_translation = anslate("Cerco un centro di gravità permanente", src='it', dest='en') Let’s say that we want to translate the above “Italian” sentence to “English”. In our example, we will define the source and the destination language. The translate function translates from source language to destination language taking as default “English” as destination language and as a source language it tries to detect the language. How to translate from source language to destination language # find the code for english, french, italian, spanish and greek Let’s say that we want to get the code of specific languages, like ‘ English‘, ‘ Italian‘, ‘ Spanish‘, ‘ French‘, and ‘ Greek‘. Lang_df = pd.om_dict(googletrans.LANGUAGES, orient='index', columns=) # how to get the supported language and their corresponing code Below, we give an example of how you can get the supported language and their corresponding code: import pandas as pd Google Translate supports more than 100 languages. I suggest to use the conda install command. The first thing that we need to do is to install the googletrans library. ![]() This uses the Google Translate Ajax API to make calls to such methods as detect and 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |