diff --git a/app/core/chunker.py b/app/core/chunker.py index 3f2898f..b41e61f 100644 --- a/app/core/chunker.py +++ b/app/core/chunker.py @@ -14,7 +14,6 @@ import logging try: from app.services.semantic_analyzer import SemanticAnalyzer, SemanticChunkResult except ImportError: - # Fallback für Tests, wenn der Service noch nicht auf dem Pfad ist print("WARNUNG: SemanticAnalyzer Service nicht gefunden.") class SemanticAnalyzer: async def analyze_and_chunk(self, text, type): return [SemanticChunkResult(content=text, suggested_edges=[])] @@ -80,19 +79,12 @@ def get_sizes(note_type: str): # 3. DATA CLASSES & HELPERS # ========================================== -_SENT_SPLIT = re.compile(r'(?<=[.!?])\s+(?=[A-ZÄÖÜ0-9„(])') -_WS = re.compile(r'\s+') - +_SENT_SPLIT = re.compile(r'(?<=[.!?])\s+(?=[A-ZÄÖÜ0-9„(])'); _WS = re.compile(r'\s+') def estimate_tokens(text: str) -> int: t = len(text.strip()); return max(1, math.ceil(t / 4)) - -# FIX: Kurzschreibweise aufgelöst, um Linter-Fehler zu vermeiden def split_sentences(text: str) -> list[str]: text = _WS.sub(' ', text.strip()) - - if not text: - return [] - + if not text: return [] parts = _SENT_SPLIT.split(text) return [p.strip() for p in parts if p.strip()] @@ -215,10 +207,11 @@ def _extract_all_edges_from_md(md_text: str, note_id: str, note_type: str) -> Li Ruft die Edge-Derivation auf Note-Ebene auf und gibt die Kanten im Format "kind:Target" zurück. """ + # Korrigierte Argumentreihenfolge (Positionale und Keyword-Argumente getrennt) raw_edges: List[Dict] = build_edges_for_note( md_text, - note_id, - note_type, + note_id=note_id, + note_type=note_type, chunks=[], note_level_references=[], include_note_scope_refs=False @@ -262,7 +255,7 @@ async def _strategy_smart_edge_allocation(md_text: str, config: Dict, note_id: s task = analyzer.analyze_and_chunk( text=chunk.text, source_type=note_type, - all_note_edges=all_note_edges_list, + # all_note_edges und target_type_resolver werden im SemanticAnalyzer benötigt ) llm_tasks.append(task)