Document analysis method and device for retrieval enhancement generation and storage medium

By converting and parsing the document format and generating target analysis results containing content and structure information, the shortcomings of the existing technology in content traceability and table extraction are solved, and the accuracy of text tiling and content extraction is achieved.

CN119862249APending Publication Date: 2025-04-22MACROWING SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411992315.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The existing document analysis technology has shortcomings in content traceability and complete table extraction, especially in the use of the original structural information of the document to explore text tiling.

Method used

By converting the document to be parsed, converting it from Word format to PDF format, and parsing it separately, generating target analysis results, including content information and structure information, for retrieval enhancement generation.

Benefits of technology

It realizes the use of the original structure information of the document to cut text, and accurately and completely extract the content in the document, improving the retrieval and enhanced generation effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862249A_ABST
    Figure CN119862249A_ABST
Patent Text Reader

Abstract

The invention discloses a document analysis method and device for retrieval enhancement generation and a storage medium. The method comprises the steps that format conversion is conducted on a first to-be-analyzed document, a second to-be-analyzed document is obtained, the first to-be-analyzed document is in a word format, and the second to-be-analyzed document is in a pdf format; respectively analyzing the first to-be-analyzed document and the second to-be-analyzed document to obtain first analysis information corresponding to the first to-be-analyzed document and second analysis information corresponding to the second to-be-analyzed document; a target analysis result is generated according to the first analysis information and the second analysis information, retrieval enhancement generation is executed based on the target analysis result, and the target analysis result comprises content information and structure information of the first to-be-analyzed document. The problem that although an existing document analysis technology can obtain all text information, defects still exist in content traceability and complete table extraction is solved, and accurate and complete extraction of the content in the document is achieved so as to be used for retrieval enhancement generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of document parsing, and in particular to a document parsing method, device and storage medium for retrieval enhanced generation. Background Art

[0002] Although the current document parsing technology used for RAG (Retrieval Augmented Generation) can obtain all text information, it still has shortcomings in content tracing and complete table extraction. In particular, there are few explorations in the use of the original structural information of the document for text segmentation.

[0003] Therefore, how to use the original structural information of the document to segment the text and accurately and completely extract the content in the document for retrieval enhancement generation is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present invention provides a document parsing method, device and storage medium for retrieval enhanced generation, so as to realize text segmentation by using original structural information of a document, and accurate and complete extraction of content in a document for retrieval enhanced generation.

[0005] According to one aspect of the present invention, there is provided a document parsing method for retrieval enhancement generation, comprising:

[0006] Performing format conversion on the first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format;

[0007] Parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed;

[0008] A target parsing result is generated according to the first parsing information and the second parsing information, and retrieval enhancement generation is performed based on the target parsing result, wherein the target parsing result includes content information and structure information of the first document to be parsed.

[0009] According to another aspect of the present invention, there is provided a document parsing device for retrieving enhanced generation, comprising:

[0010] A document format conversion module, used for converting the format of the first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format;

[0011] A text information parsing module, used to parse the first document to be parsed and the second document to be parsed respectively, to obtain first parsed information corresponding to the first document to be parsed and second parsed information corresponding to the second document to be parsed;

[0012] The parsing result determination module is used to generate a target parsing result according to the first parsing information and the second parsing information, and perform retrieval enhancement generation based on the target parsing result, wherein the target parsing result includes content information and structure information of the first document to be parsed.

[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0014] at least one processor;

[0015] and a memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document parsing method for retrieval enhancement generation described in any embodiment of the present invention.

[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the document parsing method for retrieval enhancement generation described in any embodiment of the present invention when executed.

[0018] The technical solution of the embodiment of the present invention includes: converting the format of a first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format; parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed; generating a target parsing result according to the first parsing information and the second parsing information, performing retrieval enhancement generation based on the target parsing result, and the target parsing result includes content information and structural information of the first document to be parsed. The technical solution of the embodiment of the present invention combines the advantages of parsing documents in two formats, solves the problem that although the existing document parsing technology can obtain all text information, it still has deficiencies in content tracing and complete table extraction, and realizes the use of the original structural information of the document for text segmentation, as well as accurate and complete extraction of the content in the document for retrieval enhancement generation.

[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] Figure 1 A flowchart of a document parsing method for retrieval enhanced generation provided in the first embodiment of the present invention;

[0022] Figure 2 A flowchart of a method for retrieving enhanced generated documents provided in Embodiment 2 of the present invention;

[0023] Figure 3 A flowchart of a document parsing method for retrieving enhanced generation provided in Embodiment 3 of the present invention;

[0024] Figure 4 A schematic diagram of the structure of a document parsing device for retrieval enhancement generation provided in the fourth embodiment of the present invention;

[0025] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] Embodiment 1

