Skip to content

MediaWiki API Project: Gendered/Respectful Language Drift (think pronouns) #234

Open

Description

@chinaexpert1

Overview

Track gendered/respectful language drift on Wikipedia by measuring how usage of a curated term list (deprecated → preferred) changes over time on policy-relevant pages. Deliver a reproducible dataset, statistical deltas, and a small dashboard highlighting rise/fall, first-adoption dates, and context snippets.

Action Items

If this is the beginning (research & design)

  • Define scope: English Wikipedia, Namespace 0; 100–300 pages across immigration, policing, elections, public health, and human rights (seed_pages.csv with title,pageid,qid).
  • Build terms.csv: columns deprecated,preferred,aliases,regex,notes (e.g., whitelist→allowlist, master/slave→primary/replica, illegal immigrant→undocumented immigrant). Include canonicalization rules (hyphen/space variants).
  • Choose windows: monthly sampling from 2016 → present (adjustable).
  • Metrics: term frequency per page/month, log-odds (with informative Dirichlet prior) past vs recent, first-seen date for preferred terms, disappearance of deprecated terms, context windows (±25 tokens).
  • Tooling (pick one per pair): requests or httpx; pandas or polars; mwparserfromhell or wikitextparser; storage duckdb or sqlite; viz altair or plotly.

If researched and ready (implementation steps)

  1. Seed & resolve

    • Resolve pageid via action=query&titles=<title>; store redirects.
  2. Revision sampling

    • For each page/month, fetch the oldest revision in the month (creation if earlier) and the latest revision (prop=revisions&rvprop=ids|timestamp&rvlimit=max to list; then pull rvslots=main&rvprop=content for targeted revids).
  3. Text extraction & normalization

    • Convert wikitext → plain text; drop templates, infoboxes, references, code/pre blocks, and quotes where feasible; lowercase + Unicode normalize; apply alias/regex normalization from terms.csv.
  4. Counting & context

    • Count deprecated/preferred terms; capture context windows (±25 tokens) for QA; flag code/citation hits for exclusion.
  5. Analysis

    • Compute per-term Δfrequency, Δshare (preferred / (preferred+deprecated)), and log-odds change between early (e.g., 2016–2018) and recent (last 12 months). Identify newly adopted (now>0, then=0) and disappeared (then>0, now=0) terms.
  6. Deliver

    • Artifacts: page_month_samples.parquet, term_counts.parquet, term_context.parquet, metrics.csv.
    • Dashboard: rising/falling terms, adoption timelines, page-level diff view with context snippets.
    • Methods README (API params, sampling rationale, exclusions, limitations).
  7. Quality & Ops

    • Caching + retries with exponential backoff; honor maxlag; persist continue tokens.
    • Tests: regex correctness, sampler month coverage, exclusion filters, deterministic counts on a fixed snapshot.
    • Optional monthly refresh via GitHub Actions.

Resources/Instructions

API docs to pin in repo

MediaWiki Action API: https://www.mediawiki.org/wiki/API:Action_API
Query & continuation: https://www.mediawiki.org/wiki/API:Query
Revisions (timestamps, content): https://www.mediawiki.org/wiki/API:Revisions
Pages → pageids: https://www.mediawiki.org/wiki/API:Query#By_page_title

Suggested libraries (choose pairs)

  • HTTP: requests | httpx
  • DataFrames: pandas | polars
  • Parsing: mwparserfromhell | wikitextparser
  • Storage: duckdb | sqlite
  • Viz: altair | plotly

Sample queries to copy into notes

# Resolve pageids from titles
action=query&titles=<TITLE>

# List revisions to find oldest/newest in a month (use continuation)
action=query&prop=revisions&rvprop=ids|timestamp&rvlimit=max&titles=<TITLE>

# Fetch content for a specific revision id
action=query&prop=revisions&revids=<REVID>&rvslots=main&rvprop=content

Data handling & ethics

  • Report aggregates; avoid editor-level profiling.

  • Exclude quotes, code, and citation/reference sections to reduce false positives.

  • Terms can be context-sensitive; keep a manual review sheet for ambiguous hits.

  • Error handling: wrap I/O in try/except with clear print() messages for file-not-found; terminate with a trace on dtype mismatches; log warnings for recoverable issues.

  • If this issue requires access to 311 data, please answer the following questions:

    • Not applicable.
    • N/A
    • N/A
    • N/A

Project Outline (detailed plan for this idea) in details:

Details

Research question
Are deprecated phrasings declining and preferred, respectful alternatives rising on sensitive Wikipedia pages, and when did adoption inflect?

Data sources & modules

  • prop=revisions for listing revisions and fetching monthly oldest/newest content.
  • action=query for title→pageid resolution.

