跳转到主要内容

用于从维基百科中学习单词和实体向量的工具

项目描述

Wikipedia2Vec

tests pypi Version

Wikipedia2Vec是一种用于从维基百科中获取单词和实体(即有对应维基百科页面的概念)嵌入(或向量表示)的工具。它由Studio Ousia开发和维护。

此工具允许您同时学习单词和实体的嵌入,并在连续向量空间中将相似的单词和实体彼此靠近。可以通过使用公开可用的维基百科存档作为输入的单个命令轻松训练嵌入。

此工具实现了传统的skip-gram模型来学习单词的嵌入,并实现了Yamada等(2016)提出的一种扩展,以学习实体的嵌入。

有关Wikipedia2Vec与现有嵌入工具(即FastText、Gensim、RDF2Vec和Wiki2vec)的经验比较,请参阅此处

文档可在http://wikipedia2vec.github.io/在线获得。

基本用法

Wikipedia2Vec可以通过PyPI安装

% pip install wikipedia2vec

使用此工具,可以通过运行带有维基百科存档作为输入的train命令来学习嵌入。例如,以下命令下载最新的英文维基百科存档并从中学习嵌入:

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

然后,学习到的嵌入向量将被写入到模型文件。请注意,此命令可以接受许多可选参数。有关更多详细信息,请参阅我们的文档

预训练嵌入

可以从此页面下载12种语言的预训练嵌入(即英语、阿拉伯语、中文、荷兰语、法语、德语、意大利语、日语、波兰语、葡萄牙语、俄语和西班牙语)。

应用场景

Wikipedia2Vec已应用于以下任务

参考文献

如果您在科学出版物中使用Wikipedia2Vec,请引用以下论文

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}
}

嵌入模型最初在以下论文中提出

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}
}

此示例中实现的文本分类模型在以下论文中提出

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}
}

许可证

Apache License 2.0

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码发行版

wikipedia2vec-2.0.0.tar.gz (970.0 kB 查看哈希值)

上传时间 源代码

构建发行版

wikipedia2vec-2.0.0-cp312-cp312-win_amd64.whl (1.5 MB 查看哈希值)

上传时间 CPython 3.12 Windows x86-64

wikipedia2vec-2.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB 查看哈希值)

上传时间 CPython 3.12 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传时间 CPython 3.12 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp312-cp312-macosx_10_9_x86_64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.12 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp311-cp311-win_amd64.whl (1.5 MB 查看哈希值)

上传时间 CPython 3.11 Windows x86-64

wikipedia2vec-2.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB 查看哈希值)

上传时间 CPython 3.11 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传时间 CPython 3.11 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp311-cp311-macosx_10_9_x86_64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.11 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp310-cp310-win_amd64.whl (1.5 MB 查看哈希值)

上传于 CPython 3.10 Windows x86-64

wikipedia2vec-2.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB 查看哈希值)

上传于 CPython 3.10 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传于 CPython 3.10 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp310-cp310-macosx_10_9_x86_64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.10 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp39-cp39-win_amd64.whl (1.5 MB 查看哈希值)

上传于 CPython 3.9 Windows x86-64

wikipedia2vec-2.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB 查看哈希值)

上传于 CPython 3.9 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传于 CPython 3.9 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl (1.7 MB 查看哈希值)

上传于 CPython 3.9 macOS 10.9+ x86-64

wikipedia2vec-2.0.0-cp38-cp38-win_amd64.whl (1.6 MB 查看哈希值)

上传于 CPython 3.8 Windows x86-64

wikipedia2vec-2.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB 查看哈希值)

上传于 CPython 3.8 manylinux: glibc 2.17+ x86-64

wikipedia2vec-2.0.0-cp38-cp38-macosx_11_0_arm64.whl (1.6 MB 查看哈希值)

上传于 CPython 3.8 macOS 11.0+ ARM64

wikipedia2vec-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB 查看哈希值)

上传时间 CPython 3.8 macOS 10.9+ x86-64

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面