B. DÖRNYEI

Measuring Parliamentary Discourse in Hungary, 1990–2026

A reproducible hybrid NLP pipeline that converts Hungary’s parliamentary transcripts (one PDF per sitting since 1990) into structured data on speakers, parties, attacks, interruptions and votes.

Parliament, 1990

The first freely elected parliament after 1989.

Seat distribution of the Hungarian National Assembly after each general election
1990
Antall · Boross
386 seats
Two-thirds majority
scroll
Seats after each general election · National Election Office; IPA Parline
82–91%
Hybrid accuracy vs. hand-coding
87,000
Transcript pages, 1990–2026
1,800
Plenary sessions in scope
57
Annotated political events
01

The goal is to turn Hungary’s parliamentary transcripts into reliable structured data for longitudinal and correlational political research.

Source

A detailed record

The transcripts name the speaker of every speech and record interjections such as heckles and applause. Votes are recorded with exact counts and bills are numbered.

Problem

Published as PDFs

Party labels appear once, sometimes only in the table of contents. Votes are written as Hungarian prose, and interjections are set mid-paragraph in italics. No published quantitative study covers more than a handful of sessions.

Contribution

A reusable pipeline

It runs on any set of sessions. It is validated against hand-coding, and each output row records which layer produced it. Interpreting the results is left to future work.

02

Parsing a napló

The napló’s formatting rules are not documented, so I reverse-engineered them. Capitalised names open a turn, italic parentheses mark interjections, timestamps appear every ten minutes, and votes use four stock phrasings.

  1. The documentThe napló (országgyűlési napló) is the official PDF record of each sitting. Below is a short illustrative excerpt.
  2. What is extractedSpeakers and their parties, attacks, interruptions (applause, heckles, the chair’s bell), bill numbers and votes.
  3. The outputEach extracted item becomes one data row in the numbered list beside the excerpt.
  4. The toggle“As published” shows the original text. “As parsed” highlights each extracted item and fills in the rows.
ORSZÁGGYŰLÉSI NAPLÓillustrative excerpt
(13.10)

ELNÖK: Köszönöm szépen. Megadom a szót.

KÉPVISELŐ (MSZP): Tisztelt Elnök Úr! Tisztelt Ház! Önök hazudnak az embereknek, és felelőtlenül költik a pénzüket. (Taps az ellenzéki padsorokban. – Közbekiáltás a kormánypárti padsorokból: Ez már tényleg szomorú!)

ÁLLAMTITKÁR: Tisztelt Ház! Szuper, remek munka volt, gratulálok! (Taps a kormánypártok soraiból. – Padcsapkodás.)

(Az elnök a csengő megkocogtatásával jelzi az időkeret leteltét.)

ELNÖK: Most a T/12345. számú törvényjavaslatról szavazunk. Megállapítom, hogy az Országgyűlés a törvényjavaslatot 186 igen szavazattal, ellenszavazat és tartózkodás nélkül elfogadta.

Illustrative excerpt built from the conventions and phrases documented in the paper (§3.2, §4–5). Speaker names are placeholders; this is not a real sitting.

parsed segments0 rows
  1. time13:10 timestamp, every ten minutes
  2. chairELNÖK chair turn: procedural, not scored
  3. speechMSZP → KORMÁNY tone attack · lexicon: hazudnak, felelőtlenül · direct address
  4. applauseopposition benches “Taps …” opening bigram
  5. hecklegovernment benches quoted interjection
  6. speechKORMÁNY → MSZP party from the ToC · “praise” re-read as sarcasm by the LLM
  7. applausegoverning benches
  8. benchpadcsapkodás bench-thumping
  9. bellchair’s bell time limit reached
  10. voteT/12345 · yes 186 · no 0 · abstain 0 unanimous-elision phrasing
speaker turnapplauseheckle / attackbenchbellbillvote
03

Seven-stage pipeline

Each stage is a pure function with typed inputs and outputs, and can be tested or swapped on its own. Every figure is a deterministic function of one saved dataframe, so results replicate without rerunning the slow steps.

  1. 01
    PDF extractionPyMuPDF keeps font, CAPS, bold and italic flags. Italics are how interjections are found. pdf_io.py
  2. 02
    Table-of-contents parsingSpeaker → party map taken from the document’s own ToC. pdf_io.py
  3. 03
    SegmentationSpeeches, interjections, chair turns and votes; votes split on bill references and parsed from prose. parsing.py
  4. 04
    Rule-based scoringhuBERT sentiment + hand-curated accusative lexicon + direct-address markers → attack score and target. sentiment.py · analysis.py
  5. 05
    LLM refinementGemini 2.5 Flash-Lite scores each segment a second time; a seven-case merge protocol combines the two layers. llm_scoring.py · analysis_ai.py
  6. 06
    Per-session outputsCSVs, metadata.json and ~25 figures per sitting. data/processed/sessions/
  7. 07
    Longitudinal aggregationCombines every session CSV into 7 longitudinal tables and 15 figures. longitudinal.py
python main_ai.py data/raw/nyYYMMDD.pdf
# press run to process one session
Log lines from the paper (§4); LLM step shortened
~6 minper session, end to end; limited by the free-tier LLM rate limit
$450–600estimated API cost for the full 1990–2026 corpus
0 callsto re-run unchanged text; the cache is keyed on text hash + prompt version
04

Merging rule-based and LLM scores

The rule-based layer is fast and auditable but scores sarcasm as praise. The LLM detects sarcasm but hallucinates targets and drifts between runs. The hybrid keeps rule scores for confident cases and uses the LLM to correct hard ones. A merge function with seven named outcomes decides each segment, and every row stores its merge_reason.

Rule-based layer

huBERT · lexicon · address markers

LLM layer

Gemini 2.5 Flash-Lite · JSON output

