Giter Club home page Giter Club logo

wiki-wordlists's Introduction

wiki-wordlists

Generates Unicode word frequency lists from Wikipedia pages in any language.

If you've ever wanted a word frequency list for a given language or subject—whether to start learning a new language, or just out of curiosity—you can finally do so. wiki-wordlists lets you extract a list of the top words used in any wiki that allows exporting pages as xml (Wikipedia, for example).

This allows you to create a word frequency list of the top 1000 words used across the entire English Wikipedia, for example, or the top 300 in the category Mathematics. If you were learning Swedish, you could get the 1000 most used words to start a vocabulary deck (the first 1000 words account for 75–80% of all usage).

Usage

python wiki-wordlists.py <input file> [number of words]

The input file should be an xml dump of the set of Wikipedia pages you would like to process. This could be one or more specific pages or categories downloaded from Wikipedia's Export page, or the equivalent page in a different language. Alternatively, you could download the xml dump of all the pages in Wikipedia in a certain language, available as zipped files here.

Warning: The zipped xml dumps of entire Wikipedias are very large!

An example of using wiki-wordlists on the entire English Wikipedia would look like this (if you downloaded the 65gb file!):

 bzip2 -d wikidatawiki-20190620-pages-articles-multistream.xml.bz2
 python wiki-wordlists.py wikidatawiki-20190620-pages-articles-multistream.xml 1000

Do note that the program has never been tested on files that large!

wiki-wordlists's People

Contributors

numeri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

mejans

wiki-wordlists's Issues

Does not work on large .xml files

It crashes with memory errors on files that are too large. I'll have to switch to reading the .xml files from "all at once" mode to serially.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.