PythiloLesson 6 of 12 · progress kept in this browser

Practice in Lab: Verify citation spans against versioned source digests →

Verify citation spans against versioned source digests

A known citation identifier is weak evidence if the document changed or the quoted span never existed. This verifier binds each citation to a tenant, index version, UTF-8 digest and exact code-point range. A digest proves consistency with the supplied baseline; it does not make malicious content trustworthy. Likewise a correctly quoted sentence need not support the surrounding claim. The project separates reproducible provenance checks from model-based or human judgments of faithfulness and keeps the latter as an explicit evaluation responsibility.

import hashlib
text = 'Python has types.'
print(hashlib.sha256(text.encode('utf8')).hexdigest()[:12])
print(text[0:6])
Your task

Sources have unique id,tenant,version,text,sha256 (UTF-8 digest). Each claim has text and citations containing source,start,end,quote. For each claim return ok and sorted unique errors. No citations gives missing. For each citation check known ID, exact tenant/version, recomputed source digest, integer code-point range 0<=start<end<=len(text), and exact quoted substring, in that order. Errors are id:unknown,scope,digest,range,quote. Duplicate source IDs raise ValueError. This validates provenance structure and literal spans, never semantic entailment.