Method, device, electronic device and storage medium for reading electronic documents

By extracting the incremental index table of the electronic document and deleting the signature data in reverse order, the problem of text object position offset and parsing exception caused by electronic signatures is solved, and the readability and content accuracy of the electronic document are improved.

CN114611471BActive Publication Date: 2025-04-11SHENZHEN DIGITAL CERTIFICATE AUTHORITY CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210294109.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2025-04-11
Estimated Expiration
2042-03-24

AI Technical Summary

Technical Problem

When performing electronic signatures, existing electronic document reading technology leads to offset the position of text objects. Especially in the multi-signature process, offset iteration leads to text parsing exceptions, reducing the readability of electronic text.

Method used

By receiving a reading instruction for the target document that has been added with an electronic signature, the document data is obtained and the incremental index table is extracted from the tail subdata of the data. According to the reverse order of incremental positioning data in the incremental index table, the signature data is determined and deleted in succession to restore the document content.

Benefits of technology

It effectively avoids garbled documents caused by electronic signatures, improves the readability of electronic documents, and ensures the accuracy of document content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114611471B_ABST
    Figure CN114611471B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of data processing technology, and provides a method, device, electronic device and storage medium for reading electronic documents, the method comprising: if a reading instruction of a target document with an electronic signature added is received, then the document data of the target document is obtained; the tail sub-data of the document data is read, and an incremental index table is obtained from the tail sub-data; according to the reverse order of the order of adding each incremental positioning data in the incremental index table, each incremental positioning data is read in sequence to determine the byte segments corresponding to each electronic signature in the target document in the document data; according to the signature data of the electronic signature corresponding to each byte segment, each signature data is deleted in sequence in the document data to read the document content of the target document. The above method can avoid the situation where the document content is unreadable due to garbled characters, and improve the readability of electronic documents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular relates to a method, device, electronic device and storage medium for reading an electronic document. Background Art

[0002] With the continuous advancement of the electronic process, more and more documents can be stored in digital form. In order to achieve the legalization, authenticity and non-repudiation of electronic documents, electronic signature technology has also emerged, further expanding the scope of use of electronic documents.

[0003] The existing electronic signature application technology requires that the signature object be inserted into the text when electronically signing an electronic document, which causes the position of each object in the electronic text to shift. During the process of multiple signatures, the offset will continue to iterate, which may cause text parsing anomalies when parsing the electronic text, reducing the readability of the electronic text. Summary of the invention

