Document digitization method and device, electronic equipment and readable storage medium

By performing page classification and information extraction of electronic documents to be processed, the problems of low efficiency and inconvenient subsequent utilization of documents in the prior art are solved, and efficient and accurate document digitization and structured data storage are achieved.

CN119537584APending Publication Date: 2025-02-28CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411468096.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The existing document digitalization methods lack deep intelligent processing mechanisms, low processing efficiency, and are not convenient for subsequent data processing, analysis and retrieval and utilization.

Method used

By performing page classification processing on electronic documents to be processed, the page information extraction strategy is determined, key information elements and page text collections are extracted, and structured, and stored as structured data.

Benefits of technology

It improves the efficiency and quality of document digital processing, and facilitates subsequent data processing, analysis and retrieval and utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a document digitization method and device, electronic equipment and a readable storage medium. The method comprises the following steps: converting original data into a to-be-processed electronic document in a specified format; performing primary page classification processing on the to-be-processed electronic document to obtain a primary page classification result; based on the primary page classification result, determining a page information extraction strategy for the to-be-processed electronic document; extracting key information elements and a page text set from the to-be-processed electronic document based on a page information extraction strategy; and performing structured processing on the key information elements and the page text set to obtain structured data corresponding to the to-be-processed electronic document, and storing the structured data. According to the method, deep intelligent digital processing can be carried out on the original data from different data sources, the processing efficiency is high, and subsequent data processing analysis and retrieval utilization are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a document digitization method, device, electronic device and readable storage medium. Background Art

[0002] As the demand for data from large AI models surges, the massive historical document data of traditional enterprises and institutions (including paper, scanned, vector and various electronic formats) has not been fully utilized due to their low degree of digitization and difficulty in content retrieval.

[0003] However, existing document digitization methods mainly rely on simple scanning and uploading and manual entry of metadata, lack of deep intelligent processing mechanism, low processing efficiency, and inconvenience for subsequent data processing, analysis and retrieval. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a document digitization method, device, electronic device and readable storage medium to solve the problems that the existing document digitization methods lack a deep intelligent processing mechanism, have low processing efficiency, and are not convenient for subsequent data processing, analysis and retrieval.

[0005] A first aspect of an embodiment of the present application provides a method for digitizing a document, comprising:

[0006] Convert the original data into electronic documents in the specified format for processing;

[0007] Performing a page classification process on the electronic document to be processed to obtain a page classification result;

[0008] Based on the page classification result, determine the page information extraction strategy for the electronic document to be processed;

[0009] Based on the page information extraction strategy, extract key information elements and a page text set from the electronic document to be processed, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed;

[0010] The key information elements and page text sets are structured to obtain and store structured data corresponding to the electronic document to be processed.

[0011] According to a second aspect of the embodiments of the present application, there is provided a document digitization device, comprising:

[0012] A conversion module, configured to convert the original data into an electronic document to be processed in a specified format;

[0013] The classification module is configured to perform a page classification process on the electronic document to be processed and obtain a page classification result;

[0014] A determination module, configured to determine a page information extraction strategy for the electronic document to be processed based on a page classification result;

[0015] An extraction module is configured to extract key information elements and a page text set from the electronic document to be processed based on a page information extraction strategy, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed;

[0016] The processing module is configured to perform structural processing on the key information elements and the page text set, obtain structured data corresponding to the electronic document to be processed, and store it.

[0017] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0018] According to a fourth aspect of an embodiment of the present application, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0019] Compared with the prior art, the embodiments of the present application have at least the following beneficial effects: on the one hand, by performing a page classification process on the electronic document to be processed and determining a page information extraction strategy based on the page classification result, the key information elements and page texts of different types of pages can be efficiently and accurately identified, thereby improving the efficiency and quality of digital processing of documents; on the other hand, by performing structured processing on the extracted key information elements and the page text set, subsequent data processing, analysis and retrieval can be facilitated. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] Figure 1 It is a flowchart of a document digitization method provided in an embodiment of the present application;

[0022] Figure 2 is a schematic diagram of an OCR text extraction process provided in an embodiment of the present application;

[0023] Figure 3It is a schematic diagram of the layout of the content area of ​​a pixel image provided in an embodiment of the present application;

[0024] Figure 4 It is a flowchart of another document digitization method provided in an embodiment of the present application;

[0025] Figure 5 It is a structural schematic diagram of a document digitization device provided in an embodiment of the present application;

[0026] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0028] A document digitization method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0029] Figure 1 It is a flowchart of a document digitization method provided in an embodiment of the present application. Figure 1 The document digitization method can be executed by a terminal device or a server. Figure 1 As shown, the document digitization method includes the following steps:

[0030] Step S101, converting the original data into an electronic document to be processed in a specified format.