[0029] Figure 1 This is a flowchart of a document parsing method for retrieval enhanced generation provided in the first embodiment of the present invention. This embodiment is applicable to the case where a fine-grained analysis is performed on a document and the analysis result is used for retrieval enhanced text generation. The method can be executed by a document parsing device for retrieval enhanced generation, which can be implemented in the form of hardware and / or software and can be configured in a computer device. Figure 1 As shown, the method includes:

[0030] S110: Convert the format of the first document to be parsed to obtain a second document to be parsed.

[0031] Among them, the first document to be parsed is in word format, and the second document to be parsed is in pdf format.

[0032] Specifically, a tool with a Word-to-PDF conversion function may be called to convert the first document to be parsed into the second document to be parsed, or the first document to be parsed may be format-converted through an online conversion service to obtain the second document to be parsed.

[0033] S120: Parse the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed.

[0034] The first parsed information may be information obtained after parsing the first document to be parsed, for example, the first information to be parsed includes but is not limited to table content; the second parsed information may be information obtained after parsing the second document to be parsed.

[0035] Specifically, since the first document to be parsed is in word format, it can be parsed by a tool specifically for parsing word; the second document to be parsed can be parsed by a PDF parsing tool.

[0036] In the embodiment of the present invention, the first document to be parsed includes a first table, and the first parsing information includes first table content information of the first table.

[0037] The first document to be parsed is parsed to obtain first table parsing information corresponding to the first document to be parsed, including: parsing the XML information of the first document to be parsed based on python-docx, and identifying the first table content information corresponding to the first table in the first document to be parsed through table declaration symbols.

[0038] The first table may be a table in the first document to be parsed, and the number of the first table is not limited to one, and may be multiple tables. The first table content information may be information related to the first table content obtained after parsing the first document to be parsed, such as the rows, columns, cell contents of the table, and format attributes of the table.

[0039] Specifically, the python-docx library can be used to read the first document to be parsed and access its underlying XML structure. In XML information, a table is usually represented by a table declaration symbol, and all complete information of the first table can be extracted according to the table declaration symbol, including the table's rows, columns, cell contents, and format attributes.

[0040] In the embodiment of the present invention, the second document to be parsed includes a second table, and the second parsing information includes second table content information and second table location information corresponding to the second table.

[0041] Parsing the second document to be parsed to obtain second parsing information corresponding to the second document to be parsed includes: parsing the second document to be parsed to obtain second table content information and second table location information corresponding to the second table in the second document to be parsed.

[0042] The second table may be a table in the second document to be parsed, and a single second table may correspond to the first table or may not correspond to the first table. The second table content information may be understood as information related to the content of the second table obtained after parsing the second document to be parsed; the second table location information includes the coordinate information and page number information corresponding to the second table in the second document to be parsed.

[0043] S130: Generate a target parsing result according to the first parsing information and the second parsing information, and perform retrieval enhancement generation based on the target parsing result, wherein the target parsing result includes content information and structure information of the first document to be parsed.

[0044] Among them, the target parsing result can be the parsing result corresponding to the first document to be parsed obtained by the final parsing, which can include content information and structure information. The content information can refer to the specific content included in the first document to be parsed, and the structure information can be the structure of each part of the content in the first document to be parsed, such as location coordinates, etc.

[0045] It is understandable that pure Word parsing can determine the XML structure of the document and then extract the complete content of the table, but it cannot determine the location information of the table in the entire document; while PDF parsing can accurately extract the location information of the table in the document, but due to the conversion from Word format to PDF format, a single table in the first document to be parsed will often become multiple tables across pages in the second document to be parsed.

