Implement WP-24c v4.2.0: Introduce configurable header names and levels for LLM validation and Note-Scope zones in the chunking system. Update chunking models, parser, and processor to support exclusion of edge zones during chunking. Enhance documentation and configuration files to reflect new environment variables for improved flexibility in Markdown processing.
This commit is contained in:
1 parent
39fd15b565
commit
003a270548
7 files changed
+401
-28
No files matched your search
@@ -23,19 +23,34 @@ from .graph_extractors import (
|
||||
)
|
||||
|
||||
# WP-24c v4.2.0: Header-basierte Identifikation von Note-Scope Zonen
|
||||
NOTE_SCOPE_ZONE_HEADERS = [
|
||||
"Smart Edges",
|
||||
"Relationen",
|
||||
"Global Links",
|
||||
"Note-Level Relations",
|
||||
"Globale Verbindungen"
|
||||
]
|
||||
# Konfigurierbar via MINDNET_NOTE_SCOPE_ZONE_HEADERS (komma-separiert)
|
||||
def get_note_scope_zone_headers() -> List[str]:
|
||||
"""
|
||||
Lädt die konfigurierten Header-Namen für Note-Scope Zonen.
|
||||
Fallback auf Defaults, falls nicht konfiguriert.
|
||||
"""
|
||||
import os
|
||||
headers_env = os.getenv(
|
||||
"MINDNET_NOTE_SCOPE_ZONE_HEADERS",
|
||||
"Smart Edges,Relationen,Global Links,Note-Level Relations,Globale Verbindungen"
|
||||
)
|
||||
header_list = [h.strip() for h in headers_env.split(",") if h.strip()]
|
||||
# Fallback auf Defaults, falls leer
|
||||
if not header_list:
|
||||
header_list = [
|
||||
"Smart Edges",
|
||||
"Relationen",
|
||||
"Global Links",
|
||||
"Note-Level Relations",
|
||||
"Globale Verbindungen"
|
||||
]
|
||||
return header_list
|
||||
|
||||
def extract_note_scope_zones(markdown_body: str) -> List[Tuple[str, str]]:
|
||||
"""
|
||||
WP-24c v4.2.0: Extrahiert Note-Scope Zonen aus Markdown.
|
||||
|
||||
Identifiziert Sektionen mit spezifischen Headern (z.B. "## Smart Edges")
|
||||
Identifiziert Sektionen mit spezifischen Headern (konfigurierbar via .env)
|
||||
und extrahiert alle darin enthaltenen Links.
|
||||
|
||||
Returns:
|
||||
@@ -46,8 +61,14 @@ def extract_note_scope_zones(markdown_body: str) -> List[Tuple[str, str]]:
|
||||
|
||||
edges: List[Tuple[str, str]] = []
|
||||
|
||||
# Regex für Header-Erkennung (## oder ###)
|
||||
header_pattern = r'^#{2,3}\s+(.+?)$'
|
||||
# WP-24c v4.2.0: Konfigurierbare Header-Ebene
|
||||
import os
|
||||
import re
|
||||
note_scope_level = int(os.getenv("MINDNET_NOTE_SCOPE_HEADER_LEVEL", "2"))
|
||||
header_level_pattern = "#" * note_scope_level
|
||||
|
||||
# Regex für Header-Erkennung (konfigurierbare Ebene)
|
||||
header_pattern = rf'^{re.escape(header_level_pattern)}\s+(.+?)$'
|
||||
|
||||
lines = markdown_body.split('\n')
|
||||
in_zone = False
|
||||
@@ -60,9 +81,11 @@ def extract_note_scope_zones(markdown_body: str) -> List[Tuple[str, str]]:
|
||||
header_text = header_match.group(1).strip()
|
||||
|
||||
# Prüfe, ob dieser Header eine Note-Scope Zone ist
|
||||
# WP-24c v4.2.0: Dynamisches Laden der konfigurierten Header
|
||||
zone_headers = get_note_scope_zone_headers()
|
||||
is_zone_header = any(
|
||||
header_text.lower() == zone_header.lower()
|
||||
for zone_header in NOTE_SCOPE_ZONE_HEADERS
|
||||
for zone_header in zone_headers
|
||||
)
|
||||
|
||||
if is_zone_header:
|
||||
|
||||
Reference in new issue
Block a user