speeches: end XXIV-XXVII speeches at the next RU_ anchor or the chair
Protocols of these periods mark speeches with RU_ anchors only, so no heading was found and every speech ran to the end of its session protocol (~57k documents of up to 2.8 MB; document table 11 GB, chunks 5.6 GB, nightly dump 0.4 -> 6+ GB). Segments longer than any real speech (200k chars) are now dropped instead of stored. parser_version 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
10c677ca70
commit
95355305d4
2 files changed
+30
-2
No files matched your search
@@ -217,3 +217,21 @@ def test_election_preferences_eu_layouts():
|
||||
(1, "Lopatka, Dr. Reinhold", 2268, 58013, None, 3, "Bernhuber, Alexander", 44641)])]
|
||||
assert [(c["name"], c["votes"]) for c in parse_preferences("eu", eu2019)] == [("Dr. Othmar Karas", 103035)]
|
||||
assert [(c["name"], c["votes"]) for c in parse_preferences("eu", eu2024)] == [("Dr. Reinhold Lopatka", 58013)]
|
||||
|
||||
|
||||
def test_speech_segments_end_at_next_ru_anchor_or_chair():
|
||||
"""XXIV-XXVII protocols mark speeches with "RU_" anchors only; a speech used to run to the end of the file."""
|
||||
from politrack.sources.parlament.speeches import speech_segments
|
||||
html = """<html><body>
|
||||
<p class=RB><a name="RU_1">9.50</a></p>
|
||||
<p class=StandardRB><a name="R_1_9"><b>Abgeordnete <A HREF="/WWER/PAD_1/index.shtml">Anna Eins</A></b> (Grüne)</a>: Erste Rede.</p>
|
||||
<p class=StandardRE>Danke. <i>(Beifall bei den Grünen.)</i></p>
|
||||
<p class=MsoNormal><b><span lang=DE style='display:none'><!--x--></span>Präsident
|
||||
<A HREF="/WWER/PAD_2/index.shtml">Max Vorsitz</A>:</b> Zu Wort gemeldet ist Abgeordneter Zwei.</p>
|
||||
<p class=RB><a name="RU_2">9.55</a></p>
|
||||
<p class=StandardRB><b>Abgeordneter Bernd Zwei</b> (SPÖ): Zweite Rede.</p>
|
||||
""" + "<p>Weitere Tagesordnung.</p>" * 3000 + "</body></html>"
|
||||
seg = speech_segments(html, ["RU_1", "RU_2"])
|
||||
assert seg["RU_1"].startswith("Abgeordnete Anna Eins (Grüne): Erste Rede.") and "Vorsitz" not in seg["RU_1"]
|
||||
assert seg["RU_2"].startswith("Abgeordneter Bernd Zwei (SPÖ): Zweite Rede.")
|
||||
assert "RU_2" in seg and len(seg["RU_2"]) < 200_000 # the rest of the session protocol is not one speech
|
||||
Reference in new issue
Block a user