Information extraction combining spatial and textual layout cues

Techniques for extracting information from a formatted document are provided. The techniques include combining one or more visual layout rules, one or more mark-up rules and one or more text-based rules in connection with a formatted document, and specifying one or more rules from the one or more visual layout rules, one or more mark-up rules and one or more text based rules to extract information from the formatted document.

FIELD OF THE INVENTION

Embodiments of the invention generally relate to information technology, and, more particularly, to information extraction.

BACKGROUND OF THE INVENTION

Information in Web pages and formatted documents are designed for human consumption and, hence, exhibit some visual pattern. The document author communicates this abstract visual pattern to the web browser using a specification language (for example, hypertext markup language (HTML), cascading style sheets (CSS), Javascript Code, etc.). Humans typically do not look at the specification language to understand the data. Rather, they look at the rendered version of the page through a browser. However, existing rule-based information extraction (IE) frameworks do not deal with visual representations of a page. Instead, existing approaches look for patterns in the specification language. Thus, any rules that intend to exploit the visual cues in the layout need to be translated into equivalent rules based on the source code of the page.

As such, existing IE approaches have serious limitations, including, for example, the following. An abstract visual pattern can be implemented in many different ways by the web designer. For example, a tabular structure can be implemented using any of <table>, <div> and <li> tags, and only a fraction of tables are implemented using the <table> tag. Source-based rules that use layout cues need to cover all possible ways in which the layout can be achieved. A rule that relies on a specific implementation will fail on pages that use a different implementation, even if these pages exhibit the same visual pattern.

Also, with existing approaches, the proximity of two entities in the HTML source code does not necessarily imply visual proximity, and so it may not be possible to encode visual proximity cues using simple source based rules. Additionally, rules based on HTML tags and document object model (DOM) trees are often sensitive to even minor modifications of the web page, and rule maintenance becomes messy.

Further, challenges exist in pure text-based information extraction systems. For example, specification languages are becoming more complex and difficult to analyze. Also, visualization logic in Javascript and CSS prevent text based analysis. Further, there can be errors in the markup code, but browsers can still render the page accurately in most cases, and spatial layout based rules would be more robust to these kinds of errors.

SUMMARY OF THE INVENTION

Principles and embodiments of the invention provide techniques for information extraction combining spatial and textual layout cues. An exemplary method (which may be computer-implemented) for extracting information from a formatted document, according to one aspect of the invention, can include steps of combining one or more visual layout rules, one or more mark-up rules and one or more text-based rules in connection with a formatted document, and specifying one or more rules from the one or more visual layout rules, one or more mark-up rules and one or more text based rules to extract information from the formatted document.

One or more embodiments of the invention or elements thereof can be implemented in the form of a computer product including a tangible computer readable storage medium with computer usable program code for performing the method steps indicated. Furthermore, one or more embodiments of the invention or elements thereof can be implemented in the form of an apparatus including a memory and at least one processor that is coupled to the memory and operative to perform exemplary method steps. Yet further, in another aspect, one or more embodiments of the invention or elements thereof can be implemented in the form of means for carrying out one or more of the method steps described herein; the means can include (i) hardware module(s), (ii) software module(s), or (iii) a combination of hardware and software modules; any of (i)-(iii) implement the specific techniques set forth herein, and the software modules are stored in a tangible computer-readable storage medium (or multiple such media).

DETAILED DESCRIPTION

Principles of the invention include information extraction using a combination of spatial layout based and text based rules. One or more embodiments of the invention include specifying rules (or algebra) for information extraction from formatted documents (for example, web pages) that combine visual layout information, text-based features and markup-based rules. Visual layout information, for example, of a web page, can include information such as relative locations of different regions, etc. The techniques described herein also include indexing web pages and visual regions therein using the visual layout information and storing them in a database to enable efficient information extraction.

Additionally, one or more embodiments of the invention include enabling the building of applications that need to use visual layout for information extraction. For example, this could include extracting system requirements and dependencies of software products, mining contracts for compliance, comparison shopping, etc. Further, as detailed herein, one or more embodiments of the invention include an efficient rule-based information extraction framework that combines visual and markup based rules. The visual information extraction framework allows use of visual information in a rendered web page. Also, rules can be specified in terms of the visual layout of the page along with source code.

The techniques described herein additionally include visual operator algebra for extracting regions from a web page based on their relative locations. This algebra can be, for example, rich enough to specify most of the commonly occurring patterns. By way of example, a single page can have around 10,000 visual regions. As such, one or more embodiments of the invention include efficiently retrieving the regions of interest and performing complex operations on them. Further, the visual operator algebra can be implemented using a geographical (spatial) database. A geographic information system (GIS) database can be used to store, query and retrieve visual regions of a web page. The operator algebra can also be implemented using a regular relational database.

