# Patent

## Title
Methods and apparatus for obtaining structured information in fixed layout documents

## Abstract

The present application discloses a method and an apparatus for obtaining structured information in a fixed layout document to improve the structuring speed for information management of a fixed layout document. The method may comprise: determining initial page number information corresponding to current directory entry of the document; segmenting first article content of a page corresponding to the initial page number information into at least one structured-characters-block; searching in each structured-characters-block for a first structured-characters-block which matches with name strings of the current directory entry, and obtaining first position information about where the first structured-characters-block is located in the first article content; and obtaining initial position information of the current directory entry and end position information of the previous directory entry based on the first position information.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is a 35 USC §371 National Stage application of International Application No. PCT/CN2012/086137 filed Dec. 7, 2012, which claims the benefit of priority to China Patent Application No. 201110409463.X filed Dec. 9, 2011. The disclosure of each of the prior applications is considered part of and is incorporated by reference in the disclosure of this application.
TECHNICAL FIELD
The present application relates to a technical field of information processing, in particular, to a method and an apparatus for obtaining structured information in a fixed layout document.
BACKGROUND
For informatization management of book fixed layout documents, it is required to structure each fixed layout document, such that structured information of each fixed layout document can be obtained to form corresponding directory data. Currently, the formed directory data of the fixed layout document may only include name strings and an initial position of each directory entry, but does not include an end position of each directory entry as well as a specific area where the name of each directory entry is located in the document.
In this regard, the current structured information of the fixed layout document are incomplete, and thus the specific initial and end positions corresponding to each directory entry cannot be determined according to the current directory data. Therefore, the specific directory entry of the fixed layout document cannot be read in a layout mode and a streaming mode. That is, it does not satisfy the diversified demands.
Accordingly, during a process of structuring each fixed layout document, more complete structured information of each fixed layout document need to be obtained. Generally, the fixed layout document may be structured manually, that is, contents of each directory entry in the fixed layout document need to be read and analyzed in order to obtain the required structured information manually. For an information management of a large number of fixed layout documents, there must be some errors due to manual limitations, such as intelligence or physical power. Furthermore, manual speed is relatively slow. Therefore, the accuracy and speed for obtaining the structured information is affected.
SUMMARY
The present application intends to provide a method and an apparatus for obtaining structured information in a fixed layout document to improve the structuring speed for a fixed layout document in information management.
According to one embodiment of the present application, a method for obtaining structured information in a fixed layout document is provided. The method may comprise:

    
    
        determining initial page number information corresponding to a current directory entry of the document;
        segmenting, according to content attributes, a first article content of a page corresponding to the determined initial page number information into at least one structured-characters-block;
        searching for a first structured-characters-block which matches with name strings of the current directory entry in each segmented structured-characters-block, and obtaining first position information about where the searched first structured-characters-block is located in the first article content; and
        obtaining initial position information of the current directory entry and end position information of a previous directory entry based on the obtained first position information.
    
    


According to another embodiment of the present application, an apparatus for obtaining structured information in a fixed layout document is provided. The apparatus may comprise a determining unit, a segmenting unit, a matching unit and an obtaining unit. The determining unit may be configured to determine initial page number information corresponding to current directory entry of the document. The segmenting unit may be configured to divide a first article content of a page corresponding to the initial page number information into at least one structured-characters-block. The matching unit may be configured to search for a first structured-characters-block which matches with the name strings of the current directory entry in each structured-characters-block and to obtain the first position information t. The obtaining unit may be configured to obtain initial position information of the current directory entry and end position information of the previous directory entry based on the first position information.
In the embodiments of the present invention, the first article content of the page corresponding to the initial page number information may be segmented into at least one structured-characters-block, the first structured-characters-block which matches with name strings of the current directory entry in each structured-characters-block will be searched, and the first position information may be obtained. Then, the initial position information of the current directory entry and the end position information of the previous directory entry may be determined based on the first position information. Therefore, the structured information of the fixed layout document may be obtained by analyzing and matching the article content of a particular page. Hence, the structuring speed of the fixed layout document may be faster