[0031] The original data may be paper documents, scanned documents, electronic images, database records, or various data obtained through web crawlers. The specified format may be a PDF format. The electronic document to be processed may be an electronic document in PDF format.

[0032] Specifically, various paper documents are scanned and digitized with high precision to ensure lossless conversion of information and obtain corresponding electronic documents in PDF format (hereinafter referred to as "PDF documents"). Scanned documents, electronic images, database records or various data materials obtained through web crawlers are uniformly converted into electronic documents to be processed (electronic documents in PDF format, hereinafter referred to as "PDF documents") in a specified format (such as PDF format) to facilitate subsequent unified processing and storage.

[0033] In one example, the converted electronic document in PDF format and its original data can be uploaded to a document database (e.g., MongoDB) for centralized management and secure storage. MongoDB is a database based on distributed file storage, which aims to provide a scalable, high-performance data storage solution for WEB applications. Its biggest feature is that it supports a very powerful query language, whose syntax is somewhat similar to an object-oriented query language, and can achieve almost most of the functions of a single-table query in a relational database, and also supports indexing of data.

[0034] In the document database, a unique identifier can be assigned to each electronic document in PDF format (hereinafter referred to as "PDF document"), and a corresponding relationship between the unique identifier, original data, PDF document, table of contents, and digitized document can be established. Among them, the table of contents can be used to store key information elements extracted from the PDF document in the subsequent intelligent digitization process. The digitized document can be a TXT document, which is used to store structured data obtained after intelligent digitization processing.

[0035] Exemplarily, Table 1 is a correspondence table of unique identifiers, PDF documents, original materials, content tables, and digitized documents.

[0036] Table 1 Correspondence table of unique identifier, original data, PDF document, table of contents, and digitized document

[0037] Unique identifier PDF Document Source material Table of Contents Digital Documents ID1 pdf.1 Data 1 Key information element 1 TXT.1 ID2 pdf.2 Data 2 Key information element 2 TXT.2 ... ... ... ... ... ID pdf.n Data Key information elements TXT.n

[0038] Step S102: performing a page classification process on the electronic document to be processed to obtain a page classification result.

[0039] Specifically, the electronic documents (PDF documents) to be processed in the document database are automatically pushed to a pre-set pipeline (linear communication model) processing queue to ensure the orderly start and efficient execution of the processing flow.

[0040] Step S103: Based on the page classification result, a page information extraction strategy for the electronic document to be processed is determined.

[0041] Step S104: extract key information elements and a page text set from the electronic document to be processed based on the page information extraction strategy, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed.

[0042] Key information elements include title, author, publisher, publication date, abstract, table of contents and subject.

[0043] Page text refers to all the text content in a document page.

[0044] Page text, including the text content corresponding to each content area in each document page.

[0045] Step S105 , structurally process the key information elements and the page text set to obtain structured data corresponding to the electronic document to be processed, and store the structured data.

[0046] On the one hand, the structured data corresponding to the electronic documents to be processed obtained after the above intelligent processing can be stored in MongoDB, and its powerful document storage capacity can be used to ensure the integrity and flexibility of the data. On the other hand, the structured data corresponding to the electronic documents to be processed obtained after the above intelligent processing can be stored in the distributed search engine ElasticSearch (a search server based on Lucene) to achieve more efficient data retrieval and utilization.

[0047] The technical solution provided in the embodiment of the present application, on the one hand, can efficiently and accurately identify key information elements and page texts of different types of pages by performing a page classification process on the electronic document to be processed and determining a page information extraction strategy based on the page classification result, thereby improving the efficiency and quality of digital processing of documents; on the other hand, by performing structured processing on the extracted key information elements and the page text set, subsequent data processing, analysis and retrieval can be facilitated.

[0048] In some embodiments, performing a page classification process on the electronic document to be processed to obtain a page classification result includes:

[0049] Performing paging processing on the electronic document to be processed, so as to split the electronic document to be processed into electronic documents having a plurality of document pages;

[0050] Extracting page elements of each document page of the electronic document to be processed;

[0051] Based on the page elements, all document pages of the electronic document to be processed are classified to obtain a page classification result.

[0052] As an example, a PDF viewing and analysis tool can be used to first check whether the electronic document to be processed is an encrypted and protected document. If it is an encrypted and protected document, a decryption library (such as pike) can be used to decrypt the electronic document to be processed to obtain a decrypted electronic document. Then, the decrypted electronic document is paginated to split the decrypted electronic document into an electronic document with multiple document pages. Next, the page elements of each document page obtained by the split are extracted respectively. Among them, the page elements include the richness of the text content in the page, the size and layout of the picture, and whether there are specific logos (such as trademarks / logos). Based on the page elements extracted above, all document pages of the decrypted electronic document are classified to obtain a page classification result. If it is not an encrypted and protected document, the electronic document to be processed can be directly split into pages, and the page elements of each document page can be extracted, and then all document pages of the electronic document to be processed can be classified according to the page elements to obtain a page classification result.

