Format document processing method, device and equipment

By extracting, matching and comparing layout documents, generating side-by-side comparison reports and rendering documents, the problem of inefficient side-by-side documents in the existing technology is solved, and efficient side-by-side comparison and excellent user experience is achieved.

CN119416769AInactive Publication Date: 2025-02-11BEIJING SUWELL TECHNOLOGY CO LTD +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411788504.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-02-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing document side-by-side comparison function requires manual review of two documents to find the differences, which are inefficient and have poor user experience.

Method used

By obtaining two layout documents, data extraction processing, matching data, side-by-side comparison, generating difference point data, and generating side-by-side comparison reports based on the difference point data, finally rendering and loading the document to achieve intuitive comparison results exhibit.

Benefits of technology

It reduces the workload of manual comparison, improves the efficiency and user experience of side-by-side comparison of layout documents, and allows users to intuitively see the differences between documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416769A_ABST
    Figure CN119416769A_ABST
Patent Text Reader

Abstract

The invention provides a format document processing method, device and equipment. The method comprises the following steps: acquiring a first target format document and a second target format document; performing data extraction processing on the first target format document and the second target format document to obtain first target data and second target data; matching the first target data with the second target data to obtain a matching result; according to the matching result, performing side-by-side comparison on the first target data and the second target data to obtain difference point data; obtaining a target side-by-side comparison report according to the difference point data; and rendering and loading the first target format document and the second target format document according to the target side-by-side comparison report. According to the method and the device, a user can conveniently and intuitively see the side-by-side comparison result of the first target layout document and the second target layout document, and the method and the device have the advantages of improving layout document side-by-side comparison efficiency and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of layout documents, and also to a method, device and equipment for processing layout documents. Background Art

[0002] Currently, the side-by-side comparison function of documents can view two or more documents side by side to compare the contents of different documents. However, the existing side-by-side comparison function of documents requires repeated viewing of two documents to find the differences between the two documents, which is labor-intensive and inefficient, and has a poor user experience. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a method, device and equipment for processing layout documents to improve the efficiency of layout document comparison and user experience.

[0004] In order to solve the above technical problems, the technical solution of the present invention is as follows:

[0005] A first aspect of the present invention provides a method for processing a layout document, comprising:

[0006] Acquire a first target format document and a second target format document;

[0007] Performing data extraction processing on the first target format document to obtain first target data;

[0008] Performing data extraction processing on the second target format document to obtain second target data;

[0009] Matching the first target data and the second target data to obtain a matching result;

[0010] According to the matching result, the first target data and the second target data are compared side by side to obtain difference point data;

[0011] According to the difference point data, a target side-by-side comparison report is obtained;

[0012] The first target layout document and the second target layout document are rendered and loaded according to the target side-by-side comparison report.

[0013] Optionally, obtaining the first target format document and the second target format document includes:

[0014] Acquire a first original document and a second original document;

[0015] Converting the first original document into a layout document format to obtain a first target layout document;

[0016] The second original document is converted into a layout document format to obtain a second target layout document.

[0017] Optionally, performing data extraction processing on the first target format document to obtain first target data includes: extracting at least one of directory data, text data, image data, and table data from the first target format document to obtain the first target data;

[0018] Performing data extraction processing on the second target format document to obtain second target data includes:

[0019] At least one of directory data, text data, picture data, and table data is extracted from the second target format document to obtain second target data.

[0020] Optionally, matching the first target data and the second target data to obtain a matching result includes:

[0021] Calculating similarity between the first target data and the second target data to obtain similarity;

[0022] According to the similarity and the preset expected value, the first target data and the second target data are matched to obtain a matching result.

[0023] Optionally, according to the matching result, the first target data and the second target data are compared side by side to obtain difference point data, including:

[0024] According to the matching result, determining an initialization matrix;

[0025] Traversing and filling the initialization matrix to obtain a target matrix;

[0026] According to the target matrix, the first target data and the second target data are compared side by side to obtain difference point data.

[0027] Optionally, a target side-by-side comparison report is obtained based on the difference point data, including:

[0028] According to the difference point data, an original side-by-side comparison report is obtained;

[0029] The original side-by-side comparison report is adjusted according to preset conditions to obtain a target side-by-side comparison report.

[0030] Optionally, rendering and loading the first target layout document and the second target layout document according to the target side-by-side comparison report includes:

