Skip to main content

python แปลภาษา ด้วย googletrans ใน google colab


เขียน python แปลภาษา ใน google colab

!pip install googletrans==4.0.0-rc1

import googletrans
from googletrans import Translator

print(googletrans.LANGUAGES)

output
{'af': 'afrikaans', 'sq': 'albanian', 'am': 'amharic', 'ar': 'arabic', 'hy': 'armenian', 'az': 'azerbaijani', 'eu': 'basque', 'be': 'belarusian', 'bn': 'bengali', 'bs': 'bosnian', 'bg': 'bulgarian', 'ca': 'catalan', 'ceb': 'cebuano', 'ny': 'chichewa', 'zh-cn': 'chinese (simplified)', 'zh-tw': 'chinese (traditional)', 'co': 'corsican', 'hr': 'croatian', 'cs': 'czech', 'da': 'danish', 'nl': 'dutch', 'en': 'english', 'eo': 'esperanto', 'et': 'estonian', 'tl': 'filipino', 'fi': 'finnish', 'fr': 'french', 'fy': 'frisian', 'gl': 'galician', 'ka': 'georgian', 'de': 'german', 'el': 'greek', 'gu': 'gujarati', 'ht': 'haitian creole', 'ha': 'hausa', 'haw': 'hawaiian', 'iw': 'hebrew', 'he': 'hebrew', 'hi': 'hindi', 'hmn': 'hmong', 'hu': 'hungarian', 'is': 'icelandic', 'ig': 'igbo', 'id': 'indonesian', 'ga': 'irish', 'it': 'italian', 'ja': 'japanese', 'jw': 'javanese', 'kn': 'kannada', 'kk': 'kazakh', 'km': 'khmer', 'ko': 'korean', 'ku': 'kurdish (kurmanji)', 'ky': 'kyrgyz', 'lo': 'lao', 'la': 'latin', 'lv': 'latvian', 'lt': 'lithuanian', 'lb': 'luxembourgish', 'mk': 'macedonian', 'mg': 'malagasy', 'ms': 'malay', 'ml': 'malayalam', 'mt': 'maltese', 'mi': 'maori', 'mr': 'marathi', 'mn': 'mongolian', 'my': 'myanmar (burmese)', 'ne': 'nepali', 'no': 'norwegian', 'or': 'odia', 'ps': 'pashto', 'fa': 'persian', 'pl': 'polish', 'pt': 'portuguese', 'pa': 'punjabi', 'ro': 'romanian', 'ru': 'russian', 'sm': 'samoan', 'gd': 'scots gaelic', 'sr': 'serbian', 'st': 'sesotho', 'sn': 'shona', 'sd': 'sindhi', 'si': 'sinhala', 'sk': 'slovak', 'sl': 'slovenian', 'so': 'somali', 'es': 'spanish', 'su': 'sundanese', 'sw': 'swahili', 'sv': 'swedish', 'tg': 'tajik', 'ta': 'tamil', 'te': 'telugu', 'th': 'thai', 'tr': 'turkish', 'uk': 'ukrainian', 'ur': 'urdu', 'ug': 'uyghur', 'uz': 'uzbek', 'vi': 'vietnamese', 'cy': 'welsh', 'xh': 'xhosa', 'yi': 'yiddish', 'yo': 'yoruba', 'zu': 'zulu'}

translator = Translator()
text = "hello"
translated = translator.translate(text, src='en', dest='th')
print(translated)
print(translated.src)
print(translated.dest)
print(translated.origin)
print(translated.text)
print(translated.pronunciation)

output
Translated(src=en, dest=th, text=สวัสดี, pronunciation=S̄wạs̄dī, extra_data="{'confiden...") en th hello สวัสดี S̄wạs̄dī

Comments

Popular posts from this blog

FURY (2014 film)

                    Fury 2014 film is an American war film . more than $100 million dollar budgets , film based on true story during the last month of World War II in April 1945. Cast   Brad Pitt  (from World War Z and Inglourious Basterds) as Wardaddy  Shia LaBeouf (from transformer 1,2,3) as Boyd Swan Logan Lerman (from Percy Jackson 1,2) as Norman Ellison                     Fury is film in last month of World War II in April 1945. Allied forces of the United States tried to storm the city of Berlin,Germany.But faced with a tight defense and can't penetrate.it is the duty of Wardaddy(Brad Pitt ).Sergeant Major of the Army and his team 4 peoples in tank name "FURY".Mission penetrate into stronghold of Nazi.The results of their mission became a major turning point that made United States won  the war.           ...

Watch Dogs 2014 Game details information

                     Ubisoft disclosure the game Watch Dogs. about the game features, adventure hacked game in realism of the environment and hacking system in public access to electronic devices.            For the game Watch Dogs, have realtime day / night. also include climate to sky, rainfall, raging storm, or foggy city. etc.           The game's character as peoples more than three thousand. and each with their daily lives, and it represents the city from morning till night. for example if the player walking in downtown, player will see the peoples walking around in game. the place in game have 6 districts from the city to the industrial area.           Interestingly of this game is. In addition can hacking to infrastructure,the government also can hacked population data and withdraw money to player's account, and have level ...