[0053] As an example, the page classification rules may be: if the entire document page is a picture with no text, it is classified into category one (which may be called a pure picture page, which may be recorded as L1); if the entire document page has no picture but only text, it is classified into category two (which may be called a pure text page, which may be recorded as L2); if the entire document page is a picture but there is text on the page, it is classified into category three (which may be called a full picture and text page, which may be recorded as L3); if the width of the picture in the entire document page is greater than 2 / 3 of the page and the height is greater than 1 / 20 of the page, it is classified into category four (which may be called a wide picture and text page, which may be recorded as L4); if the width of the picture in the entire document page is greater than 1 / 4 of the page but less than 2 / 3 of the page, it is classified into category five (which may be called a narrow picture and text page, which may be recorded as L5).

[0054] It should be noted that the page classification rules can be set according to actual conditions. The standards of page classification rules are intended to accurately distinguish the characteristics of different types of pages and provide a basis for the formulation of subsequent page information extraction strategies.

[0055] In some embodiments, a page classification result includes pure image page, pure text page, full image and text page, wide image and text page and narrow image and text page.

[0056] Based on the page classification result, determine the page information extraction strategy for the electronic document to be processed, including:

[0057] Counting the total number of first pages of pure image pages and full image and text pages in the electronic document to be processed, and the total number of second pages of wide image and text pages;

[0058] If the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is greater than or equal to the first threshold, and the first total number of pages is greater than the second total number of pages, then determining that the page information extraction strategy is the first information extraction strategy, wherein the first information extraction strategy is to perform OCR text extraction on each document page of the electronic document to be processed;

[0059] If the ratio of the total number of first pages to the total number of pages of the electronic document to be processed is less than a first threshold, and / or the total number of first pages is less than or equal to the total number of second pages, performing secondary page classification on the electronic document to be processed to obtain first-category pages and second-category pages;

[0060] The page information extraction strategy is determined to be a second information extraction strategy, wherein the second information extraction strategy is to perform OCR text extraction on the first category of pages and to perform vector text extraction on the second category of pages.

[0061] The first threshold can be set according to actual conditions, for example, it can be set to 0.1.

[0062] In the first case, if the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is greater than or equal to a first threshold (such as 0.1), and the first total number of pages is greater than the second total number of pages, the following conditions ① and ② are simultaneously met:

[0063] ①

[0064] ②num L1 +num L3 >num L4 .

[0065] Then the page information extraction strategy can be determined as the first information extraction strategy (FORCE OCR). Among them, FORCEOCR means that each document page of the electronic document to be processed is forced to perform OCR (optical character recognition) text extraction processing. L1~L5 correspond to categories one to five respectively. num L1 Indicates the number of document pages belonging to category 1 (pure image pages); num L2 Indicates the number of document pages belonging to category 2 (plain text pages); num L3 Indicates the number of document pages belonging to category three (entire text and image pages); num L4 Indicates the number of document pages belonging to category 4 (wide image and text pages); num L5 Indicates the page number of document pages belonging to category five (narrow graphic pages).

[0066] In the second case, if the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is less than a first threshold (such as 0.1), and / or the first total number of pages is less than or equal to the second total number of pages, the following conditions ③ and / or ④ are met:

[0067] ③

[0068] ④num L1 +num L3 ≤num L4 .

[0069] Then the electronic document to be processed is subjected to secondary page classification to obtain the first category page and the second category page. The first category page is a document page without vector text. The second category page is a document page containing vector text. Vector text is a text symbol represented by line segment strokes.

[0070] The page information extraction strategy is determined to be the second information extraction strategy (REDO OCR). REDO OCR refers to performing OCR text extraction processing only on document pages that do not contain vector text.

[0071] In some embodiments, a page classification result includes a pure image page, a pure text page, a full image and text page, a wide image and text page, and a narrow image and text page;

[0072] Based on the page classification result, determine the page information extraction strategy for the electronic document to be processed, including:

[0073] Count the total number of third pages of pure image pages, full image and text pages, and wide image and text pages in the electronic document to be processed;

[0074] If the ratio of the total number of third pages to the total number of pages of the electronic document to be processed is greater than or equal to the second threshold value and less than the first threshold value, the electronic document to be processed is classified three times to obtain pages of the third category and pages of the fourth category;

[0075] The page information extraction strategy is determined to be a third information extraction strategy, wherein the third information extraction strategy is to perform OCR text extraction on the third category of pages and to perform vector text extraction on the fourth category of pages.