[0031] Rendering the first target layout document and the second target layout document respectively according to a preset rendering mode and the target side-by-side comparison report to obtain a rendered first target layout document and a rendered second target layout document;

[0032] The rendered first target layout document and the rendered second target layout document are loaded.

[0033] A second aspect of the present invention provides a layout document processing device, comprising:

[0034] An acquisition module, used for acquiring a first target format document and a second target format document;

[0035] A processing module is used to perform data extraction processing on the first target layout document to obtain first target data; perform data extraction processing on the second target layout document to obtain second target data; match the first target data and the second target data to obtain a matching result; based on the matching result, perform a side-by-side comparison of the first target data and the second target data to obtain difference point data; based on the difference point data, obtain a target side-by-side comparison report; based on the target side-by-side comparison report, render and load the first target layout document and the second target layout document.

[0036] According to a third aspect of the present invention, a computing device is provided, comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to the first aspect is executed.

[0037] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the method described in the first aspect.

[0038] The above solution of the present invention includes at least the following beneficial effects:

[0039] The above-mentioned scheme of the present invention obtains the first target layout document and the second target layout document, and performs data extraction processing to obtain the first target data and the second target data, and then matches the first target data and the second target data, and compares the first target data and the second target data side by side according to the matching result to obtain the difference point data, and then obtains the target side-by-side comparison report, and then renders and loads the first target layout document and the second target layout document, so that the user can intuitively see the side-by-side comparison results of the first target layout document and the second target layout document, thereby reducing the workload of manual comparison, and has the advantages of improving the efficiency of side-by-side comparison of layout documents and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a flowchart of a method for processing a layout document in an embodiment of the present invention;

[0041] Figure 2 It is a flowchart of a specific embodiment of the method for processing a layout document in an embodiment of the present invention;

[0042] Figure 3 is a schematic diagram of side-by-side comparison of layout documents in an embodiment of the present invention;

[0043] Figure 4 It is a structural schematic diagram of a layout document processing device in an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0045] like Figure 1 As shown, an embodiment of the present invention provides a method for processing a layout document, comprising the following steps:

[0046] Step 101, obtaining a first target format document and a second target format document;

[0047] Step 102, performing data extraction processing on the first target format document to obtain first target data;

[0048] Step 103, performing data extraction processing on the second target format document to obtain second target data;

[0049] Step 104, matching the first target data and the second target data to obtain a matching result;

[0050] Step 105, according to the matching result, the first target data and the second target data are compared side by side to obtain difference point data;

[0051] Step 106, obtaining a target side-by-side comparison report based on the difference point data;

[0052] Step 107: Render and load the first target layout document and the second target layout document according to the target side-by-side comparison report.

[0053] The method for processing layout documents proposed in the embodiment of the present invention obtains a first target layout document and a second target layout document, and performs data extraction processing to obtain first target data and second target data, then matches the first target data and the second target data, and compares the first target data and the second target data side by side according to the matching result to obtain difference point data, and then obtains a target side-by-side comparison report, and then renders and loads the first target layout document and the second target layout document, so that the user can intuitively see the side-by-side comparison results of the first target layout document and the second target layout document, thereby reducing the workload of manual comparison and having the advantages of improving the efficiency of side-by-side comparison of layout documents and user experience.

[0054] In an optional embodiment of the present invention, step 101 includes:

[0055] Step 1011, obtaining a first original document and a second original document;

[0056] Specifically, the document formats of the acquired first original document and the acquired second original document may be documents in .doc, .html, .txt, .pdf, .xls, etc. formats, so as to meet the comparison requirements of documents in different formats.

[0057] Step 1012, converting the first original document into a layout document format to obtain a first target layout document;

[0058] Specifically, in order to facilitate subsequent processing and improve processing efficiency, it is necessary to convert the first original document into a document in a target format. In the present embodiment, an OFD format document (open format document) is used as the processing object, and therefore, the first original document is converted into a first target format document in the OFD format document format. In specific applications, the first original document can also be formatted according to the document format required for subsequent processing to meet the needs of subsequent processing and improve adaptability. Here, a document format conversion tool can be used to convert the first original document into an OFD format document; wherein, for the first original document in .txt or .xls format, the first original document can be first converted into a .doc or .pdf intermediate format document, and then the document format conversion tool can be used to convert the intermediate format document into an OFD format document. In a specific embodiment, selection can be made as needed.

[0059] Step 1013: convert the second original document into a layout document format to obtain a second target layout document.

