Coding/Python Matlab

Python - 언어 번역 (Language Translation in Python)

smores 2023. 11. 6. 02:08

googletrans 4.0.0-rc1 필요

pip install googletrans==4.0.0-rc1

 

코드 예제

 

from googletrans import Translator
translator = Translator()
print(translator.translate('안녕하세요', src='ko', dest='en').text)
print(translator.translate('안녕하세요', src='ko', dest='ja').text)
print(translator.translate('こんにちは', src='ja', dest='ko').text)
print(translator.translate('こんにちは', src='ja', dest='en').text)
print(translator.translate('good morning', src='en', dest='ko').text)
print(translator.translate('good morning', src='en', dest='ja').text)

 

실행결과