[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for reading an electronic document, which can solve the problem of existing electronic document reading technology that when electronically signing an electronic document, the signature object needs to be inserted into the text, which causes the position of each object in the electronic text to shift. During the process of multiple signatures, the offset will continue to iterate, which may cause text parsing anomalies to occur during parsing of the electronic text, thereby reducing the readability of the electronic text.

[0005] In a first aspect, an embodiment of the present application provides a method for reading an electronic document, comprising:

[0006] If a read instruction of a target document to which an electronic signature has been added is received, the document data of the target document is acquired;

[0007] Reading the tail sub-data of the document data, and obtaining an incremental index table from the tail sub-data; the incremental index table includes at least one incremental positioning data;

[0008] Reading each of the incremental positioning data in turn according to the reverse order of the order in which each of the incremental positioning data is added in the incremental index table, and determining the byte segment corresponding to each of the electronic signatures in the target document in the document data;

[0009] According to the signature data of the electronic signature corresponding to each byte segment, each signature data is deleted in the document data in turn to read the document content of the target document.

[0010] In a possible implementation manner of the first aspect, before acquiring the document data of the target document if a read instruction of the target document to which the electronic signature is added is received, the method further includes:

[0011] receiving a document read request for a target signature;

[0012] The matching degree between the candidate document and the target signature is calculated according to the signature template of the target signature and the candidate document data of each candidate document in the database; the matching degree is specifically:

[0013]

[0014] Wherein, MatchLv is the matching degree between the candidate document and the signature template; TargetDoc i is the i-th data segment framed in the candidate document based on the partition window determined by the signature template; IDF (Framework) is the inverse text coefficient of the signature template in the candidate document; TargetDoc is the data corresponding to the candidate document; Framework is the data of the signature template; Count is the character counting function; Same is the similar character recognition function;

[0015] If the matching degree between any candidate document and the signature template is greater than a preset matching threshold, any candidate document is identified as the target document, and the reading instruction of the target document is generated.

[0016] In a possible implementation manner of the first aspect, after calculating the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database, the method further includes:

[0017] If the matching degree between all the candidate documents and the signature template is less than or equal to the matching threshold, a prompt message indicating search failure is output; the prompt message includes an adjustment area of ​​the signature template;

[0018] receiving adjustment data input by a user in the adjustment area, and updating the signature template of the target signature based on the adjustment data;

[0019] Based on the updated signature template, the operation of calculating the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database is performed.

[0020] In a possible implementation manner of the first aspect, after sequentially deleting each signature data in the document data according to the signature data of the electronic signature corresponding to each byte segment to read the document content of the target document, the method further includes:

[0021] If a signature instruction regarding the target document is received, obtaining the electronic signature corresponding to the signature instruction;

[0022] Determine a signature area of ​​the electronic signature in the target document, add the electronic signature to the document sub-data in the signature area, and generate signature data;

[0023] Determine a byte offset generated based on a signature operation according to the signature data added to the signature area;

[0024] generating the incremental positioning data based on the byte offset of the signature operation and the historical offset of the target document; the historical offset is determined according to the incremental index table;

[0025] The incremental index table is updated with the incremental positioning data.

[0026] In a possible implementation manner of the first aspect, determining a signature area of ​​the electronic signature in the target document, adding the electronic signature to document sub-data in the signature area, and generating signature data includes:

[0027] Determining a document data range that needs to be signed based on the signature area and the document content of the target document;

[0028] Calculating a hash value of the document data range according to the document data contained in the document data range and the signature type of the electronic signature;

[0029] The hash value and the document data are converted using a signature algorithm associated with the signature type to obtain the signature data.

[0030] In a possible implementation manner of the first aspect, the deleting each signature data in the document data in sequence according to the signature data of the electronic signature corresponding to each byte segment to read the document content of the target document includes:

[0031] Performing semantic understanding on the document content to obtain a semantic recognition result of the document content;

[0032] If the semantic recognition result includes an abnormal character, marking the abnormal area where the abnormal character appears; the abnormal character is a semantically irrelevant character in the sentence where the abnormal character is located;

[0033] Determining abnormal positioning data from all the incremental positioning data according to the abnormal area;

[0034] The anomaly location data is adjusted based on the anomaly character.

[0035] In a possible implementation manner of the first aspect, reading the tail sub-data of the document data and acquiring the incremental index table from the tail sub-data includes:

[0036] If the document data contains the starting keyword of the tail sub-data, the starting position of the tail sub-data is determined according to the position of the starting keyword of the tail sub-data;

[0037] Determining the tail sub-data based on the starting position;

[0038] If the document data does not include the starting keyword, the document content is read based on the document data.

[0039] In a second aspect, an embodiment of the present application provides an electronic document reading device, comprising:

[0040] A document data acquisition unit, configured to acquire document data of a target document to which an electronic signature has been added if a read instruction of the target document is received;

[0041] An incremental index table acquisition unit, used for reading the tail sub-data of the document data, and acquiring an incremental index table from the tail sub-data; the incremental index table includes at least one incremental positioning data;

[0042] An incremental positioning data reading unit, configured to read each incremental positioning data in turn according to the reverse order of the order in which each incremental positioning data is added in the incremental index table, and determine the byte segment corresponding to each electronic signature in the target document in the document data;

[0043] The document content reading unit is used to delete each signature data in the document data in turn according to the signature data of the electronic signature corresponding to each byte segment, so as to read the document content of the target document.

[0044] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method as described in any one of the first aspects above when executing the computer program.

[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspects above is implemented.

[0046] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a server, enables the server to execute any of the methods described in the first aspect.

[0047] Compared with the prior art, the embodiment of the present application has the following beneficial effects: when receiving a read instruction for a target document, the document data of the target document is obtained, and an incremental index table recording the incremental positioning data of each electronic signature is extracted from the tail sub-data of the document data, and the signature data of each electronic signature added to the document data is deleted in sequence based on the reverse order of the addition order of each incremental positioning data in the incremental index table, thereby restoring the document content of the target document and avoiding garbled reading due to the addition of the electronic signature. Compared with the existing electronic document reading technology, the embodiment of the present application generates corresponding incremental positioning data when adding an electronic signature to the target document, and adds it to the incremental index table accordingly, so that the signature data added to the electronic document can be deleted in sequence based on the incremental index table when reading, avoiding the situation where the document content is unreadable due to garbled documents, and improving the readability of electronic documents. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0049] Figure 1 This is a flowchart of an implementation method of an electronic document reading method provided by an embodiment of the present application;

[0050] Figure 2 It is a schematic diagram of reading document content provided by an embodiment of the present application;

[0051] Figure 3 This is a flowchart of an implementation method of an electronic document reading method provided by an embodiment of the present application;

[0052] Figure 4 This is a schematic diagram of an implementation method of a method for reading an electronic document provided in an embodiment of the present application;

[0053] Figure 5This is a schematic diagram of an implementation method of S104 of a method for reading an electronic document provided in an embodiment of the present application;

[0054] Figure 6 This is a schematic diagram of an implementation method of S102 of a method for reading an electronic document provided in an embodiment of the present application;

[0055] Figure 7 is a schematic diagram of the structure of an electronic document reading device provided in an embodiment of the present application;

[0056] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0058] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0059] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0060] The electronic document reading method provided in the embodiment of the present application can be applied to electronic devices capable of reading electronic documents, such as smart phones, servers, tablet computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, servers, etc. The embodiment of the present application does not impose any restrictions on the specific types of electronic devices.

[0061] See also Figure 1 , Figure 1 A schematic diagram of an implementation of a method for reading an electronic document provided in an embodiment of the present application is shown, and the method comprises the following steps:

[0062] In S101, if a read instruction of a target document to which an electronic signature has been added is received, the document data of the target document is acquired.

[0063] In this embodiment, when a user needs to read an electronic document, he can initiate a read request to the electronic device, and the read request carries the document identifier of the electronic document to be read (i.e., the target document). The electronic device can parse the read request, extract the document identifier of the target document, and query the storage path corresponding to the document identifier from the local memory, and obtain the document data corresponding to the target document based on the storage path.

