WYSIWYE: An Algebra for Expressing Spatial and Textual Rules for Visual Information Extraction

Vijil Chenthamarakshan, Prasad M Desphande, Raghu Krishnapuram, Ramakrishna Varadarajan, Knut StolzearXiv 2015

TL;DR

WYSIWYE (What You See Is What You Extract) is a declarative framework that allows researchers to extract information from web pages using visual layout rules rather than brittle HTML source code. By extending traditional text-extraction algebra with spatial operators like NorthOf or VerticallyAligned, the system creates extraction rules that are simpler to write and far more robust to changes in a website's underlying code.

What Problem Does This Paper Address?

Traditional Information Extraction (IE) is a game of "find the tag." Rules are typically written to navigate the DOM tree—looking for specific <table>, <div>, or <li> tags. The problem? Web designers are creative. A tabular layout might be implemented as a standard HTML table on one page and a complex nest of CSS-styled divs on another.

This "Source Based Approach" is brittle. If a developer changes a <ul> to a <div>, the extraction script breaks, even if the page looks identical to a human user. Furthermore, proximity in HTML code doesn't always mean proximity on the screen. WYSIWYE addresses this by shifting the focus from the source code to the rendered layout, treating the web page as a visual canvas where spatial relationships (like being "under" a header) provide the strongest clues for data extraction.

Methods

The authors propose a Visual Algebra that extends the existing operator algebra of "System T" (a well-known rule-based IE framework).

The Core Components:

  • New Data Types: They introduce the Region (a bounding box with $x,y$ coordinates) and the VisualSpan (a combination of text and its physical location).
  • Spatial Operators: The heart of the paper is a set of algebraic operators categorized into:
  • Directional: NorthOf, StrictNorthOf, etc.
  • Containment: Contains, Touches, Intersects.
  • Grouping: HorizontallyAligned, VerticallyAligned.
  • Geometric: Area, Centroid.
The Visual Operators introduced in the algebra

System Architecture:

The system operates in two phases. In the Preprocessing Phase, pages are rendered in a browser (using a Firefox extension) to extract the coordinates of every DOM node. This data is stored in a relational database (IBM DB2). In the Query Phase, users write high-level visual rules which the system automatically translates into optimized SQL queries.

The overall system architecture showing the preprocessing and query phases

Datasets

The authors evaluated their system on a real-world challenge: extracting software system requirements from IBM product pages.

  • Corpus: 44,726 software product pages crawled from IBM.com.
  • Evaluation Set: A subset of 116 manually tagged pages was used to measure accuracy for specific extraction tasks (like identifying supported operating systems).

Key Insights and Ideas

  • Abstraction as Robustness: Visual rules are "source-agnostic." A rule that says "extract text vertically aligned under the 'Operating Systems' header" works regardless of whether that list is implemented as a table or a series of paragraphs.
  • SQL as an Execution Engine: One of the most clever aspects is mapping spatial algebra to relational database logic. For example, the StrictNorthOf operator simply becomes a set of coordinate comparisons in a SQL WHERE clause.
  • Hybrid Power: The framework doesn't abandon text. It allows "seamless combination," where you can use a regular expression to find a keyword (like "Windows") and then use spatial rules to find the data related to it.
Figure 1: System requirements page

Key Results

  • High Accuracy: On the task of extracting specific system requirements (Query Q4), the system achieved 100% precision and 100% recall on the test set. Other tasks like identifying the "System Requirements" section (Q2) hit 96% recall and 85% precision.
  • Significant Speedups: By leveraging standard database indexing (R-trees for coordinates and inverted indices for text), the authors achieved a 3x to 15x improvement in query execution time compared to non-indexed searches.
  • Simplicity: The authors demonstrate that a visual rule is often just a few lines of "SQL-like" syntax, whereas an equivalent HTML-based rule would need to account for dozens of possible tag combinations.

Limitations and Future Work

  • Rendering Overhead: The system requires a full browser render to get coordinates. While this happens offline during preprocessing, it is more resource-intensive than simple HTML parsing.
  • Manual Rule Specification: While the algebra makes writing rules easier, they still must be written by humans. The authors suggest that future work could involve "learning" these visual rules automatically from examples (wrapper induction).
  • Dynamic Content: The paper primarily deals with static snapshots of pages. Handling highly dynamic content or pages that change layout based on user interaction remains a challenge for future iterations.

Summary updated

BibTeX
@misc{chenthamarakshan2015wysiwye,
  author = {Vijil Chenthamarakshan and Prasad M Desphande and Raghu Krishnapuram and Ramakrishna Varadarajan and Knut Stolze},
  title = {{WYSIWYE: An Algebra for Expressing Spatial and Textual Rules for Visual Information Extraction}},
  year = {2015},
  eprint = {1506.08454},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1506.08454},
}
Figure