[0060] Specifically, in order to facilitate subsequent processing and improve processing efficiency, the second original document needs to be converted into a document in a target format. In the present embodiment, an OFD format document (open format document) is used as the processing object, therefore, the second original document is converted into a second target format document in the OFD format document format. In specific applications, the second original document can also be formatted according to the document format required for subsequent processing to meet the needs of subsequent processing and improve adaptability. Here, a document format conversion tool can be used to convert the second original document into an OFD format document; wherein, for a first original document in a format such as .txt or .xls, the second original document can be first converted into an intermediate format document in a .doc or .pdf format, and then the document format conversion tool can be used to convert the intermediate format document into an OFD format document. In a specific embodiment, selection can be made as needed.

[0061] In an optional embodiment of the present invention, step 102 includes:

[0062] At least one of directory data, text data, picture data, and table data is extracted from the first target format document to obtain first target data.

[0063] Specifically, data extraction can be performed on the first target layout document according to user needs. For example, if the user's need is to compare the main text, all the main text data in the first target layout document can be extracted and used as the first target data for subsequent comparison; if the user's need is to perform a full comparison, all the content or data in the first target layout document needs to be extracted and used as the first target data for subsequent comparison. The specific content of data extraction can be determined according to user needs to meet user needs and improve user experience. Here, the extraction of the first target layout document is not limited to the above-mentioned directory data, main text data, image data, and table data, but may also include other content, such as titles, etc.

[0064] In an optional embodiment of the present invention, step 103 includes:

[0065] At least one of directory data, text data, picture data, and table data is extracted from the second target format document to obtain second target data.

[0066] Specifically, data can be extracted from the second target layout document according to the needs of the user. For example, if the user's need is to compare the main text, all the main text data in the second target layout document can be extracted and used as the second target data for subsequent comparison; if the user's need is to perform a full comparison, all the content or data in the second target layout document needs to be extracted and used as the second target data for subsequent comparison. The specific content of data extraction can be determined according to user needs to meet user needs and improve user experience. Here, the extraction of the second target layout document is not limited to the above-mentioned directory data, main text data, image data, and table data, but may also include other content, such as titles, etc.

[0067] It should be noted that since the subsequent comparison is between the first target layout document and the second target layout document, the data type of the second target data needs to be consistent with the data type of the first target data, that is, if the first target data is the main text data in the first target layout document, then the second target data is the main text data in the second target layout document accordingly; if the first target data is the main text data and directory data in the first target layout document, then the second target data is the main text data and directory data in the second target layout document accordingly, so as to maintain data consistency and improve comparison efficiency and accuracy.

[0068] In an optional embodiment of the present invention, step 104 includes:

[0069] Step 1041, calculating similarity between the first target data and the second target data to obtain similarity;

[0070] Specifically, the purpose of calculating the similarity between the first target data and the second target data is to match the first target data in the first target layout document with the second target data in the second target layout document, and to place the data with a similarity higher than a preset value side by side, so that subsequent users can intuitively see the differences between the two documents. The similarity calculation process may include:

[0071] Firstly, the first target data and the second target data are converted into a first vector and a second vector respectively;

[0072] Here, the conversion of one of the first target data (such as a natural paragraph) into a first vector is used as an example for explanation. The text in the first target data is split into separate words, the first target data is traversed, and all unique words that appear are collected to form a vocabulary, and each word in the vocabulary has a unique index; for the first target data, the number of times each word in the vocabulary appears in the first target data is counted, represented by an array, each element of the array corresponds to a word in the vocabulary, and the value of the element is the number of times the word appears in the first target data; according to the array, the first vector is obtained, the length of the first vector is equal to the size of the vocabulary, and each element of the first vector corresponds to a word in the vocabulary. If the word appears in the first target data, the value of the corresponding element is its word frequency in the first target data (or other measurement, such as binary representation, that is, 1 for appearance and 0 for non-appearance); if the word does not appear in the first target data, the value of the corresponding element is usually 0; if the first target data has the following two natural paragraphs:

[0073] Paragraph 1: "The first paragraph is blank."

[0074] Paragraph 2: "The second paragraph is full."

[0075] After word segmentation and removal of stop words, we can get a vocabulary: {"first", "second", "is", "for", "paragraph", "empty", "full"}; when constructing a vector, we can choose to use word frequency or binary representation. For example, the example using word frequency representation:

