Skip to content
Luz y TaquígrafosThe Diarios de Sesiones of the Congress of Deputies, 1931–1945

Method

How was it made, and where can it go wrong?

This page does not walk through the process stage by stage. It answers what a reviewer would ask, and each section ends in something you can check.

It starts from one particular row: Clara Campoamor's on 1 October 1931, the day women's suffrage was voted.

How to load the deposited CSV: the lines of code assume it is loaded as d
import pandas as pd
d = pd.read_csv("2REP_Diaries.csv", sep=";", dtype={"rep_id": "Int64"})

What is a row?

A row is what the Diario prints between one speaker heading that the tagging recognises and the next.

The heading is the one that opens each turn on paper: «El Sr. PRESIDENTE:», «La Srta. CAMPOAMOR:». What follows, up to the next heading the tagging recognises, is the text of a row.

The two rows in the figure are consecutive in the session of 1 October 1931. In the first, the Chair says seven words: «Ruego a la Cámara que guarde silencio.» (‘I ask the Chamber to keep silent.’)

In the second, Clara Campoamor says 1,460. It begins: «Yo ruego a la Cámara que me escuche en silencio» (‘I ask the Chamber to hear me in silence’). Counting rows is not counting speech.

The text is neither summarised nor lemmatised. The order is kept, and the order is information: first the Chair asks for silence, then Campoamor asks for it for herself.

Each row has fourteen columns. They give the session and the row's place in it, the printed heading and the text. If the speaker was identified, they add the deputy, party and district.

Anatomy of a row

What does each row of the CSV hold?

Two consecutive rows of the session of 1 October 1931, with their 14 columns, as they stand in the deposited CSV.

The session and the row's place

id54235424
num_session4848
order2526
date1931-10-011931-10-01
legislature1931-19331931-1933

What was printed

speakerEl Sr. PRESIDENTE:La Srta. CAMPOAMOR:
speechRuego a la Cámara que guarde silencio.Yo ruego a la Cámara que me escuche en silencio; no es con agresiones y no es con ironias como vais a vencer mi fortaleza; la única cosa que yo tengo aquí ante vosotros, Sres. Diputados, que merezca la consideración y acaso la emulación es precisamente el defender un derecho a que me obliga mi naturaleza y mi fe, con tesón y […]The text continues; only its beginning is shown here.
nwords71460

The deputy, if identified

rep_id133175
rep_nameJulian Besteiro FernandezClara Campoamor Y Rodriguez
districtMadridMadrid
partyPSOEPRR
party_familySocialistaRepublicanos
ideologyIC

See what each column holds

Anatomy of a row
ColumnEl Sr. PRESIDENTE 5423La Srta. CAMPOAMOR 5424What it says
id54235424The row number, from one to 107,551, with no gaps. It follows reading order: date, session and place in the session.
num_session4848The number of the session within its legislature, as the Diario prints it. It starts again in each legislature: a session is identified by its date and number together.
order2526The place of the row in its session, counted from zero.
date1931-10-011931-10-01The date of the session, in YYYY-MM-DD format. Some days had two sessions.
legislature1931-19331931-1933Legislature: 1931-1933, 1933-1935 or 1936-1939. The third includes the wartime sessions and those in Mexico.
speakerEl Sr. PRESIDENTE:La Srta. CAMPOAMOR:The printed speaker heading, as optical character recognition read it: «El Sr. PRESIDENTE:», «La Srta. CAMPOAMOR:». It is the only column that gives the office.
speechRuego a la Cámara que guarde silencio.Yo ruego a la Cámara que me escuche en silencio; no es con agresiones y no es con ironias como vais a vencer mi fortaleza; la única cosa que yo tengo aquí ante vosotros, Sres. Diputados, que merezca la consideración y acaso la emulación es precisamente el defender un derecho a que me obliga mi naturaleza y mi fe, con tesón y […]The text of the row, neither summarised nor corrected by hand, with the shorthand writer's bracketed notes.
nwords71460The words in the text, split on the space character.
rep_id133175The deputy, according to the project's table of deputies. It is a person, not a seat; in the Chair's rows, the deputy who was presiding.
rep_nameJulian Besteiro FernandezClara Campoamor Y RodriguezThe deputy's full name, without accents and with each word capitalised.
districtMadridMadridThe constituency for which the deputy was elected.
partyPSOEPRRThe initials of the deputy's party in that legislature.
party_familySocialistaRepublicanosThe deputy's party family.
ideologyICThe position of the deputy's party, from EI, far left, to ED, far right.

