Document paragraph position extraction method, electronic device and storage medium

The text outline and column information of PDF documents are determined through image processing technology, which solves the problem of inaccurate positioning of paragraphs in the prior art, and realizes the accurate segmentation and positioning of any type of PDF documents, which is suitable for WORD documents.

CN114495141BActive Publication Date: 2025-08-19CETC DIGITAL INTELLIGENCE TECH (BEIJING) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111526160.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-14
Publication Date
2025-08-19
Estimated Expiration
2041-12-14

AI Technical Summary

Technical Problem

In the prior art, when processing PDF documents, accurate paragraph position information cannot be obtained based on stream data analysis methods, and the OCR-based method has strong dependence on special characters and languages, resulting in misalignment of paragraph information.

Method used

By image processing of the document to be processed, the text outline and column information are determined, and the outline information is integrated for cleaning and column division, avoiding dependence on document language types and OCR tools, and improving the universality and accuracy of paragraph positioning.

Benefits of technology

It realizes accurate paragraph positioning of any type of PDF document, including scan generated or picture converted documents, improves the universality, accuracy and reliability of positioning, and is suitable for WORD documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114495141B_ABST
    Figure CN114495141B_ABST
Patent Text Reader

Abstract

The present invention provides a method, electronic device, and storage medium for extracting document paragraph positions. The method comprises: performing image processing on a page of a document to be processed to obtain a first image; determining text outlines in the first image based on non-blank areas included in the first image; determining whether the first image includes column information based on the first image and the text outlines included in the first image; and determining the document paragraph positions of the page of the document to be processed based on whether the first image includes column information. From an image processing perspective, the present invention cleans, columns, and segments the document to be processed by fusing outline information, thereby improving the universality, accuracy, and reliability of document paragraph position location.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a document paragraph position extraction method, electronic equipment and storage medium. Background Art

[0002] With the rapid development of digital publishing technology, the vast majority of journals and conference papers are published electronically. PDF (Portable Document Format) is a widely used electronic publication format for journals and papers due to its ability to directly convert Word or LaTeX documents, embed fonts, support highly compressed images, small file size for easy transfer, cross-platform display, ease of modification, and high security.

[0003] With the development of digital information technology, more and more document retrieval organizations are looking to use computers to automatically extract text from journal articles by segmenting them into paragraphs. Accurately segmenting paragraphs is both fundamental and crucial for accurate text extraction. Existing paragraph segmentation technologies fall into two categories: one analyzes the stream data within PDF documents to locate paragraph positions; the other uses OCR (Optical Character Recognition) to determine character positions and derive paragraph positions.

[0004] However, methods based on stream data analysis require that the stream data of a PDF document must contain text and paragraph information. However, in reality, the stream data in many PDF documents does not contain such information, such as PDF documents generated by a scanner or converted from images. Therefore, such methods cannot obtain accurate paragraph position information from such PDF documents.

[0005] Another OCR-based solution, however, is highly dependent on the accuracy of the OCR tool. For example, existing OCR tools have low accuracy in extracting the positional information of special characters such as punctuation, Greek letters, numbers, and symbols, which can easily lead to misplaced paragraph information. Furthermore, OCR accuracy is highly dependent on the language of the document; an OCR tool that works well for English documents may not work at all for Chinese documents. Summary of the Invention

[0006] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a document paragraph position extraction method, electronic device and storage medium.

[0007] Specifically, the present invention provides the following technical solutions:

[0008] In a first aspect, an embodiment of the present invention provides a method for extracting document paragraph positions, comprising:

[0009] Performing image processing on a page of the document to be processed to obtain a first image;

[0010] determining a text outline in the first image according to a non-blank area included in the first image;

[0011] determining, based on the first image and a text outline included in the first image, whether the first image includes column information;

[0012] The document paragraph position of the page of the document to be processed is determined according to whether the first image includes column information.

[0013] Furthermore, determining the outline of the text in the first image based on the non-blank area included in the first image includes:

[0014] determining a first contour information library included in the first image according to the non-blank area included in the first image;

[0015] The non-text contours included in the first contour information library are cleaned to determine the text contours in the first image.

[0016] Furthermore, determining a first contour information library included in the first image according to the non-blank area included in the first image includes:

[0017] performing binarization processing on the first image to obtain a binarized image;

[0018] Locating pixel points in a non-blank area of the binary image to establish a first pixel coordinate library;

