refactor
This commit is contained in:
@@ -3,12 +3,22 @@
|
||||
No state, no IO — safe to import anywhere.
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
import unicodedata
|
||||
|
||||
_CATEGORIES = ("KERN", "WICHTIG", "REST") # only for the legacy-format reader now
|
||||
|
||||
|
||||
def parse_facts(raw) -> dict:
|
||||
"""subblocks.facts ist ein JSON-Blob aus LLM-Hand — leer/kaputt/kein dict → {}."""
|
||||
try:
|
||||
d = json.loads(raw) if raw else {}
|
||||
except (ValueError, TypeError):
|
||||
return {}
|
||||
return d if isinstance(d, dict) else {}
|
||||
|
||||
|
||||
def _norm_title(s: str) -> str:
|
||||
"""Normalize a title for key comparison.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user