The same data as the chart, in rows.

Download the figure data

CSV and Excel, with a README in Spanish and in English.

No form: these are aggregate data.

Source
Luz y Taquígrafos
Checksum: 360332a0ff13
Numbers exported on
How to cite
Rodrigues-Silveira, Rodrigo; García-Díez, Fátima; Llamazares, Iván; Martínez-Barahona, Elena; Barreto Martín, Eduardo. ‘Anatomy of a row’. Figure from Luz y Taquígrafos. https://luz.parlaibero.es/en/metodo/#fila. Source: Luz y Taquígrafos · 360332a0ff13. Exported on .

Before you read it Campoamor's ideology is C because it is that of her party, the Radical Party.

Try it

In the explorer

Query for the explorer's search box"me escuche en silencio"

Open the explorer Select the query and copy it.

The explorer cannot open a search from a link: copy the query and paste it into its search box (/ key).

Search for the phrase in quotation marks and open the result. The reader numbers it «Orden 30 de 415»: it is the same row, counted in the explorer. Open the explorer 

In Python, on the deposited CSV

d[d.id.isin([5423, 5424])].T

Back to contents

How does the printed Diario become a row?

In five steps, each with its number. None of them corrects the text by hand.

The source. There are 755 issues of the Diario de Sesiones of the Congress, scanned to PDF from its historical archive. They add up to 28,780 pages, according to the count of the project's files.

The reading. Each page was turned into an image and read by an optical character recognition model, GLM-OCR. What failed, and how it was recovered, is set out below.

The cleaning. A program removed from each page the running header, with its folio and date, and the folio at the foot. It then rejoined words hyphenated at the end of a line.

It also joined the short lines of the Diario's columns into paragraphs. None of these steps corrects reading errors.

The turns. A regular expression looks for the printed speaker heading: «El Sr.», «La Sra.», «La Srta.», «Los Sres.». It also accepts misread variants, such as «Ei Sr.» or «E1 Sr.».

Each heading must contain at least one word of three capital letters. That filter discarded 1,532 false positives.

That left 107,556 speaker tags. The CSV has 107,551 rows; the difference of five is not documented.

The linking. Each heading was linked to a deputy, with party, district and ideology. This is set out in ‘Who speaks’ and in ‘Party, family and ideology’.

From the Diario to the row, in five steps

How do 755 issues of the Diario become 107,551 rows?

  1. The issues of the Diario755 issues, one per session

    Scanned to PDF from the historical archive of the Congress. They are the sessions of the three legislatures and those of Mexico, in 1945.

    Documentation

  2. The pages, read28,780 pages

    Count from the project's files, not deposited. In the first pass 153 failed; all were recovered later.

    Optical character recognition

  3. The speaker headings107,556 tags

    After discarding 1,532 false positives with the capital-letter filter. Number from the deposited README.

    What a row is

  4. The rows107,551 rows

    The deposited CSV. The difference of five from the tags is not documented.

    Optical character recognition

  5. The speaker, identified107,404 rows with a deputy

    After reviewing all rows by hand and correcting 367 assignments.

    Who speaks

pasos.csv

Before you read it The difference of five between tags and rows is not documented. The pages are not deposited.

Try it

In the explorer

Open any intervention. Under the deputy's name, «Consta en el diario como» (recorded in the Diario as) gives the printed heading that opened the row. Open the explorer 

In Python, on the deposited CSV

d.speaker.value_counts().head(10)   # the most frequent printed headings

The pages and the reading failures come from the project's working files, which are not deposited.

Back to contents

What went wrong in optical character recognition?

No page was left without text, but not all of them came out at the first attempt.

Each page was read by GLM-OCR, a vision model that the project ran on its own machines. While the model was writing, a watchdog checked whether it had fallen into a loop, repeating the same text.

If it had, the page was run again with more variation. This happened on 276 pages.

In the first pass, 153 pages failed. They were spread across 131 sessions.

GLM-OCR recovered 29 on retrying them. The remaining 124 were read with Tesseract, a classic recognition program, with its models for modern and historical Spanish.