[0019] The first contour information library included in the first image is determined by fusing contours and distinguishing disjoint contours through the first pixel coordinate library.

[0020] Furthermore, performing binarization processing on the first image to obtain a binarized image includes:

[0021] A dynamic threshold is calculated, and binarization processing is performed on the first image according to the dynamic threshold to obtain a binarized image.

[0022] Furthermore, cleaning non-text contours included in the first contour information library to determine text contours in the first image includes:

[0023] screening the contours in the first contour information library according to a first preset condition to locate text contours and non-text contours;

[0024] If a non-text contour exists, excluding the non-text contour from the first contour information database;

[0025] Count all text outlines and capture effective information images;

[0026] The page size of the effective information image is calculated, and all the character outline information is corrected and updated according to the page size.

[0027] Furthermore, determining whether the first image includes column information based on the first image and the text outline included in the first image includes:

[0028] In the effective information image, locate the outline of the text, determine the area except the outline of the text as a blank area, and establish a second pixel coordinate library to record the blank area information;

[0029] fusing contours, distinguishing disjoint contours, and establishing a second contour information library through the second pixel coordinate library;

[0030] In the second contour information database, contours that are close in adjacent directions are merged and sorted;

[0031] The contours in the second contour information library are screened according to a second preset condition to determine whether the first image includes column information.

[0032] Furthermore, determining the document paragraph position of the page of the document to be processed according to whether the first image includes column information includes:

[0033] If it is determined that the page does not have a column outline, the page is considered to be a single column; otherwise, within the valid information image, the text outline is divided into different text columns from top to bottom and from left to right according to the column outline;

[0034] In the same text column, in the horizontal direction, the text outlines whose distance is less than a first preset distance threshold are merged and sorted;

[0035] In the same text column, in the vertical direction, the text outlines whose distance is less than a second preset distance threshold are merged and sorted;

[0036] The document paragraph position of the page of the document to be processed is determined according to the sorted text outline information.

[0037] Furthermore, the document to be processed includes a PDF document or a WORD document.

[0038] In a second aspect, an embodiment of the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the document paragraph position extraction method as described in the first aspect are implemented.

[0039] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the document paragraph position extraction method as described in the first aspect.

[0040] According to the above technical solutions, the document paragraph position extraction method, electronic device, and storage medium provided in the embodiments of the present invention, from the perspective of image processing, clean up, divide columns, and segment paragraphs of the document to be processed by fusing contour information. This avoids the problems of existing methods requiring that the stream data of the PDF document must contain text and paragraph information, heavily relying on the accuracy of the OCR tool, and heavily relying on the language type of the document. This improves the universality, accuracy, and reliability of paragraph position positioning in PDF documents.

[0041] It should be noted that additional aspects and advantages of the present invention will be given in part in the following description, and in part will become apparent from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 is a flowchart of a method for extracting document paragraph positions provided by one embodiment of the present invention;

[0044] Figure 2 1 is a schematic diagram of an implementation process of a document paragraph position extraction method provided by an embodiment of the present invention;

[0045] Figure 3 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0047] As mentioned in the background, methods based on stream data analysis require that the stream data of a PDF document contain text and paragraph information. However, many PDF documents, such as those generated by scanners or converted from images, do not contain this information. Therefore, these methods are unable to accurately obtain paragraph location information from such PDF documents. Technical solutions based on optical character recognition (OCR) rely heavily on the accuracy of the OCR tool. However, existing OCR tools have low accuracy in extracting the location information of special characters such as punctuation, Greek letters, numbers, and symbols, which can easily lead to misplaced paragraph information. Furthermore, OCR accuracy is highly dependent on the document's language. An OCR tool that works well for English documents may be completely ineffective for Chinese documents. To address these shortcomings of existing methods, the present invention utilizes image processing to integrate contour information to clean, columnize, and segment the document. This method is effective for all types of PDF documents, including those generated by scanners or converted from images, and provides accurate positioning, independent of the document's language. Furthermore, it should be noted that the document paragraph location extraction method provided in this embodiment of the present invention can also be applied to Word documents where necessary. The document paragraph position extraction method and device provided by the present invention will be described in detail below through specific embodiments.

[0048] Figure 1 A schematic diagram showing a flow chart of a method for extracting document paragraph positions according to an embodiment of the present invention is shown. Figure 1 , the paragraph position extraction method provided by the embodiment of the present invention includes:

