diff --git a/brancheneinstufung.py b/brancheneinstufung.py index f6e381f7..5ab24ad7 100644 --- a/brancheneinstufung.py +++ b/brancheneinstufung.py @@ -108,6 +108,18 @@ IMPUTER_FILE = "median_imputer.pkl" PATTERNS_FILE_TXT = "technician_patterns.txt" # Alt (Optional beibehalten) PATTERNS_FILE_JSON = "technician_patterns.json" # Neu (Empfohlen) +def normalize_for_mapping(text): + """ + Normalisiert einen String aggressiv für Mapping-Zwecke. + Muss VOR der Config-Klasse definiert werden, da sie dort verwendet wird. + """ + if not isinstance(text, str): + return "" + text = text.lower() + text = text.strip() + text = re.sub(r'[^a-z0-9]', '', text) + return text + # --- Globale Konfiguration Klasse --- class Config: """Zentrale Konfigurationseinstellungen."""