Scoring Document Parsers on Whole Documents, Not Single Pages
Page-by-page benchmarks miss the errors between pages. How to score split tables and broken paragraphs with code, and test your own parser.
Document parsers often fail to accurately capture information across multiple pages when dealing with complex documents. A six-page bank statement with a single table containing 222 transactions is a prime example. Many parsers return the data in pieces, with each piece appearing correct on its own page. However, this page-level scoring method fails to identify errors that only arise between pages.
The WholeDoc Bench benchmark addresses this issue by scoring entire documents, rather than individual pages. It checks for four specific errors that occur at page breaks: tables that continue onto the next page, repeated headers, page furniture intruding into the content, and blocks of text being joined together erroneously.
To score these errors, WholeDoc Bench uses plain Python code to perform string matching, edit distance calculations, and tree edit distance comparisons. The benchmark tests seven areas, including text, reading order, structure, tables, barcodes, charts, and the position of each item on the page. However, for the purpose of this explanation, we will focus on the checks performed at page breaks.
The benchmark begins by marking the breaks in the answer key, which lists the elements of the document page by page. Where content crosses a page break, the key adds a relation between the two pieces, either indicating that the second piece continues the first ("continues_in") or that they only look connected ("stays_apart"). For example, a table that runs across five pages would be represented as five table pieces linked together using the "continues_in" relation.
The scoring process then involves creating one output table for each real table in the document. The table integrity check ensures that the output accurately covers every piece of the real table without merging separate tables together. If the output contains more or fewer tables than the real document, or if it merges separate tables, the score for that table is zero.
To illustrate, consider the table in the bank statement example. If the parser returns five separate pieces for the five-page table, it would score zero on the table integrity check. Similarly, if two different tables are merged into one, the score would also be zero. However, if the parser returns the pieces correctly and links them using the "continues_in" relation, it would receive a perfect score for that table.
In conclusion, scoring document parsers on whole documents, rather than individual pages, is crucial for accurately identifying errors that only occur at page breaks. By using plain Python code to perform rigorous checks on text, reading order, structure, tables, barcodes, charts, and the position of each item on the page, the WholeDoc Bench benchmark provides a comprehensive evaluation of document parsing performance.
Rewritten by urgent.news; may contain errors — check the original.
Source: hackernoon.com