维基百科数据抽取

发布时间:2025-12-10 11:22:02 浏览次数:4

1. 数据路径

https://dumps.wikimedia.org/enwiki/latest/ ----英文
https://dumps.wikimedia.org/zhwiki/latest/ ----中文

https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-pages-articles.xml.bz2 --下载最新的

https://dumps.wikimedia.org/wikidatawiki/20230201/ 按天存储数据集

2. 基于wikiextractor包解析 bz2文件

linux 环境下数据解析成功。windows环境尝试报错,未成功。

2.1 安装wikiextractor
  • 下载git安装包:
    git: https://github.com/attardi/wikiextractor

  • 解压后进入 setpu目录
    python setup.py install

  • 数据解析
    之前下载bz2 文件如在wikiextractor
    python WikiExtractor.py -b 1024M -o zh_test enwiki-latest-pages-articles.xml.bz2
    -b: 文件大小分割
    -o: 存储的路径

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477