[0064] In this embodiment, the target document is specifically an electronic document to which an electronic signature has been added, that is, the document data contains signature data. When the electronic device adds an electronic signature to the target document, data offset will be caused to the document data inside the document. In order to implement subsequent reading operations, the amount of data offset of the document data caused by this electronic signature will be recorded, and the corresponding incremental positioning data will be obtained, and the incremental positioning data will be added to the incremental index table of the electronic document. That is, the document data of the above-mentioned target document specifically includes two parts, namely, the document main data for recording the document content and signature data, and the tail sub-data for storing the incremental positioning data and the incremental index table.

[0065] In a possible implementation, the target document may be stored in a cloud server. In this case, the read instruction may carry a download link of the target document, and the electronic device may obtain the document data of the target document from the cloud server according to the download link.

[0066] In S102, the tail sub-data of the document data is read, and an incremental index table is obtained from the tail sub-data; the incremental index table includes at least one incremental positioning data.

[0067] In this embodiment, the electronic device can extract the tail sub-data in the document data, that is, the data in the trailer part, where the data in the trailer part includes incremental positioning data and an incremental index table for indexing the signature data.

[0068] In this embodiment, the number of incremental positioning data contained in the incremental index table is the same as the number of electronic signatures contained in the target document. If the target document contains two or more electronic signatures, the incremental index table contains incremental positioning data equal to the number of electronic signatures. Since a certain amount of characters are added to the target document each time an electronic signature is added, data offset is caused for the original data in the target document. In order to record the data offset caused by the electronic signature, the electronic device generates corresponding incremental positioning data, associates the corresponding signature time with the incremental positioning data, and adds the incremental positioning data and the signature time associated with it to the above-mentioned incremental index table.

[0069] In a possible implementation, the tail sub-data is configured with a corresponding tail keyword, and the electronic device can locate the tail sub-data from the document data according to the tail keyword, and then can extract the corresponding incremental index table from the tail sub-data.

[0070] In one possible implementation, if a target document does not contain tail sub-data, or the content of the tail sub-data is empty, it means that the target document does not have any electronic signature. In this case, the electronic device can directly restore the corresponding document content based on the document data of the target document.

[0071] In S103, the incremental positioning data are read in sequence according to the reverse order of adding the incremental positioning data in the incremental index table to determine the byte segment corresponding to each electronic signature in the target document in the document data.

[0072] In S104, according to the signature data of the electronic signature corresponding to each byte segment, each signature data is deleted in the document data in turn to read the document content of the target document.

[0073] In this embodiment, the electronic device can obtain the incremental positioning data corresponding to each electronic signature from the incremental index table, and determine the byte position to which the electronic signature is added in the document data of the target document based on each incremental positioning data, that is, the byte segment mentioned above, and delete the signature data of the associated electronic signature from the data corresponding to the byte segment to obtain the document data from which the electronic signature has been deleted once, and then determine the byte segment of the next electronic signature in the document data from which the electronic signature has been deleted again according to the incremental positioning data of the next adding order, and then delete the corresponding signature data in the corresponding byte segment again, and so on, until the signature data of all electronic signatures are deleted, and the document data after all electronic signatures have been deleted is identified as the content data of the target document, and the document content of the target document is displayed according to the content data, thereby avoiding the occurrence of garbled characters when reading the document content due to the insertion of signature data, thereby improving the accuracy of reading the document content.

[0074] In this embodiment, the electronic device can obtain each incremental positioning data in sequence according to the reverse order of addition, and thus determine the corresponding byte segment according to each incremental positioning data, and delete the signature data of the electronic signature from the byte segment to avoid data offset caused by the signature data to the original content data of the document content. Since the process of deleting the electronic signature is the inverse process of adding the electronic signature, it is necessary to restore the data offset caused by the electronic signature each time according to the reverse order of addition.

[0075] For example, Figure 2FIG. 1 shows a schematic diagram of reading document content provided by an embodiment of the present application. Figure 2 As shown in (a) in FIG. 1 , the incremental index table of the target document contains two incremental positioning data, namely data A and data B, wherein the order of adding data A is earlier than the order of adding data B. Based on this, the electronic device determines the byte segment added by the electronic signature B in the document data according to data B, and deletes the signature data of the electronic signature B from the byte segment, such as Figure 2 As shown in (b) in the figure, the byte segment where the electronic signature A is located will change, and the position of the byte segment is consistent with the document state corresponding to the addition of the electronic signature A, that is, the same as the byte segment recorded in the data A; then, the electronic device obtains the data A from the incremental index table, determines the byte segment added by the electronic signature A in the document data according to the data A, and deletes the signature data of the electronic signature A from the byte segment, thereby obtaining the content data after deleting all electronic signatures, as shown in FIG. Figure 2 As shown in (c) in FIG. 1 , the content data displays the document content of the electronic document.

