Difference between revisions of "Translate"

From RHS Wiki
Jump to navigation Jump to search
m
Tag: visualeditor
m
Tag: visualeditor
Line 7: Line 7:
 
translator.translate('안녕하세요.', dest='ja')
 
translator.translate('안녕하세요.', dest='ja')
 
translator.detect('veritas lux mea').lang
 
translator.detect('veritas lux mea').lang
 +
</syntaxhighlight>
 +
 +
== Language detection ==
 +
 +
=== Langdetect ===
 +
<syntaxhighlight lang="bash">
 +
pip install landetect
 +
</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>
 
</syntaxhighlight>
 
[[Category:Python]]
 
[[Category:Python]]

Revision as of 11:04, 20 May 2019

pip install googletrans
from googletrans import Translator
translator = Translator()
translator.translate('안녕하세요.').text
translator.translate('안녕하세요.', dest='ja')
translator.detect('veritas lux mea').lang

Language detection

Langdetect

pip install landetect
from langdetect import detect
detect("War doesn't show who's right, just who's left.")
detect("Ein, zwei, drei, vier")