[0046] Therefore, the target parsing result can be generated according to the first parsing information and the second parsing information. That is, by combining the advantages of the two parsing methods, both the specific content of the table and the position of the table in the document can be determined, which facilitates the subsequent accurate and complete extraction of the table in the document for retrieval enhancement generation.

[0047] In an embodiment of the present invention, generating a target parsing result based on the first parsing information and the second parsing information includes: if the degree of matching between the first table content information and the second table content information is greater than a first preset threshold, using the second table location information as the first table location information of the first table in the first document to be parsed; and generating a target parsing result corresponding to the first table based on the first table content information and the first table location information.

[0048] The first preset threshold may be a preset matching degree threshold.

[0049] Specifically, the content information of the first table is compared with the content information of the second table, and the degree of match between them is calculated. The degree of match can be calculated by a similarity algorithm. If the degree of match is greater than a first preset threshold, it is considered that the first table and the second table are highly similar in content, and are essentially the same table in two documents of different formats. Furthermore, the second table position information of the second table is used as the position information of the first table in the first document to be parsed, that is, the first table position information. Finally, the first table content information and the first table position information can be used as the target parsing result corresponding to the first table. According to the target parsing result, the document can be analyzed in a fine-grained manner, and the analysis results can be used for retrieval-enhanced text generation (i.e., RAG).

[0050] The technical solution of the embodiment of the present invention includes: performing format conversion on a first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format; parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed; generating a target parsing result according to the first parsing information and the second parsing information, performing retrieval enhancement generation based on the target parsing result, the target parsing result including content information and structural information of the first document to be parsed. The technical solution of the embodiment of the present invention combines the advantages of parsing documents in two formats, solves the problem that although the existing document parsing technology can obtain all text information, it still has deficiencies in content tracing and complete table extraction, and realizes the use of the original structural information of the document for text segmentation, as well as accurate and complete extraction of the content in the document for retrieval enhancement generation.

[0051] Embodiment 2

[0052] Figure 2 This is a flowchart of a method for retrieving enhanced generated documents provided in the second embodiment of the present invention. Based on the above embodiment, this embodiment further explains the parsing and extraction process of images in documents. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiment are not repeated here. Figure 2 As shown, the method includes:

[0053] S210: Convert the format of the first document to be parsed to obtain a second document to be parsed.

[0054] Among them, the first document to be parsed is in word format, and the second document to be parsed is in pdf format.

[0055] S220: Parse the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed.

[0056] Among them, the first document to be parsed also includes a first picture, and the first parsing information includes first picture content information corresponding to the first picture; the second document to be parsed also includes a second picture, and the second parsing information includes second picture content information and second picture location information corresponding to the second picture.

[0057] The first image may be an image in the first document to be parsed, and the number of the first images is not limited to one, and may be multiple images. The first image content information may be information related to the first image content obtained after parsing the first document to be parsed, such as pixel data, color distribution, shape features, etc. of the image.

[0058] The second image may be an image in the second document to be parsed, and the second image content information may be understood as information related to the content of the second image obtained after parsing the second document to be parsed; the second image location information includes the coordinate information and page number information corresponding to the second image in the second document to be parsed.

[0059] S230: If the matching degree between the first image content information and the second image content information is greater than a second preset threshold, use the second image position information as the first image position information of the first image in the first document to be parsed.

[0060] The second preset threshold may be a preset matching degree threshold.

[0061] Specifically, the first image content information is compared with the second image content information, and the degree of match between them is calculated. The degree of match can be calculated by a similarity algorithm. If the degree of match is greater than a first preset threshold, it is considered that the first image and the second image are highly similar in content, and are essentially the same image in two documents of different formats. Furthermore, the second image position information of the second image is used as the position information of the first image in the first document to be parsed, that is, the first image position information. Finally, based on the first image content information and the first image position information, a target parsing result corresponding to the first image is generated. According to the target parsing result, the document can be analyzed in a fine-grained manner, and the analysis result can be used for retrieval-enhanced text generation.

[0062] S240: Generate a target parsing result corresponding to the first picture based on the first picture content information and the first picture position information.