[0076] As can be seen from the above, the electronic document reading method provided by the embodiment of the present application obtains the document data of the target document when receiving the reading instruction for the target document, extracts the incremental index table recording the incremental positioning data of each electronic signature from the tail sub-data of the document data, and deletes the signature data of each electronic signature added in the document data in sequence based on the reverse order of the adding order of each incremental positioning data in the incremental index table, thereby restoring the document content of the target document and avoiding garbled reading caused by adding the electronic signature. Compared with the existing electronic document reading technology, the embodiment of the present application generates the corresponding incremental positioning data when adding the electronic signature to the target document, and adds it to the incremental index table accordingly, so that the signature data added to the electronic document can be deleted in sequence based on the incremental index table when reading, avoiding the situation where the document content is unreadable due to garbled documents, and improving the readability of electronic documents.

[0077] Figure 3 FIG. 2 shows a specific implementation flow chart of a method for reading an electronic document provided by the second embodiment of the present invention. Figure 3 , relative to Figure 1 In the embodiment, in the electronic document reading method provided in this embodiment, S101 includes: S1011 to S1015, which are described in detail as follows:

[0078] Furthermore, before the step of obtaining the document data of the target document upon receiving a read instruction of the target document to which the electronic signature has been added, the method further comprises:

[0079] In S301, a document reading request regarding a target signature is received.

[0080] In this embodiment, in addition to receiving a user-initiated instruction to read a specific document, the electronic device can also extract electronic documents with a specified electronic signature from the database to achieve the purpose of batch reading of related documents. Based on this, the user can input the signature identifier of the electronic signature (i.e., the target signature) added to the electronic documents to be batch read, and generate a corresponding document reading request based on the signature identifier.

[0081] In a possible implementation, the electronic device may generate a search page, which is configured with an input control and a corresponding search type, and the search type includes: document type and signature type. If the user selects the document type, the document identifier of the target document entered by the user in the input control is identified; if the user selects the signature type, the signature type of the target signature entered by the user in the input control is identified. The electronic device may determine the identifier type entered in the input control according to the type selected by the user in the search type. When it is detected that the user has selected the signature type in the search type, a corresponding document read request is generated based on the signature identifier entered by the user in the input control, and the operation of S301 is performed.

[0082] In S302, the matching degree between the candidate document and the target signature is calculated based on the signature template of the target signature and the candidate document data of each candidate document in the database; the matching degree is specifically:

[0083]

[0084] Wherein, MatchLv is the matching degree between the candidate document and the signature template; TargetDoc i is the i-th data segment framed in the candidate document based on the divided window determined by the signature template; IDF (Framework) is the inverse text coefficient of the signature template in the candidate document; TargetDoc is the data corresponding to the candidate document; Framework is the data of the signature template; Count is the character counting function; Same is the similar character recognition function.

[0085] In this embodiment, each electronic signature is configured with a corresponding signature template, and the signature template is specifically generated based on the signature data of the electronic signature. If an electronic signature is added to an electronic document, the document data of the electronic document contains the signature data corresponding to the electronic signature, so a data segment in the electronic document will match the signature template of the electronic signature. Based on this, the electronic device can generate a corresponding sliding window based on the signature template of the electronic signature, and perform sliding frame extraction in each candidate document based on the sliding window, and match the data segment across the sliding area with the signature template of the electronic signature, count the number of identical characters, and use the character string with the largest number of identical characters as the degree of match between the two, so that it can identify whether the candidate document contains the electronic signature based on the degree of match.

[0086] In S303, if the matching degree between any candidate document and the signature template is greater than a preset matching threshold, the any candidate document is identified as the target document, and the reading instruction of the target document is generated.

[0087] In this embodiment, if the degree of match between any candidate document in the database and the electronic signature is greater than the matching threshold, the candidate document is identified as having the electronic signature added. In this case, the candidate document can be identified as a target document, and a data reading operation is performed on the target document, that is, a reading instruction for the target document is generated.

[0088] In an embodiment of the present application, by specifying the target signature to be searched, all target documents that match the signature template of the target signature are identified from the database, and reading instructions for all target documents are generated, thereby achieving the purpose of batch reading files, improving the diversity of file searches, being able to read all documents with the specified signature added, and thereby improving the efficiency of document reading.

[0089] In S304, if the matching degrees between all the candidate documents and the signature template are less than or equal to the matching threshold, a prompt message indicating search failure is output; the prompt message includes an adjustment area of ​​the signature template.

[0090] In this embodiment, if the matching degree between all candidate documents in the database and the signature template of the target signature is less than or equal to the matching threshold, there are two possible situations. The first situation is that there is no electronic document with the corresponding electronic signature added in the database; the second situation is that the signature template corresponding to the target signature may be abnormal and has not been updated to the latest version, which may also lead to the inability to search. In either of the above situations, the corresponding electronic document cannot be searched. At this time, the electronic device can output the corresponding search failure prompt information to notify the user of the corresponding search results. In order to correct the second situation, the prompt information can include an adjustment area for adjusting the signature template.

[0091] In S305, the adjustment data input by the user in the adjustment area is received, and the signature template of the target signature is updated based on the adjustment data.

[0092] In this embodiment, if there is an abnormality in the signature template of the target signature, the user can enter adjustment data corresponding to the signature template in the adjustment area in the prompt information, and the electronic device adjusts the signature template according to the adjustment data entered in the adjustment area to update the signature template.

