Difference between revisions of "Translate"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) (Created page with "<syntaxhighlight lang="bash"> pip install googletrans </syntaxhighlight><syntaxhighlight lang="python3"> from googletrans import Translator translator = Translator() translato...") Tag: visualeditor |
Rafahsolis (talk | contribs) m (→Langdetect) Tag: visualeditor |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
translator.translate('안녕하세요.').text | translator.translate('안녕하세요.').text | ||
translator.translate('안녕하세요.', dest='ja') | translator.translate('안녕하세요.', dest='ja') | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ==Language detection== | ||
| + | |||
| + | ===googletrans=== | ||
| + | <syntaxhighlight lang="python3"> | ||
| + | from googletrans import Translator | ||
translator.detect('veritas lux mea').lang | translator.detect('veritas lux mea').lang | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | ===Langdetect=== | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | pip install langdetect | ||
| + | </syntaxhighlight><syntaxhighlight lang="python3"> | ||
| + | from langdetect import detect | ||
| + | detect("War doesn't show who's right, just who's left.") | ||
| + | detect("Ein, zwei, drei, vier") | ||
| + | </syntaxhighlight> | ||
| + | [[Category:Python]] | ||
Latest revision as of 11:07, 20 May 2019
pip install googletrans
from googletrans import Translator
translator = Translator()
translator.translate('안녕하세요.').text
translator.translate('안녕하세요.', dest='ja')
Language detection[edit]
googletrans[edit]
from googletrans import Translator
translator.detect('veritas lux mea').lang
Langdetect[edit]
pip install langdetect
from langdetect import detect
detect("War doesn't show who's right, just who's left.")
detect("Ein, zwei, drei, vier")