A library for automatic detection of topics of new drafts on Wikipedia based on WikiProjects.
Project description
# Draft topic
Predicting topics to new drafts based on Wikiprojects on English Wikipedia.
## Setting up
Make sure to have a working python3 environment. Install requirements using:
` pip install -r requirements `
Install the library using:
` python setup.py install `
## Generating machine-readable WikiProjects data
Use the following utility from root directory to generate machine-readable WikiProjects data:
` ./utility fetch_wikiprojects --output <output_file_name.json> `
## Generating mid-level category to WikiProjects mapping
Use the following utility from root directory to generate a mapping of high-level topic categories to list of WikiProjects contained in them:
` ./utility trim_wikiprojects --wikiprojects wp --output outmid `
## Labeling a list of page-ids with the wikiprojects and mid-level categories each page belongs to
Use the following utility from root directory to label a list of page-ids with the wikiprojects and the mid-level categories the page belongs to.
` ./utility fetch_page_wikiprojects --api-host=https://en.wikipedia.org/ --input=wikiproject_page_ids.json --output=enwiki.labeled_wikiprojects.json --mid_level_wp=outmid.json --verbose `
In above, the input to the script should be a json containing a list of observations, each observation having a page_id: <page-id> mapping. Additionally also pass the mid-level wikiprojects json for the script to generate wikiprojects to mid-level categories mapping. The script augments the given list with the mentioned fields, writing them to a new file specified by “output”
## Generating predictions for a set of page-ids on Wikipedia
For generating topic predictions for a set of revision-ids, download the relevant model and use revscoring’s [score](https://github.com/wikimedia/revscoring/blob/master/revscoring/utilities/score.py) API to generate predictions. Note that the revision-ids need to be in a file with a format specified by the API. Use the revision ID of the most recent revision for a page to get a good prediction.
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
Built Distribution
File details
Details for the file drafttopic-0.4.0.tar.gz
.
File metadata
- Download URL: drafttopic-0.4.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78fb0afc8f0204f463184d4a3a386b3ef6b9895ca1ef76f89c6f489653c04cee |
|
MD5 | 368fffa2ba2c95bb713ce7cfc30828f6 |
|
BLAKE2b-256 | e5aa85ec87180fba04784349eb3543b2610c7903445d5b306f1b4f99ccdc86df |
File details
Details for the file drafttopic-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: drafttopic-0.4.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab7c037d2a9b43130935c27affcbbf8592ca3eccd06417e102c438c9b7aa252 |
|
MD5 | e5fb0cb9d4739e2763a46105a6603d85 |
|
BLAKE2b-256 | 2cadc360a7e357dd42010bfbdc4de8485f0d8f33205add016c153b95443647f7 |