Patent Publication Number: US-5841900-A

Title: Method for graph-based table recognition

Description:
This invention relates generally to a method for recognizing tables within a document, and more particularly to a system for document structure recognition based on a graph rewriting paradigm and including of four subsystems, namely segmentation, graph construction, entity recognition and graph rewriting. 
     BACKGROUND AND SUMMARY OF THE INVENTION 
     The present invention is directed to a method for document structure recognition based on a graph rewriting paradigm. Document recognition is a process by which the information regarding the organization of the document content, i.e. its structure, is extracted from the document image. The structure identifies document entity types (e.g. paragraphs, figures and tables), their properties (e.g. the number of columns in a table), and their interrelations (e.g., a figure is above a caption). Although Optical Character recognition (OCR) is an inherent part of this process, it is not intended as an aspect of the present invention. The present invention is directed to document structure recognition beyond a character level. Indeed, the methodology presented here is equivalently applicable to any of a number of document types, including documents described by a Page Description Language (PDL) such as Postscript™ or Xerox Interpress™. 
     Graphs are known to be powerful tools for document structure analysis. They provide a compact computational abstraction for representing the complex multidimensional information embedded in a document structure. In this abstraction, document entities and the inter-relations between these entities can be represented by elements of graphs, namely graph nodes and links respectively. Manipulation of these nodes and links results in a change in the topology of the graph that consequently provides a new interpretation of the document structure. As a result, the tools for graph manipulation become the basis for a computational document structure analysis framework. 
     The use of graphs for document recognition has classically been limited to academic and experimental systems due to the computational complexity of graph manipulation. A notable exception is the work of Fahmy and Blostein &#34;A Graph Grammar Programming Style for Recognition of Music Notation, &#34; Machine Vision and Applications, Vol. 6 (1993). This work provides a comprehensive computational framework for document recognition. Fu, in &#34;Syntactic Pattern Recognition Application,&#34; Springer-Verlog, Berlin (1977), used graph grammars and syntactic pattern recognition for recognizing Chinese characters. Similarly, Bunke employed techniques for line-drawing understanding in &#34;Attributed Programmed Graph Grammars and Their Application to Schematic Diagram Interpretation, &#34; IEEE Trans. Pattern Analysis and Machine Intelligence, Vol. 4, No. 6 (November 1982). 
     On the other hand, the present invention is directed to a computationally feasible technique for manipulating the graph of document images. Although the goal of the proposed system is to recognize table structures in a document, it is extensible to encompass a variety of document recognition tasks. 
     Heretofore, other document analysis methods have been disclosed, the relevant portions of which may be briefly summarized as follows: 
     R. Haralick. Document image understanding: geometric and logical layout. Proc. IEEE Conf. On Computer Vision and Pattern Recognition, 1994: 385-390 teaches page layout analysis processes and text block segmentation. Geometric layout analysis, also termed bottom-up analysis, extracts whatever structure can be inferred without reference to models of particular kinds of pages--e.g., letter, memo, title page, table, etc. Intuitively, this is the structure that would be apparent even to an illiterate person. Also, it is the structure common to pages of all kinds. Logical structure analysis classifies a given page within a repertoire of known layouts, and assigns functional interpretations to components of the page based on this classification. Geometric analysis is generally preliminary to logical structure analysis. 
     Component aggregation or clustering methods that assemble homogeneous regions from individual connected components subject to size similarity and proximity constraints were described by L. O&#39;Gorman, &#34;The document spectrum for bottom-up page layout analysis,&#34; Advances in structural and syntactic pattern recognition, Ed. H. Bunke, Singapore: World Scientific, 1992: 270-279. Background structure methods detect bands of white space (gutters) in the image and treat these as the boundaries of text blocks as described by H. S. Baird, &#34;Background structure in document images,&#34; Advances in structural and syntactic pattern recognition, Ed. H. Bunke, Singapore: World Scientific, 1992: 253-269; T. Pavlidis and J. Zhou, &#34;Page segmentation by white streams,&#34; Proc. 1st Int. Conf. On Document Recognition, Saint-Malo, 1991: 945-953; and A. Antonacopoulos and R. T. Ritchins, &#34;Flexible page segmentation using the background,&#34; Proc. 12th Int. Conf On Pattern Recognition, 1994: 339-344. 
     Top-down logical structure analysis processes do attempt to distinguish types of text, but do so using a priori layout models as taught, for example, by G. Nagy, S. Seth, and S. Stoddard, &#34;Document analysis with an expert system,&#34; Pattern Recognition in Practice II, E. Gelsema and L. Kanal, editors, North Holland, Amsterdam, 1986: 149-159; and R. Ingold and D. Armangil, &#34;A top-down document analysis method for logical structure recognition,&#34; Proc. 1st Int Conf. On Document recognition, Saint-Malo, 1991: 41-49. 
     J. Fisher, in &#34;Logical structure descriptions of segmented document images,&#34; Proc. 1st Int Conf On Document recognition, Saint-Malo, 1991: 302-310, describes a rule-based system that identifies geometrical and logical structures of document images. Location cues, format cues and textual cues (OCR) are employed to make identifications and transformations during the identification of text and non-text regions. 
     In accordance with the present invention, there is provided a graph-based method for recognizing tables present in a document represented as digital image data, including the steps of: 
     segmenting the digital image data to identify textual and image entities within the document; 
     building a layout graph of the document using the entities; 
     subsequently tagging each of the text entities with a label from a document node alphabet to produce a labeled graph; 
     manipulating the text entities of the labeled graph, using at least one rewriting rule, to identify the document structure 
     One aspect of the invention is based on the discovery of techniques for computationally feasible graph-based analysis of document structure. Such techniques are preferably associated with optical character recognition software products to enable users to accurately segment images having textual content therein. 
     The techniques build a layout of graph from the segmented blocks of the document, capture the geometric relations between the blocks, tags the individual blocks with a set of primitive labels, and uses a set of rules to rewrite the layout graph. The output of the method being another graph whose entities are constructed by merging the primitive entities in the layout graph. The system works primarily by using geometric cues and the text content of the document is not used. The techniques can be implemented with a machine that is capable of running OCR software. For example, a machine implementing the invention can include a personal computer workstation of similarly powered computer. 
     Another aspect of the invention deals with a basic problem in graph-based analysis--that of providing computationally feasible methods for document analysis in real-time and on computing platforms that are commonly available to users. Increased system efficiency is accomplished by extending the grammar productions to encompass various low-level entity recognition tasks which in turn increases the completeness and generality of the system at the cost of increased parsing complexity. 
     The technique described above is advantageous because it is computationally efficient is, therefore, inexpensive compared to other approaches. In addition, it can be used to in conjunction with OCR software to provide increased robustness in image segmentation and the improved character recognition that results from such segmentation. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a simplified block diagram of a document recognition system in accordance with the present invention; 
     FIG. 2 is a layout graph of an exemplary document; 
     FIG. 3 is an illustration of the hierarchical structure of a document; 
     FIG. 4 is an exemplary rewrite rule for constructing a table from two columns in accordance with an aspect of the present invention; 
     FIG. 5 is a layout graph depicting the results of applying the rewrite rule of FIG. 4 to the graph of FIG. 2 in accordance with the present invention; 
     FIG. 6 is another exemplary rewrite rule for constructing a table from two columns and assigning a HEADER label to a line entity; 
     FIG. 7 is a layout graph illustrating the application of the rewrite rule of FIG. 6 to the graph of FIG. 2; 
     FIG. 8 is a bitmap image of an exemplary document and FIG. 9 is a representation of the document of FIG. 8 having each entity therein identified by a surrounding box; 
     FIG. 10 is a bitmap image of an exemplary document including two tables and FIG. 11 is a representation of the document of FIG. 10 having each entity therein identified in accordance with the present invention; and 
     FIG. 12 is a bitmap image of an exemplary document including two tables and FIG. 13 is a representation of the document of FIG. 12 having each entity therein identified in accordance with the present invention; 
     FIGS. 14-16 are illustrations of additional exemplary rewrite rules associated with Rules 3-5 as found in the Appendix. 
    
    
     The present invention will be described in connection with a preferred embodiment, however, it will be understood that there is no intent to limit the invention to the embodiment described. On the contrary, the intent is to cover all alternatives, modifications, and equivalents as may be included within the spirit and scope of the invention as defined by the appended claims. 
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     For a general understanding of the present invention, reference is made to the drawings. In the drawings, like reference numerals have been used throughout to designate identical elements. In describing the present invention, the following term(s) have been used in the description. 
     The term &#34;data&#34; refers herein to physical signals that indicate or include information. When an item of data can indicate one of a number of possible alternatives, the item of data has one of a number of &#34;values.&#34; For example, a binary item of data, also referred to as a &#34;bit,&#34; has one of two values, interchangeably referred to as &#34;1&#34;and &#34;0&#34;or &#34;ON&#34; and &#34;OFF&#34; or &#34;high&#34; and &#34;low.&#34; A bit is an &#34;inverse&#34; of another bit if the two bits have different values. An N-bit item of data has one of 2 N  values. 
     The term &#34;data&#34; includes data existing in any physical form, and includes data that are transitory or are being stored or transmitted. For example, data could exist as electromagnetic or other transmitted signals or as signals stored in electronic, magnetic, or other form. 
     &#34;Memory circuitry&#34; or &#34;memory&#34; is any circuitry that can store data, and may include local and remote memory and input/output devices. Examples include semiconductor ROMs, RAMs, and storage medium access devices with data storage media that they can access. 
     A &#34;data processing system&#34; is a physical system that processes data. A &#34;data processor&#34; or &#34;processor&#34; is any component or system that can process data, and may include one or more central processing units or other processing components 
     An &#34;instruction&#34; is an item of data that a processor can use to determine its own operation. A processor &#34;executes&#34; a set of instructions when it uses the instructions to determine its operations. Execution of instructions &#34;causes&#34; a processor to perform an operation when the processor performs the operation in the process of executing the instructions. A signal &#34;requests&#34; or &#34;is a request for&#34; an event or state when the signal can cause occurrence of the event or state. 
     &#34;Code&#34; means data indicating instructions, but in a form that a processor can execute. 
     An &#34;array of data&#34; or &#34;data array&#34; or &#34;array&#34; is a combination of items of data that can be mapped into an array. A &#34;two-dimensional array&#34; is a data array whose items of data can be mapped into an array having two dimensions. 
     An item of data &#34;defines&#34; an array when it includes information sufficient to obtain or produce the array. For example, an item of data defining an array may include the defined array itself, a compressed or encoded form of the defined array, a pointer to the defined array, a pointer to a part of another array from which the defined array can be obtained, or pointers to a set of smaller arrays from which the defined array can be obtained. 
     An &#34;image&#34; is a pattern of physical light. An &#34;image output device&#34; is a device that can provide output defining an image. A &#34;display&#34; is an image output device that provides information in a visible form. A display may, for example, include a cathode ray tube; an array of light emitting, reflecting, or absorbing elements; a structure that presents marks on paper or another medium; or any other structure capable of defining an image in a visible form. To &#34;present an image&#34; on a display is to operate the display so that a viewer can perceive the image. Data &#34;defines&#34; an image when the data includes sufficient information to produce the image, such as by presenting it on a display. 
     &#34;Character&#34; means a discrete element that appears in a written or printed form of a language. Characters in the English language can thus include not only alphabetic and numerical elements, but also punctuation marks, diacritical marks, mathematical and logical symbols, and other elements used in written or printed English. More generally, characters can include, in addition to alphanumeric elements, phonetic, ideographic, or pictographic elements. 
     A &#34;character recognition system&#34; is a system that can operate on an item of data defining characteristics of a character other than its character type to obtain an item of data indicating its character type. 
     A &#34;word&#34; is a set of one or more characters that is treated as a semantic unit in a language. A &#34;text&#34; is an arrangement of one or more lines of characters; the characters of a text may form words. 
     A &#34;connected component&#34; or &#34;blob&#34; is a set of pixels within a data array defining an image, all of which are connected to each other through an appropriate rule such as that they are neighbors of each other or are both neighbors of other members of the set. A connected component of a binary form of an image can include a connected set of pixels that have the same binary value, such as black. A &#34;connected component set&#34; or &#34;component set&#34; is a set of connected components that are treated as a unit. A character can therefore be a component set; for example, the letter &#34;i&#34; includes two connected components that are treated as a single character in English components &#34;form&#34; t components &#34;form&#34; the character. A &#34;bounding box&#34; for a character or other component set is a rectangle just large enough to include all the pixels in the component set, and can be specified by coordinates. 
     An &#34;image output device&#34; is a device that can receive an item of data defining an image and provide the image as output. A &#34;display&#34; is an image output device that provides the output image in human viewable form. The visible pattern presented by a display is a &#34;displayed image&#34; or simply &#34;image.&#34; 
     The remainder of this section is devoted to presenting a formal terminology for describing graphs and a general technique for manipulating graphs based on a set of rules, referred to herein as graph rewriting. 
     Let Σ and Δ be finite sets of alphabets for node labels and edge labels respectively. A graph g={V,E,ƒ v , ƒ E ,A} over the set Σ∪Δ is a 5-tuple where V represents a nonempty finite set of nodes, E.OR right.V×V represents a finite set of unordered pairs of nodes called edges. ƒ v  :V→Σ is an injective mapping that assigns a label to each node, ƒ E  :E→Δ is an injective mapping that labels each edge, and A denotes the combined set of node and edge attributes. If A≠φ, g is called an attributed graph. A subgraph g s  of g is a graph consisting of some nodes of g and all the edges of g that connect those nodes. In document processing applications, Σ contains entities such as words, paragraphs and tables, Δ contains geometric and logical constraints such as left --  of() and refers --  to() and A contains attributes such as bounding box and font type. 
     Graph rewriting is a sequential process where by a subgraph g s  of a host graph g is replaced with another graph g r  at each step. Each replacement step involves three distinct tasks: first, locating a subgraph isomorphic to g s  in g and detaching it from the host graph; next, replacing g s  by a graph isomorphic to g r  and attaching it to the host graph; and finally recomputing the attributes of the new host graph. A formal method for carrying out these tasks is described using graph grammars. The grammatical approach provides the necessary framework for expressing the graph manipulation rules as well as a strategy for controlling the execution of those rules. Graph rewriting is, however, less stringent than the classical grammatical techniques since it does not require the ultimate reduction of the productions into a start symbol. In the following description, the terminology introduced by Rosenberg et al. &#34;Graph Grammars and Their Application to Computer Science,&#34; Springer-Verlog, Berlin (1986), hereby incorporated by reference, is employed to formally describe graph rewriting as its application pertains here. 
     An Attributed Graph Grammar, or AGG, is a five-tuple Γ={Σ,Δ, S, P, A} where Σ and Δ are node and edge alphabets respectively and A is the combined set of the node and edge attributes. Σ is the union of two disjoint alphabets Σ T  and Σ N , respectively referred to as terminal and nonterminal alphabets. Terminal entities cannot be decomposed to the constituent parts. S εΣ N  is the grammar start symbol. P denotes a finite set of grammar productions that are of the form p=(g l , g r , α,β, η) where g l  εΣ N  is left-hand side of the production p that is a graph,g r  is the right-hand side of the production that is a graph, and α, β and η are the embedding relation, the attribute transfer function and the application condition for the production respectively. Each relation α for an undirected graph G is a set of elements of the form {(γ 1 ,δ 1 ,γ 3 ,γ 2 ,δ 2 , γ 4 ): γ 1 ,γ 2 ,γ 3 ,γ 4  εΣ;δ 1 ,δ 2  εΔ}. Also, each attribute transfer function is of the form β:A→A and each application condition is a constraint of the form η:A→T/F. Starting from S, the set of all the graphs that can be generated by repeated applications of the productions in P is called the language generated by grammarΓ. If the left hand side of each production is a single nonterminal, the language is said to be context-free. 
     Let G rem  be the remainder graph of G constructed by removing graph g l  and all the edges connecting to it from G. Assuming the condition η is satisfied for the production p, the rewriting step can be defined as follows: First, g l  (or a graph isomorphic to g l ) is replaced with g r  (or a graph isomorphic to g r ). Next, g r  is glued into G rem  using the embedding relation α in the following manner: An edge with label δ 1  that connects a node ν 2  εg l  with label γ 2  to a node ν 4  εG rem  with label γ 4  is replaced by an edge with label δ 1  that connects a node ν 1  εg r  with label γ 1  to a node ν 3  G rem  with label γ 3 . The new graph G&#39; constructed as such is said to have been derived from G using the production p, ##EQU1## Finally, the node attributes for all the nodes in G&#39; are calculated using the functionsβ. The derivation process can be continued until all the nodes remaining in the graph belong to the terminal alphabet Σ T . 
     Given a graph G and a grammarΓ, parsing is the task of determining whether G belongs to the language generated by Γ. There are two general parsing strategies. In bottom-up parsing, G is reduced to the start symbol S by reverse application of the productions in P whereas in top-down parsing symbol S is expanded by forward application of the production in P until graph G is generated. Bottom-up parsing requires the replacement of each subgraph g r  in G by a graph g l . Locating a subgraph g r  (or a subgraph isomorphic to it) in G is a NP-complete problem commonly known as subgraph isomorphism, i.e. its solution is computationally expensive. Top-down parsing is as computationally expensive since generally backtracking will be needed when there are productions in P that have the same left-hand side. Parsing can become more complicated if it is required to find a best solution amongst a set of possible parses. Indeed, this is the case if the underlying grammar Γ is ambiguous, i. e. more than one sequence of the productions can generate the same graph. This is often true in document recognition applications where there are many possible ways to generate an entity, e. g. a table, from a set of related data. 
     To parse efficiently, restrictions are typically placed on the underlying grammar. A common type of restriction is the use of application conditions. The languages generated as such are known as controlled languages. Application conditions are used to limit the complexity of the search in the host graph by restricting the number of nodes or edges that are considered. For example, color or font attributes can restrict the search area for locating headings and captions. Prioritizing the production set based on the informal knowledge of the application domain is another method of reducing the complexity of parsing. The grammars that explicitly maintain an ordering of their productions are known as ordered grammars. By assigning higher priorities to the productions that describe more typical behaviors in an application, the parsing algorithm attempts to recognize those behaviors when it encounters multiple possibilities in extending the parse. For example, in a document recognition application, it might be desirable to extend the parse horizontally (vertically) first when reading a paragraph (a table). Priorities can also be assigned to the most specific entities in a hierarchical structure. This is most useful when the language is ambiguous. For example, it may be decided if an structure is a list and then decided if a it is a bulletined list or an index list. 
     Having presented a formal terminology for describing graphs, a new system for document structure recognition based on a graph rewriting paradigm is now disclosed. The preferred embodiment comprises four subsystems or subprocesses, namely segmentation, graph construction, entity recognition and graph rewriting. Referring to FIG. 1, displayed therein is an block diagram of a system implementing the present invention. It will be further appreciated that the present invention preferably operates on a programmable data processing system. A data processing system capable of executing code for carrying out the various processes of the present invention includes, for example a PC-based system having at least the capability of an lntel™80386 processor, at least 4 Megabytes of RAM and operating Windows™3.1 or higher. The order of operations is as follows: first, at process 40 the segmentation subsystem identifies textual and image document parts; then, the graph construction module 50 builds the layout graph of the document using the segmented parts; next, at process 60 the entity recognition subsystem tags each of the text parts with a label from the document node alphabet; and finally, at process 70 the graph rewriting system identifies the document structure 85 by manipulating the entities of the labeled graph. The input to the system is a document 35 that may be a scanned raster or PDL document image. 
     The grammatical basis in design of this system lends itself to a modular architecture that enables the interplay between the entity recognition and graph rewriting subsystems. This interplay can be manipulated toward increased system efficiency based on the observation that while extending the grammar productions to encompass various low-level entity recognition tasks increases the completeness and generality of the system at the cost of increased parsing complexity, confining them to a limited set of high-level rewriting tasks increases the complexity of the entity recognized at the cost of less manageable overall control strategy. By providing an abstraction and a set of well defined interfaces that enable this interplay, it is possible to provide a control strategy that allows an external recognition module to carry out the same task as a grammar production. This allows for use of various advance recognizers within a controls modular architecture. In the remainder of this section, each of the above subsystems is discussed in more detail. 
     The segmentation subsystem, a set of segmentation modules, divides the document image into contiguous areas of text, line-drawings, images and halftones. Even though there are no restrictions placed on the segmentation modules, the output of this stage is required to be a list of nonoverlapping entities. These entities make up the nodes of the input graph for the rewriting system and each will be labeled by a different character of the rewriting alphabet as discussed below. Each entity is required to have a bounding box. Other attributes such as font type in case of text, curve type in case of a line-drawing, or color map in case of an image can be associated with each entity by the segmentation modules. The text output of the segmentation subsystem is allowed to be at different levels of granularity for different entities. Thus, it is most often the case that the segmentation output list contains a mix of individual characters, word fragments, lines and entire text blocks. In addition, since the present invention is intended to deal primarily with raster text input, the system preferably allows for an OCR module to provide the actual text content prior to text entities. As will be shown, this attribute is not necessary. The required segmentation list output format and the suggested attributes can also be extracted from a PDL input. This allows for a uniform treatment of all document images beyond some elementary preprocessing stages. 
     The input graph for the rewriting subsystem is constructed prior to entity labeling. Graph nodes are constructed using the entities from the previous stage. Graph edges are constructed based on establishing a set of geometric relations between entity bounding boxes. For the initial graph, an edge is constructed between a pair of nodes if any of the four relations left --  of(), right --  of(), top --  of(), or bottom --  of() holds between the two. Referring to FIG. 2, depicted therein is a typical document layout graph 100, where the relations are represented by symbols L, R. B, and T. For example, entities N1 and N2 have the relations B, represented by reference numeral 102, and T, represented by reference numeral 104. Each node in this graph keeps track of its neighbors on each side in an ordered list. Moreover, provisions are made to deal with imperfections of segmentation. The computational complexity of the graph construction is on the order of n 2  where n is the number of the entities. 
     Prior to graph rewriting, document entities are labeled. The output of the segmentation subsystem identifies two fundamental layout entities, i.e., text regions and image regions. The entity recognition subsystem further refines the text regions&#39; labels according to their size. These entities comprise the initial document alphabet; they are: {C, W. L, TR, IR}, where C, W, L, TR and IR respectively represent a character, a word, a line, a text region and an image region. These entities obey a hierarchical structure as shown in FIG. 3. 
     The hierarchical entity structure of FIG. 3 is well suited for a grammatical reconstruction. Indeed, there are rules in the current system that enable the construction of an entity from its constituents. However, these rules are only triggered if more efficient external modules for recognizing the same entities are not available. This concept, namely making provisions for an external module to carry out the same task as intended by a grammar production, is present throughout the recognition system of the present invention. This allows for a powerful abstraction and a resulting modular architecture. For example, when there is a highly efficient liner module, an algorithm that can line up characters into lines directly and bypass the word recognition stage, it replaces the grammar rules for building lines. The system presented here is intended to take advantage of many existing external modules in its architecture. 
     In addition to the above refinement, the entity recognition subsystem classifies the text regions according to their logical identity. This classification produces the additional entity labels {P, COL, TAB, IDXL, JT, UT} where P, COL, TAB, IDXL, JT, and UT respectively represent paragraph, column structure, tabular structure, indexed list, jagged text and unformatted text region. These seven labels further refine and replace the layout label TR (text region) in the earlier alphabet; thus resulting in a pre-rewriting document alphabet that contains {C, W, L, P, COL, TAB, IDXL, JT, UT, IR}. The above classification is done using external modules that are designed using linear and second order statistics as well as neural networks. 
     An object of the graph rewriting subsystem in the present invention is the extraction of the logical structure of a document from its layout graph. As explained previously, the directed layout graph is generated following a segmentation operation. In this section, the rewriting system is discussed in terms of its four constituents: 1) production rules, 2) embedding functions, 3) attribute transfer functions, and 4) application conditions. Next, a scheme for controlling the rewriting system is presented, where the scheme is dependent on the application order of the rules. 
     Each rewriting production rule, of the form g l  →g r , specifies an ordered pair of graphs where the ordering implies that an isomorphic instance of the subgraph g r  in a host graph can be replaced with an isomorphic instance of the graph g l . For example, consider the rewrite rule depicted in FIG. 4. Referring to FIG. 4, rewrite rule 130 states that an occurrence of a graph of the form represented on the right hand side of FIG. 4, where it contains two nodes 132 and 134 with column labels and two directed edges between the two nodes with labels left (136) and right (138), can be replaced in a host graph with an occurrence of a nonterminal labeled table (140). This rule is said to be context-free since the left-hand side of the production only contains a nonterminal. An application of this rule to the layout graph of FIG. 2 is shown in FIG. 3. 
     Referring now to FIG. 5 in conjunction with FIG. 2, the node 150 labeled table in FIG. 5 replaces the graph representing two adjacent columns (106 and 108) in FIG. 2 as follows: first a search is made to locate a single node ν 1  that has a column label in the host graph of FIG. 2, then the left, L, and the right, R, edges of ν 1  are identified, if another node ν 2  with a column label adjacent to either edge (the left-hand side of the FIG. 4 is symmetric) exists, the entire subgraph containing ν 1 , ν 2 , and the adjoining L and R edges is cut off from the host graph and is replaced with the node 150 labeled table. To complete the rewrite, the replacement node needs to be connected to the remaining host graph using the embedding relations and its attributes need to be calculated. These remaining steps are discussed in the following sections. 
     A rewrite rule can also be used to label the entities in the host graph and provide additional edges. These rules are typically denoted as context-sensitive. For example, referring to FIGS. 6 and 7 in conjunction with FIG. 2, an application of the rewrite rule 180 illustrated in FIG. 6 to the host graph of FIG. 2 results in assigning the logical label of HEADER to node N4 as depicted in FIG. 7 by reference numeral 200. Two additional edges, HEAD (202) and SUBJ (204), are also added the host graph providing logical inferences between the TABLE (150) and HEADER (200) entities. 
     An exemplary set of rewrite rules that may be used in the current system are listed in in the following description and in Appendix A. The following description is directed to a discussion of exemplary Rules 1 and 2, whereas Rules 3-5 are included in the Appendix and are understood to be read in conjunction with FIGS. 14-16, respectively. 
     The embedding relations associated with each rewrite rule g l  →g r  specify how the new subgraph g l  is connected to the remainder graph of the host graph G, i e. G rem , after g r  is removed. Using the notation developed earlier, the set of embedding relations associated with each rule can be partitioned in two, IN and OUT, each containing five-tuples of the form (γ 1 ,δ 1 ,γ 3 ,γ 2 ,δ 2 ,.gamma. 4 ). 
     Referring again to FIG. 4, consider the embedding for the rewrite rule 130: ##EQU2## 
     The set operators ∪, ∩, *, and  - , with implied logical definitions of EITHER, EACH, ANY, and NOT respectively, have been used in the above expressions to make the representation compact. Each embedding relation is interpreted by establishing a correspondence between the node labels in the host graph G and the vertices indicated in the rewrite rule. For instance, the first OUT embedding relation, i. e. (2, L, *, 1, L, *), in view of the application of the above rule to the host graph of FIG. 2 is interpreted as follows: First a subgraph isomorphic to the right-hand side of the rule is located in the host graph. This is indicated by the shaded area in FIG. 5. Next, a correspondence is made where the vertex labels 2 and 3 in the above rule expressions represent host graph nodes ν 1  and ν 2  respectively as illustrated in FIG. 2. Then, (2, L, *, 1, L, *) indicates that any outgoing edge with label L from the vertex ν 1 , i.e. 2, of the g, in the host graph to any node, i. e. *, of the remainder graph G rem  should be replaced by a new edge with label L from node 1 of g l  (i. e. the new node in the host graph with label TABLE) to that same node. An example of this embedding relation is the replacement of the outgoing edge with label L from ν l  to N1 in FIG. 2 with the outgoing edge with label L from TABLE to N1 in FIG. 5. Similarly, other relations in expressions 1 and 2 can be interpreted in the same manner. For example, (3, L, 2, 1, L, 2) replaces any outgoing edge with label L from ν 2  in FIG. 2 with an outgoing with label L as long as that edge is not a directed to node ν 1  in G rem , and in case of(2∪3, T, *, 1, T, *), the outgoing edge T is established once if that edge is directed to a node in G rem  from any one of ν 1  or ν 2 . 
     Most embedding relations can be partitioned into two distinct parts: one that establishes the geometric and one that establishes the logical relations between the entities. The relations presented for the rewrite Rule 1 of FIG. 4 only manipulated the geometric edges. An example of the type of the embedding relations that introduce logical edges into the host graph is shown by rewrite Rule 2 (reference numeral 180) in FIG. 6. ##EQU3## The application of the above rules to the host graph of FIG. 2 introduces two additional logical edges as shown in FIG. 7. 
     In practice, the rewrite cost of replacing g l  with g r  in the host graph of FIG. 2 can be reduced by rewriting the part of the graph according to the rule 130 in FIG. 4 and then relabelling node N4 to HEADER and inserting additional edges connecting HEADER and TABLE with labels HEAD and SUBJ accordingly. This process is sometimes referred to as gluing in the graph grammar literature. To enable gluing, the sixth and the ninth OUT embedding relations have been introduced in Rule 2. 
     The application conditions associated with each rewrite rule specify when that rule is applicable. These conditions are typically expressed as constraints or predicates on the node and edge attributes and are typically derived based on a set of common document formatting conventions. The conditions on a rule are checked before the graph is to be rewritten. In the following discussion some of the application conditions used in a preferred embodiment of the system are described. 
     The single condition that is tested prior to the application of each rule g l  →g r  is to maintain the topological integrity of the document graph stated earlier. This condition states that the bounding box of the graph g l  should not overlap with the bounding boxes of any of the nodes in G rem . For example, this constraint denies the application of a rule that attempts to rewrite the subgraph containing the nodes ν 1  (106) and N4 (112) in FIG. 2 since the bounding box of the resulting graph will intersect (overlap) an existing node, i. e. node ν 2  (108), in the host graph. This rule was designed to avoid the case of overlapping entities in the initial design of the system. This constraint is independent of the node labels and only depends on the geometric attributes of the nodes. The following pseudocode diagram explains how this constraint is represented. Notice that the bounding box of g l  is calculated by an attribute transfer function and is discussed hereafter. 
     
         ______________________________________                                    
