A flexible learning system for wrapping tables and lists in HTML documents

William W. Cohen, Matthew Hurst, Lee S. JensenWWW 2002

Published in 2003, the $WL^2$ (WhizBang Labs Wrapper Learner) system represented a foundational advancement in the field of automated data extraction. While modern web scraping is ubiquitous, $WL^2$ addressed the fundamental challenge of "wrapper induction": the process of automatically learning rules to extract structured data from semi-structured HTML. The system's primary innovation was its ability to handle the irregular and "noisy" HTML common in real-world websites by viewing documents through multiple representational "lenses."

The Challenge of Wrapper Induction

Early extraction systems typically relied on a single view of a webpage, treating it either as a linear sequence of text tokens or as a hierarchical Document Object Model (DOM) tree. However, these approaches often failed when faced with inconsistent coding practices. For instance, two pages might appear identical to a user but possess vastly different underlying HTML structures. Conversely, complex visual layouts like tables are often intuitive for humans but difficult to parse using only DOM tags. $WL^2$ was designed to bridge this gap by integrating visual, geometric, and structural information into a unified learning framework.

System Architecture and Methods

The core of $WL^2$ is an extensible architecture that decouples the learning logic from the document representation. This is achieved through two main components: the Master Learning Algorithm and a suite of modular Builders.

The Master Learning Algorithm

The system utilizes a First Order Inductive Learner (FOIL) algorithm. This algorithm learns extraction rules in Disjunctive Normal Form (DNF) using a "set-covering" approach. It iteratively identifies the best rules to explain the positive training examples provided by the user, aiming for the most specific rule that generalizes across the data.

Modular Builders

Builders define the "bias" of the system, each specializing in a different way of interpreting the HTML document:

  1. Token-based Builder: Identifies patterns in raw text, such as content enclosed in brackets or specific punctuation.
  2. DOM-based Builder: Analyzes the hierarchical tag paths of the document. This allows the system to target specific elements based on their position in the site's structural tree.
A DOM tree representation illustrating the hierarchical structure used by the DOM-based builder.
  1. Format-based Builder: Considers visual properties such as font size, color, and bolding to identify significant data points.
  2. Geometric/Table-based Builder: This builder maps the webpage onto a 2D grid. By understanding the physical alignment of text—columns and rows—the system can extract data from complex tables regardless of how nested the underlying HTML tags might be.
An example of a structured data table that $WL^2$ aims to normalize and extract using geometric analysis.

Experimental Evaluation

The authors evaluated $WL^2$ across three distinct datasets to test its robustness and efficiency:

  • Standard Benchmarks: The system was tested against classic problems like Okra and BigBook. $WL^2$ significantly outperformed older systems like WIEN and STALKER, achieving perfect accuracy on the Okra dataset with just a single training example, compared to the 46 required by WIEN.
  • Real-World Tasks: 13 difficult extraction tasks involving job postings and continuing education courses. In these complex scenarios, the median number of examples required for 100% accuracy was remarkably low, between two and three.
  • Table Classification: A dataset of 339 examples was used to train a classifier to distinguish between "data tables" (containing actual information) and "formatting tables" (used solely for layout), ensuring the geometric builders were applied appropriately.

Key Insights and Conclusion

The success of $WL^2$ highlights several critical insights in web data extraction. First, multi-view learning is essential; no single representation is sufficient for the diversity of the web. If HTML is irregular, the system can rely on visual formatting; if formatting is inconsistent, it can fall back on the DOM. Second, geometry matters. The physical alignment of text on a screen is often a more reliable indicator of data relationships than the <table> tags themselves.

While $WL^2$ focused primarily on binary extraction decisions, its modular approach paved the way for more sophisticated systems capable of handling hierarchical data and "exotic" web structures that appear as tables to users but lack a traditional HTML table backbone.

Summary updated

BibTeX
@inproceedings{cohen2002flexible,
  author = {William W. Cohen and Matthew Hurst and Lee S. Jensen},
  title = {{A flexible learning system for wrapping tables and lists in HTML documents}},
  booktitle = {The Web Conference},
  year = {2002},
  doi = {10.1145/511446.511477},
}
Figure