[0076] The second threshold can be set according to actual conditions, for example, it can be set to 0.01.

[0077] In the third case, if the ratio of the total number of the third pages of pure image pages, full image and text pages, and wide image and text pages to the total number of pages of the electronic document to be processed is greater than or equal to the second threshold (such as 0.01) and less than the first threshold (such as 0.1), the following conditions ④ and ⑤ are met at the same time:

[0078] ④

[0079] ⑤

[0080] Then the electronic document to be processed is classified three times to obtain the third category page and the fourth category page. The third category page is the document page without vector text. The fourth category page is the document page with vector text.

[0081] The page information extraction strategy is determined to be the third information extraction strategy (REDO OCR). REDO OCR refers to performing OCR text extraction processing only on document pages that do not contain vector text.

[0082] Vector text extraction (NO OCR) is performed on the fourth type of pages, wherein NO OCR means that OCR text extraction processing is not performed.

[0083] Vector text extraction can use industry-leading text extraction tools such as the tika library and pdf.js to perform in-depth text information mining on decrypted and classified document pages. Through page-by-page analysis, the location, character information and format of the text are accurately captured to ensure that the extracted vector text data is both accurate and comprehensive, laying a solid foundation for subsequent data processing and analysis.

[0084] By performing a page classification process on the electronic document to be processed, the page type, layout and other features of the document page can be accurately identified, and the page information extraction strategy of the electronic document to be processed can be determined based on the page classification result. In this way, the accuracy and efficiency of page information extraction of the document page can be significantly improved, solving the problem of low recognition rate and high error rate of traditional OCR technology in complex document layouts.

[0085] In some embodiments, based on the page information extraction strategy, extracting key information elements and page text sets from the electronic document to be processed includes:

[0086] Convert each document page of the electronic document to be processed into a pixel image;

[0087] For each pixel image, identifying each content area in the pixel image, where the content area is any one of a text area, a title area, a table area, an image area, or a list area;

[0088] For each pixel image, based on the first information extraction strategy or the second information extraction strategy, key information elements and page texts are extracted from each content area to obtain a set of key information elements and page texts of the electronic document to be processed.

[0089] Figure 2Schematic diagram of an OCR text extraction process provided by an embodiment of the present application. The OCR text extraction process mainly includes the following steps: a) PDF splitting pages, b) page conversion images, c) layout analysis, d) text detection and recognition, and e) determining content area sorting.

[0090] As an example, see Figure 2 , the steps of extracting key information elements and page text sets from the electronic document to be processed specifically include:

[0091] a) PDF Split Pages: You can use the fitz library to efficiently open the electronic document (PDF document) to be processed and accurately obtain the total number of pages of the electronic document to be processed. The fitz library, also known as PyMuPDF, is a powerful PDF processing library with functions including text extraction, image extraction, segmentation and merging.

[0092] b) Page conversion image: Image processing technology (such as PDF to image tool) can be used to convert PDF documents page by page into high-definition pixel images. In order to improve the accuracy and efficiency of subsequent OCR recognition, the size of the converted pixel image can be enlarged (such as 2 times) to ensure that every detail can be clearly captured. The enlarged pixel image can be stored in a dedicated folder corresponding to the PDF document in the coding order of the document page, which is convenient for subsequent instant call.

[0093] In some embodiments, the key information elements and the page text set are structured to obtain structured data corresponding to the electronic document to be processed, including:

[0094] Determine the content category label and boundary position coordinates corresponding to each content area of ​​each document page of the electronic document to be processed;

[0095] Extract key information elements and regional content text corresponding to each content area;

[0096] Determine the region order corresponding to each content region in the same document page;

[0097] For each document page, the page code of the document page, each content area and its corresponding content category label, boundary position coordinates, area content text and area order are filled into a preset data structure to obtain structured data.

[0098] For ease of understanding, continue to use the above example. Figure 2 and Figure 3 The step of extracting key information elements and page text sets from the electronic document to be processed also includes:

[0099] c) Layout analysis: Taking the pixel image 1 corresponding to the first page of the electronic document to be processed as an example, a layout information extraction algorithm (for example, layout-parser (an open source document image analysis toolbox based on deep learning)) can be used to identify the various content areas in the pixel image 1, and accurately divide the boundary position coordinates and content category labels corresponding to each content area.

[0100] The boundary position coordinates include the upper left corner horizontal coordinate (x1 axis coordinate), the upper left corner vertical coordinate (y1 axis coordinate), the lower right corner horizontal coordinate (x2 axis coordinate), and the lower right corner vertical coordinate (y2 axis coordinate) of the content area.

[0101] Content category labels include text, title, table, image, list and other categories.