[0049] Step 101: Performing image processing on a page of a document to be processed to obtain a first image;

[0050] In this step, the document to be processed is divided into pages, and each page of the document is image-processed to obtain a corresponding first image. When converting the pages of the document to be processed into images, the image size can be adjusted to an appropriate size based on computing power.

[0051] In this step, the document to be processed can be a Word document or a PDF document. The PDF document here can be a horizontal PDF journal article, where each page in the PDF document corresponds to a single page in the journal article. The PDF document can be any type of PDF document, including those generated by a scanner or converted from an image. The page content can be black and white or color.

[0052] Step 102: determining the outline of the text in the first image according to the non-blank area included in the first image;

[0053] In this step, the first image corresponding to each page is converted into a two-dimensional grayscale image. The pixel value distribution of all pixels is comprehensively analyzed. The image is then binarized using either a global threshold or a local threshold such as the weighted mean or Otsu's algorithm. All black pixels are then located and a first contour information library is established.

[0054] In this step, first locate all pixel points with black pixel values and establish a first pixel coordinate library; then, according to preset conditions, merge the pixels that are close in the four directions of up, down, left and right into the same contour, and distinguish the contours that are not close, and establish a first contour information library. Then clean up the non-text contour information, and intercept the valid information image. Specifically, first organize the first contour information library and record it in a standardized form. Then, use the preset threshold to filter the size, area and other information of the contour, and define the contours that do not meet the conditions as non-text contours. If there are non-text contours, they are removed from the first contour information library, and the remaining contours are defined as text contours. Combine all text contours, calculate the minimum valid information image page size containing all text contours, and update the contour coordinate information in the first contour information library based on the boundary coordinates of the valid information image.

[0055] Step 103: Determine whether the first image includes column information based on the first image and the text outline included in the first image;

[0056] In this step, all white pixels in the obtained valid information image are located, and a second contour information library is established. Specifically, all white pixels in the valid information image are located first, and a second pixel coordinate library is established. If the pixel coordinates fall within the aforementioned non-text contours, they are removed from the second pixel coordinate library. Next, based on pre-defined conditions, pixels that are close in the four directions (upward, downward, left, and right) are merged into the same contour, while non-close contours are distinguished to establish a second contour information library. This second contour information library is then organized and recorded in a standardized format.

[0057] Then, the column outline is located and the text outline is segmented. Specifically, the size, area, and other information of the outlines in the second outline information library are screened using a preset threshold, and the outlines that meet the conditions are defined as column outlines. The column outline is located by screening the outline size and area.

[0058] Step 104: Determine the document paragraph position of the page of the document to be processed according to whether the first image includes column information.

[0059] In this step, the column outlines are located by screening the size and area of the outlines. If no column outlines exist, the page is considered a single column. Otherwise, within the valid information image, the text outlines are divided into different text columns from top to bottom and from left to right according to the column outlines.

[0060] In this step, for all text contours in the same text column, first, based on a preset threshold, all horizontally similar text contours are merged to form row contours. Dissimilar row contours should belong to different contours. Then, vertically, all similar row contours are merged to form segment contours. Dissimilar segment contours should belong to different contours. The final segment contour information is the extracted paragraph position information.

[0061] According to the above technical solution, the embodiment of the present invention starts from the perspective of image processing and cleans, divides columns and segments paragraphs of the document to be processed by fusing contour information. This avoids the problems of existing methods requiring that the stream data of the PDF document must contain text and paragraph information, heavily relying on the accuracy of the OCR tool, and heavily relying on the language type of the document. It improves the universality, accuracy and reliability of paragraph positioning in PDF documents.

[0062] Based on the content of the above embodiment, in this embodiment, determining the outline of the text in the first image according to the non-blank area included in the first image includes:

[0063] determining a first contour information library included in the first image according to the non-blank area included in the first image;

[0064] The non-text contours included in the first contour information library are cleaned to determine the text contours in the first image.

[0065] In this embodiment, when determining the outlines of text in the first image based on the non-blank areas included in the first image, the following methods can be used: determining a first outline information library included in the first image based on the non-blank areas included in the first image; and cleaning the non-text outlines included in the first outline information library to determine the outlines of text in the first image. Thus, this embodiment processes the non-blank areas in the first image to obtain all outlines, and then cleans the non-text outlines, thereby obtaining text outlines that are truly useful for paragraph segmentation, thereby improving the accuracy of paragraph extraction.