[0076] For paragraph 1: "The first paragraph is empty.", the vector is: [1, 0, 1, 0, 1, 1, 0] (because "first", "is", "paragraph", and "empty" each appear once, and "second", "is", and "full" do not appear).

[0077] For paragraph 2: "The second paragraph is full.", the vector is: [0, 1, 0, 1, 1, 0, 1] (because "second", "is", "paragraph", and "full" each appear once, and "first", "is", and "empty" do not appear).

[0078] Then, the cosine value of the angle between the first vector and the second vector is calculated as the similarity.

[0079] Here, you can use in, is the first vector, is the second vector, n is the dimension of the vector (the first and second vectors have the same dimension), A i is the component of the first vector in the i-th dimension, B i is the component of the second vector in the i-th dimension.

[0080] Step 1042: Match the first target data and the second target data according to the similarity and the preset expected value to obtain a matching result.

[0081] Specifically, the first target data and the second target data whose similarity is greater than or equal to the preset expected value are placed side by side. For example, if the first target data is the first natural paragraph in the first target layout document, and the second target data is the second natural paragraph in the second target layout document, if the similarity between the first natural paragraph and the second natural paragraph is 0.9, which is greater than the preset expected value 0.6, then the first natural paragraph in the first target layout document and the second natural paragraph in the second target layout document are placed side by side (if the first target layout document is on the left and the second target layout document is on the right, the first natural paragraph and the second natural paragraph are aligned and placed side by side), so that after the difference points are rendered later, the user can directly see the difference between the first target layout document and the second target layout document. Here, the matching result can be the result of placing the natural paragraphs with the highest similarity between the first target data and the second target data side by side, wherein, if there is no natural paragraph in the second target data whose similarity with a natural paragraph in the first target data is greater than or equal to the preset expected value, the place in the second target data side by side with the first target data can be left blank, and the "deleted" difference points can be directly obtained later.

[0082] In an optional embodiment of the present invention, step 105 includes:

[0083] Step 1051, determining an initialization matrix according to the matching result;

[0084] Specifically, according to the length of the first target data segment and the length of the second target data segment in the matching result, determine the initialization matrix (p+1)×(q+1), where p is the length of the first target data segment, q is the length of the second target data segment, and the first row and the first column of the initialization matrix are initialized to integers from 0 to p and from 0 to q, respectively. The first row represents the number of insertion operations required to convert an empty string into the second string, and the first column represents the number of deletion operations required to convert an empty string into the first string.

[0085] Step 1052, traverse and fill the initialization matrix to obtain a target matrix;

[0086] Specifically, traverse each cell (i, j) of the initialization matrix. If i is 0 (the first row), D[i][j] = j, because j characters need to be inserted into the empty string to match the first j characters of the second string; if j is 0 (the first column), D[i][j] = i, because i characters need to be deleted to convert the first i characters of the first string into an empty string; if the current characters of the two strings are the same (character 1[i-1] == character 2[j-1]), no editing operation is required, so D[i][j] = target matrix i-1][j-1]; if the current characters are different, calculate the minimum number of edits required for replacement, deletion, and insertion operations, and take the minimum value of these three cases as the value of D[i][j]. According to the above process, the target matrix D can be obtained.

[0087] Step 1053: perform a side-by-side comparison on the first target data and the second target data according to the target matrix to obtain difference point data.

[0088] Specifically, according to the target matrix, specific operations such as deletion, replacement or insertion can be obtained to change the characters of a natural paragraph in the first target data into the characters of a natural paragraph in the corresponding second target data. These operations are used as the difference point data between the first target data and the second target data for subsequent display to the user.

[0089] In an optional embodiment of the present invention, step 106 includes:

[0090] Step 1061, obtaining an original side-by-side comparison report based on the difference point data;

[0091] Specifically, the original side-by-side comparison report may include all differences between the first target data and the second target data, that is, the original side-by-side comparison report may include all difference point data.

[0092] Step 1062, adjusting the original side-by-side comparison report according to preset conditions to obtain a target side-by-side comparison report.

