A single certificate verification method and device, computer equipment and storage medium
By parsing document templates and verification requests, and reading document content for matching and comparison, the problem of document printing errors was solved, enabling accurate extraction and timely processing, and reducing customer complaints.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2023-08-25
- Publication Date
- 2026-04-28
AI Technical Summary
In the existing technology, incomplete information or incorrect content values are prone to occur during the document printing process, which makes it impossible to detect and deal with them in a timely manner, leading to customer complaints and disputes.
By receiving verification requests, parsing document templates, obtaining fields to be verified and processing classes, reading document content for matching and verification, extracting field content using coordinate information, comparing it with the matched field values, generating alarm information, and promptly detecting errors.
It improves the accuracy of document content extraction, enables timely detection and handling of printing errors, reduces complaints and disputes, and enhances user experience.
Smart Images

Figure CN117133006B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of image detection and financial technology, and in particular to a document verification method, apparatus, computer equipment and storage medium. Background Technology
[0002] Documents, including contracts, confirmations, agreements, vouchers, and receipts, are generated based on textual information related to business transactions. In daily operations, organizations frequently need to print these documents, which contain a wealth of information, and the accuracy and correctness of this information are extremely important. However, printed documents are prone to incomplete information or incorrect values, which can lead to significant financial losses. For example, insurance documents (policies, endorsements, transportation declarations, etc.) are legally binding and serious contractual documents. If printing errors, such as incomplete information or incorrect values, are not detected and addressed promptly after the insurance company issues or modifies the policy, it can lead to customer complaints and even serious disputes. Summary of the Invention
[0003] The purpose of this application is to provide a document verification method, apparatus, computer equipment, and storage medium to solve the technical problem that printing errors are easily generated during the document printing process and cannot be detected in a timely manner in the prior art.
[0004] To address the aforementioned technical problems, this application provides a document verification method, employing the following technical solution:
[0005] Receive a verification request for a target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document;
[0006] Based on the document template, obtain the corresponding fields to be verified and the processing class, wherein the processing class includes the extraction method of the fields to be verified;
[0007] Read the document content and corresponding location information of the target document, associate and match the field to be verified with the document content, and obtain the coordinate information of the field to be verified.
[0008] Based on the coordinate information, extract the field content matching the field to be verified from the document content according to the extraction method;
[0009] Validate the content of the field.
[0010] Furthermore, the procedure includes the following steps prior to receiving the verification request for the target document:
[0011] Obtain all historical business documents, classify the historical business documents according to document type, and obtain a document set for each document type;
[0012] Extract the feature fields of each of the document sets to form the fields to be verified for each of the document types;
[0013] The system receives configuration information input by the user, generates a corresponding document template based on the configuration information and the field to be verified, and stores the document template in a preset template database.
[0014] Furthermore, after the step of generating the corresponding document template based on the configuration information and the field to be verified, the method further includes:
[0015] Obtain the text content and corresponding coordinate position of the field to be verified in each of the historical business documents;
[0016] The positional attribute of the text content is obtained based on the coordinates.
[0017] Based on the location attribute, a corresponding processing class is configured for the document template, and the processing class includes the initial extraction method of the field to be verified;
[0018] Based on the coordinate position, extract the document content corresponding to the field to be verified from the historical business documents according to the initial extraction method to obtain the recognition result;
[0019] The initial extraction method is adjusted based on the recognition result until the correct document content is extracted, thus obtaining the final extraction method for the field to be verified.
[0020] Furthermore, the step of adjusting the initial extraction method based on the identification result until the correct document content is extracted includes:
[0021] Calculate the loss value based on the identification result and the actual document content corresponding to the field to be verified;
[0022] The initial extraction method is adjusted based on the loss value to obtain the adjusted extraction method;
[0023] Based on the adjusted extraction method, extract the document content corresponding to the field to be verified in the historical business documents until the correct document content is extracted.
[0024] Furthermore, the step of validating the field content includes:
[0025] Obtain the business document corresponding to the document identifier of the target document, and obtain the matching field value of the matching field in the business document that corresponds to the field to be verified;
[0026] The content of the field is compared with the value of the matching field to obtain the comparison result;
[0027] Based on the comparison results, determine whether the content of the field is consistent with the value of the matching field;
[0028] If they match, the target document verification is successful;
[0029] If there is a discrepancy, the inconsistent fields will be assembled into an alarm message and sent to the user.
[0030] Furthermore, the step of comparing the field content with the matching field value to obtain the comparison result includes:
[0031] Construct a first string and a second string corresponding to the content of the field and the value of the matching field, respectively;
[0032] Construct a comparison matrix based on the first string and the second string;
[0033] The comparison result is calculated based on the comparison matrix.
[0034] Furthermore, the step of calculating the alignment result based on the alignment matrix includes:
[0035] Calculate the matching window value based on the first length of the first string and the second length of the second string;
[0036] Based on the comparison matrix and the matching window value, calculate the number of matched characters and the number of transpositions in the matched characters;
[0037] Calculate the string similarity based on the first length, the second length, the number of matched characters, and the number of transpositions of the matched characters;
[0038] Determine the length of the common prefix between the first string and the second string, calculate the matching degree based on the length of the common prefix and the string similarity, and use the matching degree as the comparison result.
[0039] To address the aforementioned technical problems, this application also provides a document verification device, which employs the following technical solution:
[0040] The parsing module is used to receive a verification request for a target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document.
[0041] The acquisition module is used to obtain the corresponding fields to be verified and the processing class according to the document template, wherein the processing class includes the extraction method of the fields to be verified;
[0042] The matching module is used to read the document content and corresponding location information of the target document, associate and match the field to be verified with the document content, and obtain the coordinate information of the field to be verified.
[0043] The extraction module is used to extract the field content matching the field to be verified from the document content according to the coordinate information and the extraction method.
[0044] The validation module is used to validate the content of the field.
[0045] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0046] The computer device includes a memory and a processor, the memory storing computer-readable instructions, and the processor executing the computer-readable instructions to implement the steps of the document verification method as described above.
[0047] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0048] The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the document verification method described above.
[0049] Compared with the prior art, the embodiments of this application have the following main advantages:
[0050] This application obtains the target document by receiving a verification request for the target document, parsing the verification request to obtain the target document, and determining the document template corresponding to the target document; obtaining the corresponding fields to be verified and processing classes based on the document template, wherein the processing class includes the extraction method of the fields to be verified; reading the document content and corresponding location information of the target document, associating and matching the fields to be verified with the document content to obtain the coordinate information of the fields to be verified; extracting the field content matching the fields to be verified from the document content according to the extraction method based on the coordinate information; verifying the field content; and obtaining the fields to be verified of the target document through the document template of the target document, thereby obtaining... The extraction methods for fields to be verified enable different fields to be extracted using different methods, improving the accuracy of document content recognition. By using the document content and corresponding location information of the target document, the coordinate information of the fields to be verified can be obtained. Based on the coordinate information, the field content can be extracted using different methods, further improving the accuracy of target document content extraction. Verifying the extracted field content can promptly identify and quickly handle problems that occur during document printing, improving problem-solving efficiency, ensuring the correctness of document printing, minimizing complaints or disputes, and enhancing user experience. Attached Figure Description
[0051] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0053] Figure 2 This is a flowchart of one embodiment of the document verification method according to this application;
[0054] Figure 3 This is a flowchart of another embodiment of the document verification method according to this application;
[0055] Figure 4 This is a schematic diagram of the structure of one embodiment of the document verification device according to this application;
[0056] Figure 5 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0058] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0059] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0060] This application provides a document verification method that can be applied to, for example... Figure 1 In the system architecture 100 shown, the system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 is used as a medium to provide a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0061] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0062] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0063] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0064] It should be noted that the document verification method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the document verification device is generally set in the server / terminal device.
[0065] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0066] Continue to refer to Figure 2 The flowchart illustrates an embodiment of the document verification method according to this application, including the following steps:
[0067] Step S201: Receive a verification request for the target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document.
[0068] The target document is the printed document to be verified. This printed document can be a PDF electronic document generated by the business system from the printing system, including but not limited to insurance policies and bank negotiable instruments. Insurance policies include insurance policies, endorsements, and transportation declarations. Specifically, the business system initiates a print request, receives the printed document returned by the printing system based on the print request, sends the printed document to the print verification system, and assembles the printed document into a verification request for verification.
[0069] In this embodiment, the verification request for the target document can be received via a wired connection or a wireless connection. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future-developed wireless connection methods.
[0070] In this embodiment, the verification request carries the target document to be verified. The received verification request is parsed to obtain the target document. According to the preset mapping relationship between the target document and the document template, the document template corresponding to the target document is obtained from the template database. The document template includes fields to be verified, including but not limited to the type of insurance, policy number, insurance period, endorsement number, insured, and document number. The fields to be verified contained in each document template are not completely the same.
[0071] In some optional implementations, the document template is pre-configured, and the configuration steps include:
[0072] Retrieve all historical business documents, categorize them according to document type, and obtain a document set for each document type;
[0073] Extract the feature fields of each document set to form the fields to be verified for each document type;
[0074] Receive configuration information input by the user, generate corresponding document templates based on the configuration information and fields to be verified, and store the document templates in a preset template database.
[0075] Specifically, all historical business documents are retrieved from the business system. The document type of each historical business document is determined based on its type identifier, and the documents are classified according to their type. Document types include, but are not limited to, insurance policies, insurance certificates, joint insurance certificates, pre-arranged insurance policies, insurance declarations, endorsements, etc., for different product types. Product types include, but are not limited to, corporate property insurance, cargo insurance, etc.
[0076] Extract the feature fields of each historical business document from the document set corresponding to each document type. The feature fields are the fields to be verified. Generate a document template corresponding to each document type based on the received configuration information and feature fields. The configuration information includes the document template name, the effective time of the document template, the validity period of the document template, the version number of the document template, and the document template type. Store the document template in a preset template database based on the template number. The template number is unique and can be used as the index information of the document template in the template database.
[0077] In one specific example, the target document and its corresponding template number are assembled to generate a verification request. The verification request is parsed to obtain the target document and template number. The corresponding document template is then retrieved from the template database based on the template number.
[0078] The target document and template number are assembled into binary content.
[0079] This embodiment configures the document template by receiving configuration information, which can improve the efficiency of document template generation.
[0080] It should be emphasized that, to further ensure the privacy and security of the target documents, the aforementioned target documents can also be stored in a node of a blockchain.
[0081] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0082] Step S202: Obtain the corresponding fields to be verified and processing class based on the document template. The processing class includes the extraction method of the fields to be verified.
[0083] In this embodiment, the fields to be verified of the target document can be obtained based on the document template. Different fields to be verified correspond to different extraction methods, and the extraction methods are used to extract the field content.
[0084] In some optional implementations, the configuration steps for the extraction method are as follows:
[0085] Retrieve the text content and corresponding coordinates of the field to be verified in each historical business document;
[0086] The positional attributes of the text content are obtained based on the coordinates.
[0087] Configure a corresponding processing class for the document template based on the location attribute. The processing class includes the initial extraction method for the fields to be verified.
[0088] Based on the coordinate location, extract the document content corresponding to the field to be verified from historical business documents according to the initial extraction method to obtain the recognition result;
[0089] Adjust the initial extraction method based on the recognition results until the correct document content is extracted, and obtain the final extraction method for the field to be verified.
[0090] In this embodiment, all historical business documents obtained can be divided into a training set and a validation set. The training set is used to configure the initial extraction method, and the validation set is used to adjust the initial extraction method.
[0091] Historical business documents are electronic document files in PDF format. The PDFPlumber library can be used to extract the text content and its corresponding coordinate position of each historical business document. For example, if the extracted text content is "insurance type", its corresponding coordinate position is {"x0":100.1, "x1":140.2, "top":100.2, "bottom":120.2}, where x0, x1, top, and bottom are the coordinate data corresponding to "insurance type" on the document, i.e., the coordinate position.
[0092] The positional attribute of text content can be determined based on its coordinates. The positional attribute can be single-line or multi-line text, and it is calculated using the following formula:
[0093] P d = (bottom - top) × k;
[0094] Among them, P d This represents the distance between the upper and lower coordinates of the text content; k represents the coefficient. When P d When the value is less than or equal to a preset threshold, it is considered a single-line text; P d When the value exceeds the preset threshold, it will be multi-line text.
[0095] Based on location attributes, a `matrix` class is configured to handle the corresponding recognition and extraction fields of the document template. This `matrix` class includes the initial extraction method for each field to be verified in the document template. The initial extraction methods include regular expression matching, text slicing, and coordinate segmentation. If the text content corresponding to the field to be verified is a single line of text, a regular expression is configured for matching and extraction. If the text content corresponds to a multi-line of text, a combination of text slicing and coordinate segmentation is configured for extraction. For example, for the policy number: 13201753900178368336, with a fixed length and fixed text on both sides of the same line, a regular expression can be used to extract the policy number. The content between "policy number:" and "category batch number" is the policy number. For insurance type content occupying three lines, regular expressions cannot be used. Instead, text slicing and coordinate segmentation can be configured for extraction. The coordinates of the fixed characters surrounding the insurance type are read, the coordinates of four points are obtained, and then text slicing is performed. The extracted text slice content is the insurance type content.
[0096] According to the initial extraction method, the content of the document corresponding to the field to be verified is extracted from the historical business documents in the verification set. The recognition result is obtained. The regular expression, text slicing and coordinate segmentation parameters are adjusted according to the recognition result until the extracted field values are accurate, and the final extraction method is obtained.
[0097] In this embodiment, a correspondence between document templates and processing classes is pre-set, and the corresponding processing class is obtained based on the document template.
[0098] This embodiment improves the efficiency and accuracy of field content extraction by configuring corresponding extraction methods for different fields to be verified.
[0099] Step S203: Read the document content and corresponding location information of the target document, and match the field to be verified with the document content to obtain the coordinate information of the field to be verified.
[0100] In this embodiment, the PDFPlumber library can be used to read all the contents of the target document and its corresponding location information. The document contents include text content and tables, and the location information is the coordinate data corresponding to each character.
[0101] By matching the field to be verified with the identified document content, the coordinate information of the field to be verified and its corresponding field content can be obtained.
[0102] Step S204: Based on the coordinate information, extract the field content that matches the field to be verified from the document content according to the extraction method.
[0103] The coordinate information of the field to be verified is used as the extraction parameter, and the corresponding extraction method is called to extract the field content that matches the field to be verified in the document content.
[0104] For example, the fields to be verified include insurance type, insurance period, endorsement number, policy number, and insured. The extraction method corresponding to each field to be verified is obtained according to the processing class, and the field content is extracted according to the extraction method.
[0105] Step S205: Validate the field content.
[0106] Specifically, the process involves obtaining the business document corresponding to the document identifier of the target document, and obtaining the matching field value of the matching field in the business document that corresponds to the field to be verified. The field content is compared with the matching field value to obtain the comparison result. Based on the comparison result, it is determined whether the field content and the matching field value are consistent. If they are consistent, the target document is verified successfully. If they are inconsistent, the inconsistent fields are assembled into an alarm message and sent to the user.
[0107] The business system's business database stores the business documents corresponding to the target document. The business documents contain field values corresponding to the fields to be verified. The matching field value that matches the field to be verified in the target document is retrieved from the business database and compared with the field content. If the comparison is consistent, it means that the printing is accurate; if the comparison is inconsistent, it means that there is an error in the printing. The inconsistent fields are assembled into an alarm message and sent to the relevant business personnel for follow-up processing, so as to promptly discover and resolve the problems and minimize complaints or disputes.
[0108] This application obtains the coordinate information of the fields to be verified by analyzing the content and location information of the target document. Based on the coordinate information, the field content is extracted using an extraction method, further improving the accuracy of the target document content extraction. Verifying the extracted field content can promptly identify and address problems that occur during the document printing process, improving problem-solving efficiency, ensuring the correctness of document printing, minimizing complaints or disputes, and enhancing user experience.
[0109] In some optional implementations of this embodiment, the step of adjusting the initial extraction method according to the recognition result until the correct document content is extracted includes:
[0110] Calculate the loss value based on the identification result and the actual document content corresponding to the field to be verified;
[0111] The initial extraction method is adjusted based on the loss value to obtain the adjusted extraction method;
[0112] Based on the adjusted extraction method, extract the document content corresponding to the fields to be verified in historical business documents until the correct document content is extracted.
[0113] Each recognition result is compared with the actual document content. If the comparison is consistent, the recognition is correct; if the comparison is inconsistent, the recognition is incorrect. The number of correct recognitions and the number of incorrect recognitions are then obtained. The loss value is calculated based on the number of correct and incorrect recognitions. The initial extraction method is adjusted based on the loss value, such as adjusting the matching expression of the regular expression, coordinate reference words, etc. The adjusted extraction method is then verified again until the extracted field content is accurate.
[0114] This application improves recognition accuracy by adjusting the extraction method to avoid errors in recognition and extraction.
[0115] In some optional implementations, the steps described above for comparing field content with matching field values to obtain the comparison result include:
[0116] Step S301: Construct the first string and the second string corresponding to the field content and the matching field value, respectively.
[0117] Assuming the field content is X, construct the first string str corresponding to the field content. x If the value of the matching field is Y, construct the second string str corresponding to the value of the matching field. y For example, if field X is the policy number {13201753900178368336}, then the first string str x = "13201753900178368336".
[0118] Step S302: Construct a comparison matrix based on the first string and the second string.
[0119] Assuming the first string has a length of m and the second string has a length of n, the constructed alignment matrix is M(X, Y). m×n .
[0120] Step S303: Calculate the alignment result based on the alignment matrix.
[0121] Specifically, the matching window value is calculated based on the first length len1 of the first string and the second length len2 of the second string. The formula for calculating the matching window value is as follows:
[0122]
[0123] Based on the comparison matrix and the matching window value, the number of matched characters and the number of transpositions in the matched characters are calculated. Specifically, the calculation of the number of matched characters 's': if the first string is str... x The second string is str yIf the distance between identical characters is less than the matching window value MW, then the character is considered a match. During the matching process, previously matched characters must be excluded. If a matching character is found, the current matching must be stopped, and the next character must be matched to obtain the set of matched characters.
[0124] Calculating the transposition t for matching characters: Determine the first string as str. x The second string is str y The order of the matched characters must be consistent. If they are inconsistent, half of the transposition is the transposition t of the matched characters.
[0125] In this embodiment, the number of matched characters s and the number of transpositions t satisfy the following formula:
[0126]
[0127] The string similarity is calculated based on the first length, the second length, the number of matched characters, and the transposition of the matched characters. The string similarity is called Jao Distanc, and the calculation formula is as follows:
[0128]
[0129] Determine the length of the common prefix between the first and second strings, and calculate the matching score based on the common prefix length and string similarity. Use the matching score as the comparison result. The formula for calculating the matching score is as follows:
[0130] Sim(X,Y)=D w =D j +(l×p×(1-D j ))
[0131] Where l represents the length of the common prefix of the first string and the second string, but the maximum is specified to be 4; p is a constant for adjusting the fraction, which is specified to not exceed 0.25, otherwise a D might occur. w For cases greater than 1, Winkler defines this constant as 0.1.
[0132] In this embodiment, the value of Sim(X,Y) reflects the degree of similarity between two fields, and the larger the value, the higher the degree of similarity and the more consistent the two fields are. If the value of Sim(X,Y) is 1, it means that the field content is consistent with the matching field value; otherwise, the field content is inconsistent with the matching field value.
[0133] This embodiment compares and verifies the field content extracted from the target document with the field values in the business database. This allows for the timely detection and processing of erroneous field content, improving comparison efficiency and avoiding resource waste.
[0134] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0135] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0136] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0137] Further reference Figure 4 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a document verification device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0138] like Figure 4As shown, the document verification device 400 described in this embodiment includes: a parsing module 401, an acquisition module 402, a matching module 403, an extraction module 404, and a verification module 405. Wherein:
[0139] The parsing module 401 is used to receive a verification request for a target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document.
[0140] The acquisition module 402 is used to obtain the corresponding fields to be verified and the processing class according to the document template, wherein the processing class includes the extraction method of the fields to be verified;
[0141] The matching module 403 is used to read the document content and corresponding location information of the target document, associate and match the field to be verified with the document content, and obtain the coordinate information of the field to be verified.
[0142] Extraction module 404 is used to extract the field content matching the field to be verified from the document content according to the coordinate information and the extraction method.
[0143] The verification module 405 is used to verify the content of the field.
[0144] It should be emphasized that, to further ensure the privacy and security of the target documents, the aforementioned target documents can also be stored in a node of a blockchain.
[0145] Based on the aforementioned document verification device, the fields to be verified in the target document are obtained from the document template, and then the extraction method for these fields is determined. This allows for content extraction of different fields using different extraction methods, improving the accuracy of document content recognition. Furthermore, the coordinate information of the fields to be verified is obtained from the document content and corresponding location information. Based on this coordinate information, the field content is extracted using the appropriate extraction method, further improving the accuracy of the target document content extraction. Verifying the extracted field content allows for the timely detection and rapid handling of problems during document printing, improving problem-solving efficiency, ensuring the correctness of document printing, minimizing complaints or disputes, and enhancing user experience.
[0146] In some optional implementations of this embodiment, the document verification device 400 further includes a template configuration module, comprising:
[0147] The classification submodule is used to obtain all historical business documents, classify the historical business documents according to the document type, and obtain a document set for each document type.
[0148] The extraction submodule is used to extract the feature fields of each of the document sets to form the fields to be verified for each of the document types.
[0149] The template generation submodule is used to receive configuration information input by the user, generate corresponding document templates based on the configuration information and the fields to be verified, and store the document templates in a preset template database.
[0150] Configuring document templates using received configuration information can improve the efficiency of document template generation.
[0151] In some optional implementations of this embodiment, the document verification device 400 further includes an extraction method configuration module, comprising:
[0152] The coordinate acquisition submodule is used to acquire the text content and corresponding coordinate position of the field to be verified in each of the historical business documents.
[0153] A submodule is used to obtain the position attributes of the text content based on the coordinates.
[0154] A configuration submodule is used to configure a corresponding processing class for the document template based on the location attribute, wherein the processing class includes the initial extraction method of the field to be verified;
[0155] The extraction submodule is used to extract the document content corresponding to the field to be verified from the historical business documents according to the coordinate position and the initial extraction method, so as to obtain the recognition result.
[0156] The adjustment submodule is used to adjust the initial extraction method according to the recognition result until the correct document content is extracted, thus obtaining the final extraction method of the field to be verified.
[0157] By configuring appropriate extraction methods for different fields to be verified, the efficiency and accuracy of field content extraction can be improved.
[0158] In some alternative implementations, the modified submodule is further used for:
[0159] Calculate the loss value based on the identification result and the actual document content corresponding to the field to be verified;
[0160] The initial extraction method is adjusted based on the loss value to obtain the adjusted extraction method;
[0161] Based on the adjusted extraction method, extract the document content corresponding to the field to be verified in the historical business documents until the correct document content is extracted.
[0162] By adjusting the extraction method, we can avoid problems with recognition and extraction, thereby improving the recognition accuracy.
[0163] In some alternative implementations, the verification module 405 includes:
[0164] The acquisition submodule is used to acquire the business document corresponding to the document identifier of the target document, and to acquire the matching field value of the matching field corresponding to the field to be verified in the business document.
[0165] The comparison submodule is used to compare the content of the field with the value of the matching field to obtain the comparison result;
[0166] The judgment submodule is used to determine whether the content of the field is consistent with the value of the matching field based on the comparison result; if they are consistent, the target document verification is successful; if they are inconsistent, the inconsistent fields are assembled into an alarm message and sent to the user.
[0167] This embodiment can promptly identify and resolve problems, minimizing complaints or disputes.
[0168] In some optional implementations of this embodiment, the comparison submodule includes:
[0169] The construction unit is used to construct a first string and a second string corresponding to the field content and the matching field value, respectively;
[0170] A matrix unit, used to construct a comparison matrix based on the first string and the second string;
[0171] The comparison calculation unit is used to calculate the comparison result based on the comparison matrix.
[0172] In this embodiment, the comparison calculation unit is further used for:
[0173] Calculate the matching window value based on the first length of the first string and the second length of the second string;
[0174] Based on the comparison matrix and the matching window value, calculate the number of matched characters and the number of transpositions in the matched characters;
[0175] Calculate the string similarity based on the first length, the second length, the number of matched characters, and the number of transpositions of the matched characters;
[0176] Determine the length of the common prefix between the first string and the second string, calculate the matching degree based on the length of the common prefix and the string similarity, and use the matching degree as the comparison result.
[0177] By comparing and verifying the field content extracted from the target document with the field values in the business database, erroneous field content can be detected and processed in a timely manner, improving the efficiency of comparison and avoiding waste of resources.
[0178] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 5 , Figure 5 This is a basic structural block diagram of the computer device in this embodiment.
[0179] The computer device 5 includes a memory 51, a processor 52, and a network interface 53 that are interconnected via a system bus. It should be noted that only the computer device 5 with components 51-53 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0180] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0181] The memory 51 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as the hard disk or memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 5. Of course, the memory 51 may include both the internal storage unit and its external storage device of the computer device 5. In this embodiment, the memory 51 is typically used to store the operating system and various application software installed on the computer device 5, such as computer-readable instructions for document verification methods. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or will be output.
[0182] In some embodiments, the processor 52 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 52 is typically used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is used to execute computer-readable instructions stored in the memory 51 or to process data, such as executing computer-readable instructions for the document verification method.
[0183] The network interface 53 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 5 and other electronic devices.
[0184] This embodiment implements the document verification method steps described above by executing computer-readable instructions stored in memory through a processor. It obtains the fields to be verified in the target document using the document template, and then determines the extraction method for these fields. This allows for content extraction of different fields using different extraction methods, improving the accuracy of document content recognition. Furthermore, it obtains the coordinate information of the fields to be verified from the document content and corresponding location information, and uses the extraction method based on the coordinate information to further improve the accuracy of content extraction. Verifying the extracted field content allows for timely detection and rapid handling of problems during document printing, improving problem-solving efficiency, ensuring the correctness of document printing, minimizing complaints or disputes, and enhancing user experience.
[0185] This application also provides another implementation method, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to perform the steps of the document verification method described above. This involves obtaining the fields to be verified in the target document through its template, and then obtaining the extraction method for these fields. This allows for content extraction of different fields using different extraction methods, improving the accuracy of document content recognition. Furthermore, by using the document content and corresponding location information of the target document, the coordinate information of the fields to be verified is obtained. Based on the coordinate information, the extraction method is used to extract the field content, further improving the accuracy of target document content extraction. Verifying the extracted field content allows for timely detection and rapid handling of problems during document printing, improving problem-solving efficiency, ensuring the correctness of document printing, minimizing complaints or disputes, and enhancing user experience.
[0186] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0187] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A document verification method, characterized in that, Includes the following steps: Receive a verification request for a target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document; Based on the document template, obtain the corresponding fields to be verified and the processing class, wherein the processing class includes the extraction method of the fields to be verified; Read the document content and corresponding location information of the target document, associate and match the field to be verified with the document content, and obtain the coordinate information of the field to be verified. Based on the coordinate information, extract the field content matching the field to be verified from the document content according to the extraction method; Validate the content of the field; The procedure includes, prior to the step of receiving a verification request for the target document: Obtain all historical business documents, classify the historical business documents according to document type, and obtain a document set for each document type; Extract the feature fields of each of the document sets to form the fields to be verified for each of the document types; Receive configuration information input by the user, generate a corresponding document template based on the configuration information and the field to be verified, and store the document template in a preset template database; Following the step of generating the corresponding document template based on the configuration information and the field to be verified, the method further includes: Obtain the text content and corresponding coordinate position of the field to be verified in each of the historical business documents; The positional attribute of the text content is obtained based on the coordinates. Based on the location attribute, a corresponding processing class is configured for the document template, and the processing class includes the initial extraction method of the field to be verified; Based on the coordinate position, extract the document content corresponding to the field to be verified from the historical business documents according to the initial extraction method to obtain the recognition result; The initial extraction method is adjusted based on the recognition result until the correct document content is extracted, thus obtaining the final extraction method for the field to be verified.
2. The document verification method according to claim 1, characterized in that, The step of adjusting the initial extraction method based on the recognition result until the correct document content is extracted includes: Calculate the loss value based on the identification result and the actual document content corresponding to the field to be verified; The initial extraction method is adjusted based on the loss value to obtain the adjusted extraction method; Based on the adjusted extraction method, extract the document content corresponding to the field to be verified in the historical business documents until the correct document content is extracted.
3. The document verification method according to claim 1, characterized in that, The step of validating the content of the field includes: Obtain the business document corresponding to the document identifier of the target document, and obtain the matching field value of the matching field in the business document that corresponds to the field to be verified; The content of the field is compared with the value of the matching field to obtain the comparison result; Based on the comparison results, determine whether the content of the field is consistent with the value of the matching field; If they match, the target document verification is successful; If there is a discrepancy, the inconsistent fields will be assembled into an alarm message and sent to the user.
4. The document verification method according to claim 3, characterized in that, The step of comparing the content of the field with the value of the matching field to obtain the comparison result includes: Construct a first string and a second string corresponding to the content of the field and the value of the matching field, respectively; Construct a comparison matrix based on the first string and the second string; The comparison result is calculated based on the comparison matrix.
5. The document verification method according to claim 4, characterized in that, The step of calculating the alignment result based on the alignment matrix includes: Calculate the matching window value based on the first length of the first string and the second length of the second string; Based on the comparison matrix and the matching window value, calculate the number of matched characters and the number of transpositions in the matched characters; Calculate the string similarity based on the first length, the second length, the number of matched characters, and the number of transpositions of the matched characters; Determine the length of the common prefix between the first string and the second string, calculate the matching degree based on the length of the common prefix and the string similarity, and use the matching degree as the comparison result.
6. A document verification device, characterized in that, include: The parsing module is used to receive a verification request for a target document, parse the verification request to obtain the target document, and determine the document template corresponding to the target document. The acquisition module is used to obtain the corresponding fields to be verified and the processing class according to the document template, wherein the processing class includes the extraction method of the fields to be verified; The matching module is used to read the document content and corresponding location information of the target document, associate and match the field to be verified with the document content, and obtain the coordinate information of the field to be verified. The extraction module is used to extract the field content matching the field to be verified from the document content according to the coordinate information and the extraction method. The verification module is used to verify the content of the field; The document verification device further includes a template configuration module, which comprises a classification submodule, an extraction submodule, and a template generation submodule, wherein: The classification submodule is used to obtain all historical business documents, classify the historical business documents according to the document type, and obtain a document set for each document type. The extraction submodule is used to extract the feature fields of each document set to form the fields to be verified for each document type. The template generation submodule is used to receive configuration information input by the user, generate a corresponding document template according to the configuration information and the field to be verified, and store the document template in a preset template database. The document verification device further includes: an extraction method configuration module, which comprises: a coordinate acquisition submodule, an acquisition submodule, a configuration submodule, an extraction submodule, and an adjustment submodule, wherein: The coordinate acquisition submodule is used to acquire the text content and corresponding coordinate position of the field to be verified in each of the historical business documents; The obtaining submodule is used to obtain the position attribute of the text content based on the coordinate position; The configuration submodule is used to configure a corresponding processing class for the document template based on the location attribute, and the processing class includes the initial extraction method of the field to be verified. The extraction submodule is used to extract the document content corresponding to the field to be verified from the historical business documents according to the coordinate position and the initial extraction method, so as to obtain the recognition result. The adjustment submodule is used to adjust the initial extraction method according to the recognition result until the correct document content is extracted, thus obtaining the final extraction method of the field to be verified.
7. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the document verification method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the document verification method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Information structured extraction method, device and equipment after bill identification
CN112800848A
Document verification method and device, computer equipment and storage medium
CN113378549A