[0066] Based on the content of the above embodiment, in this embodiment, determining the first contour information library included in the first image according to the non-blank area included in the first image includes:

[0067] performing binarization processing on the first image to obtain a binarized image;

[0068] Locating pixel points in a non-blank area of the binary image to establish a first pixel coordinate library;

[0069] The first contour information library included in the first image is determined by fusing contours and distinguishing disjoint contours through the first pixel coordinate library.

[0070] In this embodiment, when determining the first contour information library included in the first image based on the non-blank area included in the first image, the means that can be used are: binarizing the first image to obtain a binary image; locating the pixel points of the non-blank area in the binary image to establish a first pixel coordinate library; and determining the first contour information library included in the first image by fusing contours and distinguishing non-connected contours through the first pixel coordinate library. As can be seen, this embodiment first establishes the first pixel coordinate library by binarizing the first image, then locating the pixel points of the non-blank area in the binary image, and finally, based on the first pixel coordinate library, determines all contour information included in the first image by fusing contours and distinguishing non-connected contours through the first pixel coordinate library. As can be seen, through this contour determination method, all contours included in the first image can be easily and conveniently found, thereby providing a basis for subsequent cleaning of non-text contours and determining text contours that are truly useful for paragraph segmentation.

[0071] Based on the content of the above embodiment, in this embodiment, binarization is performed on the first image to obtain a binarized image, including:

[0072] A dynamic threshold is calculated, and binarization processing is performed on the first image according to the dynamic threshold to obtain a binarized image.

[0073] In this embodiment, by calculating a dynamic threshold and performing binarization processing on the first image according to the dynamic threshold, the obtained binarized image is more accurate and can better reflect the actual situation of the document itself.

[0074] Based on the content of the above embodiment, in this embodiment, cleaning the non-text contours included in the first contour information library to determine the text contours in the first image includes:

[0075] screening the contours in the first contour information library according to a first preset condition to locate text contours and non-text contours;

[0076] If a non-text contour exists, excluding the non-text contour from the first contour information database;

[0077] Count all text outlines and capture effective information images;

[0078] The page size of the effective information image is calculated, and all the character outline information is corrected and updated according to the page size.

[0079] In this embodiment, the first contour information library is first organized and recorded in a standardized format. Then, contour size, area, and other information are screened using preset thresholds. Contours that do not meet these criteria are defined as non-text contours. If any non-text contours exist, they are removed from the first contour information library, and the remaining contours are defined as text contours. The minimum valid information image page size that includes all text contours is calculated based on the integration of all text contours. The contour coordinate information in the first contour information library is then updated based on the boundary coordinates of the valid information image.

[0080] Based on the content of the above embodiment, in this embodiment, determining whether the first image includes column information according to the first image and the outline of the text included in the first image includes:

[0081] In the effective information image, locate the outline of the text, determine the area except the outline of the text as a blank area, and establish a second pixel coordinate library to record the blank area information;

[0082] fusing contours, distinguishing disjoint contours, and establishing a second contour information library through the second pixel coordinate library;

[0083] In the second contour information database, contours that are close in adjacent directions are merged and sorted;

[0084] The contours in the second contour information library are screened according to a second preset condition to determine whether the first image includes column information.

[0085] In this embodiment, all white pixels are first located in the valid information image to establish a second pixel coordinate library. If the pixel coordinates fall within the aforementioned non-text contours, they are removed from the second pixel coordinate library. Next, based on preset conditions, pixels that are close in the four directions of up, down, left, and right are merged into the same contour, while non-close contours are distinguished to establish a second contour information library. This second contour information library is then organized and recorded in a standardized format. Column contours are located and text contours are segmented. First, the size, area, and other information of the contours in the second contour information library are screened using a preset threshold. Contours that meet the conditions are defined as column contours. By screening the contour size and area, the column contours are located.

[0086] Based on the content of the above embodiment, in this embodiment, determining the document paragraph position of the page of the to-be-processed document according to whether the first image includes column information includes:

[0087] If it is determined that the page does not have a column outline, the page is considered to be a single column; otherwise, within the valid information image, the text outline is divided into different text columns from top to bottom and from left to right according to the column outline;

[0088] In the same text column, in the horizontal direction, the text outlines whose distance is less than a first preset distance threshold are merged and sorted;

[0089] In the same text column, in the vertical direction, the text outlines whose distance is less than a second preset distance threshold are merged and sorted;

