Abstract
The determination of the reading sequence of text is fundamental to document understanding. This problem is easily solved in pages where the text is organized into a sequence of lines and vertical alignment runs the height of the page. We present a situation—the directory page parsing problem—where information is presented on the page in an irregular, visually-organized, two-dimensional format. Directory pages are common in financial prospectuses and carry key information about organizations and their relationships. We present solutions to identifying directory pages and constructing a "reading tree" using classifiers for text segments and a bottom-up traversal of segments. This solution supports automatic extraction of organization and relationship information in production.
Introduction
In the financial industry, processing client onboarding documents like prospectuses is a significant manual bottleneck. A critical task involves extracting lists of organizations, their specific roles (e.g., "Investment Manager", "Auditor"), and their addresses.
The primary challenge lies in parsing directory pages. Unlike standard text with a predictable left-to-right, top-to-bottom reading order, directory pages utilize a 2D visual layout to convey hierarchical relationships. For instance, a header like "Legal Counsel" might be centered at the top, applying to multiple law firms listed in separate columns below. Standard OCR reading order algorithms often scramble this text by reading horizontally across columns, severing the logical link between an entity and its role. To solve this, the authors propose a method to parse this 2D structure into a hierarchical "reading tree."
Methodology
The proposed pipeline utilizes a custom library, visualjson, to extract text along with visual metadata such as font size, weight, and coordinates. The process consists of three main stages:
1. Directory Page Identification
A binary classifier (Random Forest or Multi-Layer Perceptron) identifies directory pages. Given their rarity, the model uses 15 hand-crafted features, including address candidate presence, word counts, and specific role-related entities.
2. Text Segmentation
A rule-based algorithm classifies text segments as "Header," "Body," or "Neither." This classification relies on visual cues—headers are typically bold, larger, and shorter—and entity recognition, as "Body" segments often contain addresses or organization names.
3. Directory Tree Construction
The core novelty is a bottom-up parsing algorithm. Instead of a traditional top-down approach, the algorithm traverses nodes in reverse order (bottom-to-top, right-to-left). It identifies "Body" leaf nodes and searches upward and leftward for the visually dominating "Header" parent. This mimics human visual grouping, where sub-items are naturally associated with the category headers above them.
Datasets and Results
The system was trained and tested on a proprietary dataset of financial prospectuses. The training set included 90 documents (83 directory pages), while the test set comprised 23 documents (26 directory pages).
The pipeline is currently in production at Goldman Sachs, demonstrating high performance:
- Page Classification: The Random Forest model achieved an F1-score of 0.94 on the imbalanced test set.
- Text Segmentation: Heuristic-based segmentation reached an F-score of 0.983.
- Tree Construction: The bottom-up algorithm achieved an F-score of 0.98 for linking a Body to its immediate Parent Header and 0.88 for full "Directory Block" reconstruction.
Conclusion
By treating document layout as a semantic hierarchy rather than a simple sequence, this approach enables the automated extraction of complex entity relationships. While currently reliant on some hand-crafted heuristics, the success of the bottom-up parsing method suggests a robust framework for handling other types of tree-structured text in visually complex documents. Future work will explore generalizing this approach to broader document categories.
Summary updated