9d79cf1576
Know-how-Freeze der Website-Compliance-Runde (DSE/Cookie/Impressum/AGB). docs: platform_evidence_v1 (Evidenz-/Qualitaetsnachweis, echte Zahlen), nutzungsbedingungen_mapping (neues Modul = Mapping, empirisch belegt), platform_checker_matrix (Meta-Modell verification_method x decision_method), verification_method, platform_validation_v1. code: checkers/ (reusable Pruefer-Library base+reference+embedding+llm, im Container validiert), agb/ (decision_method-Routing + Checker-Prototypen, 71% FP -> ~0 validiert). Dev-only, kein Prod-Push; Benchmark-GTs/Korpora im internen Archiv (data-retention). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""REFERENCE-Pruefer (verification_method=REFERENCE, decision_method=LINK_RESOLVER).
|
|
|
|
Ist ein klarer Verweis auf ein anderes Pflichtdokument vorhanden (+ optional: loest
|
|
der Link auf)? Deterministisch. Bsp: 'Details in unserer Datenschutzerklaerung'.
|
|
KEIN LLM, kein juristisches Urteil. (Validiert an AGB data_protection: 7/7.)
|
|
|
|
Die tatsaechliche HTTP-Aufloesung des Links ist ein optionaler Runtime-Schritt
|
|
(online), nicht Teil dieser deterministischen Text-Pruefung — die URL wird hier
|
|
nur extrahiert und in `detail['link']` zurueckgegeben.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
from .base import CheckResult, ControlSpec, DocContext, VerificationMethod
|
|
|
|
_URL = re.compile(r"https?://[^\s)\]]+", re.I)
|
|
|
|
|
|
class ReferenceChecker:
|
|
verification_method = VerificationMethod.REFERENCE
|
|
|
|
async def check(self, ctrl: ControlSpec, doc: DocContext) -> CheckResult:
|
|
text = doc.text or ""
|
|
pats = ctrl.patterns or []
|
|
if not pats or not text:
|
|
return CheckResult(present=False, source="reference")
|
|
for p in pats:
|
|
m = re.search(p, text, re.I)
|
|
if m:
|
|
window = text[max(0, m.start() - 40): m.end() + 200]
|
|
url = _URL.search(window) or _URL.search(text)
|
|
link = url.group(0) if url else None
|
|
return CheckResult(
|
|
present=True,
|
|
evidence=" ".join(m.group(0).split())[:120],
|
|
confidence=1.0,
|
|
source="reference",
|
|
detail={"link": link},
|
|
)
|
|
return CheckResult(present=False, source="reference")
|