bugfix
This commit is contained in:
10
helpers.py
10
helpers.py
@@ -984,11 +984,13 @@ def evaluate_branche_chatgpt(crm_branche, beschreibung, wiki_branche, wiki_kateg
|
|||||||
parsed_confidence = False
|
parsed_confidence = False
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line_lower = line.lower(); line_stripped = line.strip()
|
line_stripped = line.strip()
|
||||||
if line_lower.startswith("branche:"):
|
# NEU: Flexibleres Parsing mit Regex, ignoriert Groß/Kleinschreibung
|
||||||
suggested_branch = line_stripped.split(":", 1)[1].strip().strip('"\'')
|
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
|
parsed_branch = True
|
||||||
elif line_lower.startswith("konfidenz:"):
|
elif line_stripped.lower().startswith("konfidenz:"):
|
||||||
confidence_text = line_stripped.split(":", 1)[1].strip().strip('"\'')
|
confidence_text = line_stripped.split(":", 1)[1].strip().strip('"\'')
|
||||||
valid_confidences = ["hoch", "mittel", "niedrig"]
|
valid_confidences = ["hoch", "mittel", "niedrig"]
|
||||||
if confidence_text.lower() in valid_confidences:
|
if confidence_text.lower() in valid_confidences:
|
||||||
|
|||||||
Reference in New Issue
Block a user