LoginSignup
2
3

More than 3 years have passed since last update.

Google(翻訳)は、pythonを理解している。しかも、日本語で。

Posted at

目的

少し、ネタのような記事になっているが、お伝えしたいことは一つ。
ワタシが伝える必要はないかもしれませんが、

  Google翻訳(英語→日本語)のレベルが、もの凄いです。

最近、このような翻訳を使っていませんでしたが、いま、使ってみて驚きました。
必要があるときは、試されるといいと思います。:candy::candy:
翻訳は、AIにも属する技術だと思いますが、AIに興味があり、その観点でも、これを例示しているつもりです。

翻訳の例1

(出典: https://docs.python.org/3/reference/)

When a generator function is called, it returns an iterator known as a generator. That generator then controls the execution of the generator function. The execution starts when one of the generator’s methods is called. At that time, the execution proceeds to the first yield expression, where it is suspended again, returning the value of expression_list to the generator’s caller. By suspended, we mean that all local state is retained, including the current bindings of local variables, the instruction pointer, the internal evaluation stack, and the state of any exception handling. When the execution is resumed by calling one of the generator’s methods, the function can proceed exactly as if the yield expression were just another external call. The value of the yield expression after resuming depends on the method which resumed the execution. If next() is used (typically via either a for or the next() builtin) then the result is None. Otherwise, if send() is used, then the result will be the value passed in to that method.

https://translate.google.com/
による翻訳結果(2019/06/20現在)

ジェネレータ関数が呼び出されると、ジェネレータと呼ばれるイテレータが返されます。そのジェネレータはジェネレータ関数の実行を制御します。ジェネレータのメソッドの1つが呼び出されると実行が開始されます。その時点で、実行は最初のyield式に進み、そこで再び中断され、expression_listの値がジェネレータの呼び出し元に返されます。一時停止とは、ローカル変数の現在のバインディング、命令ポインタ、内部評価スタック、および例外処理の状態など、すべてのローカル状態が保持されることを意味します。ジェネレータのメソッドの1つを呼び出して実行が再開されると、関数はyield式が別の外部呼び出しであるかのように正確に処理を進めることができます。再開後のyield式の値は、実行を再開したメソッドによって異なります。 _next _()が使用されている場合(通常はforまたはnext()の組み込みのいずれかを介して)、結果はNoneになります。そうではなく、send()が使用されると、結果はそのメソッドに渡された値になります。

翻訳の例2

(出典: https://docs.python.org/3/reference/)

You can think of packages as the directories on a file system and modules as files within directories, but don’t take this analogy too literally since packages and modules need not originate from the file system. For the purposes of this documentation, we’ll use this convenient analogy of directories and files. Like file system directories, packages are organized hierarchically, and packages may themselves contain subpackages, as well as regular modules.
It’s important to keep in mind that all packages are modules, but not all modules are packages. Or put another way, packages are just a special kind of module. Specifically, any module that contains a path attribute is considered a package.
All modules have a name. Subpackage names are separated from their parent package name by dots, akin to Python’s standard attribute access syntax. Thus you might have a module called sys and a package called email, which in turn has a subpackage called email.mime and a module within that subpackage called email.mime.text.

https://translate.google.com/
による翻訳結果(2019/06/20現在)

パッケージはファイルシステム上のディレクトリ、モジュールはディレクトリ内のファイルと考えることができますが、パッケージとモジュールはファイルシステムから派生する必要はないので、この類推を文字通りにしないでください。このドキュメントでは、この便利なディレクトリとファイルの類推を使用します。ファイルシステムディレクトリと同様に、パッケージは階層的に編成されており、パッケージ自体に通常のモジュールと同様にサブパッケージを含めることができます。
すべてのパッケージがモジュールであることを心に留めておくことは重要ですが、すべてのモジュールがパッケージであるわけではありません。言い換えれば、パッケージは単なる特別な種類のモジュールです。具体的には、__ path__属性を含むモジュールはすべてパッケージと見なされます。
すべてのモジュールに名前があります。サブパッケージ名は、親パッケージ名とドットで区切られています。これは、Pythonの標準属性アクセス構文に似ています。したがって、sysというモジュールとemailというパッケージがあり、その中にemail.mimeというサブパッケージとそのサブパッケージ内のemail.mime.textというモジュールがあります。

翻訳の例3

(出典: https://docs.python.org/3/reference/)

While I am trying to be as precise as possible, I chose to use English rather than formal specifications for everything except syntax and lexical analysis. This should make the document more understandable to the average reader, but will leave room for ambiguities. Consequently, if you were coming from Mars and tried to re-implement Python from this document alone, you might have to guess things and in fact you would probably end up implementing quite a different language. On the other hand, if you are using Python and wonder what the precise rules about a particular area of the language are, you should definitely be able to find them here. If you would like to see a more formal definition of the language, maybe you could volunteer your time — or invent a cloning machine :-).

https://translate.google.com/
による翻訳結果(2019/06/20現在)

私はできるだけ正確になろうとしている間、私は構文と語彙分析を除いてすべてのために形式的な仕様よりむしろ英語を使うことを選びました。 これにより、この文書は一般の読者にとって理解しやすくなるはずですが、あいまいさの余地があります。 したがって、もしあなたが火星から来て、この文書だけからPythonを再実装しようとしたならば、あなたは物事を推測しなければならないかもしれず、そして実際にはあなたは全く異なる言語を実装することになるでしょう。 一方、Pythonを使用していて、その言語の特定の領域に関する正確な規則が何であるか疑問に思う場合は、間違いなくここでそれらを見つけることができるはずです。 もっと正式な言語の定義を見たいのであれば、多分あなたはあなたの時間を志願することができます - またはクローン作成機を発明することができます:-)。

※翻訳に関してでなく、上記の内容に関しては、少しコメントしたい部分もあります。

まとめ

Google翻訳(英語→日本語)が、

異常なレベル

に入っていると思われませんか?

単に、使われたらどうでしょう、という記事です。
特に、随分前に、なんらかの翻訳をされてがっかりされている方は、今一度、使われると印象が変わるかと。。。。:candy::candy:

関連(本人)

pythonをストレスなく使う!(Pythonでは、すべてがオブジェクトとして実装されている)
pythonをストレスなく使う!(Pylintに寄り添う)
pythonをストレスなく使う!(ExpressionとStatement)
英語と日本語、両方使ってPythonを丁寧に学ぶ。

今後

コメントなどあれば、お願いします。:candy:

もう少しだけ、例示とか含め記載を増やしたい気があります。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3