[0090] The document paragraph position of the page of the document to be processed is determined according to the sorted text outline information.

[0091] In this embodiment, if no column outlines exist, the page is considered a single column; otherwise, within the valid information image, the text outlines are divided into different text columns from top to bottom and from left to right according to the column outlines. The outlines within the same text column are merged, and paragraph position information is extracted. In this step, for all text outlines within the same text column, all horizontally similar text outlines are first merged based on a preset threshold to form row outlines. Dissimilar row outlines should belong to different outlines. Then, all vertically similar row outlines are merged to form segment outlines. Dissimilar segment outlines should belong to different outlines. The final segment outline information is the extracted paragraph position information.

[0092] Figure 2 The flowchart of the document paragraph position extraction method provided by the present invention is particularly suitable for horizontal PDF journal articles. Figure 2 The method is described in detail using a PDF document as an example. The method includes:

[0093] Step 11: Paginate the PDF document and convert it into image files.

[0094] In this step, the PDF document is a landscape-formatted journal article, with each page corresponding to a single page in the journal article. The PDF document can be any type of PDF document, including those generated by scanners and those converted from images. Page content can be in black and white or color. When converting to an image, the image size can be adjusted to a suitable size based on computing power, and the threshold can be adjusted accordingly.

[0095] Step 12: Convert the single-page image into an image containing only pure black (pixel value 0) and pure white (pixel value 255).

[0096] In this step, the image is first converted into a two-dimensional grayscale image to comprehensively analyze the pixel value distribution of all pixels. The image can then be binarized by setting a global threshold or using local thresholds such as the weighted mean and Otsu's algorithm.

[0097] Step 13: locate all black pixels and establish a first contour information database.

[0098] In this step, all black pixel points are first located to establish a first pixel coordinate library. Then, according to preset conditions, pixels close to each other in the four directions of up, down, left, and right are fused into the same contour, while non-close contours are distinguished to establish a first contour information library.

[0099] Step 14: clean up non-text outline information and capture the valid information image.

[0100] In this step, the first contour information library is first organized and recorded in a standardized format. Then, using preset thresholds, contour information such as size and area is screened, and contours that do not meet the criteria are defined as non-text contours. If any non-text contours exist, they are removed from the first contour information library, and the remaining contours are defined as text contours. The minimum valid information image page size that includes all text contours is calculated based on all text contours. The contour coordinate information in the first contour information library is then updated based on the boundary coordinates of the valid information image.

[0101] Step 15: locate all white pixel positions in the valid information image and establish a second contour information database.

[0102] In this step, all white pixels in the valid information image are located to establish a second pixel coordinate library. If the pixel coordinates are included in the non-text contours in step 14, they are removed from the second pixel coordinate library. Next, based on pre-set conditions, pixels that are close in the four directions (upward, downward, leftward, and rightward) are fused to form the same contour, while non-close contours are distinguished to establish a second contour information library. This second contour information library is then organized and recorded in a standardized format.

[0103] Step 16: Position the column outline and split the text outline.

[0104] In this step, the outlines in the second outline information library are first screened using a preset threshold, including size and area. Outlines that meet these criteria are defined as column outlines. By screening the outlines based on size and area, the column outlines are located. If no column outlines exist, the page is considered a single column. Otherwise, within the valid information image, the text outlines are divided into different text columns from top to bottom and from left to right based on the column outlines.

[0105] Step 17: merge the outlines in the same text column and extract the paragraph position information.

[0106] In this step, for all text contours in the same text column, first, based on a preset threshold, all horizontally similar text contours are merged to form row contours. Dissimilar row contours should belong to different contours. Then, vertically, all similar row contours are merged to form segment contours. Dissimilar segment contours should belong to different contours. The final segment contour information is the extracted paragraph position information.

[0107] From the perspective of image processing, the embodiments of the present invention clean up, divide columns and segment paragraphs of the document to be processed by fusing contour information. This avoids the problems of existing methods such as requiring the stream data of PDF documents to contain text and paragraph information, being heavily dependent on the accuracy of OCR tools, and being heavily dependent on the language type of the document. This improves the universality, accuracy and reliability of paragraph positioning in PDF documents.

[0108] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, see Figure 3 , the electronic device specifically includes the following contents: a processor 301, a memory 302, a communication interface 303 and a communication bus 304;

[0109] The processor 301, memory 302, and communication interface 303 communicate with each other via the communication bus 304; the communication interface 303 is used to implement transmission between relevant devices;

