kbzhishiku
This commit is contained in:
1 parent
7f542f54a5
commit
08a19ebe96
68 files changed
+16602
-229
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from edkb_system.contracts import Chunk, Context
|
||||
|
||||
|
||||
def run(input_data: list[Chunk], context: Context) -> list[Chunk]:
|
||||
chunks = input_data
|
||||
if not chunks:
|
||||
context.warnings.append("quality_gate: no chunks generated")
|
||||
context.confidence = min(context.confidence, 0.5)
|
||||
return chunks
|
||||
|
||||
short_count = sum(1 for c in chunks if len(c.text.strip()) < 60)
|
||||
if short_count:
|
||||
context.warnings.append(f"quality_gate: {short_count} short chunks")
|
||||
context.confidence = min(context.confidence, 0.8)
|
||||
|
||||
unique_texts = len({c.text for c in chunks})
|
||||
if unique_texts < len(chunks):
|
||||
context.warnings.append("quality_gate: duplicate chunks detected")
|
||||
context.confidence = min(context.confidence, 0.75)
|
||||
|
||||
return chunks
|
||||
Reference in new issue
Block a user