[0102] If the content category label of a content area is text, then the content area is a text area. If the content category label of a content area is title, then the content area is a title area. If the content category label of a content area is table, then the content area is a table area. If the content category label of a content area is picture, then the content area is a picture area. If the content category label of a content area is list, then the content area is a list area.

[0103] like Figure 3 As shown, the pixel image 1 includes content regions 1 to 4. The boundary position coordinates and content category labels corresponding to the content regions 1 to 4 are respectively identified.

[0104] d) Text detection and recognition: Detect content areas 1 to 4 in pixel image 1 to identify text detection frames corresponding to content areas 1 to 4, and then use a text recognition algorithm to extract the text content in the text detection frames to obtain key information elements of pixel image 1 and page text (including the text content of the text detection frames of content areas 1 to 4).

[0105] e) Determine the content area order: determine the layout order of content areas 1 to 4 in pixel image 1.

[0106] In some embodiments, determining the region ranking corresponding to each content region in the same document page includes:

[0107] If the document page is a single-column page, sorting each content area in the document page according to the first sorting rule to obtain a region sorting;

[0108] If the document page is a double-column page, sorting each content area in the document page according to the second sorting rule to obtain a region sorting;

[0109] If the document page is a multi-column page, then the content areas in the document page are sorted according to the third sorting rule to obtain a region sorting.

[0110] The first sorting rule may be to prioritize sorting according to the upper left corner horizontal coordinate (x1 axis coordinate) (less than 4 / 5 of the page width) of the boundary position coordinates of each content area from small to large. If the upper left corner horizontal coordinates (x1 axis coordinates) are the same, then continue to sort according to the upper left corner vertical coordinate (y1 axis coordinate) of the boundary position coordinates of each content area from small to large.

[0111] As an example, Figure 3 As shown, in the pixel image 1 corresponding to the document page 1, the layout order of content areas 1 to 4 is increasing from top to bottom. The x-axis coordinates of the starting point coordinates (i.e., the upper left corner position) of the content areas 1 to 4 are the same, then the content areas 1 to 4 are sorted from small to large according to the y-axis coordinates of the starting point coordinates. The sorting result is: content area 1 → content area 2 → content area 3 → content area 4.

[0112] The second sorting rule may be to prioritize sorting according to the upper left corner horizontal coordinate (x1 axis coordinate) (less than 1 / 2 page width) of the boundary position coordinates of each content area from small to large. If the upper left corner horizontal coordinates (x1 axis coordinates) are the same, then continue to sort according to the upper left corner vertical coordinate (y1 axis coordinate) of the boundary position coordinates of each content area from small to large.

[0113] The third sorting rule may be to sort based on the lexicographic order of the upper left corner horizontal coordinate (x1 axis coordinate) and the upper left corner vertical coordinate (y1 axis coordinate) of the boundary position coordinates of each content area. The lexicographic order can be divided into alphabetical order, comparison principle and upper and lower case rules.

[0114] The preset data structure includes a page code area, a content category label area, a boundary position coordinate area, a region content text area, and a region sorting area.

[0115] As an example, the page code of the document page is filled into the page code area of ​​the preset data structure, the content category label is filled into the content category label area, the boundary position coordinates are filled into the boundary position coordinate area, the regional content text is filled into the regional content text area, and the regional sorting is filled into the regional sorting area to obtain structured data, and then the structured data is written into MongoDB and the distributed search engine ElasticSearch. Specifically, the structured data can be written into the "digital document" column of Table 1 above.

[0116] Through the above method, the contents of different columns in the document page can be accurately identified and separated, effectively solving the problems of text confusion and disordered order that are easy to occur in OCR processing of multi-column documents; at the same time, the original page information of the electronic document to be processed can be well preserved, and the readability, accuracy and usability of the digitized document (TXT document) can be improved.

[0117] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0118] Figure 4 It is a flowchart of another document digitization method provided in an embodiment of the present application.

[0119] See also Figure 4 , the document digitization method comprises the following steps:

[0120] Step S401: input a PDF document.

[0121] Step S402, document parsing and classification. First, determine whether the PDF document needs to be decrypted; if decryption is required, first decrypt the PDF document, and then perform page classification on the decrypted electronic document; if decryption is not required, directly perform page classification on the PDF document.

[0122] Step S403: Determine the page information extraction strategy. For documents that require OCR text extraction processing, calculate and apply the optimal OCR processing strategy based on the document characteristics to ensure the accuracy and efficiency of text recognition.

[0123] Step S404: OCR text extraction: Perform OCR text extraction on the document page that needs OCR text extraction.

[0124] Step S405: Vector text extraction: Perform vector text extraction on document pages that do not require OCR text extraction.

