Structured data

Why is it worthwhile to store page numbers and original text fragments in JSON?

extraction yields only one amount: 1200, the reviewer still has to reread the entire document. Saving additional page numbers and short original text fragments

阅读文本 / Reading text
This paper uses synthetic samples to demonstrate the processing method. The code has been verified using examples in an isolated environment; this does not guarantee effectiveness for all real-world files or products. Before processing important files, please retain the original copies and verify them against the boundaries and acceptance criteria outlined in this document. extraction yields only one amount: 1200 , the reviewer still has to reread the entire document. Saving additional page numbers and short original text fragments is often more useful than adding another decimal place to the “confidence score”: it allows errors to be pinpointed and ensures that subsequent corrections are well-documented. evidence object should be able to lead users back to the original text uses page numbers starting from 1. If your parsing library starts from zero, perform the conversion at the boundary and document this in the protocol. The snippet should retain only short sentences relevant to the field, avoiding the inclusion of entire sensitive pages in logs, search indexes, or notification messages. first validates the shape, then validates the correspondence from jsonschema import Draft202012Validator schema = { "type": "object", "required": ["value", "evidence"], "additionalProperties": False, "properties": { "value": {"type": "string"}, "evidence": {"type": "object", "additionalProperties": False, "required": ["page", "quote"], "properties": {"page": {"type": "integer", "minimum": 1}, "quote": {"type": "string", "minLength": 1}}} } } v = Draft202012Validator(schema) pages = ["Invoice total: USD 1200."] record = {"value": "1200", "evidence": {"page": 1, "quote": "USD 1200"}} assert v.is_valid(record) def quote_exists(r): if not v.is_valid(r): return False e = r["evidence"] return e["page"] <= len(pages) and e["quote"] in pages[e["page"] - 1] assert quote_exists(record) fake = {"value": "9999", "evidence": {"page": 1, "quote": "USD 9999"}} assert v.is_valid(fake) assert not quote_exists(fake) assert not quote_exists({"value": "1", "evidence": {"page": 9, "quote": "x"}}) This synthetic example deliberately constructs a record that is syntactically valid yet lacks any supporting evidence. It demonstrates that schema matching and source matching cannot substitute for one another. Real-world PDFs may exhibit variations in word breaking, ligatures, and whitespace; substring matching serves only as a minimal demonstration and should not be prematurely claimed to constitute a complete evidence-validation algorithm. evidence must also be bound to file version saved item can solve cannot guarantee file content hash identifies the corresponding version uploader has file permissions page number narrows the search scope page has not been rearranged original text fragment Quick text verification field semantics must be correct coordinates and coordinate system positioning page area The OCR results are already accurate The original text may also exist and could be incorrectly cited in the wrong location A single document may contain the same amount appearing multiple times. Even if such a fragment exists, it must be determined whether it represents a total, tax amount, or prior-period balance. Further validation can examine field labels, the table in which it appears, and the surrounding context; when multiple candidates are encountered, the first one should not be selected without further verification. Bilingual proofreading most requires traceability associates such source records with OmniDoc (Product Entry) is used in conjunction with bilingual proofreading, allowing the reviewer to jump from the translated text back to the source page to verify meaning. The value lies not in making the output appear more complex, but in ensuring that each correction is clearly explained, thereby reducing the time spent repeatedly referring to the original document. Reference: JSON Schema object structure 。 - 1 -
Updated 2026-10-08