Difference between revisions of "Translate"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) m Tag: visualeditor |
Rafahsolis (talk | contribs) m (→Langdetect) Tag: visualeditor |
||
| Line 10: | Line 10: | ||
==Language detection== | ==Language detection== | ||
| − | === googletrans === | + | ===googletrans=== |
<syntaxhighlight lang="python3"> | <syntaxhighlight lang="python3"> | ||
from googletrans import Translator | from googletrans import Translator | ||
| Line 18: | Line 18: | ||
===Langdetect=== | ===Langdetect=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| − | pip install | + | pip install langdetect |
</syntaxhighlight><syntaxhighlight lang="python3"> | </syntaxhighlight><syntaxhighlight lang="python3"> | ||
from langdetect import detect | from langdetect import detect | ||
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")