Those Tesseract pages are in 106 sessions. None of them went through any automatic correction afterwards.

The text comes from optical character recognition and has not been corrected by hand.

Reading errors are in the text and also in the speaker headings, which are what tell us who is speaking. Try correcting a few yourself.

Proofread the Diario

This is how the machine read a speaker heading. Correct it: every reading is in the dataset, exactly as shown.

Some of the machine's readings, as they stand in the dataset
The machine readIt should sayRows
El Sr PRESIDENTE:El Sr. PRESIDENTE:1
El Sr, PRESIDENTE:El Sr. PRESIDENTE:13
Ei Sr. PRESIDENTE:El Sr. PRESIDENTE:1
El Sr. PERSIDENTE:El Sr. PRESIDENTE:6
El Sr. PRESIDENT7E:El Sr. PRESIDENTE:1
La Sr. PRESIDENTE:El Sr. PRESIDENTE:1
El Sr. RESIDENTE:El Sr. PRESIDENTE:1
La Srta. COMPOAMOR:La Srta. CAMPOAMOR:1
El Sr. QL ROBLES:El Sr. GIL ROBLES:1
El señor PRESIDENTE:not an error141

The Chair's heading alone is written in 32 different ways in the dataset, and there are 2,460 distinct speaker headings.

That is why the text is not corrected by hand. The tagging accepts the reading variants, and the link between each heading and its deputy was checked row by row.

The project's session metadata declare two incidents. Both can be seen in the corpus:

  • Session 9, of 27 July 1931, ends in a loop: it repeats «Sánchez Guerra, Ossorio y Gallardo» six times.
  • Session 48, of 1 October 1931, lost its end. Its last five rows repeat «Pido la palabra», and the last one breaks off at «El Sr. Ministro de».

Session 48 as it stands in the corpus: the end of the digitised minutes was lost in optical character recognition.

The last five rows of session 48, as they stand in the dataset
  1. El Sr. Ministro de la GOBERNACION (Maura): Pido la palabra.
  2. El Sr. Ministro de la GOBERNACION (Maura): Pido la palabra.
  3. El Sr. Ministro de la GOBERNACION (Maura): Pido la palabra.
  4. El Sr. Ministro de la GOBERNACION (Maura): Pido la palabra.
  5. El Sr. Ministro de la GOBERNACION (Maura): Pido la palabra. El Sr. Ministro de

Try it

In the explorer

Open the running session of any intervention of 1 October 1931 and scroll to the end. Orders 411 to 415 repeat the same request. Open the explorer 

In Python, on the deposited CSV

s48 = d[(d.date == "1931-10-01") & (d.num_session == 48)]
s48.tail(5)[["id", "speaker", "speech"]]

These numbers come from the project's working files, which are not deposited. The incidents are recorded in its session metadata.

Back to contents

Who speaks?

The Diario prints the speaker's surname, almost never the first name or party. Linking each heading to a person is the most delicate step.

The difficulty can be measured in the project's table of deputies: 317 of those who speak share their first surname with someone else.

Each heading was looked up in the project's table of deputies in steps, from the strictest to the most flexible:

  1. identical surnames;
  2. printed surnames as the beginning of the full ones;
  3. the first surname;
  4. an approximate similarity between surnames, with a threshold of 0.82;
  5. the same similarity, on the first surname.

If several deputies matched, the legislature decided. The Chair, the Vice-Presidents and the ministers were resolved separately, with the context of each session.

The deposited README calls that similarity Jaro-Winkler. The code uses the one in Python's difflib library.

Then all rows were reviewed by hand. The review corrected 367 assignments.

As a result, 99.86% of the rows have a deputy. 147 are left without one.

The README says those rows belong to ministers without a seat. Read one by one, 123 do indeed carry a ministry's heading.

The rest belong to secretaries, to the Chair without a name, or to headings damaged in reading.

The Chair has a party. «El Sr. PRESIDENTE:» goes to the deputy who was in the Chair, with party and ideology. In 586 of the 755 sessions, a Vice-President took the Chair for part of the session.

That is why the Presidents of the Chamber top any unfiltered word count.

Try it

In the explorer

Query for the explorer's search box"guarde silencio"

Open the explorer Select the query and copy it.