BRIEF DESCRIPTION OF THE DRAWING
FIG. 1 is a flowchart illustrating a method for obtaining structured information of a fixed layout document according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a searching process according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating directory data information of a fixed layout document according to an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating the updated directory data information of the fixed layout document according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating the structured data information of the fixed layout document according to an embodiment of the present application; and
FIG. 6 is a structured diagram illustrating an apparatus for obtaining structured information in a fixed layout document according to an embodiment of the present application.



DETAILED DESCRIPTION
According to embodiments of the present invention, contents on a particular page are analyzed and matched to obtain structured information of the fixed layout document. Therefore, the structuring speed of the fixed layout document can be faster.
Referring to FIG. 1, a process for obtaining structured information of a fixed layout document according to an embodiment of the present invention may include the following steps.
Step 101: determining initial page number corresponding to the current directory entry of the document.
For an information management of the fixed layout document, the directory data information of the fixed layout document has been loaded. The directory data information may include hierarchical relationship, name strings of a directory entry as well as the initial page number corresponding to the directory entry. The directory data information may be described through a XML file format or other customized TXT file format or EXCEL file format.
In this manner, a specific directory entry, which needs to be read in a layout mode and a streaming mode, may be determined as the current directory entry. Or, any directory entry of the directory data information may be determined as the current directory entry, and the initial page number corresponding to the current directory entry may be found from the directory data information.
According to an embodiment of the present application, in order to improve an accuracy for obtaining the structured information, effectiveness of the directory data information of the loaded fixed layout document, such as the hierarchical relationship of the directory entry and effectiveness of the initial page number of the directory entry etc., may be analyzed before determining the initial page number corresponding to the current directory entry.
Step 102: segmenting a first article contents of a page corresponding to the initial page number information into at least one structured-characters-block.
Generally, the fixed layout documents have common features, for example, differences of a font size and a format between characters of directory and characters of main body of the document may be large. Additionally, differences between a first line-spacing between directories and the main body of the document and a second line-spacing among the characters of main body of the document may also be large. Therefore, in embodiments of the present application, the first article contents may be segmented into one, two or multiple structured-characters-blocks according to the differences of the font size and the format and according to the difference between the first line-spacing and the second line-spacing.
Accordingly, the content attribute information may include character information and line-spacing information. In embodiments of the present application, the structured-characters-blocks may include structured-character-paragraphs or structured-character-lines In this regard, the first article contents may be segmented into respective structured-character-paragraphs or structured-character-lines by automating them into segments or lines, according to the differences of said font size and said format and according to the difference between said first line-spacing and said second line-spacing.
Step 103: searching in each structured-characters-block for a first structured-characters-block which matches with the name strings of the current directory entry.
In embodiments of the present application, the first structured-characters-block which matches with the name strings of the current directory entry may be searched in each structured-characters-block by using a preset matching module. The matching module may be varied such that the searching process may also be varied.
Step 104: obtaining first position information about where the first structured-characters-block is located in the first article content.
Since the first structured-characters-block matched with the name strings of the current directory entry has been found, the first position information about where the first structured-characters-block is located in the first article content may be obtained. The first position information may include one or more selected from a group consisting of the page number of the page on which the first structured-characters-block is located, coordinate information, coordinate information of a transverse start line and coordinate information of a transverse end line.
Step 105: obtaining initial position information of the current directory entry and end position information of the previous directory entry based on the first position information.
Generally, the first position information may be used to determine the initial position information of the current directory entry, and the position information of the previous structured-characters-block of the first structured-characters-block may be used to determine the end position information of the previous directory entry.
However, when the first position information refers to a position where the end structured-characters-block is located in the first article content, the second article content of next page of the page corresponding to the initial page number information may be segmented into at least one structured-characters-block according to the attribute information of the characters. Furthermore, the initial position information of the current directory entry may be determined based on the first position information and the position information about where an initial structured-characters-block is located in the second article content. That is, the initial position information of the current directory entry may be determined by combing the both position information as stated above.
When the first position information refers to a position where the initial structured-characters-block is located in the first article content, a third article content of previous page of the page corresponding to the initial page number information may be segmented into at least one structured-characters-block according to the attribute information of the character. Furthermore, the end position information of the previous directory entry may be determined based on the first position information and the position information about where the end structured-characters-block is located in the third article content. That is, the initial position information of the current directory entry may be determined by combing the both position information.
Accordingly, the structured information of the current directory entry can be obtained. At the moment, the directory data information of the fixed layout document can be updated, that is, in embodiments of the present application, the method may further include the following step 106.
Step 106: updating the directory data information of the fixed layout document according to the initial position information of the current directory entry and the end position information of the previous directory entry.
Here, the determined initial position information of the current directory entry and the end position information of the previous directory entry may be added to a XML document corresponding to the directory data information.
In embodiments of the present application, the directory data information of the fixed layout document may be updated again after the structured information of all the directory entries are obtained.
Therefore, the structured information corresponding to the directory entry may be obtained by analyzing and matching the first article content of the page corresponding to the initial page number, the second article content of the next page of the page corresponding to the initial page number information, or the third article content of the previous page of the page corresponding to the initial page number information. That is, the structured information of the fixed layout document may be obtained by analyzing and matching the article content of a particular page. Hence, the structuring speed of the fixed layout document may be faster.
In the step 103, since the matching module may be varied, the searching process for searching the first structured-characters-block matching with the name strings of the current directory entry in each structured-characters-block may be varied. For example, it may be searched directly in each structured-characters-block whether there is a structured-characters-block matched with each character in the name strings of the current directory entry. If the fixed layout document has a relative high quality, the searching process can be completed by this method. In the embodiment of the present application, in order to increase success rate of the matching, other matching modules may be added. Referring to FIG. 2, the specific searching process may include the following steps.
Step 201: searching in each structured-characters-block to determine whether there is a structured-characters-block matched with each character in the name strings of the current directory entry, if yes, the process goes to step 204. Otherwise, the process goes to step 202.
Step 202: searching in each structured-characters-block to determine whether there is a structured-characters-block matched with the name strings of the current directory entry by using regular expression, if yes, the process goes to step 204. Otherwise, the process goes to step 203.
Here, since the step 201 fails to meet the matching requirements, the structured-characters-blocks and the characters of the name character of the current directory entry which affect the matching, such as spaces, modifiers or other characters may affect the matching, may be removed.
Then, the processed characters may be matched according to the preset regular expression, and the regular expression is an equation for matching a class of a character string with a pattern. The structured-characters-block matching with the name character of the current directory entry can be obtained by using the equation to match.
Step 203: calculating matched degree between each structured-characters-block and the name character of the current directory entry by one-by-one character matching.
For example, if one structured-characters-block is matched with half of characters of the name character of the current directory entry, then the matched degree may be 50%. Otherwise, other matched degree may be used.
Step 204: determining whether the matched degree is larger or equal to a threshold, if yes, the process goes to step 205. Otherwise, the matching process fails. The threshold may be adjusted to achieve a higher matched degree based on actual typesetting situation of various batches of the fixed layout documents.
Step 205: determining a structured-characters-block with a corresponding matched degree as the first structured-characters-block.
Step 206: determining the searched structured-characters-block as the first structured-characters-block.
The structured-characters-block matched with the name character of the current directory entry can be found substantially through the above steps. In the embodiments of the present application, before the step 201, each structured-characters-block and the name strings of the current directory entry need to be normalized to full-width characters or half-width characters in order to facilitate the subsequent searching.
Embodiments of the present application are further described below with reference to the attached figures.
In the embodiment, the directory data information of the fixed layout document is shown in FIG. 3, “” may be taken as the name character of the current directory entry to describe, the process for obtaining the structured information of the fixed layout document may be discussed as below.
The initial page number corresponding to the current directory entry will be determined as “16”. And then the process may comprise: segmenting a first article content of page 16 into at least one structured-characters-block according to content attribute information; searching in each structured-characters-block for a first structured-characters-block which matches with the name strings of the current directory entry; and obtaining first information of position where the first structured-characters-block is located in the first article content. Here, the first position information may include: “ebookPageNum=“16” left=“1740” top=“396” right=“3016” buttom=“587” startVerticalPos=“396” end VerticalPos=“4082”.
Since the first position information refers to the position where the initial structured-characters-block is located in the first article content, the third article content of page 15 are segmented into at least one structured-characters-block according to its content attribute information, and the position information about where the end structured-characters-block is located in the third article content can be obtained. As the end structured-characters-block is not matched with the name character of the current directory entry, the position information about where the end structured-characters-block is located the third article content is taken as the end position information of the previous directory entry. For example, the end position information may include: ebookEndLPageNum=15, endvertiempos=2341 and so on. The first position information is taken as the initial position information of the current directory entry, for example, the initial position information may include: ebookPageNum=“16” left=“1740” top=“396” right=“3016” buttom=“587” startVerticalPos=“396” endVerticalPos=“4082”.
The process for analyzing and matching the second article content of the next page of the page corresponding to the initial page number is similar to the process above and thus is omitted herein.
With the above mentioned process, the structured information of each directory can be obtained. Finally, the initial directory data information of the fixed layout document may be updated based on the obtained structured information. FIG. 4 shows the updated structured directory data information.
In the embodiments of the present application, the article content information corresponding to the directory entry may be added to the directory entry corresponding to the updated structured directory data information in order to form structured data information of the fixed layout document, as shown in FIG. 5. Therefore, a system will scan automatically the structured data information of all fixed layout documents to segment and output them, respectively, such that a layout reading mode and a streaming reading mode for the specific directory entry of the fixed layout document of a book can be provided alone.
Based on the method for obtaining structured information in the fixed layout document, an apparatus for obtaining structured information of a fixed layout document may be provided, as shown in FIG. 6, and the apparatus may include a determining unit 100, a segmenting unit 200, a matching unit 300 and an obtaining unit 400.
The determining unit 100 may be configured to determine initial page number information corresponding to current directory entry.
The segmenting unit 200 may be configured to divide a first article content of a page corresponding to the initial page number information into at least one structured-characters-block.
The matching unit 300 may be configured to search in each structured-characters-block for a first structured-characters-block which matches with the name character of the current directory entry and to obtain first position information of the first structured-characters-block in the first article content.
The obtaining unit 400 may be configured to obtain initial position information of the current directory entry and end position information of the previous directory entry based on the first position information.
Specifically, the segmenting unit 200 is further configured to divide the first article content into at least one structured-characters-block according to the differences of the font size and the format between characters of directory and characters of main body of the document and according to the differences between the first line-spacing between directories and the main body of the document and the second line-spacing among the characters of main body of the document. The structured-characters-block may include a segment-structured-character or a line-structured-character.
Specifically, the matching unit 300 is further configured to search in each structured-characters-block to determine whether there is a structured-characters-block matched with each character in the name character of the current directory entry. If yes, the matching unit 300 determines the searched structured-characters-block as the first structured-characters-block. Otherwise, the matching unit 300 searches in each structured-characters-block whether there is a structured-characters-block matched with the name character of the current directory entry by using regular expression. If yes, the matching unit 300 determines the searched structured-characters-block as the first structured-characters-block. Otherwise, the matching unit 300 calculates matched degree between each structured-characters-block and the name character of the current directory entry by one-by-one character matching. When the matched degree reaches the preset threshold, the matching unit 300 determines a structured-characters-block with a corresponding matched degree as the first structured-characters-block.
The matching unit 300 may further be configured to unify each structured-characters-block and the name character of the current directory entry to full-width characters or half-width characters.
The obtaining unit 400 may further be configured to determine the first position information to the initial position information of the current directory entry, and to determine the position information of the previous structured-characters-block of the first structured-characters-block to the end position information of the previous directory entry.
The obtaining unit 400 may further be configured to divide a second article content of next page of the page corresponding to the initial page number information into at least one structured-characters-block according to the attribute information of the character, when the first position information refers to a position where the end structured-characters-block is located in the first article content. Furthermore, the obtaining unit 400 may be configured to determine the initial position information of the current directory entry based on the first position information and the position information about where the initial structured-characters-block is located in the second article content. Additionally, the obtaining unit 400 may further be configured to divide the third article contents of previous page of the page corresponding to the initial page number information into at least one structured-characters-block according to the attribute information of the character, when the first position information refers to a position where the initial structured-characters-block is located in the first article content. Furthermore, the obtaining unit 400 may be configured to determine the end position information of the previous directory entry based on the first position information and the position information about where the end structured-characters-block is located in the third article content.
In the embodiments of the present application, the structured information of the fixed layout document may be obtained by analyzing and matching the article content of a particular page. Hence, the structuring speed of the fixed layout document may be faster.
Furthermore, the searching process for searching the first structured-characters-block matching with the name character of the current directory entry in each structured-characters-block may be varied. If one matching manner fails, there are other matching manners, such that the success rate of matching can be increased.
In addition, during a process for structuring data of a large number of fixed layout documents, the matching process can be proceeded via a preset matching module without manual work so as to save a lot of manpower.
The foregoing is only preferred embodiments of the present application, and it is not intended to limit the present application. Moreover, it will be apparent to those skilled in the art that various modifications and variations can be made to the present application. Thus, any modifications, equivalent substitutions, improvements etc. within the spirit and principle of the present application should be included within the scope of protection of the application.