As detailed herein, one or more embodiments of the invention include using spatial layout rules, where such rules can include specification of the direction of a region with respect to another other, the area of a region, the location of a region within other regions, the alignment of a set of regions, the distance between regions, etc. Such rules can also include some property of the region such as text, font size, the hypertext markup language (HTML) tag, etc.

Additionally, one or more embodiments of the invention can include storing annotations with the associated visual region and formatting information extracted from a formatted document in a database. The techniques detailed herein can also include indexing regions extracted from a formatted document using a spatial database or a custom index structure to enable scalable and efficient implementation of rules with visual constraints. Further, visual rules can be combined with other rules on the source code of a web page (text-based rules).

By way of example, sample scenarios can include horizontally aligned regions with no gaps, vertically aligned regions with no gaps, etc. For vertically aligned regions (with large gaps), for example, functions used for information extraction can include, for example, SouthOf and NorthOf. Additionally, text-based rules can be used to identify operating systems and/or product names, version numbers, etc., and can also be combined with visual rules.

FIG. 1is a block diagram illustrating an exemplary embodiment, according to an aspect of the invention. By way of illustration,FIG. 1depicts a list of uniform resource locators (URLs)102, which provides input to a web page dump104, which can be implemented as a browser extension and also provide local copies of web pages to a visual region extractor module106, which provides annotations to a spatial database module108. Annotations can include, for example, span, type-specific attributes, visual region, formatting attributes, etc.

The visual region extractor module106extracts of all the visual regions of all web pages stored locally by web page dump104by rendering the local copy of the web page in a web browser and using browser application programming interfaces (APIs) to query for the coordinates of each node in the document object model (DOM) tree of the web page. The rendering can also be done on the online version of the webpage by passing the uniform resource locator (URL). A visual region represents a visual box in the layout of a web page and has the attributes: <xl, yl, xh, yh,>. (xl, yl) and (xh, yh) denote the bounding box of the identified region in the visual layout of the document. One can assume that the regions are rectangles, which applies to most markup languages such as hypertext markup language (html). For example, html uses a box model for visual layout in which each html element is mapped to a rectangular area in the layout of the page.

The spatial database module108includes a spatial indexer module110, and also interacts with a rules engine module112(which receives visual rules and text rules). The spatial indexer module110creates indexes on the regions to make the evaluation of visual rules faster. The spatial indexer can also be implemented using a relational database. The rules engine module112processes the rules and converts them into queries that can be understood by the spatial database module. The output of the rules engine module112is a set of annotations that satisfy the rules.

FIG. 2is a diagram illustrating visual operator algebra202, according to an embodiment of the present invention. By way of illustration,FIG. 2depicts a portion of a framework that can include formal algebra of useful operations over visual regions and an engine to implement a combination of visual and text based rules.

One or more embodiments of the invention include operators in the algebra to enable writing of rules based on visual regions. The operators can be classified as span generating, scalar or grouping operators.

Span generating operators produce a set of visual spans as output and examples are listed in the table below:

Scalar operators can take as input one or more values from a single tuple and return a single value. Scalar operators that return Boolean values are called Boolean operators and can be used in predicates and are further classified as directional or containment operators. The directional operators allow visual spans to be compared based on their positions in the layout. Exemplary directional Boolean operators are listed in the table below:

Exemplary containment Boolean operators are listed in the table below:

PredicateExplanationContains(vs1, vs2)vs1is contained within vs2Touches(vs1, vs2)vs1touches vs2on one of the four edgesIntersects(vs1, vs2)vs1and vs2intersect
Note that these operators can also be expressed using regular comparison operators on the bounding box coordinates. For example, StrictNorthOf(vs1, vs2) corresponds to the expression vs1.yh≦vs2.yl& vs1.xl≧vs2.xl& vs1.xh≦vs2.xh. However, they have been provided in the algebra to make the rules more readable and short. Other scalar operators include the generalization and/or specialization operators and the geometric operators as listed in the tables below:

OperatorExplanationMaximalRegion(vs)Returns the largest visual span vsmthat containsvs and also has the same text content as vs1MinimalRegion(vs)Returns the smallest visual span vsmthat iscontained in vs and also has the same textcontent as vsArea(vs)Returns the area corresponding to vsCentroid(vs)Returns a visual span that has x and y coordinatescorresponding to the centroid of vs and text spanidentical to vs