[0063] The technical solution of the embodiment of the present invention includes: performing format conversion on a first document to be parsed to obtain a second document to be parsed. Parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed. If the degree of match between the first image content information and the second image content information is greater than a second preset threshold, the second image position information is used as the first image position information of the first image in the first document to be parsed. A target parsing result corresponding to the first image is generated based on the first image content information and the first image position information. The technical solution of the embodiment of the present invention combines the advantages of parsing documents in two formats, solves the problem that although the existing document parsing technology can obtain all text information, it still has deficiencies in content tracing and complete table extraction, and realizes the use of the original structural information of the document for text segmentation, as well as accurate and complete extraction of the content in the document for retrieval enhancement generation.

[0064] Embodiment 3

[0065] Figure 3 This is a flowchart of a document parsing method for retrieval enhancement generation provided in the third embodiment of the present invention. Based on the above embodiment, this embodiment further introduces the text parsing in the document. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiment are not repeated here. Figure 3 As shown, the method includes:

[0066] S310: Convert the format of the first document to be parsed to obtain a second document to be parsed.

[0067] The first parsing information further includes first text block content information, and the second parsing information includes second text block content information and second text block position information corresponding to the second text block.

[0068] The first text block content information may be content information related to the text block extracted from the first document to be parsed. The text block may be a continuous text, such as a paragraph, a title, etc. The first text content information may include the actual characters, font, font size, color, bold, and other information of the text.

[0069] The second text block content information is similar to the first text block content information. The second text block content information is content information related to the text block extracted from the second document to be parsed. The second text block position information refers to the position information of the second text block in the second document to be parsed, including the coordinates of the text block on the page, the page number, etc.

[0070] S320: parse the first document to be parsed to obtain XML information, and determine tag information of text in the first document to be parsed based on the XML information.

[0071] Specifically, when parsing the first document to be parsed, the tag information of the text in the first document to be parsed can be determined based on the XML information, for example, the tag information such as the font size, font information, bold information, etc. of the text can be extracted.

[0072] S330: Determine a text cutting symbol according to the marking information of the text, and cut the text by recursive cutting to obtain a plurality of the first text blocks.

[0073] After obtaining the marking information of the text, the corresponding cutting symbols can be determined based on the marking information of the text. The title can be set as the first-level cutting symbol of the text, the paragraph can be set as the second-level cutting symbol of the text, and the period can be set as the third-level cutting symbol of the text. The text can be cut using a recursive cutting method to obtain multiple first text blocks.

[0074] S340: For a single first text block, determine first text block content information corresponding to the first text block.

[0075] Specifically, the first document to be parsed is parsed, text blocks therein are identified, and content information of each first text block is extracted.

[0076] S350: Parse the second document to be parsed to determine second text block content information and second text block position information corresponding to the second text block in the second document to be parsed.

[0077] Specifically, the second document to be parsed is parsed, the second text blocks therein are identified, and the content information and position information of each second text block, ie, the second text block content information and the second text block position information, are extracted.

[0078] S360: If the matching degree between the first text block content information and the second text block content information is greater than a third preset threshold, the second text block position information is used as the first text block position information of the first text block in the first document to be parsed.

[0079] S370. Generate a target parsing result corresponding to the first text block based on the first text block content information and the first text block position information.

[0080] The third preset threshold may be a preset matching degree threshold.

[0081] Specifically, the content information of the first text block is compared with the content information of the second text block, and the degree of match between them is calculated. The degree of match can be calculated by a similarity algorithm. If the degree of match is greater than a first preset threshold, it is considered that the first text block and the second text block are highly similar in content, and are essentially the same text block in two documents of different formats. Furthermore, the second text block position information of the second text block is used as the position information of the first text block in the first document to be parsed, that is, the first text block position information. Finally, based on the first text block content information and the first text block position information, a target parsing result corresponding to the first text block is generated. According to the target parsing result, a fine-grained analysis of the document can be performed, and the analysis result can be used for retrieval-enhanced text generation.

[0082] It is understandable that pure Word parsing can determine the XML structure of the document, extract detailed formatting information of the text (such as font size, font, bold, etc.) and the complete content of the table. PDF parsing can accurately extract the location information (such as coordinates, page numbers) of elements such as text, tables, and pictures in the document, which plays an important role in document cutting. By combining the two parsing methods, it supports the positioning of document content and can completely extract table information. It can also cut based on the document structure, that is, make full use of the structural information of the document to cut the text as much as possible.

