diff --git a/src/preprocessing/extract_geo_topic.py b/src/preprocessing/extract_geo_topic.py index 39344a4..2667325 100644 --- a/src/preprocessing/extract_geo_topic.py +++ b/src/preprocessing/extract_geo_topic.py @@ -40,10 +40,15 @@ "Animal-Related", "Water", "Nature", - "Human/Civil Rights" # FIX: War vorher vergessen + "Human/Civil Rights", # FIX: War vorher vergessen + "Technology", + "Digital Transformation", + "Scientific Research and Technology Transfer", + "Innovation", + "tech-enablement" ] -# 2. Die zentrale Mapping-Schmiede (Konsolidiert von ~24 auf 13 Hauptkategorien) +# 2. Die zentrale Mapping-Schmiede (Konsolidiert von ~24 auf 14 Hauptkategorien inkl. tech-enablement) TAG_NORMALIZATION = { # Schreibweisen-Korrekturen "Arts and Culture": "Arts & Culture", @@ -57,7 +62,14 @@ "Employment/Workforce": "Socio-economic Development, Poverty", "Social/Human Services": "Socio-economic Development, Poverty", "Recreation, Sport & Well-being": "Health", - "Policy development": "Citizenship, Social Justice & Public Affairs" + "Policy development": "Citizenship, Social Justice & Public Affairs", + + # Technology / Digitalization Mapping to tech-enablement + "Technology": "tech-enablement", + "Digital Transformation": "tech-enablement", + "Scientific Research and Technology Transfer": "tech-enablement", + "Innovation": "tech-enablement", + "tech-enablement": "tech-enablement" } # 3. Die Keyword-Kanten für den Freitext-Fallback (Exakt synchron zu den Normalisierungs-Targets) @@ -116,6 +128,10 @@ ], "Peace & Conflict Resolution": [ r"peacebuilding", r"conflict sensitivity", r"peace work" + ], + "tech-enablement": [ + r"tech\w*", r"technolog\w*", r"digital\w*", r"software", r"data science", r"artificial intelligence", r"ai\b", + r"\bit\b(?=\s+(systems?|services?|infrastructure|department|team|strategy|support))" ] } diff --git a/src/tests/test_pipeline.py b/src/tests/test_pipeline.py index a43ae49..f828e6c 100644 --- a/src/tests/test_pipeline.py +++ b/src/tests/test_pipeline.py @@ -125,6 +125,31 @@ def test_extract_tags_special_boundary(self): extract_tags(members) self.assertEqual(members[0]["tags_focus"], ["Human/Civil Rights"]) + def test_extract_tags_tech_enablement(self): + # 1. Robust path: from official tags + members_robust = [ + { + "name": "Org Tech Robust", + "philea_info": { + "Programme Areas": "Digital Transformation\nEducation" + } + } + ] + extract_tags(members_robust) + self.assertEqual(sorted(members_robust[0]["tags_focus"]), ["Education", "tech-enablement"]) + + # 2. Fallback path: from free text keywords + members_fallback = [ + { + "name": "Org Tech Fallback", + "philea_info": { + "About": "Supporting the development of custom software and ai-driven solutions." + } + } + ] + extract_tags(members_fallback) + self.assertEqual(members_fallback[0]["tags_focus"], ["tech-enablement"]) + def test_extract_geo_taxonomy_matching(self): members = [ {