A tool for extracting plain text from Wikipedia dumps
Go to file
Giuseppe Attardi b36dcfc56a New options.
2015-04-12 11:05:52 +02:00
ChangeLog Enabled multithread version. 2015-04-12 10:21:35 +02:00
extractPage.py Initial commit. 2015-03-22 13:45:17 +01:00
LICENSE Initial commit 2015-03-22 13:03:01 +01:00
README.md New options. 2015-04-12 11:05:52 +02:00
WikiExtractor.py Enabled multithread version. 2015-04-12 10:21:35 +02:00

wikiextractor

WikiExtractor.py is a Python script that extracts and cleans text from a Wikipedia database dump.

The tool is written in Python and requires no additional library.

For further information, see the project Home Page or the Wiki.

The current beta version of WikiExtrctor.py is capable of performing template expansion to some extent.

Usage

The script is invoked with a Wikipedia dump file as an argument. The output is stored in a number of files of similar size in a chosen directory. Each file will contains several documents in this document format.

This is a beta version that performs template expansion by preprocesssng the whole dump and extracting template definitions.

Usage:
 WikiExtractor.py [options] xml-dump-file
  
optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output directory
  -b n[KM], --bytes n[KM]
                    put specified bytes per output file (default is 1M)
  -B BASE, --base BASE  base URL for the Wikipedia pages
  -c, --compress        compress output files using bzip
  -l, --links           preserve links
  -ns ns1,ns2, --namespaces ns1,ns2
                        accepted namespaces
  -q, --quiet           suppress reporting progress info
  --debug               print debug info
  -s, --sections        preserve sections
  -a, --article         analyze a file containing a single article
  --templates TEMPLATES
                        use or create file containing templates
  --no-templates        Do not expand templates
  --threads THREADS     Number of threads to use (default 8)
  -v, --version         print program version

Saving templates to a file will speed up performing extraction the next time, assuming template definitions have not changed.