single_mergeable(g.sub.l, g.sub.r, G)                                     
temp.sub.-- node ← make.sub.-- node( )                               
temp.sub.-- node→bbox ← g.sub.l →bbox                  
temp.sub.-- node→nearest.sub.-- neighbor ← g.sub.r →nea
rest.sub.-- neighbor                                                      
if overlap (temp.sub.-- node, temp.sub.-- node→nearest.sub.--      
neighbor)                                                                 
return FALSE;                                                             
return TRUE;                                                              
______________________________________                                    
 
    
     Another application condition that imposes a structural constraint on graph rewriting is alignment. This constraint checks whether the text lines in a horizontal merge, or column structures in a vertical merge, are aligned. This is accomplished via a single abstraction that measures the extent of alignments between two sequences of line segments or intervals. The instantiation of this constraint for a horizontal merge deals with the sequence of line-height intervals for the text lines in each node and for a vertical merge deals with the sequence of column-width intervals for the columns in each node. Consider two interval sequences I 1 , and I 2 . Let each sequence I j  be defined as: 
     
         I.sub.j ={i.sub.jk = a.sub.jk, b.sub.jk):a.sub.jk &lt;b.sub.jk ≦a.sub.jk+l, k=0, . . . , N.sub.j }j=1,2           Eq. 1 
    
     Then, the alignment metric can be expressed in the following manner: ##EQU4## 
     The symbols ∪ and .OR right.represent the interval operators of overlap and containment respectively. These operators are designed to be statistically robust against document anomalies such as page skew or noise. For example, interval overlaps of a few pixels are disregarded. The containment operator has a higher precedence than the overlap operator in the above formulation. Given the cost metric (alignment--cost, Eq. 2) defined above, vertical and horizontal alignment 
     
         ______________________________________                                    
