Skip to main content

# 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.

Release files for drafttopic 0.4.1

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

Source distribution (sdist)

Source distribution for drafttopic 0.4.1
File Size Uploaded
drafttopic-0.4.1.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drafttopic 0.4.1
File Interpreter ABI Platform
drafttopic-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / drafttopic-0.4.1.tar.gz

Download URL drafttopic-0.4.1.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f85d58d1cf4d3e0eab78c7adef623924c461647c9b504a9c41935367a875a412
BLAKE2b-256 checksum
How to use checksums
3708d01d5c452367974ef72232fbb92c8d8c5034fb568e18845857a685bde03b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / drafttopic-0.4.1-py3-none-any.whl

Download URL drafttopic-0.4.1-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78e0f65188e41232f2ac5c3970848e44739a1bf3c9217187f144a1b767af217f
BLAKE2b-256 checksum
How to use checksums
6edde4f986bdd5ee5c2ac8c4969bb31e9faceca20ee14ada8115cd6884b1fbbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

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