科学の箱

科学・IT・登山の話題

Python

pythonからgoogle translateを使う

投稿日:2019年6月19日 更新日:

まずはパッケージをpip経由でインストール

pip install googletrans

これで完了。あとは利用するだけです。

日本語を英語に翻訳するとき。

translator = Translator()
print(translator.translate(“How are you today?.”, dest=’ja’))

結果

Translated(src=en, dest=ja, text=今日は元気ですか?。, pronunciation=None, extra_data=”{‘translat…”)

英語を日本語に訳すとき

translator = Translator()
print(translator.translate(“こんにちは、お元気ですか”, dest=’en’))

結果

Translated(src=ja, dest=en, text=Hello, how are you, pronunciation=None, extra_data=”{‘translat…”)

メタ情報

inarticle



メタ情報

inarticle



-Python

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

tensorflowをpipでインストールするときのオプション

tensorflow環境を構築するときにはpipを利用すると簡単である。pipの簡単な使い方としてはinstallオプションを指定すればよい。 pip install tensoflow しかしこのオ …

no image

UnionFindのfindについて処理を考える。

UnionFindにおけるfind()もしくはroot()はルート(グループの根)を見つける処理である。 記述方法としては2種類ある。 whileループを回す 再帰処理 それぞれについて動きを確認して …

no image

Python + Slack Bot – 2

Slackのチャネルに投稿するにはChanel IDが必要。 Chanel IDは下記から取得できる。 https://api.slack.com/methods/channels.list/test …

no image

kaggle Titanic Tutorial – 3

DecitionTreeのパラメータを調整する。 まずはMaxDepthから from sklearn.model_selection import LeaveOneOut from sklearn. …

no image

pythonで配列に関係する型

pythonで配列に関連する型は3つある。 list array numpy.ndarray pandas.dataframe list 違っている複数のデータ型を要素として保持できる 多次元配列可能 …

2019年6月
月 火 水 木 金 土 日
« 5月   7月 »
 12
3456789
10111213141516
17181920212223
24252627282930

side bar top



アーカイブ

カテゴリー