Files
Brancheneinstufung2/connector-superoffice/normalize_persona.py

83 lines
2.8 KiB
Python

import re
def normalize_persona(title: str) -> str:
"""
Normalisiert rohe Jobtitel auf die 4 RoboPlanet-Personas.
Rückgabe: Persona-ID (z.B. 'PERSONA_A_OPS') oder 'MANUAL_CHECK'.
"""
if not title:
return "MANUAL_CHECK"
t = title.lower()
# 1. HARD EXCLUDES (Kosten sparen / Irrelevanz)
blacklist = [
"praktikant", "intern", "student", "assistenz", "assistant",
"werkstudent", "azubi", "auszubildende", "secretary", "sekretär"
]
if any(x in t for x in blacklist):
return "IGNORE"
# 2. HIERARCHISCHE LOGIK (Specialist > Generalist)
# Persona D: Visionary (Innovations-Treiber)
# Trigger: ESG, Digitalisierung, Transformation
keywords_d = [
"sustainability", "esg", "umwelt", "digital", "innovation",
"transformation", "csr", "strategy", "strategie", "future"
]
if any(x in t for x in keywords_d):
return "PERSONA_D_VISIONARY"
# Persona B: FM / Infra (Infrastruktur-Verantwortlicher)
# Trigger: Facility, Technik, Immobilien, Bau
keywords_b = [
"facility", "fm", "objekt", "immobilie", "technisch", "technik",
"instandhaltung", "real estate", "maintenance", "haushandwerker",
"building", "property", "bau", "infrastructure"
]
if any(x in t for x in keywords_b):
return "PERSONA_B_FM"
# Persona A: Ops (Operativer Entscheider - Q1 Fokus!)
# Trigger: Logistik, Lager, Supply Chain, Produktion, Operations
keywords_a = [
"logistik", "lager", "supply", "operat", "versand", "warehouse",
"fuhrpark", "site manager", "verkehr", "dispatch", "fertigung",
"produktion", "production", "plant", "werk", "standortleiter",
"branch manager", "niederlassungsleiter"
]
if any(x in t for x in keywords_a):
return "PERSONA_A_OPS"
# Persona C: Economic / Boss (Wirtschaftlicher Entscheider)
# Trigger: C-Level, GF, Finance (wenn keine spezifischere Rolle greift)
keywords_c = [
"gf", "geschäftsführer", "ceo", "cfo", "finance", "finanz",
"vorstand", "prokurist", "owner", "inhaber", "founder", "gründer",
"managing director", "general manager"
]
if any(x in t for x in keywords_c):
return "PERSONA_C_ECON"
# Fallback
return "MANUAL_CHECK"
# Test-Cases (nur bei direkter Ausführung)
if __name__ == "__main__":
test_titles = [
"Head of Supply Chain Management",
"Technischer Leiter Facility",
"Geschäftsführer",
"Director Sustainability",
"Praktikant Marketing",
"Teamleiter Fuhrpark",
"Hausmeister",
"Kaufmännischer Leiter"
]
print(f"{'TITLE':<40} | {'PERSONA'}")
print("-" * 60)
for title in test_titles:
print(f"{title:<40} | {normalize_persona(title)}")