[0093] Exemplarily, the user may enter a version number of the target signature in the signature template, and the electronic device may download the corresponding signature template from the server corresponding to the target signature according to the version number to replace the associated signature template.

[0094] In S306, the operation of calculating the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database is performed based on the updated signature template.

[0095] In this embodiment, after the signature template is updated, the matching degree between the signature template and each candidate document may be calculated again based on the updated signature template, so as to select the target document.

[0096] In an embodiment of the present application, by configuring a corresponding adjustment area in the output prompt information of search failure, it is convenient for the user to quickly enter the corresponding adjustment data to adjust the signature template, so as to quickly repair the situation where the signature template is expired or invalid, thereby reducing unnecessary user operations and improving adjustment efficiency.

[0097] Figure 4 FIG. 4 shows a specific implementation flow chart of a method for reading an electronic document provided by the third embodiment of the present invention. Figure 4 , relative to Figure 1In the embodiment, the method for reading an electronic document provided by the embodiment further includes: S401 to S405, which are described in detail as follows:

[0098] Further, after deleting each signature data in the document data in sequence according to the signature data of the electronic signature corresponding to each byte segment to read the document content of the target document, the method further includes:

[0099] In S401, if a signature instruction regarding a target document is received, the electronic signature corresponding to the signature instruction is obtained.

[0100] In this embodiment, when a user needs to sign an electronic document, he or she can generate a signature instruction that specifies the identifier of the signature stamp required for the electronic signature. The electronic device can obtain the signature template and signature data of the corresponding electronic signature based on the identifier.

[0101] In S402, a signature area of ​​the electronic signature in the target document is determined, and the electronic signature is added to the document sub-data in the signature area to generate signature data.

[0102] In this embodiment, the signature instruction may include a signature area for the required signature, and the electronic device may add the signature data of the electronic signature to the document sub-data corresponding to the signature data based on the signature area, thereby generating corresponding signature data.

[0103] Further, as another embodiment of the present application, the above S402 may specifically include the following three steps:

[0104] In S402.1, based on the signature area and the document content of the target document, a document data range that needs to be signed is determined.

[0105] In S402.2, a hash value of the document data range is calculated according to the document data contained in the document data range and the signature type of the electronic signature.

[0106] In S402.3, data conversion is performed on the hash value and the document data using a signature algorithm associated with the signature type to obtain the signature data.

[0107] In this embodiment, when an electronic document is electronically signed, a specific range in a specified document can be signed, that is, the entire document range of the electronic document does not need to be signed. In this case, the electronic device can parse the signature request, determine the text range specified by the user, and extract the corresponding document content based on the text range specified by the user, thereby obtaining the document data range that needs to be electronically signed.

[0108] In this embodiment, after obtaining the text data, the electronic device can extract the text data within the document data range, and import the text data into the above-mentioned hash conversion algorithm through the hash conversion algorithm corresponding to the signature type to obtain the corresponding signature data. The above-mentioned hash conversion algorithm can be specifically generated by an electronic seal based on the signature type, and the text data is converted through the electronic seal, so that the text data within the text data range can be added to the corresponding electronic seal.

[0109] In the embodiment of the present application, by automatically determining the text data range and automatically adding an electronic signature to the local data, the operations required by the user can be reduced and the operation of the electronic signature can be made more flexible.

[0110] In S403, a byte offset generated based on the signature operation is determined according to the signature data added to the signature area.

[0111] In S404, the incremental positioning data is generated based on the byte offset of the signature operation and the historical offset of the target document; the historical offset is determined according to the incremental index table.

[0112] In S405, the incremental index table is updated with the incremental positioning data.

[0113] In this embodiment, since a signature template of an electronic signature is added to the original document data, that is, corresponding signature data is generated, in this case, a certain data offset will occur in the document data. If other electronic signatures have been added to the target document, the historical offset of the electronic document can be determined based on the latest added incremental positioning data, and the incremental positioning data corresponding to this signature can be generated based on the corresponding byte offset and the historical offset, and the corresponding incremental positioning data is added to the incremental index table, so that the document content of the target document can be restored based on the incremental index table during subsequent reading.

[0114] In an embodiment of the present application, when adding an electronic signature, the corresponding incremental positioning data can be determined, and the incremental index table can be updated based on the incremental positioning data, which can facilitate the completion of subsequent document reading operations and improve the readability of the electronic document after adding the electronic signature.

[0115] Figure 5 FIG. 4 shows a specific implementation flow chart of a method S104 for reading an electronic document provided by the fourth embodiment of the present invention. Figure 5 , relative to Figure 1-4 In any of the above embodiments, the electronic document reading method S104 provided in this embodiment includes: S1041 to S1044, which are described in detail as follows:

[0116] Further, according to the signature data of the electronic signature corresponding to each of the byte segments, each of the signature data is deleted in the document data in sequence to read the document content of the target document, including:

[0117] In S1041, semantic understanding is performed on the document content to obtain a semantic recognition result of the document content.

[0118] In S1042, if the semantic recognition result includes an abnormal character, an abnormal area where the abnormal character appears is marked; the abnormal character is a semantically irrelevant character in the sentence where the abnormal character is located.

[0119] In S1043, abnormal positioning data is determined from all the incremental positioning data according to the abnormal area.