[0125] Step S406, text cleaning and normalization. Perform text cleaning and normalization on the OCR text extracted in step S404 and the vector text extracted in step S405. Specifically, redundant punctuation marks, blank characters and unnecessary line breaks in the OCR text and vector text can be removed to ensure the neatness of the text; the utf-8 encoding standard can be uniformly adopted to enhance the compatibility and readability of the text; privacy-sensitive information that may be contained in the text can be screened and removed to protect user privacy and security; intelligent conversion from Traditional Chinese to Simplified Chinese can be implemented; all letters in the text are uniformly converted to lowercase to simplify subsequent processing procedures; accent marks in the text are removed to keep the text standard and clear; discriminatory remarks are filtered to maintain the positivity and respect of the text content. Through

[0126] Step S407, text deduplication processing. Specifically, the digitized documents corresponding to different PDF documents can be identified by relying on the minimum hash (MinHash) and local sensitive hash (LSH) algorithms to remove digitized documents whose text similarity reaches a preset similarity threshold (which can be flexibly set according to actual conditions, for example, 80%, 90%, etc.). In this way, data redundancy can be effectively reduced, data storage efficiency can be improved, and the training quality and speed of subsequent large model training using digitized documents in the document database can be improved.

[0127] Step S408, text structuring processing. For each PDF document, the page text set obtained after text cleaning and deduplication processing is converted into standardized and orderly structured data. At the same time, a QA question and answer format (such as a QA question and answer table) that is convenient for retrieval and model training can be generated based on the structured data. In this way, the accessibility and application value of digital documents can be further enhanced.

[0128] Step S409, text storage. Specifically, the structured data and QA question-answer format obtained in step S408 can be synchronously stored in a document database (such as MongoDB) and a distributed search engine ElasticSearch. The structured data and QA question-answer format stored in ElasticSearch can be further segmented and an inverted index constructed to improve intelligent retrieval functions and increase the utilization and value of original data. The structured data and QA question-answer format stored in MongoDB can be used as an important corpus for training large language models, providing rich and accurate data support for deep learning and optimization of the model.

[0129] The technical solution provided by the embodiment of the present application has at least the following beneficial effects:

[0130] 1) High-quality structured data is obtained by converting the original data into a format, classifying pages, extracting page information, and structuring them. These structured data are not only suitable for search engine indexing and query optimization, but can also directly provide high-quality input (corpus data) for large models (such as natural language processing models and machine learning models), thereby enhancing the compatibility and utility of structured data in various application scenarios, helping to improve the language comprehension, generation, and generalization capabilities of large language models, and promoting the further development of natural language processing technology, injecting new vitality into the field of artificial intelligence.

[0131] 2) By introducing a new document page classification and page information extraction strategy, it realizes the rapid identification and accurate classification of document content. At the same time, combined with an efficient indexing mechanism, it enables users to quickly locate the required information. This intelligent retrieval method not only improves the accuracy and speed of retrieval, but also greatly reduces the cost of manual intervention, bringing revolutionary changes to the document management of enterprises and institutions.

[0132] 3) It can realize the digital and intelligent management of original data, so that enterprises and institutions can more conveniently obtain, process and analyze various types of information, so as to make more scientific and reasonable decisions and improve overall work efficiency. At the same time, enterprises and institutions can also use the technical solution of this application to realize the automation and intelligent upgrade of business processes, further improve service quality and customer satisfaction, and thus bring more significant economic and social benefits.

[0133] 4) The structured data obtained by this application can be seamlessly transferred and efficiently used across multiple platforms. The application scope of the technical solution of this application is wide, covering multiple fields such as book publishing, archive management, and legal document processing, and has significant social and economic benefits.

[0134] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0135] Figure 5 Schematic diagram of the structure of a document digitization device provided in an embodiment of the present application. Figure 5 As shown, the document digitization device includes:

[0136] The conversion module 501 is configured to convert the original data into an electronic document to be processed in a specified format;

[0137] The classification module 502 is configured to perform a page classification process on the electronic document to be processed and obtain a page classification result;

[0138] The determination module 503 is configured to determine a page information extraction strategy for the electronic document to be processed based on a page classification result;

[0139] The extraction module 504 is configured to extract key information elements and a page text set from the electronic document to be processed based on the page information extraction strategy, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed;

[0140] The processing module 505 is configured to perform structural processing on the key information elements and the page text set, obtain structured data corresponding to the electronic document to be processed, and store it.

[0141] In some embodiments, the classification module 502 includes:

[0142] A paging unit is configured to perform paging processing on the electronic document to be processed, so as to split the electronic document to be processed into electronic documents having a plurality of document pages;

[0143] An extraction unit, configured to extract page elements of each document page of the electronic document to be processed;

