Refine edge parsing and chunk attribution in chunking_parser.py and graph_derive_edges.py for version 4.2.9: Ensure current_edge_type persists across empty lines in callout blocks for accurate link processing. Implement two-phase synchronization for chunk authority, collecting explicit callout keys before the global scan to prevent duplicates. Enhance callout extraction logic to respect existing chunk callouts, improving deduplication and processing efficiency.

This commit is contained in:
Lars committed 2026-01-11 14:30:16 +01:00
1 parent a780104b3c
commit 727de50290
2 files changed
+31 -15

No files matched your search

+8 -1
View File
@@ -206,6 +206,8 @@ def parse_edges_robust(text: str) -> List[Dict[str, Any]]:
"""
Extrahiert Kanten-Kandidaten aus Wikilinks und Callouts.
WP-24c v4.2.7: Gibt Liste von Dicts zurück mit is_callout Flag für Chunk-Attribution.
WP-24c v4.2.9 Fix A: current_edge_type bleibt über Leerzeilen hinweg erhalten,
damit alle Links in einem Callout-Block korrekt verarbeitet werden.
Returns:
List[Dict] mit keys: "edge" (str: "kind:target"), "is_callout" (bool)
@@ -234,11 +236,16 @@ def parse_edges_robust(text: str) -> List[Dict[str, Any]]:
found_edges.append({"edge": f"{current_edge_type}:{l}", "is_callout": True})
continue
# Links in Folgezeilen des Callouts
# WP-24c v4.2.9 Fix A: current_edge_type bleibt über Leerzeilen hinweg erhalten
# innerhalb eines Callout-Blocks, damit alle Links korrekt verarbeitet werden
if current_edge_type and stripped.startswith('>'):
# Fortsetzung des Callout-Blocks: Links extrahieren
links = re.findall(r'\[\[([^\]]+)\]\]', stripped)
for l in links:
if "rel:" not in l:
found_edges.append({"edge": f"{current_edge_type}:{l}", "is_callout": True})
elif not stripped.startswith('>'):
elif current_edge_type and not stripped.startswith('>') and stripped:
# Nicht-Callout-Zeile mit Inhalt: Callout-Block beendet
current_edge_type = None
# Leerzeilen werden ignoriert - current_edge_type bleibt erhalten
return found_edges