[0120] In S1044, the abnormality locating data is adjusted based on the abnormal character.

[0121] In this embodiment, after reading the document content of the electronic document, the electronic device can again determine whether there is garbled code in the electronic document, so the semantic recognition result corresponding to the document content can be determined through a semantic understanding algorithm. The semantic understanding algorithm can identify the semantics of each sentence in the electronic document, determine whether the sentence semantics are smooth, and thus determine whether there are abnormal characters irrelevant to the semantics in each sentence. If so, the electronic device can mark the corresponding characters in the document content through a preset abnormal mark. At this time, if the electronic device detects that the semantic recognition result contains abnormal characters, it means that there is garbled code in the electronic document, and the garbled code needs to be repaired, and the sentence where the abnormal character appears, that is, the above-mentioned abnormal area, is located, and it is determined whether there is any association with the abnormal area in the incremental positioning data corresponding to all electronic signatures. If so, the incremental positioning data corresponding to the electronic signature is identified as abnormal positioning data, and the abnormal positioning data is adjusted to repair the garbled code characters in the above-mentioned sentence.

[0122] In the embodiment of the present application, the purpose of automatically repairing abnormal situations is achieved by semantically understanding the sentence to determine whether the sentence contains abnormal characters and repairing the abnormal location data associated with the abnormal characters.

[0123] Figure 6 FIG. 5 shows a specific implementation flow chart of a method S102 for reading an electronic document provided by the fifth embodiment of the present invention. Figure 6 , relative to Figure 1-4 In any of the above embodiments, in the electronic document reading method provided in this embodiment, S102 includes: S1021 to S1023, which are described in detail as follows:

[0124] Furthermore, the reading of the tail sub-data of the document data and obtaining the incremental index table from the tail sub-data includes:

[0125] In S501, if the document data contains the starting keyword of the tail sub-data, the starting position of the tail sub-data is determined according to the position of the starting keyword of the tail sub-data.

[0126] In S502, the tail sub-data is determined based on the start position.

[0127] In S503, if the document data does not include the starting keyword, the document content is read based on the document data.

[0128] In this embodiment, the electronic device can locate the tail sub-data from the document data through the starting keyword of the tail sub-data. If the tail sub-data of the target document is not empty, it means that an electronic signature is added to the target document. In this case, the operation of the incremental index table can be obtained. Conversely, if the document data does not contain the starting keyword, it means that it does not contain the tail sub-data and no electronic signature is added. At this time, the document content can be read directly according to the document data.

[0129] Figure 7 The structure diagram of a method and device for reading an electronic document provided by an embodiment of the present invention is shown. The server includes units for executing Figure 1 The steps implemented by the intermediate server in the corresponding embodiment. For details, please refer to Figure 1 and Figure 1 For the convenience of explanation, only the parts related to this embodiment are shown.

[0130] See also Figure 7 , the electronic document reading device comprises:

[0131] The document data acquisition unit 71 is used to acquire the document data of the target document if a read instruction of the target document to which the electronic signature has been added is received;

[0132] The incremental index table acquisition unit 72 is used to read the tail sub-data of the document data and acquire the incremental index table from the tail sub-data; the incremental index table contains at least one incremental positioning data;

[0133] An incremental positioning data reading unit 73 is used to read each incremental positioning data in turn according to the reverse order of the order in which each incremental positioning data is added in the incremental index table, and determine the byte segment corresponding to each electronic signature in the target document in the document data;

[0134] The document content reading unit 74 is used to delete each signature data in the document data in turn according to the signature data of the electronic signature corresponding to each byte segment, so as to read the document content of the target document.

[0135] Optionally, the electronic document reading device further includes:

[0136] A document reading request unit, configured to receive a document reading request regarding a target signature;

[0137] A matching degree calculation unit is used to calculate the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database; the matching degree is specifically:

[0138]

[0139] Wherein, MatchLv is the matching degree between the candidate document and the signature template; TargetDoc i is the i-th data segment framed in the candidate document based on the partition window determined by the signature template; IDF (Framework) is the inverse text coefficient of the signature template in the candidate document; TargetDoc is the data corresponding to the candidate document; Framework is the data of the signature template; Count is the character counting function; Same is the similar character recognition function;

[0140] The target document selection unit is used to identify any candidate document as the target document if the matching degree between any candidate document and the signature template is greater than a preset matching threshold, and generate the reading instruction of the target document.

[0141] Optionally, the electronic document reading device further includes:

[0142] A prompt information display unit, configured to output a prompt information indicating that the search failed if the matching degree between all the candidate documents and the signature template is less than or equal to the matching threshold; the prompt information includes an adjustment area of ​​the signature template;

[0143] an adjustment data receiving unit, configured to receive adjustment data input by a user in the adjustment area, and update the signature template of the target signature based on the adjustment data;

[0144] The adjustment search unit is used to return to perform the operation of calculating the matching degree between the candidate document and the target signature based on the signature template of the target signature and the candidate document data of each candidate document in the database based on the updated signature template.

[0145] Optionally, the electronic document reading device further:

[0146] An electronic signature acquisition unit, configured to acquire the electronic signature corresponding to the signature instruction upon receiving a signature instruction regarding a target document;