[0144] The classification unit is configured to classify all document pages of the electronic document to be processed based on the page elements to obtain a page classification result.

[0145] In some embodiments, the page classification results include pure image pages, pure text pages, full image and text pages, wide image and text pages, and narrow image and text pages. The above-mentioned determination module 503 includes:

[0146] A first counting unit is configured to count a first total number of pure image pages and full image and text pages in the electronic document to be processed, and a second total number of wide image and text pages;

[0147] A first strategy determination unit is configured to determine that the page information extraction strategy is a first information extraction strategy if a ratio of the first total number of pages to the total number of pages of the electronic document to be processed is greater than or equal to a first threshold, and the first total number of pages is greater than the second total number of pages, wherein the first information extraction strategy is to perform OCR text extraction on each document page of the electronic document to be processed;

[0148] a secondary classification unit configured to perform secondary page classification on the electronic document to be processed to obtain first-category pages and second-category pages if the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is less than a first threshold value, and / or the first total number of pages is less than or equal to the second total number of pages;

[0149] The second strategy determination unit is configured to determine that the page information extraction strategy is a second information extraction strategy, wherein the second information extraction strategy is to perform OCR text extraction on the first category of pages and to perform vector text extraction on the second category of pages.

[0150] In some other embodiments, the page classification results include pure image pages, pure text pages, full image and text pages, wide image and text pages, and narrow image and text pages. The above-mentioned determination module 503 includes:

[0151] The second counting unit is configured to count the total number of third pages of pure image pages, full image and text pages, and wide image and text pages in the electronic document to be processed;

[0152] a third classification unit configured to perform third-category page classification on the electronic document to be processed to obtain third-category pages and fourth-category pages if the ratio of the third page total number to the total page number of the electronic document to be processed is greater than or equal to the second threshold value and less than the first threshold value;

[0153] The third strategy determination unit is configured to determine that the page information extraction strategy is a third information extraction strategy, wherein the third information extraction strategy is to perform OCR text extraction on the third category of pages and to perform vector text extraction on the fourth category of pages.

[0154] In some embodiments, the extraction module 504 includes:

[0155] A page conversion unit, configured to convert each document page of the electronic document to be processed into a pixel image;

[0156] The recognition unit is configured to recognize, for each pixel image, each content area in the pixel image, where the content area is any one of a text area, a title area, a table area, a picture area or a list area;

[0157] The information extraction unit is configured to extract key information elements and page text from each content area for each pixel image based on the first information extraction strategy or the second information extraction strategy to obtain a set of key information elements and page text of the electronic document to be processed.

[0158] In some embodiments, the processing module 505 includes:

[0159] A first determining unit is configured to determine a content category label and a boundary position coordinate corresponding to each content area of ​​each document page of the electronic document to be processed;

[0160] A text extraction unit configured to extract key information elements and regional content text corresponding to each content region;

[0161] A second determining unit is configured to determine the region order corresponding to each content region in the same document page;

[0162] The filling unit is configured to fill the page code of the document page, each content area and its corresponding content category label, boundary position coordinates, area content text and area order into a preset data structure for each document page to obtain structured data.

[0163] In some embodiments, the second determining unit may include:

[0164] The first sorting component is configured to sort each content area in the document page according to a first sorting rule to obtain an area sorting if the document page is a single-column page;

[0165] The second sorting component is configured to sort each content area in the document page according to a second sorting rule to obtain an area sorting if the document page is a double-column page;

[0166] The third sorting component is configured to sort the content areas in the document page according to the third sorting rule to obtain an area sorting if the document page is a multi-column page.

[0167] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0168] Figure 6 Schematic diagram of an electronic device 6 provided in an embodiment of the present application. Figure 6 As shown, the electronic device 6 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 601 executes the computer program 603, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0169] The electronic device 6 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 6 may include, but is not limited to, a processor 601 and a memory 602. Those skilled in the art will appreciate that Figure 6 The electronic device 6 is merely an example and does not limit the electronic device 6 . The electronic device 6 may include more or less components than those shown in the figure, or different components.

[0170] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0171] The memory 602 may be an internal storage unit of the electronic device 6, for example, a hard disk or memory of the electronic device 6. The memory 602 may also be an external storage device of the electronic device 6, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. The memory 602 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 602 is used to store computer programs and other programs and data required by the electronic device.

[0172] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0173] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable storage media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0174] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application 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. 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 embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for digitizing a document, characterized in that: include: Convert the original data into electronic documents in the specified format for processing; Performing a page classification process on the electronic document to be processed to obtain a page classification result; Based on the first page classification result, determining a page information extraction strategy for the electronic document to be processed; Based on the page information extraction strategy, extract key information elements and a page text set from the electronic document to be processed, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed; The key information elements and the page text set are subjected to structural processing to obtain structured data corresponding to the electronic document to be processed, and the structured data is stored.