horizontal.sub.-- alignment(ν.sub.1, ν.sub.2)                       
if alignment.sub.-- cost(ν.sub.1 →lines, ν.sub.2 →line
s)                                                                        
        return FALSE;                                                     
return TRUE;                                                              
and                                                                       
vertical.sub.-- alignment(ν.sub.1, ν.sub.2)                         
if alignment.sub.-- cost(ν.sub.1 →columns, ν.sub.2 →co
lumns)                                                                    
        return FALSE;                                                     
return TRUE;                                                              
______________________________________                                    
 
    
     conditions for two graph nodes ν l  and ν 2  can be expressed by the following two functions: 
     Application conditions can also be designed to check the validity of certain logical combinations. For example, a simple predicate can be constructed that prohibits the merging of graph nodes if any of them is a paragraph. This reaffirms the perception that a paragraph is an atomic document logical entity that does not combine with other document entities. Simple predicates can also be used to identify such entities as figures or halftones that are recognized at previous stages as nonmergeable. These entities, although nonmergeable, can be used in the manner indicated by the rule in FIG. 4 to label other entities. 
     The attribute transfer functions associated with each rule g l  →g r  compute the attributes of the graph g l  based on the attributes of the graph g r  and the host graph G. There are two distinct mechanisms for transferring attributes: inheritance and synthesis. Examples of inherited types of attributes include font face of the characters and the actual text content of the lines. These attributes can be transferred directly to the word entity made from those characters or the paragraph entity made from those lines. The transfer mechanism in this case is an identity mapping. The synthesized attributes, on the other hand, are constructed using functional mappings. The bounding box of an entity is an example of the type of an attribute that is synthesized. The is following function shows how the bounding box of g l  is constructed for the rewrite rule in FIG. 4. 
     
         ______________________________________                                    
