Skip to main content

A tool for learning vector representations of words and entities from Wikipedia

Project description

Wikipedia2Vec

tests pypi Version

Wikipedia2Vec is a tool used for obtaining embeddings (or vector representations) of words and entities (i.e., concepts that have corresponding pages in Wikipedia) from Wikipedia. It is developed and maintained by Studio Ousia.

This tool enables you to learn embeddings of words and entities simultaneously, and places similar words and entities close to one another in a continuous vector space. Embeddings can be easily trained by a single command with a publicly available Wikipedia dump as input.

This tool implements the conventional skip-gram model to learn the embeddings of words, and its extension proposed in Yamada et al. (2016) to learn the embeddings of entities.

An empirical comparison between Wikipedia2Vec and existing embedding tools (i.e., FastText, Gensim, RDF2Vec, and Wiki2vec) is available here.

Documentation are available online at http://wikipedia2vec.github.io/.

Basic Usage

Wikipedia2Vec can be installed via PyPI:

% pip install wikipedia2vec

With this tool, embeddings can be learned by running a train command with a Wikipedia dump as input. For example, the following commands download the latest English Wikipedia dump and learn embeddings from this dump:

% wget https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-pages-articles.xml.bz2
% wikipedia2vec train enwiki-latest-pages-articles.xml.bz2 MODEL_FILE

Then, the learned embeddings are written to MODEL_FILE. Note that this command can take many optional parameters. Please refer to our documentation for further details.

Pretrained Embeddings

Pretrained embeddings for 12 languages (i.e., English, Arabic, Chinese, Dutch, French, German, Italian, Japanese, Polish, Portuguese, Russian, and Spanish) can be downloaded from this page.

Use Cases

Wikipedia2Vec has been applied to the following tasks:

References

If you use Wikipedia2Vec in a scientific publication, please cite the following paper:

Ikuya Yamada, Akari Asai, Jin Sakuma, Hiroyuki Shindo, Hideaki Takeda, Yoshiyasu Takefuji, Yuji Matsumoto, Wikipedia2Vec: An Efficient Toolkit for Learning and Visualizing the Embeddings of Words and Entities from Wikipedia.

@inproceedings{yamada2020wikipedia2vec,
  title = "{W}ikipedia2{V}ec: An Efficient Toolkit for Learning and Visualizing the Embeddings of Words and Entities from {W}ikipedia",
  author={Yamada, Ikuya and Asai, Akari and Sakuma, Jin and Shindo, Hiroyuki and Takeda, Hideaki and Takefuji, Yoshiyasu and Matsumoto, Yuji},
  booktitle = {Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations},
  year = {2020},
  publisher = {Association for Computational Linguistics},
  pages = {23--30}
}

The embedding model was originally proposed in the following paper:

Ikuya Yamada, Hiroyuki Shindo, Hideaki Takeda, Yoshiyasu Takefuji, Joint Learning of the Embedding of Words and Entities for Named Entity Disambiguation.

@inproceedings{yamada2016joint,
  title={Joint Learning of the Embedding of Words and Entities for Named Entity Disambiguation},
  author={Yamada, Ikuya and Shindo, Hiroyuki and Takeda, Hideaki and Takefuji, Yoshiyasu},
  booktitle={Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning},
  year={2016},
  publisher={Association for Computational Linguistics},
  pages={250--259}
}

The text classification model implemented in this example was proposed in the following paper:

Ikuya Yamada, Hiroyuki Shindo, Neural Attentive Bag-of-Entities Model for Text Classification.

@article{yamada2019neural,
  title={Neural Attentive Bag-of-Entities Model for Text Classification},
  author={Yamada, Ikuya and Shindo, Hiroyuki},
  booktitle={Proceedings of The 23th SIGNLL Conference on Computational Natural Language Learning},
  year={2019},
  publisher={Association for Computational Linguistics},
  pages = {563--573}
}

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wikipedia2vec-2.0.0.tar.gz (970.0 kB view hashes)

Uploaded Source

Built Distributions

wikipedia2vec-2.0.0-cp312-cp312-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

wikipedia2vec-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp312-cp312-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp311-cp311-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

wikipedia2vec-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp311-cp311-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp310-cp310-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

wikipedia2vec-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp310-cp310-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp39-cp39-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

wikipedia2vec-2.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp38-cp38-win_amd64.whl (1.6 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

wikipedia2vec-2.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp38-cp38-macosx_11_0_arm64.whl (1.6 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page