[0093] Specifically, in order to conform to the user's reading habits and facilitate understanding, the difference point data in the original side-by-side comparison report can be adjusted. For example, the "123" in the first target data and the "124" in the second target data, the difference point data in the original side-by-side comparison report are "3" and "4", but "123" and "124" as a whole, in order to conform to the reading habits, the difference point data can be adjusted to "123" and "124", that is, the "123" in the first target data is replaced with "124" in the second target data, instead of replacing the "123" in the first target data with "124" in the second target data in the original side-by-side comparison report. 3" is replaced with "4", which is conducive to improving the intuitiveness of the difference display and the user experience. Here, the difference point data in the original side-by-side comparison report can also be adjusted according to preset conditions, such as dictionary, stop dictionary, whether to use word segmentation, whether to ignore junk characters, paragraph matching minimum similarity, whether to use phrases and junk character recognition functions, etc. If the preset condition is whether to use word segmentation, the word segmentation in the difference point data can be merged accordingly, such as replacing "123" with "124" in the above; if the preset condition is to ignore junk characters, the junk characters such as spaces in the difference point data can be deleted accordingly.

[0094] In an optional embodiment of the present invention, step 107 includes:

[0095] Step 1071, rendering the first target layout document and the second target layout document respectively according to a preset rendering mode and the target side-by-side comparison report to obtain a rendered first target layout document and a rendered second target layout document;

[0096] Specifically, in order to realize the visualization of the difference between the two documents, the first target layout document and the second target layout document need to be rendered respectively according to the difference point data in the target side-by-side comparison report, so that the user can directly see the difference points between the first target layout document and the second target layout document, and what deletion, replacement or insertion operations are performed on the second target layout document relative to the first target layout document. Here, the first target layout document and the second target layout document can be rendered using an existing rendering engine, or other rendering methods can be selected as needed.

[0097] Step 1072, loading the rendered first target layout document and the rendered second target layout document.

[0098] Specifically, the rendered first target layout document and the rendered second target layout document may be loaded on the user terminal for the user to view.

[0099] like Figure 2 As shown, a specific embodiment of the method for processing a layout document according to an embodiment of the present invention includes:

[0100] Step 111, obtaining at least two target format documents;

[0101] Convert at least two documents provided by the user into layout documents in OFD format for subsequent processing and side-by-side comparison. In specific applications, the OFD document analysis system or other OFD document content extraction system can be used to extract the OFD document content and format from at least two documents provided by the user. If the original document obtained is a long article, the natural paragraphs in the document can be retained to facilitate the subsequent output of a better side-by-side comparison report. In addition, the target layout document can also be formatted. For example, for the cross-page paragraphs in the target layout document, the cross-page paragraphs can be merged into one page; in addition to the cross-page paragraphs, blank paragraphs, titles, directories, tables and other data can also be processed according to the user's viewing and reading habits to improve the convenience of viewing and reading.

[0102] Step 112, data extraction;

[0103] According to the user's comparison requirements, data extraction and processing are performed on the target layout document. For example, if the user's requirement is to ignore the directory data and only compare the main text, it is only necessary to extract the main text paragraphs in the two target layout documents as target data for subsequent processing.

[0104] Step 113, target data matching;

[0105] Before performing a side-by-side comparison, it is necessary to calculate the similarity between each natural paragraph in the second target data and the paragraph in the first target data, and match the natural paragraphs in the second target data whose similarity is greater than the expected value with the paragraph in the first target data, that is, place the similar first target data and second target data side by side, so as to facilitate the subsequent intuitive viewing of the differences between the two documents.

[0106] Here, the difference of the natural paragraph pure text in the first target data and the second target data is cyclically compared. According to the similarity of the natural paragraphs in the two data, if the similarity is greater than or equal to the minimum similarity of paragraph pairing (i.e., the preset expected value), the paired paragraph can be obtained; if there are multiple paragraphs with similarity greater than or equal to the preset expected value, the paragraph with the highest similarity is selected as the corresponding paired paragraph. The pairing may be successful or unsuccessful in this process. If it is unsuccessful, it means that there is a paragraph insertion (i.e., it exists in the second target data of the second target layout document, but not in the first target data of the first target layout document) or paragraph deletion (it exists in the first target data of the first target layout document, but not in the second target data of the second target layout document).

[0107] Step 114, determining difference point data;

[0108] According to the calculation steps in the above, the corresponding operation data (such as replacement, deletion or insertion, etc.) for changing the first target data into the second target data, that is, the difference point data, is obtained.

[0109] Step 115, determine the target side-by-side comparison report;

