Skip to main content

Wiki Extractor

Project description

📂 WikiExtractor 💡

Dumping hole wiki content,which can :

  • clean unused symbol,mark,label
  • extract knowledge - synonym,concept,relationship

這是一個wiki的預處理工具,可以:

  • 清理wiki中沒有用的内容:標簽,符號...
  • 提取出一些有用的知識:同義詞,關係,翻譯

Usage

How to use:

pip install wikiext
wikiext -h
usage: wikiext [-h] [--lang LANG]
               [--dump {redirect_pair,langlink,category,articles,all} [{redirect_pair,langlink,category,articles,all} ...]]
               [--savedir SAVEDIR] [--type {csv,dict}] [--s2t]

optional arguments:
  -h, --help            show this help message and exit
  --lang LANG           default:zhwiki, from
                        https://dumps.wikimedia.org/backup-index-bydb.html
  --dump {redirect_pair,langlink,category,articles,all} [{redirect_pair,langlink,category,articles,all} ...]
                        select what to extract
  --savedir SAVEDIR     save dir, default /dump_result
  --type {csv,dict}
  --s2t                 simplify chinese to traditional chinese

Function

init

from wiki import *
wiki = WikiDump(language_source="zh_yuewiki", c2t=False)

Arguments

dump_articles(outfile, type="csv")

Arguments

  • outfile(String) : name of output file
  • type(String) : csv or text Result
csv : 
數學,"歐幾裏得,西元前三世紀的古希臘數學家,現在被認為是幾何之父,此畫為拉斐爾的作品《雅典學院》。
數學是利用符號語言研究數量、結構、變化以及空間等概念的一門學科,從某種角度看屬於形式科學的一種。數學透過抽象化和邏輯推理的使用,由計數、計算、量度和對物體形狀及運動的觀察而產生。數學家們拓展這些概念,為了公式化新的猜想以及從選定的公理及定義中建立起嚴謹推導出的定理。
......
text :
數學
歐幾裏得,西元前三世紀的古希臘數學家,現在被認為是幾何之父,此畫為拉斐爾的作品《雅典學院》。
數學是利用符號語言研究數量、結構、變化以及空間等概念的一門學科,從某種角度看屬於形式科學的一種。數學透過抽象化和邏輯推理的使用,由計數、計算、量度和對物體形狀及運動的觀察而產生。數學家們拓展這些概念,為了公式化新的猜想以及從選定的公理及定義中建立起嚴謹推導出的定理。

dump_redirect_pair(outfile, type)

get all redirect pair Arguments

  • outfile(String) : name of output file
  • type(String) : csv or dict Result
csv:
origin.redirect to
鋼の錬金術師,鋼之鍊金術師
香港仔海旁道,香港仔海傍道
飛機外部燈光,航行燈
螢幕八爪娛,熒幕八爪娛
司农卿,大司農
大司农卿,大司農
司農,大司農
司农,大司農
Earth 2160,地球2160
图勒凯尔姆,图勒凯尔姆省
盖勒吉利耶,盖勒吉利耶省
......
dict
鋼の錬金術師
鋼之鍊金術師
香港仔海旁道
香港仔海傍道
飛機外部燈光
航行燈
螢幕八爪娛
熒幕八爪娛
司农卿
大司農
大司农卿
大司農
司農
大司農
司农
大司農
Earth 2160
地球2160
图勒凯尔姆
图勒凯尔姆省
盖勒吉利耶
盖勒吉利耶省

dump_langlink(outfile, type):

Arguments

  • outfile(String) : name of output file
  • type(String) : csv or dict

dump_category(outfile, type="csv"):

use this to extract specific categories noun Arguments

  • outfile(String) : name of output file
  • type(String) : csv or dict

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

wikiext-0.0.4.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

wikiext-0.0.4-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file wikiext-0.0.4.tar.gz.

File metadata

  • Download URL: wikiext-0.0.4.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for wikiext-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5731bb358691400055b7dff192f32a021866ddc7e9d44b2c4ce0325fb310fb35
MD5 ecbee7e98c29c76a4183f989950a964e
BLAKE2b-256 de4c23dacaf40b6c7e5d5c70d60d2bb1d3b2186045be6f793e3afa51aa623ef3

See more details on using hashes here.

File details

Details for the file wikiext-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: wikiext-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.4

File hashes

Hashes for wikiext-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 caece95e020db4c9ec835378e57fe62b861713d960b2fe799da6fb204536a5fa
MD5 fa4f88a48a372fb1fc806902d77d1b85
BLAKE2b-256 860962ab4cbf03bc12b3c59747c0e66cb1be053c628230a1b11fc3e45e364bf7

See more details on using hashes here.

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