【wiki維基百科中文數據集】抽取wiki數據集——實操

參考python

http://www.javashuo.com/article/p-zblfoaoe-db.htmlgit

【另一篇參考處理wiki數據】github

  【1】【https://blog.csdn.net/sinat_26917383/article/details/79462107工具

    【上述代碼】【https://github.com/mattzheng/ChineseWiki/blob/master/README.mdspa

  【2】【http://www.javashuo.com/article/p-eujlmmpp-ge.html.net

  1、下載數據集code

  到【https://dumps.wikimedia.org/zhwiki/latest/】下載最新的中文wiki百科數據集【zhwiki-latest-pages-articles.xml.bz2】。xml

  也就是【https://dumps.wikimedia.org/zhwiki/latest/zhwiki-latest-pages-articles.xml.bz2】blog

 


 

  

  2、提取原始語料庫數據(新詞彙:語料庫(corpus —— corpora【複數】))ip

  (一)節點信息

  聽說xml節點信息相似以下:(待驗證)

<page>
  <title></title>
  <id></id>
  <timestamp></timestamp>
  <username></username>
  <comment></comment>
  <text xml:space="preserve"></text>
</page>

 

  (二)抽取數據

  【抽取數據工具】:使用Wikipedia的extractor抽取工具。

# 克隆下載wikipedia的Extractor工具 git clone https://github.com/attardi/wikiextractor.git wikiextractor
 # 進入提取工具目錄。個人該目錄和語料文件.xml.bz2在同一個目錄下 cd wikiextractor # 提示了權限問題 記得要在前面sudo一下 python setup.py install # 注意這裏.xml.bz2文件在.py文件的上一級 須要對.xml.bz2文件的位置改動 改成相對路徑 即 ../xxxx.xml.bz2 python WikiExtractor.py -b 1024M -o ../extracted zhwiki-latest-pages-articles.xml.bz2 # 而後提取了很久 等着吧 等啊等

  

=====================

  記錄了一下時間,刷屏太快只能靠截圖手算估計。(372w-365w)/min=7w條目/min。

  不知道爲什麼其餘博主都是幾十w條的數據量,我下載的這個數據包目前還在解壓中已通過了426w條了額……

=====================

 

 

  (三)原始語料文件內容——實例

相關文章
相關標籤/搜索