Cloud Translateを使って、英語から日本語
日本語から英語の翻訳です
前回紹介した音声をテキスト化する方法と
更に、テキストを読み上げる方法を加えて
日本語で話すると、英語で翻訳された音声が聞こえてくる
また、その逆もあるようなプログラムを組みたいと考えています
ですから、これは最初の一歩(にもならないかかも知れませんが)です
train(訓練)を列車と訳してますが、改良点かも知れません
英語は一つの単語に複数の意味があるため
その文面からどれに当たるか決めないと、おかしなことになるのかも知れません
# -*- coding: utf-8 -*-
from __future__ import print_function
from googleapiclient.discovery import build
from __future__ import print_function
from googleapiclient.discovery import build
def main():
service = build('translate', 'v2',
developerKey='MyKey ')
print(service.translations().list(
service = build('translate', 'v2',
developerKey='MyKey ')
print(service.translations().list(
source='en',
target='ja',
target='ja',
q=["Today's Keras tutorial for beginners will introduce you to the basics of Python deep learning:",
"You’ll first learn what Artificial Neural Networks are",
"Then, the tutorial will show you step-by-step how to use Python and its libraries to understand, explore and visualize your data,",
"How to preprocess your data: you’ll learn how to split up your data in train and test sets and how you can standardize your data,",
"How to build up multi-layer perceptrons for classification tasks,"
"How to compile and fit the data to these models,",
"How to use your model to predict target values, and",
"How to validate the models that you have built.",
"Lastly, you’ll also see how you can build up a model for regression tasks and you’ll learn how you can fine-tune the model that you’ve built."]
).execute())
"You’ll first learn what Artificial Neural Networks are",
"Then, the tutorial will show you step-by-step how to use Python and its libraries to understand, explore and visualize your data,",
"How to preprocess your data: you’ll learn how to split up your data in train and test sets and how you can standardize your data,",
"How to build up multi-layer perceptrons for classification tasks,"
"How to compile and fit the data to these models,",
"How to use your model to predict target values, and",
"How to validate the models that you have built.",
"Lastly, you’ll also see how you can build up a model for regression tasks and you’ll learn how you can fine-tune the model that you’ve built."]
).execute())
if __name__ == '__main__':
main()
main()
====================================================================================================
{'translations':
[{'translatedText': '初心者のための今日のKerasチュートリアルでは、Pythonの深い学習の基礎を紹介します:'},
{'translatedText': '最初に、人工ニューラルネットワークが'},
{'translatedText': '次に、このチュートリアルでは、Python とそのライブラリを使用してデータを理解、探索、視覚化する方法を段階的に示します。'}, {'translatedText': 'あなたのデータを前処理する方法:列車とテストセットのデータを分割する方法と、データを標準化する方法を学びます。'},
{'translatedText': '分類タスクのために多層パーセプトロンを構築する方法、これらのモデルにデータをコンパイルして適合させる方法、'}, {'translatedText': 'モデルを使用して目標値を予測する方法'},
{'translatedText': 'あなたが構築したモデルを検証する方法。'},
{'translatedText': '最後に、回帰タスクのモデルを構築する方法と、構築したモデルを微調整する方法についても学習します。'}]}