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.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distributions

wikiext-0.0.2-py3.7.egg (11.9 kB view details)

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wikiext-0.0.2.tar.gz
  • Upload date:
  • Size: 6.2 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.2.tar.gz
Algorithm Hash digest
SHA256 ad86d5dad61ed2ed5dd9cb3e2932ca4e51249d24aef196b4b833ae3762535da9
MD5 7c3c4045002d0d031d571522a8e6613e
BLAKE2b-256 c247dbbddcd76869d843e9daf4ab54bed1acbd1a45643f6b11c00b2a100f7994

See more details on using hashes here.

File details

Details for the file wikiext-0.0.2-py3.7.egg.

File metadata

  • Download URL: wikiext-0.0.2-py3.7.egg
  • Upload date:
  • Size: 11.9 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.2-py3.7.egg
Algorithm Hash digest
SHA256 75fce627b23c2e0c9099ea257a5f9db06645057a06db74e210ec2fb8c423f339
MD5 63c92c59e46fe48b48bcd6d4f6129e03
BLAKE2b-256 08de69d643a2a04cecc75727240f189b2ea9b3a32bebb1952095e196d49e97f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wikiext-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 794cfdd5e097908cc783ec8a70929c2951eab6e8357d8005b930830c3783e01f
MD5 07e3aa11b2fbb274560ade289c32802a
BLAKE2b-256 84d969b31258943a1ec1f4a439ca4c1b522541a09e6535a1b9a870e1b49f07fc

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