Merged result

deterministic merge function

Sentences and merge rules from the paper (§4.4–4.6); individual scores are illustrative.

Validation · 126 hand-coded segments · 9 sessions

The hybrid scored higher than both alternatives in every session.

Ranges span the nine sessions. The gap is widest where sarcasm and quoted attribution are common. Rules cannot resolve these cases, and an LLM alone scores them inconsistently.

Hybrid
82–91%
Rule-based
55–72%
LLM-only
34–50%
0255075100%
05

Results from one sitting

The charts below show attacks, praise and interruptions in a single plenary sitting.

Party-to-party sentiment

Net directed sentiment (praise − attack). Rows are the speaking party, columns the target.
−218+20
Hover a cell for its value. The largest flow is MSZP → KORMÁNY, −218.5.

Opposition vs. government

Total attack intensity between the two blocs.
Opposition → Government558.5
Government → Opposition235.9

KORMÁNY = government-affiliated parties and roles; ELLENZÉK = all opposition. Static post-2010 mapping (see limits).

Interjections

210 detected and classified after LLM refinement.

Tone of 140 speeches

Cross-bloc praise is rare.
attack 104procedural 29neutral 4praise 3

How the layers were merged

merge_reason counts, same session.
06

Nine sessions, 2014–2022

The longitudinal model was run on the first spring-term plenary of each year, giving one observation per year and controlling for session type and legislative calendar. These results illustrate what the full corpus could support. They are not yet substantive claims.

8 of 9

sessions where the opposition attacked harder than the government. February 2019 was the exception.

3.4×

LMP’s share of words spoken relative to its share of seats (3.3% of seats on average).

0.18×

Fidesz’s voice-to-seat ratio while holding 58.6% of seats; ministers and state secretaries spoke for the government.

~1.2→1.7

interjections per speech, rising from 2014 to peaks in 2016 and 2022, with a dip in 2018.

Voice ÷ seats

Share of words spoken divided by share of seats, mean across sessions. Right of the line = speaks more than its seats predict.
07

Parliaments and events, 1990–2026

The map covers ten parliaments and 57 events (elections, EU accession, the Őszöd speech, the migrant-quota referendum, COVID rule by decree). The events are stored in an editable file that the pipeline uses for before/after comparisons.

Scroll sideways, or tap to enlarge.

08

A proposed Parliamentary Climate Index

The index is a per-session score for how well parliament is functioning. It averages four components, each rescaled to [0, 1] across sessions. It is a prototype and has not been validated.

Cooperation

praise_x / (praise_x + attack_x)

Share of cross-bloc sentiment that is praise.

Consensus

mean |yes − no| / total

How lopsided the session’s recorded votes were.

Peace

1 / hostility

Inverse of mean cross-bloc attack intensity.

Order

1 / interjection rate

Inverse of interjections per speech.

09

Limitations and future work

Limitations

  • Transcription bias. The secretaries who write the napló are often MPs with party ties; selective transcription would carry into interjection rates.
  • Static bloc mapping. Government = Fidesz–KDNP holds after 2010 but not for the Antall or Horn eras; a date-indexed table is needed before pre-2010 claims.
  • Sarcasm. The pipeline catches roughly 60–70% of what a human reader flags; misses inflate the cooperation component.
  • Targets and procedure. Implicit or multi-party attacks resolve imperfectly; procedurally dressed attacks are zeroed.
  • Hungarian morphology. Case endings (Fidesz, Fideszt, Fidesznek, Fidesszel) and free compounding strain any lexicon.
  • Validation. One annotator, 126 segments. Indicative only; there is no formal inter-rater study.

Future work

  • Process the full corpus. ~1,800 sessions and 87,000 pages, released as a public research dataset.
  • Expand validation. Multiple fluent coders, inter-rater reliability, a sample stratified by year, party and session type.
  • Date-indexed blocs. A (start, end, governing parties) table so 1990–2010 can be read correctly.
  • Event windows. ±3-month comparisons around the 57 annotated events.
  • Controls and topics. PPP-adjusted GDP per capita and institutional indicators; topic models to split health, economy, foreign policy.
  • Refine the PCI. Test alternative weights against external expert assessments of parliamentary functioning.
10

Where this started

Hungary’s electoral incentives

An earlier, unfinished project asked how parties’ incentive strategies and changes to the electoral rules shaped party competition and voter behavior in Hungary from 1989 to 2025. I presented it as a work in progress at the Jackson School’s Academic Workshop Series.

Part of it was a first pass over about 56,000 pages of plenary transcripts with Python and an LLM API. That experiment became the pipeline on this page.

What it drew on

  • Archives. Library of the Hungarian Parliament, Hungarian National Archives, Central Statistical Office (KSH), Metropolitan Ervin Szabó Library.
  • Election data. Returns from the National Election Office, with KSH sociodemographics.
  • Party positions. Chapel Hill Expert Survey (1999–2019) and V-Party (2020–2025).
  • Literature. 61 scholarly papers, 32 reports and 5 datasets.
11

Paper, poster and citation

Cite
Dörnyei, Bendegúz Barna. 2026. “Measuring Parliamentary Discourse in Hungary, 1990–2026: A Reproducible Pipeline for Extracting Structured Discourse Data from Hungarian Parliamentary Transcripts.” Senior project, Department of Statistics & Data Science, Yale University. Advisor: Jonathan Reuning-Scherer.
PythonPyMuPDFhuBERT · NYTK sentiment-hts5huSpaCy hu_core_news_lgGemini 2.5 Flash-Litepandasmatplotlib

Sources: Hungaricana digital library (1990–2022), parlament.hu (2022–2026), Hungarian National Archives and IPA Parline for seats.

© 2026 Bendegúz Dörnyei← Home