Many HTML elements in a nested HTML source may actually have identical text content. The MinimalRegion and MaximalRegion operators can be used to find the visual span corresponding to the innermost or the outermost HTML element, respectively.

Grouping operators are used to group multiple tuples based on some criteria and apply an aggregation function to each group (for example, similar to the GROUP BY functionality in structure query language (SQL)). Exemplary grouping operators and the aggregation operators specific to visual spans are listed in the tables below, respectively:

OperatorExplanationHorizontallyAlligned(V S,Returns groups of horizontallyconsecutive, maxdist)aligned visual spans from V S.If the consecutive flag is set, thevisual spans have to be consecutivewith no non-aligned span in between.The maxdist limits the maximumdistance possible between twoconsecutive visual spans in a group.VerticallyAligned(V S,Returns groups of vertically alignedconsecutive, maxdist)visual spans from V S.If the consecutive flag is set, thevisual spans have to be consecutivewith no non-aligned span in between.The maxdist limits the maximumdistance possible between twoconsecutive visual spans in a group.MinimalSuperRegion(V S)Returns the smallest visual span thatcontains all the visual spans in set V SMinimalBoundingRegion(V S)Returns a region that is a minimumbounding rectangle of all visual spansin set V S

FIG. 3is a flow diagram illustrating techniques for extracting information from a formatted document, according to an embodiment of the present invention. Step302includes combining one or more visual layout rules, one or more mark-up rules and one or more text-based rules in connection with a formatted document. By way of example, a user can combine visual layout rules with other rules on the source code of the web page. Additionally, in one or more embodiments of the invention, the specific rules combined can depend on the task at hand and can be subjective (for example, determined by a user).

The visual layout rules can include, for example, specification of a direction of a region with respect to another region, an area of a region, a location of a region within one or more additional regions, an alignment of a set of one or more regions, a distance between two or more regions and/or a property of a region (for example, text, font size, HTML tag, etc.). Also, the layout rules can include an aggregation operator.

Step304includes specifying one or more rules from the one or more visual layout rules, one or more mark-up rules and one or more text based rules to extract information from the formatted document.

The techniques depicted inFIG. 3can also include storing one or more annotations with an associated visual region, as well as formatting information extracted from a formatted document in a database. Additionally, one or more embodiments of the invention include indexing each region extracted from a formatted document using a spatial database and/or a custom index structure (for example, to enable efficient implementation of rules with visual constraints). Further, the techniques described herein can include using a text index in combination with a spatial index for efficient implementation of one or more rules combining text and spatial layout based rules.

The techniques depicted inFIG. 3can also, as described herein, be run on a system, wherein the system includes distinct software modules, each of the distinct software modules being embodied on a tangible computer-readable recordable storage medium. The distinct software modules can include, for example, a visual region extractor module, a spatial database module, a spatial indexer module and a rules engine module executing on a hardware processor.

One or more embodiments of the invention, or elements thereof, can be implemented in the form of an apparatus including a memory and at least one processor that is coupled to the memory and operative to perform exemplary method steps.

A data processing system suitable for storing and/or implementing program code will include at least one processor402coupled directly or indirectly to memory elements404through a system bus410. The memory elements can include local memory employed during actual implementation of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during implementation.

Input/output or I/O devices (including but not limited to keyboards408, displays406, pointing devices, and the like) can be coupled to the system either directly (such as via bus410) or through intervening I/O controllers (omitted for clarity).

It should be noted that any of the methods described herein can include an additional step of providing a system comprising distinct software modules embodied on a computer readable storage medium; the modules can include, for example, any or all of the components shown inFIG. 1. The method steps can then be carried out using the distinct software modules and/or sub-modules of the system, as described above, executing on one or more hardware processors402. Further, a computer program product can include a computer-readable storage medium with code adapted to be implemented to carry out one or more method steps described herein, including the provision of the system with the distinct software modules.

At least one embodiment of the invention may provide one or more beneficial effects, such as, for example, implementing an information extraction framework that allows specification of visual rules combined with text based rules.

It will be appreciated and should be understood that the exemplary embodiments of the invention described above can be implemented in a number of different fashions. Given the teachings of the invention provided herein, one of ordinary skill in the related art will be able to contemplate other implementations of the invention. Indeed, although illustrative embodiments of the present invention have been described herein with reference to the accompanying drawings, it is to be understood that the invention is not limited to those precise embodiments, and that various other changes and modifications may be made by one skilled in the art.