[0110] The processor 301 is configured to call the computer program in the memory 302. When the processor executes the computer program, all steps of the document paragraph position extraction method are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0111] Step 101: Performing image processing on a page of a document to be processed to obtain a first image;

[0112] Step 102: determining the outline of the text in the first image according to the non-blank area included in the first image;

[0113] Step 103: Determine whether the first image includes column information based on the first image and the text outline included in the first image;

[0114] Step 104: Determine the document paragraph position of the page of the document to be processed according to whether the first image includes column information.

[0115] Based on the same inventive concept, another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, all steps of the above-mentioned document paragraph position extraction method are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0116] Step 101: Performing image processing on a page of a document to be processed to obtain a first image;

[0117] Step 102: determining the outline of the text in the first image according to the non-blank area included in the first image;

[0118] Step 103: Determine whether the first image includes column information based on the first image and the text outline included in the first image;

[0119] Step 104: Determine the document paragraph position of the page of the document to be processed according to whether the first image includes column information.

[0120] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0121] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the embodiments of the present invention. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0122] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the document paragraph position extraction method described in each embodiment or certain parts of the embodiment.

[0123] In the present invention, terms such as "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0124] In addition, in the present invention, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further limitations, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device that includes the element.

[0125] In addition, in the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for extracting document paragraph positions, characterized in that: include: Performing image processing on a page of the document to be processed to obtain a first image; determining a text outline in the first image according to a non-blank area included in the first image; determining, based on the first image and a text outline included in the first image, whether the first image includes column information; determining a document paragraph position of a page of the document to be processed according to whether the first image includes column information; The determining, based on the non-blank area included in the first image, the outline of the text in the first image includes: determining a first contour information library included in the first image according to the non-blank area included in the first image; The first contour information database is sorted and recorded in a standardized form, the size and area of the contours are screened using a preset threshold, and contours that do not meet the conditions are defined as non-text contours; If there are non-text contours, the non-text contours are removed from the first contour information library, and the remaining contours are defined as text contours; All the character outlines are integrated to calculate the minimum effective information image page size containing all the character outlines, and the outline coordinate information in the first outline information library is updated according to the boundary coordinates of the effective information image.

2. The document paragraph position extraction method according to claim 1, characterized in that: Determining a first contour information library included in the first image according to a non-blank area included in the first image includes: performing binarization processing on the first image to obtain a binarized image; Locating pixel points in a non-blank area of the binary image to establish a first pixel coordinate library; The first contour information library included in the first image is determined by fusing contours and distinguishing disjoint contours through the first pixel coordinate library.

3. The document paragraph position extraction method according to claim 2, characterized in that: Binarizing the first image to obtain a binary image includes: A dynamic threshold is calculated, and binarization processing is performed on the first image according to the dynamic threshold to obtain a binarized image.

4. The document paragraph position extraction method according to claim 1, characterized in that: Determining whether the first image includes column information according to the first image and a text outline included in the first image includes: In the effective information image, locate the outline of the text, determine the area except the outline of the text as a blank area, and establish a second pixel coordinate library to record the blank area information; fusing contours, distinguishing disjoint contours, and establishing a second contour information library through the second pixel coordinate library; In the second contour information database, contours that are close in adjacent directions are merged and sorted; The contours in the second contour information library are screened according to a second preset condition to determine whether the first image includes column information.

5. The document paragraph position extraction method according to claim 4, characterized in that: Determining a document paragraph position of a page of the to-be-processed document according to whether the first image includes column information includes: If it is determined that the page does not have a column outline, the page is considered to be a single column; otherwise, within the valid information image, the text outline is divided into different text columns from top to bottom and from left to right according to the column outline; In the same text column, in the horizontal direction, the text outlines whose distance is less than a first preset distance threshold are merged and sorted; In the same text column, in the vertical direction, the text outlines whose distance is less than a second preset distance threshold are merged and sorted; The document paragraph position of the page of the document to be processed is determined according to the sorted text outline information.

6. The method for extracting document paragraph positions according to any one of claims 1 to 5, characterized in that: The document to be processed includes a PDF document or a WORD document.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the document paragraph position extraction method according to any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the document paragraph position extraction method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • A research report format identification and segmentation method, system and apparatus

    CN108960210A

  • Document picture recognition method and device and computer equipment

    CN113221632A

  • OCR image character recognition and paragraph output method based on deep learning

    CN113435449A