construct.sub.-- boundingbox(g.sub.l, g.sub.r)                            
        g.sub.l → lfedge ← MIN (g.sub.r → lfedges)     
        g.sub.l → rtedge ← MAX (g.sub.r → rtedges)     
        g.sub.l → tpedge ← MIN (g.sub.r → tpedges)     
        g.sub.l → btedge ← MAX (g.sub.r → btedges)     
        return g.sub.l ;                                                  
______________________________________                                    
 
    
     The synthesis of other attribute types requires more sophisticated procedures. For example, merging of two interval sets is required in order to construct the column structure of a TABLE entity. For the rewrite rule shown in FIG. 4, this reduces to adjoining two line intervals. However, when two tables are combined vertically, a more general procedure is used to construct the resulting column structure. 
     As discussed previously, there are two principal strategies for controlling the graph rewriting process: application conditions and ordering of the productions. The present invention utilizes both capabilities. The following three considerations are taken in designing the control strategy. First, the order of the productions is horizontally biased. In other words, if a horizontal rule is applicable, it will be used prior to any vertical rule. This bias was designed based on empirical knowledge that most tables obey the horizontal reading order. Second, if there are any application conditions that are common to a set of productions, they are tested prior to the rule application. Third, whenever possible, parsing is continued at the point of last rewrite in order to minimize the complexity of a search associated with subgraph isomorphism. This is justified since rewriting the graph is what is sought not to minimize the graph to a single start symbol. If parsing cannot be continued at the point of last rewrite, a search is made to locate the next eligible node. To comply with the first consideration, the productions are partitioned into four categories, each corresponding to one of L, R, T or B directions. It is often the case that the same production is in multiple partitions. The combination of above strategies results in the following control mechanism. Let G be a graph and ν and ν&#39; be nodes, then the top-level control strategy can be expressed as follows: 
     
         ______________________________________                                    