[0110] The difference point data is adjusted according to preset conditions, such as merging word segmentation, ignoring junk characters, etc., to obtain the target side-by-side comparison report. Here, the difference point data can be adjusted according to preset configuration parameters (i.e., preset conditions), such as dictionary, stop dictionary, whether to use word segmentation, whether to ignore junk characters, paragraph matching minimum similarity, whether to use phrases and junk character recognition functions, etc. If the preset configuration parameter is to use word segmentation, the difference point data is merged by word segmentation; if the preset configuration parameter is to ignore junk characters (such as spaces), the replacement, deletion or insertion of spaces in the difference point data is deleted, that is, there is no difference between the two documents caused by spaces in the target side-by-side comparison report. Among them, junk characters are identified and modified, including the types of the three adjacent difference points on the left, middle and right of the junk characters, the starting position of the first target data and the starting position of the second target data. Word segmentation recognition uses a backtracking method to correct the adjacent difference point types, the starting position of the first target data and the starting position of the second target data.

[0111] Step 116, rendering and loading at least two target layout documents.

[0112] like Figure 3 As shown, the difference point data in the target side-by-side comparison report is rendered in two target layout documents, and the two rendered target layout documents are loaded side by side on the user side, so that the user can intuitively view the difference points of the two documents.

[0113] The method for processing layout documents in the embodiment of the present invention can realize automatic identification and annotation of document differences, thereby improving user experience and intuitiveness of reading.

[0114] like Figure 4 As shown, an embodiment of the present invention provides a layout document processing device 200, comprising:

[0115] An acquisition module 201 is used to acquire a first target format document and a second target format document;

[0116] Processing module 202 is used to perform data extraction processing on the first target layout document to obtain first target data; perform data extraction processing on the second target layout document to obtain second target data; match the first target data and the second target data to obtain a matching result; based on the matching result, perform a side-by-side comparison of the first target data and the second target data to obtain difference point data; based on the difference point data, obtain a target side-by-side comparison report; based on the target side-by-side comparison report, render and load the first target layout document and the second target layout document.

[0117] Optionally, obtaining the first target format document and the second target format document includes:

[0118] Acquire a first original document and a second original document;

[0119] Converting the first original document into a layout document format to obtain a first target layout document;

[0120] The second original document is converted into a layout document format to obtain a second target layout document.

[0121] Optionally, performing data extraction processing on the first target format document to obtain first target data includes: extracting at least one of directory data, text data, image data, and table data from the first target format document to obtain the first target data;

[0122] Performing data extraction processing on the second target format document to obtain second target data includes:

[0123] At least one of directory data, text data, picture data, and table data is extracted from the second target format document to obtain second target data.

[0124] Optionally, matching the first target data and the second target data to obtain a matching result includes:

[0125] Calculating similarity between the first target data and the second target data to obtain similarity;

[0126] According to the similarity and the preset expected value, the first target data and the second target data are matched to obtain a matching result.

[0127] Optionally, according to the matching result, the first target data and the second target data are compared side by side to obtain difference point data, including:

[0128] According to the matching result, determining an initialization matrix;

[0129] Traversing and filling the initialization matrix to obtain a target matrix;

[0130] According to the target matrix, the first target data and the second target data are compared side by side to obtain difference point data.

[0131] Optionally, a target side-by-side comparison report is obtained based on the difference point data, including:

[0132] According to the difference point data, an original side-by-side comparison report is obtained;

[0133] The original side-by-side comparison report is adjusted according to preset conditions to obtain a target side-by-side comparison report.

[0134] Optionally, rendering and loading the first target layout document and the second target layout document according to the target side-by-side comparison report includes:

[0135] Rendering the first target layout document and the second target layout document respectively according to a preset rendering mode and the target side-by-side comparison report to obtain a rendered first target layout document and a rendered second target layout document;

[0136] The rendered first target layout document and the rendered second target layout document are loaded.

[0137] The layout document processing device proposed in the embodiment of the present invention obtains the first target layout document and the second target layout document, and performs data extraction processing to obtain the first target data and the second target data, and then matches the first target data and the second target data, and compares the first target data and the second target data side by side according to the matching result to obtain the difference point data, and then obtains the target side-by-side comparison report, and then renders and loads the first target layout document and the second target layout document, so that the user can intuitively see the side-by-side comparison result of the first target layout document and the second target layout document, thereby reducing the workload of manual comparison and having the advantages of improving the efficiency of side-by-side comparison of layout documents and user experience.