2. The method according to claim 1, characterized in that Performing a page classification process on the electronic document to be processed to obtain a page classification result includes: Performing paging processing on the electronic document to be processed, so as to split the electronic document to be processed into electronic documents having a plurality of document pages; Extracting page elements of each document page of the electronic document to be processed; Based on the page elements, all document pages of the electronic document to be processed are classified to obtain a page classification result.

3. The method according to claim 1 or 2, characterized in that: The page classification results include pure picture pages, pure text pages, full picture and text pages, wide picture and text pages, and narrow picture and text pages; Based on the first page classification result, determining a page information extraction strategy for the electronic document to be processed includes: Counting the total number of first pages of pure image pages and full image and text pages, and the total number of second pages of wide image and text pages in the electronic document to be processed; If the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is greater than or equal to a first threshold, and the first total number of pages is greater than the second total number of pages, determining that the page information extraction strategy is a first information extraction strategy, wherein the first information extraction strategy is to perform OCR text extraction on each document page of the electronic document to be processed; If the ratio of the first total number of pages to the total number of pages of the electronic document to be processed is less than a first threshold, and / or the first total number of pages is less than or equal to the second total number of pages, performing secondary page classification on the electronic document to be processed to obtain first category pages and second category pages; The page information extraction strategy is determined to be a second information extraction strategy, wherein the second information extraction strategy is to perform OCR text extraction on the first category of pages and to perform vector text extraction on the second category of pages.

4. The method according to claim 1 or 2, characterized in that: The page classification results include pure picture pages, pure text pages, full picture and text pages, wide picture and text pages, and narrow picture and text pages; Based on the first page classification result, determining a page information extraction strategy for the electronic document to be processed includes: Counting the total number of third pages of pure image pages, full image and text pages, and wide image and text pages in the electronic document to be processed; If the ratio of the total number of the third pages to the total number of pages of the electronic document to be processed is greater than or equal to the second threshold value and less than the first threshold value, the electronic document to be processed is classified three times to obtain pages of the third category and pages of the fourth category; The page information extraction strategy is determined to be a third information extraction strategy, wherein the third information extraction strategy is to perform OCR text extraction on the third category pages and to perform vector text extraction on the fourth category pages.

5. The method according to claim 3, characterized in that: Based on the page information extraction strategy, extracting key information elements and page text sets from the electronic document to be processed includes: Convert each document page of the electronic document to be processed into a pixel image; For each of the pixel images, identifying each content area in the pixel image, wherein the content area is any one of a text area, a title area, a table area, a picture area or a list area; For each of the pixel images, based on the first information extraction strategy or the second information extraction strategy, key information elements and page texts are extracted from each of the content areas to obtain a set of key information elements and page texts of the electronic document to be processed.

6. The method according to claim 5, characterized in that Structuring the key information elements and the page text set to obtain structured data corresponding to the electronic document to be processed includes: Determine the content category label and boundary position coordinates corresponding to each content area of ​​each document page of the electronic document to be processed; Extracting key information elements and regional content text corresponding to each of the content regions; Determine the area order corresponding to each of the content areas in the same document page; For each document page, the page code of the document page, each content area and its corresponding content category label, boundary position coordinates, area content text and area order are filled into a preset data structure to obtain structured data.

7. The method according to claim 6, characterized in that Determining the area order corresponding to each of the content areas in the same document page includes: If the document page is a single-column page, sorting the content areas in the document page according to a first sorting rule to obtain an area sorting; If the document page is a double-column page, sorting each of the content areas in the document page according to a second sorting rule to obtain an area sorting; If the document page is a multi-column page, the content areas in the document page are sorted according to the third sorting rule to obtain an area sorting.

8. A document digitizing device, characterized in that: include: A conversion module, configured to convert the original data into an electronic document to be processed in a specified format; A classification module is configured to perform a page classification process on the electronic document to be processed to obtain a page classification result; A determination module, configured to determine a page information extraction strategy for the electronic document to be processed based on the first page classification result; an extraction module, configured to extract key information elements and a page text set from the electronic document to be processed based on the page information extraction strategy, wherein the page text set includes page text corresponding to each document page of the electronic document to be processed; The processing module is configured to perform structural processing on the key information elements and the page text set, obtain structured data corresponding to the electronic document to be processed, and store the structured data.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Legal text generation method and system

    CN120579525A

  • A legal text generation method and system

    CN120579525B

  • Structured information extraction method based on artificial intelligence, intelligent agent and device

    CN120747526A

  • Visual language model-oriented PDF (Portable Document Format) document input optimization method, equipment and medium

    CN121259852A