Abstract
Extracting structured data from the web is notoriously difficult because tables that appear identical to users can have vastly different underlying HTML structures. We propose HTML-LSTM, a bidirectional tree-structured neural network that processes Document Object Model (DOM) trees. By integrating linguistic features with structural context through both upward and downward tree passes, HTML-LSTM accurately extracts and unifies information from non-uniform web tables into a relational format.
Introduction
The World Wide Web serves as a massive repository of relational data, including product listings, flight schedules, and academic syllabi. However, this data is often "trapped" within HTML tables that lack a universal schema. Different websites may represent the same data types using varying row/column orientations or decorative tags. Existing information extraction (IE) methods frequently fail when the visual representation of a table does not align with its source code structure. To bridge this gap, a system must understand both the linguistic meaning of cell contents and the hierarchical context provided by the HTML structure.
Methods
The proposed pipeline transforms raw HTML into structured relational data through several key stages, as illustrated in the overall workflow.
Node Encoding and DOM Processing
The process begins by extracting the table's subtree and converting it into a DOM tree. Each node in this tree is represented by a feature vector comprising the HTML tag (e.g., <td>), the text content, and the Part-of-Speech (PoS) tags of the text. A Bidirectional LSTM processes the text and PoS tags to generate a dense representation for each node.
The HTML-LSTM Architecture
Standard Tree-LSTMs typically operate in a bottom-up (leaf-to-root) fashion. While effective for natural language parsing, this approach ignores the top-down context critical in HTML, where "parent" tags (like headers) define the meaning of "child" data cells. HTML-LSTM addresses this by implementing a bidirectional flow.
As shown in the architecture diagram, the model consists of an Upward Tree-LSTM and a Downward Tree-LSTM. This dual-flow architecture ensures that every node "sees" both its descendants and its ancestors. The resulting representations are concatenated and passed through a Softmax classifier to label the node (e.g., "Instructor" or "Price"). To manage the extreme class imbalance—where most nodes are irrelevant "noise"—the authors utilize Focal Loss to prioritize the learning of rare "signal" nodes.
Robustness through Augmentation
To prevent the model from simply memorizing table coordinates, the researchers employed data augmentation. By randomly swapping the order of rows and columns during training, the network is forced to learn the underlying structural relationships rather than fixed grid positions.
Results and Evaluation
The model was evaluated on two distinct real-world datasets: Preschool Data (47 Japanese local government pages) and Syllabus Data (over 20,000 pages from 22 universities).
HTML-LSTM demonstrated significant performance gains over baseline models. On the Preschool dataset, it achieved a 0.96 F1-measure. On the more complex and noisy Syllabus dataset, it reached an 0.86 F1-measure. An ablation study confirmed the value of the bidirectional architecture; a standard upward-only Tree-LSTM achieved an F1 of 0.8285, while the full HTML-LSTM with data augmentation improved this to 0.8575.
Conclusion
HTML-LSTM effectively leverages the hierarchical nature of the DOM to extract structured data from diverse web tables. By treating HTML as a tree rather than a flat sequence, the model captures the essential relationship between headers and data. Future research will focus on extending this approach to "less structured" web fragments, such as those built with CSS grids or generic <div> containers, to further scale information extraction across the modern web.
Summary updated