From 74c33d7239eabe56bcb35de76fe5a0a3df808011 Mon Sep 17 00:00:00 2001 From: Floke Date: Fri, 20 Jun 2025 16:20:54 +0000 Subject: [PATCH] bugfix --- brancheneinstufung.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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."""