Search for the phrase and open a result from the Chair. The record attributes it to the deputy who was in the Chair; «Consta en el diario como» says only «El Sr. PRESIDENTE:». Open the explorer 

In Python, on the deposited CSV

d[d.rep_id.isna()].speaker.value_counts()   # the rows without a deputy

Whoever is in the Chair orders the debate, but does not carry it. To count speakers, remove the Chair first.

Back to contents

What is speech and what is not?

A short row is usually procedure; a long row may not be speech.

66.53% of the rows have 50 words or fewer. The median is fourteen words.

More than half of those short rows belong to the Chair: 58.17%.

At the other end, sort the rows from longest to shortest and take the first 10%. That slice holds 74.5% of the words.

Length is not importance. A short row may be a vote or a decisive interruption.

What is not speech. The Diario also prints what nobody said aloud: voting lists, committee reports, written requests, tables and the account of the session.

The dataset keeps it in 12,654 rows of their own, «Comentarios del Diario» (the Diario's comments). Each session also opens with its summary.

In the explorer, the «Solo lo que se habla» (speech only) box leaves out summaries and comments. That leaves 108,291 of the 121,700 interventions.

The separation follows an audit by the project. That a row is kept as speech does not prove that all its text was spoken in the plenary.

Procedure versus speech

Count
Legislature

How many rows are short, and how much text do the long ones take?

  • From the Chair
  • From other speakers

Rows · All

Words per row, in ever wider bands

  1. 0–534,196
  2. 6–1015,002
  3. 11–209,845
  4. 21–5012,507
  5. 51–1007,339
  6. 101–30011,300
  7. 301–1,00010,821
  8. 1,001–3,0005,225
  9. 3,001–10,0001,292
  10. more than 10,00024

Rows

Up to 50 words: 71,550 of 107,551 rows.

Rows · 1931-1933

Words per row, in ever wider bands

  1. 0–519,785
  2. 6–108,729
  3. 11–205,586
  4. 21–507,237
  5. 51–1004,217
  6. 101–3006,479
  7. 301–1,0005,998
  8. 1,001–3,0002,660
  9. 3,001–10,000647
  10. more than 10,00017

Rows

Rows · 1933-1935

Words per row, in ever wider bands

  1. 0–512,789
  2. 6–105,413
  3. 11–203,711
  4. 21–504,679
  5. 51–1002,762
  6. 101–3004,223
  7. 301–1,0004,108
  8. 1,001–3,0002,132
  9. 3,001–10,000520
  10. more than 10,0005

Rows

Rows · 1936-1939

Words per row, in ever wider bands

  1. 0–51,622
  2. 6–10860
  3. 11–20548
  4. 21–50591
  5. 51–100360
  6. 101–300598
  7. 301–1,000715
  8. 1,001–3,000433
  9. 3,001–10,000125
  10. more than 10,0002

Rows

Words · All

Words per row, in ever wider bands

  1. 0–5121,139
  2. 6–10109,503
  3. 11–20147,559
  4. 21–50407,923
  5. 51–100529,124
  6. 101–3002,047,271
  7. 301–1,0006,117,020
  8. 1,001–3,0008,754,055
  9. 3,001–10,0005,806,632
  10. more than 10,000295,670

Words

Words · 1931-1933

Words per row, in ever wider bands

  1. 0–569,270
  2. 6–1062,779
  3. 11–2084,459
  4. 21–50235,576
  5. 51–100304,388
  6. 101–3001,181,542
  7. 301–1,0003,358,950
  8. 1,001–3,0004,448,006
  9. 3,001–10,0003,006,189
  10. more than 10,000215,131

Words

Words · 1933-1935

Words per row, in ever wider bands

  1. 0–546,109
  2. 6–1040,457
  3. 11–2055,000
  4. 21–50153,073
  5. 51–100199,426
  6. 101–300755,345
  7. 301–1,0002,339,445
  8. 1,001–3,0003,563,526
  9. 3,001–10,0002,265,298
  10. more than 10,00058,441

Words

Words · 1936-1939

Words per row, in ever wider bands

  1. 0–55,760
  2. 6–106,267
  3. 11–208,100
  4. 21–5019,274
  5. 51–10025,310
  6. 101–300110,384
  7. 301–1,000418,625
  8. 1,001–3,000742,523
  9. 3,001–10,000535,145
  10. more than 10,00022,098

Words

Where the words are concentrated

What share of all words the longest rows hold, from the longest to the shortest.

Share of all words

25%50%75%100%

Rows, from longest to shortest

  • The first 10% of rows holds 74.5% of the words.
  • The first 20% holds 90.4%.
Procedure versus speech
Words per rowRows from the ChairRows from the restWords from the ChairWords from the rest
All
0–515,74118,45563,57257,567
6–1011,3603,64282,14427,359
11–206,5343,31197,61749,942
21–507,9894,518256,821151,102
51–1003,1234,216220,235308,889
101–3002,4368,864389,5991,657,672
301–1,00061910,202329,2085,787,812
1,001–3,0003414,884605,1568,148,899
3,001–10,000961,196419,2545,387,378
more than 10,00022227,863267,807
1931-1933
0–58,80510,98035,47133,799
6–106,6042,12546,89115,888
11–203,6311,95555,02129,438
21–504,5172,720144,90890,668
51–1001,7632,454124,272180,116
101–3001,3615,118219,877961,665
301–1,0003445,654178,8533,180,097
1,001–3,0001372,523230,5184,217,488
3,001–10,00027620123,7312,882,458
more than 10,00021527,863187,268
1933-1935
0–56,2136,57625,16020,949
6–104,0581,35530,18810,269
11–202,4641,24736,13418,866
21–503,0671,61298,85054,223
51–1001,1761,58683,390116,036
101–3009183,305143,653611,692
301–1,0002073,901112,6702,226,775
1,001–3,0001821,950336,5073,227,019
3,001–10,00058462242,7962,022,502
more than 10,00005058,441
1936-1939
0–57238992,9412,819
6–106981625,0651,202
11–204391096,4621,638
21–5040518613,0636,211
51–10018417612,57312,737
101–30015744126,06984,315
301–1,0006864737,685380,940
1,001–3,0002241138,131704,392
3,001–10,0001111452,727482,418
more than 10,00002022,098

The same data as the chart, in rows.

Download the figure data

CSV and Excel, with a README in Spanish and in English.

No form: these are aggregate data.

Source
Luz y Taquígrafos
Checksum: 360332a0ff13
Numbers exported on
How to cite
Rodrigues-Silveira, Rodrigo; García-Díez, Fátima; Llamazares, Iván; Martínez-Barahona, Elena; Barreto Martín, Eduardo. ‘Procedure versus speech’. Figure from Luz y Taquígrafos. https://luz.parlaibero.es/en/metodo/#tramite. Source: Luz y Taquígrafos · 360332a0ff13. Exported on .

Before you read it What is measured is length; ‘procedural’ is an interpretation. The Chair is recognised by its printed heading, with the explorer's parser.

Try it

In the explorer

Query for the explorer's search box"casas viejas"

Open the explorer Select the query and copy it.

Search for the phrase twice, with the «Solo lo que se habla» box ticked and without it. The difference is summaries and comments from the Diario, not anyone's speech. Open the explorer 

In Python, on the deposited CSV

(d.nwords <= 50).mean()   # the share of short rows

Back to contents

How was each session dated?

Each date was checked against four sources, session by session.

The audit cross-checked four independent sources for each session:

  • the running headers of each printed page;
  • the session heading, «SESIÓN CELEBRADA…» (session held…);
  • the dates cited in the text itself;
  • the sequence of Diario numbers, with the day of the week.

To settle a date it required two independent indications, or an unambiguous printed header.

The paper makes mistakes too. The title page of a volume may give the date on which those Cortes began, not that of the session. And some headings carry a printer's error or a damaged digit that optical character recognition misread.

The audit has a limit: it does not detect a date error that is consistent with the sequence.

Try it

In the explorer

With no search text, choose the 1933-1935 legislature and type 77 in «Nº de sesión» (session no.). All its interventions are from 4 May 1934. Open the explorer 

In Python, on the deposited CSV

d[(d.legislature == "1933-1935") & (d.num_session == 77)].date.unique()

The audit's table of evidence is not deposited.

Back to contents

What do party, family and ideology mean?

The three columns describe the deputy, not the row. They come from the project's table of deputies.

Party is given by deputy and legislature. Anyone who changed party between legislatures also changes in the dataset.

Family groups parties. In the CSV it has 33 distinct values, with spelling variants such as «Repubicanos» or «Republicanoses».

The explorer reduces them to 24 families.

Ideology is coded from EI, far left, to ED, far right, with C in the centre. It is assigned to the deputy according to party; it does not measure what was said.

It is not always uniform within a party. In five parties, different codes coexist.

The CEDA, for example, is D in 7,656 rows. But it is CD in 255. And it is C in 51.

«Republicanos» groups parties coded from the left to the centre-right.

The Chair carries the party and ideology of whoever is in the Chair.

Some labels are pending review by the author:

  • Diego Martínez Barrio appears in the AR party in 1931-1933;
  • the «Liberal» family, with 15,364 rows, which the explorer merges with «Liberales»;
  • the Lliga, which is CD in the CSV and D in the README.

Left or right?

A word and seven benches, from the far left to the far right. Where did it sound most, per ten thousand words?

Three points for the right bench; two if you are next to it; one if two benches away.

The game's words: appearances per ten thousand words, by ideology
WordEIICICCDDED
«patria»1.40.60.81.50.91.11.9
«Iglesia»2.12.34.01.32.83.54.7
«Dios»0.00.20.30.30.30.60.8
«marxismo»0.00.00.10.00.00.10.4
«religión»0.00.41.00.60.71.10.9
«propiedad»0.62.33.02.74.34.93.9
«Cataluña»5.05.43.13.96.41.34.7
«monarquía»1.61.62.01.31.30.31.3
«caciques»0.41.00.80.50.30.30.2
«fascismo»11.00.10.20.00.10.20.3
«trabajadores»15.44.61.61.10.71.50.6
«España»35.213.713.312.214.312.017.3

The ideology is that of each speaker's party, not their own. The far left speaks little in the dataset: with few appearances, its rate jumps. And a word sounding more on one bench says nothing about the tone or the side.

Try it

In the explorer

Choose the CEDA party in the filters and open the «Ideología» facet. You will see more than one code. Open the explorer 

In Python, on the deposited CSV

d[d.party == "CEDA"].ideology.value_counts()

A broad category serves to compare blocs, not to classify a person.

Back to contents

What does the corpus not claim, and how should you compare?

The dataset says who spoke, when and how much. It does not say about what, in what tone, from what position or how they voted.

Legislatures are unequal. The first holds 53.28% of the words.

Compare rates, not volumes: words per session, or each group's share within its legislature.

The vote is not a column. Roll-call votes are in the text, as lists of names, in rows of the Diario's comments.

Tone is not measured. The shorthand writer's bracketed notes, «(Rumores.)», «(Aplausos.)», are in the text. Nobody has turned them into a variable of the dataset.

Counting a word does not tell you who defends it or in what tone.

  • Topic. There is no topic column: each search is a hypothesis of yours.
  • Tone. The bracketed notes are in the text; tone is not measured.
  • Position. Ideology classifies the deputy, not what they said.
  • Vote. The roll-call lists are in the text, not in a column.

Try it

In the explorer

Query for the explorer's search box"total 161"

Open the explorer Select the query and copy it.

Search for the phrase with the «Solo lo que se habla» box ticked and without it. With the box ticked, the list disappears: it is a comment from the Diario. Open the explorer 

In Python, on the deposited CSV

print(d.loc[d.id == 5453, "speech"].iloc[0])   # the list, inside the Chair's row

That the Diario records something does not make it true: the dataset transcribes what was printed; it does not verify it.

Back to contents

Where is the full documentation?

What is deposited, what is not, and what this site publishes.

Deposited in Harvard Dataverse: the CSV, the README and the change logs, in Spanish and English.

Not deposited. The session metadata (Diario, pages, President of the Cortes and Government) and the table of deputies against which each heading was linked, which the README offers on request.

On this site: the exporter that computes each number, and a file, procedencia.csv, with the formula and date of all of them.

What has no public address is not linked.

Where each number comes from

A derived edition for research: wherever it differs, the Diario de Sesiones prevails.

Try it

In the explorer

Open «Sobre este corpus» (about this corpus), in the explorer's side panel: it gives the dataset's citation. Open the explorer 

In Python, on the deposited CSV

d.shape   # compare it with the README: rows and columns

Back to contents