[0147] A signature data acquisition unit, used to determine a signature area of ​​the electronic signature in the target document, add the electronic signature to the document sub-data in the signature area, and generate signature data;

[0148] A byte offset determination unit, configured to determine a byte offset generated based on a signature operation according to the signature data added to the signature area;

[0149] An incremental positioning data generating unit, configured to generate the incremental positioning data based on a byte offset of the signature operation and a historical offset of the target document; the historical offset is determined according to the incremental index table;

[0150] The incremental positioning data adding unit is used to update the incremental index table with the incremental positioning data.

[0151] Optionally, the signature data acquisition unit includes:

[0152] A document data range determining unit, configured to determine a document data range to be signed based on the signature area and the document content of the target document;

[0153] a hash value determination unit, configured to calculate a hash value of the document data range according to the document data contained in the document data range and the signature type of the electronic signature;

[0154] A hash value conversion unit is used to perform data conversion on the hash value and the document data through a signature algorithm associated with the signature type to obtain the signature data.

[0155] Optionally, the document content reading unit includes:

[0156] A semantic recognition unit, used to perform semantic understanding on the document content to obtain a semantic recognition result of the document content;

[0157] an abnormal character recognition unit, for marking an abnormal area where the abnormal character appears if the semantic recognition result includes an abnormal character; the abnormal character is a semantically irrelevant character in the sentence where the abnormal character is located;

[0158] an abnormal region identification unit, configured to determine abnormal positioning data from all the incremental positioning data according to the abnormal character;

[0159] The abnormal character adjustment unit is used to adjust the abnormal location data based on the abnormal character.

[0160] Optionally, the incremental index table acquisition unit includes:

[0161] a starting keyword positioning unit, configured to, if the document data contains the starting keyword of the tail sub-data, use the position of the starting keyword of the tail sub-data as the starting position of the tail sub-data;

[0162] a tail sub-data locating unit, configured to determine the tail sub-data based on the starting position;

[0163] A document content reading unit is configured to read the document content based on the document data if the document data does not contain the starting keyword.

[0164] Therefore, the electronic document reading method device provided by the embodiment of the present invention can also obtain the document data of the target document when receiving the reading instruction for the target document, extract the incremental index table recording the incremental positioning data of each electronic signature from the tail sub-data of the document data, and delete the signature data of each electronic signature added in the document data in sequence based on the reverse order of the adding order of each incremental positioning data in the incremental index table, thereby restoring the document content of the target document and avoiding garbled reading due to the addition of the electronic signature. Compared with the existing electronic document reading technology, the embodiment of the present application generates corresponding incremental positioning data when adding an electronic signature to the target document, and adds it to the incremental index table accordingly, so that the signature data added to the electronic document can be deleted in sequence based on the incremental index table when reading, avoiding the situation where the document content is unreadable due to garbled documents, and improving the readability of electronic documents.

[0165] It should be understood that Figure 7 In the structural block diagram of the electronic document reading method device shown, each module is used to execute Figures 1 to 6 The steps in the corresponding embodiments, and for Figures 1 to 6Each step in the corresponding embodiment has been explained in detail in the above embodiment. Figures 1 to 6 as well as Figures 1 to 6 The relevant descriptions in the corresponding embodiments are not repeated here.

[0166] Figure 8 is a structural block diagram of an electronic device provided by another embodiment of the present application. Figure 8 As shown, the electronic device 800 of this embodiment includes: a processor 88, a memory 820, and a computer program 830 stored in the memory 820 and executable by the processor 88, such as a program of a method for reading an electronic document. When the processor 88 executes the computer program 830, the steps of each embodiment of the method for reading an electronic document are implemented, such as Figure 1 Alternatively, the processor 88 implements the above when executing the computer program 830 Figure 8 The functions of each module in the corresponding embodiment are, for example, Figure 7 For details on the functions of the units 71 to 74 shown, please refer to Figure 7 Related description in the corresponding embodiment.

[0167] Exemplarily, the computer program 830 may be divided into one or more modules, one or more modules are stored in the memory 820, and are executed by the processor 88 to complete the present application. One or more modules may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 830 in the electronic device 800. For example, the computer program 830 may be divided into various unit modules, and the specific functions of each module are as described above.

[0168] The electronic device 800 may include, but is not limited to, a processor 88 and a memory 820. Those skilled in the art will appreciate that Figure 8 It is only an example of the electronic device 800 and does not constitute a limitation of the electronic device 800. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0169] The processor 88 may be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0170] The memory 820 may be an internal storage unit of the electronic device 800, such as a hard disk or memory of the electronic device 800. The memory 820 may also be an external storage device of the electronic device 800, such as a plug-in hard disk, a smart memory card, a flash memory card, etc. equipped on the electronic device 800. Furthermore, the memory 820 may also include both an internal storage unit of the electronic device 800 and an external storage device.

