Skip to main content

Japanese Wikipedia Cleaner

  • Split sentences at the proper position taking parentheses into account.
  • Normalize Unicode characters by NFKC.
  • Extract text from wiki links
  • Remove of unnecessary symbols.

Apply this tool for a extracted text by WikiExtractor.

$ jawiki-cleaner --input ./wiki.txt --output ./cleaned-wiki.txt
$ jawiki-cleaner -i ./wiki.txt -o ./cleaned-wiki.txt
$ jawiki-cleaner -i ./wiki.txt # output path will be `./cleaned-wiki.txt`

Example

Before

<doc id="5" url="?curid=5" title="アンパサンド">
アンパサンド

アンパサンド (&amp;、英語名:) とは並立助詞「…と…」を意味する記号である。ラテン語の の合字で、Trebuchet MSフォントでは、と表示され "et" の合字であることが容易にわかる。ampersa、すなわち "and per se and"、その意味は"and [the symbol which] by itself [is] and"である。
歴史.
その使用は1世紀に遡ることができ、5世紀中葉から現代に至るまでの変遷がわかる。
Z に続くラテン文字アルファベットの27字目とされた時期もある。
アンパサンドと同じ役割を果たす文字に「のet」と呼ばれる、数字の「7」に似た記号があった(, U+204A)。この記号は現在もゲール文字で使われている。
記号名の「アンパサンド」は、ラテン語まじりの英語「&amp; はそれ自身 "and" を表す」(&amp; per se and) のくずれた形である。英語以外の言語での名称は多様である。
手書き.
日常的な手書きの場合、欧米でアンパサンドは「ε」に縦線を引く単純化されたものが使われることがある。
また同様に、「t」または「+(プラス)」に輪を重ねたような、無声歯茎側面摩擦音を示す発音記号「」のようなものが使われることもある。
プログラミング言語.
プログラミング言語では、C など多数の言語で AND 演算子として用いられる。以下は C の例。
PHPでは、変数宣言記号($)の直前に記述することで、参照渡しを行うことができる。
BASIC 系列の言語では文字列の連結演算子として使用される。codice_4 は codice_5 を返す。また、主にマイクロソフト系では整数の十六進表記に codice_6 を用い、codice_7 (十進で15)のように表現する。
SGML、XML、HTMLでは、アンパサンドを使ってSGML実体を参照する。

</doc>

Run jawiki-cleaner -i wiki.txt

After

アンパサンド(&、英語名)とは並立助詞「...と...」を意味する記号である。
ラテン語の の合字で、Trebuchet MSフォントでは、と表示され "et" の合字であることが容易にわかる。
ampersa、すなわち "and per se and"、その意味は"and [the symbol which] by itself [is] and"である。
その使用は1世紀に遡ることができ、5世紀中葉から現代に至るまでの変遷がわかる。
Z に続くラテン文字アルファベットの27字目とされた時期もある。
アンパサンドと同じ役割を果たす文字に「のet」と呼ばれる、数字の「7」に似た記号があった(U-204A)。
この記号は現在もゲール文字で使われている。
記号名の「アンパサンド」は、ラテン語まじりの英語「& はそれ自身 "and" を表す」(& per se and)のくずれた形である。
英語以外の言語での名称は多様である。
日常的な手書きの場合、欧米でアンパサンドは「ε」に縦線を引く単純化されたものが使われることがある。
また同様に、「t」または「-(プラス)」に輪を重ねたような、無声歯茎側面摩擦音を示す発音記号のようなものが使われることもある。
プログラミング言語では、C など多数の言語で AND 演算子として用いられる。
PHPでは、変数宣言記号($)の直前に記述することで、参照渡しを行うことができる。
BASIC 系列の言語では文字列の連結演算子として使用される。
codice_4 は codice_5 を返す。
また、主にマイクロソフト系では整数の十六進表記に codice_6 を用い、codice_7(十進で15)のように表現する。
SGML、XML、HTMLでは、アンパサンドを使ってSGML実体を参照する。

Metadata

Release files for jawiki-cleaner 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jawiki-cleaner 0.1.5
File Size Uploaded
jawiki-cleaner-0.1.5.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jawiki-cleaner 0.1.5
File Interpreter ABI Platform
jawiki_cleaner-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / jawiki-cleaner-0.1.5.tar.gz

Download URL jawiki-cleaner-0.1.5.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd716b6330bca31555acff5c244a99e849837e14fa14353c95eed65ef098d768
BLAKE2b-256 checksum
How to use checksums
3777a6855bca45b1c53230d22a507ca1b0d6211acd25236f75dcbdf50c9cfdc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0

Release files / jawiki_cleaner-0.1.5-py3-none-any.whl

Download URL jawiki_cleaner-0.1.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc36dec465d295ba55a28b16873669dfa09b28097acc74037b9d57cffea60e18
BLAKE2b-256 checksum
How to use checksums
7b99284ce67c9272514a9031352f4601fdcd78c09706ee0cf14a448c1611ad3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page