Wikidata:Pywikibot - Python 3 チュートリアル

From Wikidata
Jump to navigation Jump to search
This page is a translated version of the page Wikidata:Pywikibot - Python 3 Tutorial and the translation is 50% complete.

このチュートリアルは Wikidata:Creating a bot のアップデート版です。しかし、Python 3 を使った完全に独立した短いチュートリアルとなっており、Wikidata と Pywikibot で巨大なデータセットを取り扱う方法を説明します。

テキストの大部分を書き直し、プログラミング経験が浅い人や全くない人でも理解しやすいように、より分かりやすくしました。Wikidata にだけ興味がある読者も、プログラミングを学んでみようと思うきっかけになるかもしれません。

このコースを学ぶには、Python 3 の経験が最低数日、理想的には数週間あることが望ましいです。コースの目的は、bot を動かして情報の収集と編集を行い、あなたのワークフローで使っている他のツールとデータをやり取りできるようにすることです。

Python と Pywikibot を使えば、チュートリアル全体を1つの言語で完結させられます。1つのプログラミング言語を学ぶのでも大変なので、データサイエンスの分野で最もよく使われている言語の1つである Python を利用します。Python 3 に絞ることで (3というバージョンを強調しておきます)、多言語が使われる Wikidata の性質にぴったり合ったアプローチを取ることができます。

このチュートリアルは誰でも編集できます。また、別のトークページでは自由に質問ができます。

インストール

bot の開発は、オンラインでもオフラインでも可能です。

オンライン、ブラウザー上の場合 (PAWS)

このチュートリアル (およびそれ以上のあらゆるタスク) は、PAWS ウェブインターフェイスを使用して最後まで実行することができます。

これは、ほとんどのユーザーにおすすめする選択肢です。

オフライン、ご利用のコンピューターにインストールの場合

はじめに

This learning block focuses on setting up pywikibot, querying data, — using functions, iteration and generators, — and writing data to a file or database.

  1. Data Harvest: Gathering data from one Wikidata-item
  2. Winter Storage: Writing data into a file or database
  3. Big Data: Iterating over large sets of items

After finishing the first three chapters award yourself the {{User Pywikibot basic}} badge. Congratulations!

This user has basic understanding of the Pywikibot software library.

Wikidata の編集

This learning block focuses on writing to Wikidata and comparing values between Wikipedia and Wikidata.

  1. Information about bot editing
  2. Labels: Setting labels, descriptions and aliases.
  3. Setting sitelinks
  4. Setting statements
  5. Changing Items: Correcting claims that link to a wrong item.
  6. Quantities and Units: Add a quantity claim with uncertainty and units.
  7. Setting qualifiers
  8. Setting sources

After finishing the 2nd block award yourself the {{User Pywikibot advanced}} badge. Congratulations!

This user has an advanced understanding of the Pywikibot software library.

専門的なトピックとさまざまな例

This block consists of advanced examples that go beyond iterating over Wikidata and getting or setting statements. This includes for example the templates that are used on Wikidata. You can just read and try out the chapters that you are interested in.

  • Templates: Examples how to look for certain templates, statements within them, and editing them.

After finishing the 3rd block, or if you are already experienced with running bots on Wikidata, you can award yourself the {{User Pywikibot professional}} badge. Congratulations!

This user is a Pywikibot expert.

役に立つ資料

BotAcademy 2015, Swedish

このチュートリアルが使われたワークショップ