## Claims

1. A computer-implemented method for obtaining structured information of a fixed layout document on a computer comprising a processor, the method comprising:
determining, using the processor, initial page number information corresponding to a current directory entry of the document;
segmenting, using the processor and according to content attributes, a first article content of a page corresponding to the determined initial page number information into at least one structured-characters-block;
searching, using the processor, in each segmented structured-characters-block for a first structured-characters-block which matches with name strings of the current directory entry, and obtaining, using the processor, first position information about where the searched first structured-characters-block is located in the first article content; and
obtaining, using the processor, initial position information of the current directory entry and end position information of a previous directory entry based on the obtained first position information,
wherein the searching comprises:
searching, using the processor, in each structured-characters-block to determine whether there is a structured-characters-block matched with each character in the name strings of the current directory entry,
if there is a structured-characters-block matched with each character in the name strings of the current directory entry, determining, using the processor, the searched structured-characters-block as the first structured-characters-block;
if there is no structured-characters-block matched with each character in the name strings of the current directory entry, searching, using the processor, in each structured-characters-block to determine whether there is a structured-characters-block matched with the name strings of the current directory entry by using regular expression,
if there is a structured-characters-block matched with the name strings of the current directory entry by using regular expression, determining, using the processor, the searched structured-characters-block as the first structured-characters-block;
if there is no structured-characters-block matched with the name strings of the current directory entry by using regular expression, calculating, using the processor, a matched degree between each structured-characters-block and the name strings of the current directory entry by one-by-one character matching, and
determining, using the processor, a structured-characters-block with the calculated matched degree as the first structured-characters-block, when the calculated matched degree reaches a preset threshold,