Method

  1. Curate terms.csv with deprecated→preferred mappings and regex/alias variants; add ignore rules (citations, code, quotes).
  2. Monthly sample each page: pull oldest and newest revisions; extract and normalize text; count term occurrences and capture contexts.
  3. Aggregate per term and per page: frequency, share, log-odds change, first/last seen dates; compute adoption timelines.
  4. Visualize rise/fall and adoption curves; surface pages with largest improvements or regressions.

Key metrics

  • Δfrequency and Δshare preferred vs deprecated.
  • Log-odds change (past vs recent).
  • Time-to-adoption for preferred term; disappearance rate for deprecated term.
  • Pages with largest positive/negative shifts.

Deliverables

  • Clean tables (term_counts.parquet, term_context.parquet, term_metrics.parquet).
  • Reproducible notebook + reports/language_drift.md.
  • Streamlit/Altair dashboard (rising/falling, timelines, per-page diff with snippets).

Caveats & limitations

  • Sampling misses intra-month churn; choose monthly/quarterly depending on load.
  • Some terms have legitimate historical usage in quotes—exclusion rules mitigate but won’t be perfect.
  • Wikitext parsing can miss template-embedded text; document residual noise.

Implementation notes

  • Keys: (pageid, revid) for text pulls; (pageid, month) for samples.
  • Store a query manifest (params + timestamps + continuation cursors).
  • Provide a reviewer checklist to confirm mappings and spot-check context windows.

Activity

  1. self-assigned this
    on Sep 22, 2026
  2. chinaexpert1 commented on Sep 22, 2026

    @chinaexpert1
    MemberAuthor
    Instructions
    1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
    2. Blockers: "Difficulties or errors encountered."
    3. Availability: "How much time will you have this week to work on this issue?"
    4. ETA: "When do you expect this issue to be completed?"
    5. Pictures (if necessary): "Add any pictures that will help illustrate what you are working on."
    1. Progress:
    2. Blockers:
    3. Availability:
    4. ETA:
    5. Pictures (if necessary):
  3. aklu00 commented on Sep 28, 2026

    @aklu00
    Member

    Progress:

    • Research and design phase started.
    • Gathered 5 articles to test with Python script
    • Created terms table
    • Need to create Python script and test data retrieval from the 5 test articles.

    Blockers:

    • Unfamiliar with writing Python code to retrieve information from online sources and will need to learn to create test script.

    Availability:

    • 5 hours

    ETA:

    • 1 week to complete research and design phase
    • a few months out for all phases of issue to be complete

    Pictures (if necessary):
    Image

    Image
  4. moved this from New Issue Approval to Prioritized Backlog in CoP: Data Science: Project Boardon Oct 20, 2026
  5. self-assigned this
    on Oct 20, 2026
  6. chinaexpert1 commented on Oct 20, 2026

    @chinaexpert1
    MemberAuthor
    Instructions
    1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
    2. Blockers: "Difficulties or errors encountered."
    3. Availability: "How much time will you have this week to work on this issue?"
    4. ETA: "When do you expect this issue to be completed?"
    5. Pictures (if necessary): "Add any pictures that will help illustrate what you are working on."
    1. Progress:
    2. Blockers:
    3. Availability:
    4. ETA:
    5. Pictures (if necessary):
  7. Priyankahoude commented on Oct 23, 2026

    @Priyankahoude

    Hi, i am interested in contributing to this project and i have experience in python, pandas and data analysis. Is this issue still open for contributions and is there any specific part you'd recommend starting with?

  8. aaronliang1 commented on Oct 27, 2026

    @aaronliang1
    Member
    Instructions
    1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
    2. Blockers: "Difficulties or errors encountered."
    3. Availability: "How much time will you have this week to work on this issue?"
    4. ETA: "When do you expect this issue to be completed?"
    5. Pictures (if necessary): "Add any pictures that will help illustrate what you are working on."
    1. Progress: Completed Python script to pull yearly revision history for now, still working on text normalization. Tested on a few sample articles using sample terms.
    2. Blockers: Was wondering if the previous volunteer's term sheet was available, otherwise I'm aiming to create that next to begin performing EDA.
    3. Availability: Roughly estimate at least 5 hours of availability this coming week.
    4. ETA: Planning to have term counts for the sample articles with the full terms list by next week and can hopefully provide an estimate for the overall project then.
    5. Pictures (if necessary):
    Image
  9. aklu00 commented on Oct 27, 2026

    @aklu00
    Member

    Hi Aaron, I was the previous volunteer. The term sheet is attached. Let me know if you have any issues opening it and I will find another way to send it.

    terms.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions