From 3da2f89a6d302e020b8b5826c28f794c10c396bc Mon Sep 17 00:00:00 2001 From: Floke Date: Mon, 30 Jun 2025 13:47:19 +0000 Subject: [PATCH] bugfix --- helpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/helpers.py b/helpers.py index d6ee8195..c1422da7 100644 --- a/helpers.py +++ b/helpers.py @@ -984,11 +984,13 @@ def evaluate_branche_chatgpt(crm_branche, beschreibung, wiki_branche, wiki_kateg parsed_confidence = False for line in lines: - line_lower = line.lower(); line_stripped = line.strip() - if line_lower.startswith("branche:"): - suggested_branch = line_stripped.split(":", 1)[1].strip().strip('"\'') + line_stripped = line.strip() + # NEU: Flexibleres Parsing mit Regex, ignoriert Groß/Kleinschreibung + branch_match = re.match(r"^(Branche|Branchenzuordnung):\s*(.*)", line_stripped, re.IGNORECASE) + if branch_match: + suggested_branch = branch_match.group(2).strip().strip('"\'') parsed_branch = True - elif line_lower.startswith("konfidenz:"): + elif line_stripped.lower().startswith("konfidenz:"): confidence_text = line_stripped.split(":", 1)[1].strip().strip('"\'') valid_confidences = ["hoch", "mittel", "niedrig"] if confidence_text.lower() in valid_confidences: