{"id":"citation-anchor-check","version":"1.0.0","description":"Check a quote anchor (exact text plus prefix/suffix) matches exactly one place in a supplied source version.","supported_operations":["verify text quote selector anchors uniquely","check quote with prefix and suffix context in source","is this quotation ambiguous in the document","resolve exact quote anchor to code point offsets","check that the cited sentence exists verbatim","verify annotation anchor against supplied text version","בדיקה שציטוט מופיע במקור פעם אחת בדיוק"],"unsupported_operations":["fetching the source or proving the supplied text is authentic","fuzzy or approximate anchoring (no edit distance)","case folding, whitespace collapsing or Unicode normalization","XPath, CSS or range selectors"],"semantics":["Implements W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0; every result carries reference_version.","Checks only the caller-supplied text: authenticity_checked is always false. The cited (source_id, version) must be supplied (unknown_source, version_mismatch with available_versions sorted by code point).","exact (non-empty), prefix and suffix are compared code point for code point with no normalization. Every occurrence of exact is considered, overlapping ones included; prefix must end immediately before it and suffix must start immediately after it (W3C 4.2.4). An omitted or empty prefix/suffix matches anything.","Comparison order: exact_not_found, prefix_mismatch (exact occurs but never after prefix; observed is the text before the first occurrence), suffix_mismatch (observed is the text after the first prefix-matching occurrence), ambiguous_anchor (more than one full match), position_mismatch (claimed_start differs from the unique match).","Positions count Unicode code points from 0 (W3C 4.2.5 convention). A valid result returns match {start, end} of the unique occurrence; match_starts lists at most the first two full-match starts.","claimed_start is optional; omitted means no position is checked."],"limits":{"max_input_bytes":1048576,"max_sources":16,"max_text_bytes":524288,"max_quote_bytes":16384,"max_context_bytes":1024,"max_label_bytes":256},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["sources","citation"],"properties":{"sources":{"type":"array","minItems":1,"maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["source_id","version","text"],"properties":{"source_id":{"type":"string","minLength":1},"version":{"type":"string","minLength":1},"text":{"type":"string"}}}},"citation":{"type":"object","additionalProperties":false,"required":["source_id","version","selector"],"properties":{"source_id":{"type":"string","minLength":1},"version":{"type":"string","minLength":1},"selector":{"type":"object","additionalProperties":false,"required":["type","exact"],"properties":{"type":{"type":"string","const":"TextQuoteSelector"},"exact":{"type":"string","minLength":1},"prefix":{"type":"string"},"suffix":{"type":"string"}}},"claimed_start":{"type":"integer","minimum":0}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","match","authenticity_checked","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"unknown_source","version_mismatch","exact_not_found","prefix_mismatch","suffix_mismatch","ambiguous_anchor","position_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["field","available_versions","exact_matches","prefix_matches","full_matches","match_starts","claimed_start","resolved_start","observed"],"properties":{"field":{"type":"string","enum":["source_id","version","exact","prefix","suffix","claimed_start"]},"available_versions":{"type":["array","null"],"items":{"type":"string"}},"exact_matches":{"type":["integer","null"],"minimum":0},"prefix_matches":{"type":["integer","null"],"minimum":0},"full_matches":{"type":["integer","null"],"minimum":0},"match_starts":{"type":["array","null"],"maxItems":2,"items":{"type":"integer","minimum":0}},"claimed_start":{"type":["integer","null"],"minimum":0},"resolved_start":{"type":["integer","null"],"minimum":0},"observed":{"type":["string","null"]}}},"match":{"type":["object","null"],"additionalProperties":false,"required":["start","end"],"properties":{"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}}},"authenticity_checked":{"type":"boolean","const":false},"reference_version":{"type":"string","const":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}}},"examples":[{"input":{"sources":[{"source_id":"doc","version":"2017-02-23","text":"An anotation is not an annotation, but this is an anotation that has some typos."}],"citation":{"source_id":"doc","version":"2017-02-23","selector":{"type":"TextQuoteSelector","exact":"anotation","prefix":"this is an ","suffix":" that has some"}}},"output":{"valid":true,"reason":null,"first_discrepancy":null,"match":{"start":50,"end":59},"authenticity_checked":false,"reference_version":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}},{"input":{"sources":[{"source_id":"doc","version":"2017-02-23","text":"An anotation is not an annotation, but this is an anotation that has some typos."}],"citation":{"source_id":"doc","version":"2017-02-23","selector":{"type":"TextQuoteSelector","exact":"anotation"}}},"output":{"valid":false,"reason":"ambiguous_anchor","first_discrepancy":{"field":"exact","available_versions":null,"exact_matches":2,"prefix_matches":2,"full_matches":2,"match_starts":[3,50],"claimed_start":null,"resolved_start":null,"observed":null},"match":null,"authenticity_checked":false,"reference_version":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}}],"execute_url":"/v1/tools/citation-anchor-check/versions/1.0.0/execute"}