wherein the step of obtaining initial position information of the current directory entry and end position information of the previous directory entry based on the first position information comprises:
when the first position information refer to a position where the end structured-characters-block is located in the first article content,
segmenting, according to character attributes, a second article content of next page of the page corresponding to the initial page number information into at least one structured-characters-block, and
determining the initial position information of the current directory entry based on the first position information and a position information about where the initial structured-characters-block is located in the second article content;

when the first position information refers to a position where the initial structured-characters-block is located in the first article content,
segmenting, according to the character attributes, a third article content of previous page of the page corresponding to the initial page number information into at least one structured-characters-block, and
determining the end position information of the previous directory entry based on the first position information and a position information about where the end structured-characters-block is located in the third article content.

2. The method according to claim 1, wherein the segmenting comprises:
segmenting the first article content into at least one structured-characters-block according to differences of a font size and a format between characters of directory and characters of main body of the document, and according to differences between: a first line-spacing between directories and the main body of the document, and a second line-spacing among the characters of main body of the document,
wherein the structured-characters-block comprises a segment-structured-character or a line-structured-character.

3. The method according to claim 1, wherein before searching in each structured-characters-block to determine whether there is a structured-characters-block matched with each character in the name strings of the current directory entry, the method further comprises:
unifying each structured-characters-block and the name strings of the current directory entry into full-width characters or half-width characters.

