Git Product home page Git Product logo

wiki_extractor's Introduction

Wiki_Extractor

对维基百科中文语料,繁转简并提取文字内容整理成 JSON 文件

文件说明

opencc文件夹为中文简繁转换的套件

Wiki_Extractor.py 提取维基百科内容( 使用 https://github.com/attardi/wikiextractor 所提供的 code,原 code 改为 Python3 版本之后 bug 较多, 故提取维基百科内容的时候后采用了 fork 的原 repo 的方法,改为了繁转简 )

Wiki_Cleaning.py 将资料转换为简体的 json 格式

初始化

git clone https://github.com/Aman-4-Real/Wiki_Extractor

或者使用下载方式把 github 上的资料上传到本地端( 解压缩后文件夹名称为 Wiki_Extractor-master )

安装所需套件

pip3 install -r requirements.txt

下载维基百科语料

语料下载处:https://dumps.wikimedia.org/zhwiki/20201120/

在 linux 下可直接使用指令

wget https://dumps.wikimedia.org/zhwiki/20201120/zhwiki-20201120-pages-articles-multistream.xml.bz2

提取维基百科语料內容

python3 Wiki_Extractor.py -b 1024M -o extracted zhwiki-20201120-pages-articles-multistream.xml.bz2

提取完的内容会保存到 /extracted/AA/

将文章内容繁转简并整理成 Json 格式

python3 Wiki_Cleaning.py --file_path ./extracted/AA/

转换后的文件格式

[
  { 
    "id" : (int) 编号 ,
    "title" : (str) 文章标题  ,
    "articles" : (str) 文章內容
  },
...
]

wiki_extractor's People

Contributors

aman-4-real avatar harry-chan avatar udicatnchu avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.