[0171] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for reading an electronic document, characterized in that: include: If a read instruction of a target document to which an electronic signature has been added is received, the document data of the target document is acquired; Reading the tail sub-data of the document data, and obtaining an incremental index table from the tail sub-data; the incremental index table includes at least one incremental positioning data; Reading each of the incremental positioning data in turn according to the reverse order of the order in which each of the incremental positioning data is added in the incremental index table, and determining the byte segment corresponding to each of the electronic signatures in the target document in the document data; According to the signature data of the electronic signature corresponding to each of the byte segments, each of the signature data is deleted in the document data in sequence to read the document content of the target document; After deleting each signature data in the document data in sequence according to the signature data of the electronic signature corresponding to each byte segment to read the document content of the target document, the method further includes: If a signature instruction regarding the target document is received, obtaining the electronic signature corresponding to the signature instruction; Determine a signature area of ​​the electronic signature in the target document, add the electronic signature to the document sub-data in the signature area, and generate signature data; Determine a byte offset generated based on a signature operation according to the signature data added to the signature area; generating the incremental positioning data based on the byte offset of the signature operation and the historical offset of the target document; the historical offset is determined according to the incremental index table; The incremental index table is updated with the incremental positioning data.

2. The reading method according to claim 1, characterized in that: Before the step of obtaining the document data of the target document if a read instruction of the target document with an electronic signature added is received, the method further includes: receiving a document read request for a target signature; The matching degree between the candidate document and the target signature is calculated according to the signature template of the target signature and the candidate document data of each candidate document in the database; the matching degree is specifically: Wherein, MatchLv is the matching degree between the candidate document and the signature template; TargetDoc i is the i-th data segment framed in the candidate document based on the partition window determined by the signature template; IDF (Framework) is the inverse text coefficient of the signature template in the candidate document; TargetDoc is the data corresponding to the candidate document; Framework is the data of the signature template; Count is the character counting function; Same is the similar character recognition function; If the matching degree between any candidate document and the signature template is greater than a preset matching threshold, the candidate document is identified as the target document, and the reading instruction of the target document is generated.

3. The reading method according to claim 2, characterized in that: After calculating the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database, the method further includes: If the matching degree between all the candidate documents and the signature template is less than or equal to the matching threshold, a prompt message indicating search failure is output; the prompt message includes an adjustment area of ​​the signature template; receiving adjustment data input by a user in the adjustment area, and updating the signature template of the target signature based on the adjustment data; Based on the updated signature template, the operation of calculating the matching degree between the candidate document and the target signature according to the signature template of the target signature and the candidate document data of each candidate document in the database is performed.

4. The reading method according to claim 1, characterized in that: The step of determining a signature area of ​​the electronic signature in the target document, adding the electronic signature to the document sub-data in the signature area, and generating signature data includes: Determining a document data range that needs to be signed based on the signature area and the document content of the target document; Calculating a hash value of the document data range according to the document data contained in the document data range and the signature type of the electronic signature; The hash value and the document data are converted using a signature algorithm associated with the signature type to obtain the signature data.

5. The reading method according to any one of claims 1 to 4, characterized in that: The method of sequentially deleting each signature data in the document data according to the signature data of the electronic signature corresponding to each byte segment to read the document content of the target document includes: Performing semantic understanding on the document content to obtain a semantic recognition result of the document content; If the semantic recognition result includes an abnormal character, marking the abnormal area where the abnormal character appears; the abnormal character is a semantically irrelevant character in the sentence where the abnormal character is located; Determining abnormal positioning data from all the incremental positioning data according to the abnormal area; The anomaly location data is adjusted based on the anomaly character.

6. The reading method according to any one of claims 1 to 4, characterized in that: The step of reading the tail sub-data of the document data and obtaining the incremental index table from the tail sub-data includes: If the document data contains the starting keyword of the tail sub-data, the starting position of the tail sub-data is determined according to the position of the starting keyword of the tail sub-data; Determining the tail sub-data based on the starting position; If the document data does not include the starting keyword, the document content is read based on the document data.

7. An electronic document reading device, characterized in that: include: A document data acquisition unit, configured to acquire document data of a target document to which an electronic signature has been added if a read instruction of the target document is received; An incremental index table acquisition unit, used for reading the tail sub-data of the document data, and acquiring an incremental index table from the tail sub-data; the incremental index table includes at least one incremental positioning data; An incremental positioning data reading unit, configured to read each incremental positioning data in turn according to the reverse order of the order in which each incremental positioning data is added in the incremental index table, and determine the byte segment corresponding to each electronic signature in the target document in the document data; A document content reading unit, configured to delete each signature data in the document data in turn according to the signature data of the electronic signature corresponding to each byte segment, so as to read the document content of the target document; The electronic document reading device also: An electronic signature acquisition unit, configured to acquire the electronic signature corresponding to the signature instruction upon receiving a signature instruction regarding a target document; A signature data acquisition unit, used to determine a signature area of ​​the electronic signature in the target document, add the electronic signature to the document sub-data in the signature area, and generate signature data; A byte offset determination unit, configured to determine a byte offset generated based on a signature operation according to the signature data added to the signature area; An incremental positioning data generating unit, configured to generate the incremental positioning data based on a byte offset of the signature operation and a historical offset of the target document; the historical offset is determined according to the incremental index table; The incremental positioning data adding unit is used to update the incremental index table with the incremental positioning data.

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

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

Citation Information

Patent Citations

  • Electronic document generation method and device, computer equipment and storage medium

    CN110543450A

  • Method and device for generating PDF electronic signature based on template, and storage medium

    CN111985202A