[0083] The technical solution of the embodiment of the present invention can convert a document in word format into a document in pdf format and parse it for positioning, and parse pure word to obtain richer text structure information; based on the chapter structure of the document, the text in the word format document is segmented to make it available for RAG tasks.

[0084] The technical solution of the embodiment of the present invention includes: converting the format of a first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format; parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed; generating a target parsing result according to the first parsing information and the second parsing information, performing retrieval enhancement generation based on the target parsing result, and the target parsing result includes content information and structural information of the first document to be parsed. The technical solution of the embodiment of the present invention combines the advantages of parsing documents in two formats, solves the problem that although the existing document parsing technology can obtain all text information, it still has deficiencies in content tracing and complete table extraction, and realizes the use of the original structural information of the document for text segmentation, as well as accurate and complete extraction of the content in the document for retrieval enhancement generation.

[0085] Embodiment 4

[0086] Figure 4 A schematic diagram of a document parsing device for searching enhanced generation provided by the fourth embodiment of the present invention. Figure 4 As shown, the device comprises:

[0087] The document format conversion module 410 is used to convert the format of the first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format;

[0088] A text information parsing module 420, configured to parse the first document to be parsed and the second document to be parsed respectively, to obtain first parsed information corresponding to the first document to be parsed and second parsed information corresponding to the second document to be parsed;

[0089] The parsing result determination module 430 is used to generate a target parsing result according to the first parsing information and the second parsing information, and perform retrieval enhancement generation based on the target parsing result, wherein the target parsing result includes content information and structure information of the first document to be parsed.

[0090] Optionally, the first document to be parsed includes a first table, and the first parsing information includes first table content information of the first table;

[0091] The text information parsing module 420 includes:

[0092] The first table content information extraction submodule is used to parse the XML information of the first document to be parsed based on python-docx, and identify the first table content information corresponding to the first table in the first document to be parsed through table declaration symbols.

[0093] Optionally, the second document to be parsed includes a second table, and the second parsing information includes second table content information and second table location information corresponding to the second table;

[0094] The text information parsing module 420 includes:

[0095] A first table content information extraction submodule is used to parse the second document to be parsed to obtain second table content information and second table position information corresponding to the second table in the second document to be parsed;

[0096] The second table location information includes coordinate information and page number information corresponding to the second table in the second document to be parsed.

[0097] Optionally, the analysis result determination module 430 is specifically configured to:

[0098] If the matching degree between the first table content information and the second table content information is greater than a first preset threshold, taking the second table position information as the first table position information of the first table in the first document to be parsed;

[0099] A target parsing result corresponding to the first table is generated based on the first table content information and the first table location information.

[0100] Optionally, the first document to be parsed also includes a first picture, and the first parsing information includes first picture content information corresponding to the first picture; the second document to be parsed also includes a second picture, and the second parsing information includes second picture content information and second picture location information corresponding to the second picture.

[0101] Optionally, the analysis result determination module 430 is further configured to:

[0102] If the matching degree between the first picture content information and the second picture content information is greater than a second preset threshold, using the second picture position information as the first picture position information of the first picture in the first document to be parsed;

[0103] A target parsing result corresponding to the first picture is generated based on the first picture content information and the first picture location information.

[0104] Optionally, the first parsing information further includes first text block content information, and the second parsing information includes second text block content information and second text block position information corresponding to the second text block;

[0105] The text information parsing module 420 is also used for:

[0106] Parsing the first document to be parsed to obtain XML information, and determining tag information of text in the first document to be parsed based on the XML information;

[0107] Determining a text cutting symbol according to the mark information of the text, and cutting the text by recursive cutting to obtain a plurality of the first text blocks;

[0108] For a single first text block, determining first text block content information corresponding to the first text block;

[0109] The second document to be parsed is parsed to determine second text block content information and second text block position information corresponding to the second text block in the second document to be parsed.

[0110] Optionally, the analysis result determination module 430 is further configured to:

[0111] If the matching degree between the first text block content information and the second text block content information is greater than a third preset threshold, taking the second text block position information as the first text block position information of the first text block in the first document to be parsed;

