Landtag lists: match existing persons by birth date, Landtag membership and name variants
- person_by_name rules out homonyms born on another day and prefers the one who sat in that Landtag; failing an exact name, accepts a unique variant among that Landtag's members (Rudi/Rudolf, Chiara-Sophia/Chiara, new double surnames) - normalize() maps ß to ss like SQL unaccent(); migration 0008 aligns stored aliases - clean_name drops image captions, parenthesised suffixes, LTP, other abbreviations and zero-width characters Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
faf9572b9f
commit
68be25a953
10 files changed
+114
-13
No files matched your search
@@ -11,6 +11,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": false,
|
||||
"match_landtag": null,
|
||||
"photo_url": "https://www.europarl.europa.eu/mepphoto/220897.jpg",
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -74,6 +75,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -135,6 +137,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -196,6 +199,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -257,6 +261,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -318,6 +323,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -379,6 +385,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
@@ -440,6 +447,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": true,
|
||||
"match_landtag": null,
|
||||
"photo_url": null,
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"honorific_prefix": null,
|
||||
"honorific_suffix": null,
|
||||
"match_by_name": false,
|
||||
"match_landtag": null,
|
||||
"photo_url": "https://www.parlament.gv.at/dokument/bild/201426/20142639_500.jpg",
|
||||
"ref": {
|
||||
"__type__": "PersonRef",
|
||||
|
||||
@@ -10,6 +10,12 @@ def test_clean_name_drops_functions_and_titles_but_not_names():
|
||||
assert L.clean_name("Dipl. Päd., DI Carina Laschober-Luif") == "Carina Laschober-Luif"
|
||||
assert L.clean_name("Mag. a Astrid Eisenkopf") == "Astrid Eisenkopf"
|
||||
assert L.clean_name("Ingrid Korosec") == "Ingrid Korosec" # "Ing" is a title, "Ingrid" is not
|
||||
assert L.clean_name("Portraitfoto von Simon Heilig-Hofbauer") == "Simon Heilig-Hofbauer"
|
||||
assert L.clean_name("LTP Jakob Wolf") == "Jakob Wolf"
|
||||
assert L.clean_name("MMst. Doris Schmidl") == "Doris Schmidl"
|
||||
assert L.clean_name("Claudia Gamon, MSc (WU)") == "Claudia Gamon"
|
||||
assert L.clean_name("Johannes" + chr(0x200B) + " Schwarz") == "Johannes Schwarz"
|
||||
assert L.clean_name("Michael J. Fox") == "Michael J. Fox" # initials stay
|
||||
assert L.surname_first("Höglinger Tobias, Mag.") == "Tobias Höglinger"
|
||||
assert L.surname_first("EISEL-EISELSBERG Detlev") == "Detlev Eisel-Eiselsberg"
|
||||
|
||||
@@ -66,3 +72,15 @@ def test_robots_excluded_states_have_no_adapter():
|
||||
from politrack.core.registry import ADAPTERS
|
||||
assert "landtag.wien" not in ADAPTERS and "landtag.ktn" not in ADAPTERS
|
||||
assert "landtag.bgld" in ADAPTERS
|
||||
|
||||
|
||||
def test_name_variants_and_sharp_s():
|
||||
from politrack.core.resolve import variant_of
|
||||
from politrack.text import normalize
|
||||
assert normalize("Klaudia Stroißnig") == normalize("Klaudia Stroissnig")
|
||||
for listed, known in [("Rudi Hemetsberger", "Rudolf Hemetsberger"), ("Max Hiegelsberger", "Maximilian Hiegelsberger"),
|
||||
("Chiara-Sophia Glawogger", "Chiara Glawogger"), ("Helena Kirchmayr-Felbermaier", "Helena Kirchmayr"),
|
||||
("Michael Stefan Wagner", "Michael Wagner"), ("Gebi Mair", "Gebhard Mair")]:
|
||||
assert variant_of(listed, known), (listed, known)
|
||||
for listed, known in [("Michael Weber", "Michael Huber"), ("Doris Kampus", "Doris Hahn"), ("Jo Mair", "Josef Mair")]:
|
||||
assert not variant_of(listed, known), (listed, known)
|
||||
Reference in new issue
Block a user