Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/preprocessing/extract_geo_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Comment on lines +67 to +68
"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)
Expand Down Expand Up @@ -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))"
]
Comment thread
Copilot marked this conversation as resolved.
}

Expand Down
25 changes: 25 additions & 0 deletions src/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down
Loading