[0112] A target parsing result corresponding to the first text block is generated based on the first text block content information and the first text block position information.

[0113] The document parsing device for retrieval enhanced generation provided by the embodiment of the present invention can execute the document parsing method for retrieval enhanced generation provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0114] Embodiment 5

[0115] Figure 5 A schematic diagram of the structure of an electronic device provided for Embodiment 5 of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0116] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0117] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0118] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a document parsing method for retrieval enhancement generation.

[0119] In some embodiments, the document parsing method for retrieving enhanced generation may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the document parsing method for retrieving enhanced generation described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the document parsing method for retrieving enhanced generation in any other appropriate manner (e.g., by means of firmware).

[0120] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0121] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0122] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0123] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0124] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0125] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0126] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A document parsing method for retrieval enhanced generation, characterized in that: include: Performing format conversion on the first document to be parsed to obtain a second document to be parsed, wherein the first document to be parsed is in word format and the second document to be parsed is in pdf format; Parsing the first document to be parsed and the second document to be parsed respectively to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed; A target parsing result is generated according to the first parsing information and the second parsing information, and retrieval enhancement generation is performed based on the target parsing result, wherein the target parsing result includes content information and structure information of the first document to be parsed.

2. The method according to claim 1, characterized in that The first document to be parsed includes a first table, and the first parsing information includes first table content information of the first table; The step of parsing the first document to be parsed to obtain first table parsing information corresponding to the first document to be parsed includes: The xml information of the first document to be parsed is parsed based on python-docx, and the first table content information corresponding to the first table in the first document to be parsed is identified through a table declaration symbol.

3. The method according to claim 2, characterized in that The second document to be parsed includes a second table, and the second parsed information includes second table content information and second table location information corresponding to the second table; The parsing the second document to be parsed to obtain second parsing information corresponding to the second document to be parsed includes: Parsing the second document to be parsed to obtain second table content information and second table location information corresponding to the second table in the second document to be parsed; The second table location information includes coordinate information and page number information corresponding to the second table in the second document to be parsed.

4. The method according to claim 3, characterized in that The generating a target parsing result according to the first parsing information and the second parsing information includes: If the matching degree between the first table content information and the second table content information is greater than a first preset threshold, taking the second table position information as the first table position information of the first table in the first document to be parsed; A target parsing result corresponding to the first table is generated based on the first table content information and the first table location information.

5. The method according to claim 1, characterized in that The first document to be parsed also includes a first picture, and the first parsing information includes first picture content information corresponding to the first picture; the second document to be parsed also includes a second picture, and the second parsing information includes second picture content information and second picture location information corresponding to the second picture.

6. The method according to claim 5, characterized in that The generating a target parsing result according to the first parsing information and the second parsing information includes: If the matching degree between the first picture content information and the second picture content information is greater than a second preset threshold, using the second picture position information as the first picture position information of the first picture in the first document to be parsed; A target parsing result corresponding to the first picture is generated based on the first picture content information and the first picture location information.

7. The method according to claim 1, characterized in that The first parsing information further includes first text block content information, and the second parsing information includes second text block content information and second text block position information corresponding to the second text block; The step of respectively parsing the first document to be parsed and the second document to be parsed to obtain first parsing information corresponding to the first document to be parsed and second parsing information corresponding to the second document to be parsed includes: Parsing the first document to be parsed to obtain XML information, and determining tag information of text in the first document to be parsed based on the XML information; Determining a text cutting symbol according to the mark information of the text, and cutting the text by recursive cutting to obtain a plurality of the first text blocks; For a single first text block, determining first text block content information corresponding to the first text block; The second document to be parsed is parsed to determine second text block content information and second text block position information corresponding to the second text block in the second document to be parsed.

8. The method according to claim 7, characterized in that The generating a target parsing result according to the first parsing information and the second parsing information includes: If the matching degree between the first text block content information and the second text block content information is greater than a third preset threshold, taking the second text block position information as the first text block position information of the first text block in the first document to be parsed; A target parsing result corresponding to the first text block is generated based on the first text block content information and the first text block position information.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the document parsing method for retrieval enhancement generation according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the document parsing method for retrieval enhancement generation according to any one of claims 1 to 8 when executed.