parse(G, v)                                                               
if ν&#39; = REWRITE (G, ν, left.sub.-- productions);                    
if ν&#39; = REWRITE (G, ν, right.sub.-- productions);                   
if ν&#39; = REWRITE (G, ν, top.sub.-- productions);                     
if ν&#39; = REWRITE (G, ν, bottom.sub.-- productions);                  
else ν&#39; = SELECT.sub.-- NEXT(G)                                        
parse (G, ν&#39;);                                                         
______________________________________                                    
 
    
     This control strategy is carried through a recursive function that terminates when there are no more rewrites possible. The engine that powers the control mechanism is the REWRITE() function. This function first tests all the common application conditions. These are typically conditions that preserve the structural integrity of the graph and are common to an entire set of productions. 
     
         ______________________________________                                    
rewrite (G, ν, production.sub.-- set)                                  
/* apply production common application conditions */                      
paragraph(ν);  return FALSE;                                           
/* test each production */                                                
for each production p: g.sub.l → g.sub.r in production.sub.-- set  
g.sub.r ← instantiate (right.sub.-- hand (p));                       
IF NOT single.sub.-- mergeable (g.sub.l, g.sub.r, G) return FALS          
/* apply production specific application conditions */                    
for each ν&#39; in g.sub.r ; IF paragraph (ν&#39;); return FALSE            
/* if all conditions are satisfied, rewrite the graph */                  
detach (g.sub.r, G);                                                      
embed (g.sub.l, G);                                                       
transfer.sub.-- attributes (g.sub.l, g.sub.r, G);                         
return (g.sub.l);                                                         
______________________________________                                    
 
    
     It then goes through an ordered set of productions and rewrites the graph based on the first production that is applicable. This function returns the rewritten node, g l  in the case of a context free grammar, as the point of last rewrite. If g l  is a graph itself, an appropriate node of the rewritten graph is returned. The rewrite function takes advantage of the direction of the actual parse to simplify some of its operations. The following pseudocode represents the rewrite engine: 
     The rewrite engine starts with testing all the application conditions that are common to all productions. For example, if the node at the point of rewrite is a paragraph, rewrite is aborted. The engine will then go through the ordered set of productions and checks all the production specific conditions. For example, if it is required to check for horizontal or vertical alignment between any two nodes, the test is performed. Finally, if conditions are satisfied, g r  is detached from graph G, g l  is embedded in G, and new attributes are transferred. For example, a bounding box attribute is calculated at this point. 
     The system proposed herein has been developed and integrated within Xerox TextBridge™ product. Referring to FIGS. 8--13, there are illustrated various sample document images processed in accordance with the present application to recognize tables therein. The shading in the output images (8B,9B and 10B) indicates column structure. In particular, referring to FIGS. 8 and 9, bitmap image 220 contains at least two image regions 280 and 281 representing portions of columns therein. Applying rewrite Rule 1 to regions 280 and 281, the sub-columns (shown as regions 280&#39; and 281&#39; in FIG. 9) are combined into a sub-table and eventually into a table region 250 as depicted in image 222 of FIG. 9. Although the application of rewrite rules as described herein are not specifically illustrated in the TextBridge product during operation, the rewriting operations are executed by the data processing system to identify the regions. 
     Referring next to FIGS. 10 and 11, depicted therein are images 260 and 262 that are used to illustrate the application of rewrite Rule 5 contained in the Appendix. Specifically, image 260 contains two table regions 291 and 292, and a header region 290. As seen by the representation of the rule in FIG. 16, the table regions 291&#39; and 292&#39; of FIG. 11 are combined with header region 290&#39; to form a larger table region 295. Lastly, FIGS. 12 and 133 illustrate the application of rewrite Rules 3 and 4. Referring to FIG. 12, displayed therein is image 296 having a table region 300 and a row region 301. Applying rewrite Rule 4 to associated regions 300&#39; and 301&#39; in FIG. 13, the two regions are combined into a table 305. Continuing to refer to FIG. 13, by applying rewrite Rule 3, the regions 310 and 307 are combined to form larger region 310. 
     In recapitulation, the present invention is a method for recognizing tables in documents. It begins by building a layout graph from segmented blocks of a document. The graph captures the geometric relations between the blocks. The present invention then proceeds to tag the individual blocks with a set of primitive of labels. Finally, it uses a set of rules to rewrite the layout graph. The output of this process is another graph whose entities are constructed by merging the primitive entities in the layout graph. The rewrite rules for this process are designed based on document knowledge and general formatting conventions. The system is applicable to a PDL document as well as a raster document with proper preprocessing. The system works primarily by using geometric cues. The text content of the document is not used. 
     It is, therefore, apparent that there has been provided, in accordance with the present invention, a method for recognizing tables in document images. While this invention has been described in conjunction with preferred embodiments thereof, it is evident that many alternatives, modifications, and variations will be apparent to those skilled in the art. Accordingly, it is intended to embrace all such alternatives, modifications and variations that fall within the spirit and broad scope of the appended claims. ##EQU5##