4. An apparatus for obtaining structured information in a fixed layout document, the apparatus comprising:
a memory that stores executable components; and
a processor, coupled to the memory, that executes the executable components to perform operations of the apparatus, the executable components comprising:
a determining unit configured to determine initial page number information corresponding to a current directory entry of the document;
a segmenting unit configured to divide a first article content of a page corresponding to the initial page number information into at least one structured-characters-block;
a matching unit configured to search for a first structured-characters-block which matches with the name strings of the current directory entry in each structured-characters-block, and to obtain first position information about where the searched first structured-characters-block is located in the first article content of the document; and
a obtaining unit configured to obtain initial position information of the current directory entry based on the first position information, wherein
the matching unit is further configured to determine whether there is a structured-characters-block matched with each character in the name strings of the current directory entry,
if there is a structured-characters-block matched with each character in the name strings of the current directory entry, to determine the searched structured-characters-block as the first structured-characters-block;
if there is no structured-characters-block matched with each character in the name strings of the current directory entry, to further search in each structured-characters-block to determine whether there is a structured-characters-block matched with the name strings of the current directory entry by using regular expression,
if there is a structured-characters-block matched with the name strings of the current directory entry by using regular expression, to determine the searched structured-characters-block as the first structured-characters-block;
if there is no structured-characters-block matched with the name strings of the current directory entry by using regular expression, to calculate a matched degree between each structured-characters-block and the name strings of the current directory entry by one-by-one character matching, and
to determine a structured-characters-block with the calculated matched degree as the first structured-characters-block, when the calculated matched degree reaches a preset threshold,

when the first position information refers to a position where the end structured-characters-block is located in the first article content, the obtaining unit is further configured to
divide, according to character attributes, a second article content of next page of the page corresponding to the initial page number information into at least one structured-characters-block, and
determine the initial position information of the current directory entry based on the first position information and a position information about where the initial structured-characters-block is located in the second article content;

when the first position information refers to a position where the initial structured-characters-block is located in the first article content, the obtaining unit is further configured to
divide, according to the character attributes, a third article content of previous page of the page corresponding to the initial page number information into at least one structured-characters-block, and
determine the end position information of the previous directory entry based on the first position information and a position information about where the end structured-characters-block is located in the third article content.

5. The apparatus according to claim 4, wherein the segmenting unit is further configured to divide the first article content into at least one structured-characters-block according to:
differences of a font size and a format between characters of directory and characters of main body of the document, and according to differences between: a first line-spacing between directories and the main body of the document, and a second line-spacing among the characters of main body of the document,
wherein the structured-characters-block comprises a segment-structured-character or a line-structured-character.

6. The apparatus according to claim 4, wherein the matching unit is further configured to unify each structured-characters-block and the name strings of the current directory entry into full-width characters or half-width characters.