Name matching algorithm for linking legislative candidates across elections in sub-Saharan Africa
# Name Matching Algorithm for African Legislative Elections
A component-aware fuzzy name matching algorithm designed for linking candidates across elections in sub-Saharan Africa. Developed for use with the Constituency-Level Elections Archive (CLEA).
## Overview
Tracking individual candidates across elections is essential for studying incumbency effects, political careers, and electoral competition. However, electoral datasets for sub-Saharan Africa typically lack unique candidate identifiers. The same individual may appear with different name spellings, orderings, or transliterations across elections.
This algorithm addresses this challenge through:
- **Component-aware matching**: Separately identifies and scores surname vs. given name components, rather than treating the full name as a single string
- **Frequency-based surname detection**: Identifies surnames by within-country frequency rather than assuming a fixed name order, accommodating diverse naming conventions across Africa
- **Country-specific common surname handling**: Applies stricter matching thresholds when candidates share high-frequency surnames (e.g., Banda in Malawi, Ochieng in Kenya)
- **Consecutive election matching**: Compares candidates only across adjacent election years, reducing false positives from compounding name variation
- **Confidence-tiered output**: Classifies matches as high-confidence (auto-accept), medium-confidence (manual review), or low-confidence (auto-reject)
- **Transitive grouping**: Uses Union-Find to assign consistent candidate IDs across multiple elections
## Algorithm
1. **Surname identification** — For each candidate, the most frequent name component in the country-year is identified as the likely surname
2. **Component-level scoring** — Jaro-Winkler similarity is computed separately for surnames (weight: 0.6) and given names (weight: 0.4), with a district-match bonus
3. **Confidence classification** — Pairs are classified as high (auto-accept), medium (manual …