[0138] It should be noted that the device is a device corresponding to the above method, and all implementations in the above method embodiment are applicable to the embodiment of the device and can achieve the same technical effect. This embodiment will not be repeated.

[0139] The embodiment of the present invention further provides a computing device, comprising: a processor, and a memory storing a computer program, wherein when the computer program is executed by the processor, the method described in any one of the above embodiments is executed. All implementations in the above method embodiments are applicable to the embodiments of the device, and can achieve the same technical effects. They will not be described in detail in this embodiment.

[0140] The embodiment of the present invention further provides a computer-readable storage medium on which instructions are stored. When the instructions are executed on a computer, the computer executes the method as described in any one of the above embodiments. All implementations in the above method embodiments are applicable to the embodiments of the device and can achieve the same technical effects. They will not be described in detail in this embodiment.

[0141] It should be noted that in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. In addition, the steps of performing the above series of processes can naturally be performed in chronological order according to the order of description, but do not necessarily need to be performed in chronological order. Some steps can be performed in parallel, crosswise or independently of each other.

[0142] It should be noted that, in the above-mentioned embodiments, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the implementation of the above-mentioned embodiments is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0143] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for processing a layout document, characterized in that: include: Acquire a first target format document and a second target format document; Performing data extraction processing on the first target format document to obtain first target data; Performing data extraction processing on the second target format document to obtain second target data; Matching the first target data and the second target data to obtain a matching result; According to the matching result, the first target data and the second target data are compared side by side to obtain difference point data; According to the difference point data, a target side-by-side comparison report is obtained; The first target layout document and the second target layout document are rendered and loaded according to the target side-by-side comparison report.

2. The method for processing layout documents according to claim 1, characterized in that: Obtaining a first target layout document and a second target layout document, including: Acquire a first original document and a second original document; Converting the first original document into a layout document format to obtain a first target layout document; The second original document is converted into a layout document format to obtain a second target layout document.

3. The method for processing layout documents according to claim 1, characterized in that: Performing data extraction processing on the first target format document to obtain first target data includes: Extracting at least one of directory data, text data, picture data, and table data from the first target format document to obtain first target data; Performing data extraction processing on the second target format document to obtain second target data includes: At least one of directory data, text data, picture data, and table data is extracted from the second target format document to obtain second target data.

4. The method for processing layout documents according to claim 1, characterized in that: Matching the first target data and the second target data to obtain a matching result includes: Calculating similarity between the first target data and the second target data to obtain similarity; According to the similarity and the preset expected value, the first target data and the second target data are matched to obtain a matching result.

5. The method for processing layout documents according to claim 1, characterized in that: According to the matching result, the first target data and the second target data are compared side by side to obtain difference point data, including: According to the matching result, determining an initialization matrix; Traversing and filling the initialization matrix to obtain a target matrix; According to the target matrix, the first target data and the second target data are compared side by side to obtain difference point data.

6. The method for processing layout documents according to claim 1, characterized in that: Based on the difference point data, a target side-by-side comparison report is obtained, including: According to the difference point data, an original side-by-side comparison report is obtained; The original side-by-side comparison report is adjusted according to preset conditions to obtain a target side-by-side comparison report.

7. The method for processing layout documents according to claim 1, characterized in that: Rendering and loading the first target layout document and the second target layout document according to the target side-by-side comparison report includes: Rendering the first target layout document and the second target layout document respectively according to a preset rendering mode and the target side-by-side comparison report to obtain a rendered first target layout document and a rendered second target layout document; The rendered first target layout document and the rendered second target layout document are loaded.

8. A layout document processing device, characterized in that: include: An acquisition module, used for acquiring a first target format document and a second target format document; A processing module, used for performing data extraction processing on the first target format document to obtain first target data; Performing data extraction processing on the second target format document to obtain second target data; The first target data and the second target data are matched to obtain a matching result; based on the matching result, the first target data and the second target data are compared side by side to obtain difference point data; based on the difference point data, a target side-by-side comparison report is obtained; based on the target side-by-side comparison report, the first target layout document and the second target layout document are rendered and loaded.

9. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is performed.

10. A computer-readable storage medium, characterized in that: Instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Format document comparison method, device and equipment, and computer storage medium

    CN111191436A

  • Format document comparison method, apparatus and device, and storage medium

    CN111222314A

  • Document comparison result optimization method and device, equipment and storage medium

    CN115759032A

  • Contract document difference detection method and device based on ICR character matrix

    CN116580414A