Document matching method and device, electronic equipment and storage medium
Through the matching method of the correlation relationship between order numbers and transaction data and the text classification model, the existing document matching efficiency is solved and the error rate is high, efficient and accurate document matching is achieved to adapt to diverse application scenarios.
Patent Information
- Application Number
- CN202411432143.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-01-10
AI Technical Summary
The existing document matching method relies on manual operation, has low efficiency, high error rate, and a single dimension, which cannot meet the diverse document matching needs.
By obtaining document information, establishing an association relationship based on the order number and transaction data, classifying document fields using a preset text classification model, and matching them according to the classification results and matching rules, supporting the matching of text and numerical data, and expanding the matching dimension.
It improves the efficiency and accuracy of document matching, reduces manual operations, adapts to diverse document matching needs, and meets a variety of application scenarios.
Smart Images

Figure CN119293521A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a document matching method, device, electronic equipment and storage medium. Background Art
[0002] Documents are written proofs obtained or filled out when economic transactions occur, which record the actual situation of transactions and matters. They are the original data and important basis for accounting. Supply chain management is to minimize logistics and inventory costs while supporting the growth of core businesses through the integrated analysis of logistics, information flow, and capital flow in the supply chain. In the supply chain, invoices are important vouchers provided to both sellers and buyers during the purchase and sale of goods by enterprises, and are also the main basis for audits in fund review.
[0003] In the course of business processing, it is necessary to calculate and check the amount and other document information based on the document, and document matching is the basis for operations such as document checking. However, at present, document matching still mainly relies on manual work, which not only takes up a lot of time and energy of operators, but also makes document matching inefficient and error-prone. In related technologies, machines can only perform auxiliary verification of simple information such as invoice numbers and amounts, and are limited to establishing document relationships based on the document total amount matching dimension. The dimension is too single, and the relationship establishment error rate is high, which can only meet some simple settlement business scenarios. In another related technology, document matching needs to be pre-processed by humans or computers before matching, and the matching results need to be manually reviewed, resulting in low document matching efficiency and high error rates. Therefore, there is an urgent need for a better document matching method to solve at least one of the above problems.
[0004] It should be noted that the above content only provides background technical information related to the present invention and does not necessarily constitute prior art. Summary of the invention
[0005] In view of the above-mentioned shortcomings of the prior art, the present invention provides a document matching method, device, electronic device and storage medium to solve at least one of the above-mentioned technical problems.
[0006] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0007] According to one aspect of an embodiment of the present invention, a document matching method is provided, comprising: obtaining document information of a document to be matched, the document information comprising a document number and transaction data; determining a first matching document and a first corresponding document according to the document number and the transaction data, and establishing an association relationship between the first matching document and the first corresponding document; classifying a first document field of the first matching document and a second document field of the first corresponding document respectively through a preset text classification model, and determining a field matching result of the first document field and the second document field according to the classification result and a preset matching rule; and matching the first matching document and the first corresponding document based on the field matching result and the association relationship.
[0008] In one embodiment of the present invention, based on the aforementioned scheme, a first matching document and a first corresponding document are determined according to the order number and the transaction data, and an association relationship is established between the first matching document and the first corresponding document, including: determining the first matching document according to the order number; determining a document set corresponding to the first matching document based on a transaction identification identifier of the first matching document, matching transaction commodity information of the first matching document with transaction commodity information of the document set, determining the successfully matched document as the first corresponding document, the transaction data including the transaction identification identifier and the transaction commodity information; establishing the association relationship between the first matching document and the first corresponding document according to the order number and transaction data of the first matching document and the order number and transaction data of the first corresponding document.
[0009] In one embodiment of the present invention, based on the aforementioned scheme, the first document field of the first matching document and the second document field of the first corresponding document are respectively classified through a preset text classification model, including: classifying the first document field through a preset text classification model to obtain a first classification result, and the preset text classification model is trained by sample document fields and sample classification results; classifying the second document field through a preset text classification model to obtain a second classification result, and the classification result includes at least one of precise text, similar text, precise numerical value and floating numerical value.
[0010] In one embodiment of the present invention, based on the above scheme, after the first document field of the first matching document and the second document field of the first corresponding document are respectively classified by a preset text classification model, the method further includes: if the classification result includes the similar text, calculating the text similarity between the first document field and the second document field, and if the text similarity is greater than a preset similarity threshold, determining that the first document field matches the second document field; if the classification result includes the precise text, the text lengths of the first document field and the second document field are both less than the preset text length, and the texts of the first document field and the second document field are the same, determining that the first document field matches the second document field; if the classification result includes the precise value, the numerical precision of the first document field and the second document field is both the preset precision threshold, and the numerical values of the first document field and the second document field are the same, determining that the first document field matches the second document field; if the classification result includes the floating value, and the difference between the numerical value of the first document field and the numerical value of the second document field after conversion by the preset conversion ratio is less than the preset floating threshold, determining that the first document field matches the second document field.
[0011] In one embodiment of the present invention, based on the aforementioned scheme, the first matching document and the first corresponding document are matched based on the field matching results and the association relationship, including: if the matching results of each classification data corresponding to the classification result are matched, then the first corresponding document is determined as a candidate matching document; based on a preset field type weight, a final score of each candidate matching document is calculated; the final scores are sorted, and the candidate matching document corresponding to the first-ranked final score is determined as a fully matching document of the first matching document, and the fully matching document is fully matched with the first matching document according to the association relationship.
[0012] In one embodiment of the present invention, based on the above scheme, after the first document field of the first matching document and the second document field of the first corresponding document are respectively classified by a preset text classification model, the method further includes: determining a field to be merged and a merged corresponding field according to a preset merging rule, merging the field to be merged based on the classification result and the preset merging rule to obtain a merged document field, the field to be merged is a document field of at least one of the first matching document and the other corresponding document, and the other corresponding document is other documents of the first corresponding document except the fully matching document; determining a merged field matching result of the merged document field and the merged corresponding field according to the classification result and the preset matching rule; calculating the document similarity of the other corresponding documents using the field to be merged whose merged field matching result is matched and a preset similarity weight; determining other corresponding documents whose document similarity is greater than a preset document similarity threshold as similar matching documents, and performing similar matching with the first matching document.
[0013] In one embodiment of the present invention, based on the above scheme, the fields to be merged are merged based on the classification result and the preset merging rule to obtain a merged document field, including: if the classification result includes similar text, calculating the field text similarity between multiple fields to be merged and the merged corresponding field, if the field text similarity is greater than the preset text similarity threshold, using the field to be merged corresponding to the field text similarity as the merged document field; if the classification result includes precise text, and multiple fields to be merged are the same, any one of the fields to be merged is used as the merged document field; if the classification result includes precise values, and multiple fields to be merged are If there is a preset additive field, then multiple fields to be merged are summed and the document field after the sum is used as the merged document field; if the classification result includes an exact value and multiple fields to be merged are the same, then any one of the fields to be merged is determined as the merged document field; if the classification result includes a floating value and multiple fields to be merged are preset additive fields, then multiple fields to be merged are summed and the document field after the sum is used as the merged document field; if the classification result includes a floating value and the difference between multiple fields to be merged is less than a preset floating threshold, the value range of the fields to be merged that meets the preset floating threshold is determined as the merged document field.
[0014] According to one aspect of an embodiment of the present invention, a document matching device is provided, comprising: an acquisition module, configured to acquire document information of a document to be matched, the document information comprising a document number and transaction data; a determination association module, configured to determine a first matching document and a first corresponding document according to the document number and the transaction data and to establish an association relationship between the first matching document and the first corresponding document; a field matching module, configured to classify a first document field of the first matching document and a second document field of the first corresponding document respectively through a preset text classification model, and determine a field matching result of the first document field and the second document field according to the classification result and a preset matching rule; and a document matching module, configured to match the first matching document with the first corresponding document based on the field matching result and the association relationship.
[0015] According to one aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements a document matching method as described in any one of the above embodiments.
[0016] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer is enabled to execute the document matching method as described in any one of the above embodiments.
[0017] Beneficial effects of the present invention: The present invention provides a document matching method, device, electronic device and storage medium. The present invention reduces the scope of document matching through the order number and transaction data, improves the efficiency of document matching, and classifies the document fields of the documents to be matched, and matches each field according to the classification results, so that not only numerical data but also text data can be matched, and the dimension of document matching is expanded, so that the matching parameters are more diversified, and the diversified document matching requirements can be met to adapt to a variety of application scenarios, and the accuracy of document matching is improved, which can greatly reduce tedious manual work, avoid occupying a lot of time and energy of operators, and also avoid the low efficiency and high error rate of document matching caused by manual operation.
[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0020] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;
[0021] Figure 2 is a flowchart of a document matching method shown in an exemplary embodiment of the present application;
[0022] Figure 3 is a block diagram of a document matching device shown in an exemplary embodiment of the present application;
[0023] Figure 4 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0025] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present invention in a schematic manner, and thus the illustrations only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0026] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0027] First of all, it should be noted that BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model (PLM). BERT is based on the Transformer model, but it is the encoder. When a sentence is input, the Transformer encoder will output the vector representation of each word in the sentence. The bidirectionality is because the Transformer encoder is bidirectional. Its input is a complete sentence. When a token is specified, BERT has already read all the words in both directions.
[0028] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0029] Reference Figure 1 As shown, the system architecture may include a data acquisition device 101 and a computer device 102. The computer device 102 may be at least one of a desktop graphics processing unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. Relevant technicians may use the computer device 102 to obtain the document information of the document to be matched, the document information includes the document number and transaction data, determine the first matching document and the first corresponding document according to the document number and the transaction data, and establish an association relationship between the first matching document and the first corresponding document, classify the first document field of the first matching document and the second document field of the first corresponding document respectively through a preset text classification model, determine the field matching result of the first document field and the second document field according to the classification result and the preset matching rule, and match the first matching document with the first corresponding document based on the field matching result and the association relationship. The data acquisition device 101 is used to obtain the document information of the document to be matched, the document information includes the document number and transaction data. In this embodiment, the data acquisition device 101 obtains the document creation data and provides it to the computer device 102 for processing. It should be noted that the data acquisition device 101 and the computer device 102 provided in this embodiment are only an example and should not bring any limitation to the functions and scope of use of the embodiment of the present invention.
[0030] It should be noted that the document matching method provided in the embodiment of the present application is generally executed by the computer device 102 , and accordingly, the document matching device is generally disposed in the computer device 102 .
[0031] Figure 2 is a flowchart of a document matching method shown in an exemplary embodiment of the present application. The document matching method can be executed by a computing and processing device. The computing and processing device can be Figure 1 The computer device 102 shown in FIG. Figure 2 As shown, the document matching method at least includes steps S210 to S240, which are described in detail as follows:
[0032] In step S210, the document information of the document to be matched is obtained.
[0033] In one embodiment of the present application, the document information of the document to be matched is obtained from the enterprise database, the document to be matched includes but is not limited to at least one of an order, a settlement form, an acceptance form, a receipt and an invoice, the document information includes but is not limited to the document number and transaction data, and the transaction data includes but is not limited to the transaction identification mark and transaction commodity information. If the document to be matched is an invoice, the relevant information of the invoice to be matched, that is, the document information, includes but is not limited to one or more of the commodity name, specification model, unit, quantity, amount, tax amount and tax rate contained in the invoice line information, the company information of the two parties to the transaction contained in the invoice header information, and the company information includes but is not limited to one or more of the company name, taxpayer identification number, address, telephone number, bank and account number, as well as one or more of the remarks, payee, review, invoice issuer, seller, etc.
[0034] In step S220, a first matching document and a first corresponding document are determined according to the document number and the transaction data, and an association relationship is established between the first matching document and the first corresponding document.
[0035] In one embodiment of the present application, a first matching document is determined based on an order number; a document set corresponding to the first matching document is determined based on a transaction identification identifier of the first matching document, transaction commodity information of the first matching document is matched with transaction commodity information of the document set, and the successfully matched document is determined as the first corresponding document, and the transaction data includes a transaction identification identifier and transaction commodity information; based on the order number and transaction data of the first matching document and the order number and transaction data of the first corresponding document, an association relationship is established between the first matching document and the first corresponding document.
[0036] In this embodiment, the order number is unique, so the first matching document can be determined based on the order number, and the document set corresponding to the first matching document is determined based on the transaction identification identifier of the first matching document, such as the company information of the above-mentioned two transaction parties, and the transaction commodity information of the first matching document is matched with the transaction commodity information of the documents in the document set, and the successfully matched document is determined as the first corresponding document, which can be one or more. The two enterprises are associated by the order number and transaction data of the first matching document and the order number and transaction data of the first corresponding document. This type of association between the two transaction parties is a binary association relationship. Further, the first matching document and the first corresponding document are associated, and the first matching document and the first corresponding document are associated. By establishing an association relationship between documents, the subsequent matching document field is faster and more efficient. It should be noted that the transaction identification identifier in this embodiment can be the company information of the two transaction parties, or it can be a transaction order number, etc., and this application does not impose any restrictions on this.
[0037] In step S230, the first document field of the first matching document and the second document field of the first corresponding document are respectively classified by a preset text classification model, and the field matching result of the first document field and the second document field is determined according to the classification result and the preset matching rule.
[0038] In one embodiment of the present application, a first document field is classified by a preset text classification model to obtain a first classification result, and the preset text classification model is trained by a sample document field and a sample classification result; a second document field is classified by a preset text classification model to obtain a second classification result, and the classification result includes but is not limited to at least one of precise text, similar text, precise value and floating value. The above-mentioned preset text classification model is used to classify the document field to obtain a classification result of at least one of precise text, similar text, precise value and floating value. It should be noted that the data types do not necessarily include all of the above four types, and the match can be determined as long as each existing data type meets the matching requirements. By classifying the document fields of the document to be matched and matching each field according to the classification results, not only numerical data can be matched, but also text data can be matched, which expands the dimension of document matching, makes the matching parameters more diversified, can meet the diverse document matching requirements and adapt to a variety of application scenarios, and improves the accuracy of document matching.
[0039] In this embodiment, since different companies use different names or nomenclatures for the same event, there may be differences in the field information between the documents, which cannot be matched directly. Therefore, it is necessary to classify the document fields through a preset text classification model before matching the documents. For example, "product name" may be written as "goods name" in some cases, or directly written as "goods". Therefore, it is necessary to train the model to classify the goods name and product name into one category, both as similar text fields. The training method of the text classification model is to use the document corpus for secondary training based on the Bert pre-training model, such as the invoice and statement corpus. The training process of the preset text classification model is as follows: obtain sample document fields and sample classification results to generate training text classification sample data; annotate the training text classification sample data according to the sample classification results to generate a sample data set; train the preset text classification model based on the sample data set to obtain the preset text classification model. In this embodiment, the Bert pre-trained model is the above-mentioned pre-set text classification model. It should be noted that the above-mentioned Bert pre-trained model is a pre-set text classification model and is a preferred model. In actual application, other models can also be selected as the above-mentioned pre-set text classification model. This application does not impose any restrictions on this.
[0040] In one embodiment of the present application, if the classification results, i.e., the first classification results and the second classification results, include similar texts, the text similarity between the first document field and the second document field is calculated. If the text similarity is greater than a preset similarity threshold, the first document field and the second document field are determined to match; if the classification results include precise texts, the text lengths of the first document field and the second document field are both less than a preset text length, and the texts of the first document field and the second document field are the same, then the first document field and the second document field are determined to match; if the classification results include precise values, the numerical precision of the first document field and the second document field are both within a preset precision threshold, and the numerical values of the first document field and the second document field are the same, then the first document field and the second document field are determined to match; if the classification results include floating values, and the difference between the numerical value of the first document field and the numerical value of the second document field after conversion by a preset conversion ratio is less than a preset floating threshold, then the first document field and the second document field are determined to match.
[0041] In this embodiment, if the classification result includes similar text, the text similarity between the first document field and the second document field is calculated using the edit distance or language model method. If the text similarity value is greater than the preset similarity threshold, the first document field is deemed to match the second document field. For similar character data, i.e., similar text such as product names, first remove irrelevant characters, then perform word segmentation, and calculate the similarity for each group of words separately to improve the accuracy. For the language model, pre-training is performed in advance using industry-related corpora, and multiple language models are trained to optimize the word vector results for specific fields. Specifically, a regular matching method is used to remove irrelevant characters, such as: "-", "《》", ":" and "**", etc. The training method of the language model is similar to that of the above-mentioned classification model, except that a different corpus is used for training, which will not be repeated here.
[0042] In this embodiment, there are two conversion methods for the preset conversion ratio of the floating numerical type: percentage conversion and absolute value conversion. If calculated according to the percentage, the current numerical total, that is, the percentage of the total number of the first document field, is used for calculation. The matching data and the difference between the second document field and the current numerical value can be matched within the upper and lower preset floating range of the percentage calculation. If calculated according to the absolute value, the difference between the matching data and the current data can be matched within the upper and lower preset floating range of the absolute value. Example 1: The pre-set error range is 10%. The unit price of the product "*Basic Chemicals*Foaming Agent" on the bill of Company A is 8 yuan, the error value is 8*10%=0.8 yuan, and the error tolerance range is 7.2 to 8.8 yuan. On the invoice issued by Company B to Company A, the product is "*Basic Chemicals*Foaming Agent" with a unit price of 8.5 yuan. Within the error tolerance range, it can be correctly matched successfully. Example 2: The pre-set error range is 3. The unit price of the product "*Drawing and measuring instrument* Ring stylus" on Company A's invoice is 100 yuan, and the allowable error range is between 97 and 103 yuan. On the invoice issued by Company B to Company A, the product is "*Drawing and measuring instrument* Ring stylus" with a unit price of 102 yuan. It is within the allowable error range and can be correctly matched successfully.
[0043] In step S240, the first matching document and the first corresponding document are matched based on the field matching result and the association relationship.
[0044] In one embodiment of the present application, if the matching results of each classified data corresponding to the classification results are all matched, the first corresponding document is determined as a candidate matching document; the final score of each candidate matching document is calculated based on the preset field type weight; the final scores are sorted, and the candidate matching document corresponding to the first ranked final score is determined as a fully matched document of the first matching document, and the fully matched document is fully matched with the first matching document according to the association relationship. Matching documents through field matching results not only improves the accuracy of document matching, but also can greatly reduce tedious manual work, avoid occupying a lot of time and energy of operators, and also avoid low efficiency and high error rate of document matching caused by manual operation.
[0045] In this embodiment, a distributed method is used to match the first matching document and the first corresponding document, and the result is found that any field of the first corresponding document satisfies the matching rule of its corresponding category, and the result is placed in the candidate matching list as a candidate matching document, that is, the first corresponding document in which each second document field matches the first document field is determined as a candidate matching document, and the final score of each candidate matching document is calculated based on the preset field type weight, and the preset field type weight is the weight of each field set in advance. Preferably, the weight of accurate and key fields such as precise text and precise numerical values is set higher, and the weight of inaccurate and non-key fields such as similar text is set lower. It should be noted that the above preset weight setting is only a preferred example. In actual application, the field type weight can be preset according to actual needs, and this application does not limit this. According to the preset field type weight, each candidate matching document is weighted and calculated to obtain the final score, and the matching result with the highest final score is identified as a complete match. According to the association relationship, the complete matching document is matched with the first matching document and marked as a complete match, and the remaining results are returned to the list to be matched. Specifically, the efficiency of one-to-one matching is significantly reduced when the amount of data exceeds 10,000. The matching efficiency can be improved through distributed computing. First, the grouping fields are identified to split the data to be matched. The grouping fields are generally precise character data. Then, distributed methods such as multi-threading are used for matching, and finally the results are merged.
[0046] In this embodiment, similar text data and floating value data are weighted in the form of multiplication. The weight values of all types of data are summed to obtain the final score result. The score calculation formula for the document field with the classification result of similar text is as follows:
[0047] Score 相似文本型(t) =S ij *W t Formula (1)
[0048] Among them, S ij represents the similarity between string i and string j, Wt Indicates that the weight corresponding to the text data is the preset field type weight.
[0049] The score calculation formula for document fields whose classification results are floating values is as follows:
[0050]
[0051] Among them, R t Indicates the conversion ratio of the floating numeric data, d i Indicates the source data value, d j represents the target data value, δ t Indicates the floating threshold value of the floating numerical data, W t Indicates the weight corresponding to the floating numeric data.
[0052] In one embodiment of the present application, after the first document field of the first matching document and the second document field of the first corresponding document are respectively classified by a preset text classification model, the fields to be merged and the merged corresponding fields are determined according to the preset merging rules, and the fields to be merged are merged based on the classification results and the preset merging rules to obtain the merged document fields, the fields to be merged are the document fields of at least one of the first matching document and the other corresponding documents, and the other corresponding documents are the other documents of the first corresponding document except the fully matching document; the merged field matching result of the merged document field and the merged corresponding field is determined according to the classification results and the preset matching rules; the document similarity of the other corresponding documents is calculated based on the fields to be merged whose merged field matching results are matched and the preset similarity weight; the other corresponding documents whose document similarity is greater than the preset document similarity threshold are determined as similar matching documents, and the similar matching documents are similarly matched with the first matching document.
[0053] In this embodiment, the preset merge rule can be to merge similar data, which includes the same field name and the same type of field name. The same type of field name is a name that is not completely the same but actually refers to the same type of event, such as commodity unit price, unit price, commodity price, etc. The preset merge rule can also be a merge calculation, that is, a sum calculation, for example, the amount of the first matching document A is 100, the amount of the first corresponding document B is 60, and the amount of the first corresponding document C is 40. It should be noted that the above-mentioned preset merge rules in this embodiment are for example explanation, and this application does not limit the preset merge rules.
[0054] In one embodiment of the present application, the fields to be merged are merged based on the classification results and the preset merging rules to obtain the merged document field. Specifically, if the classification results, i.e., the first classification results and the second classification results, include similar texts, the field text similarities of the multiple fields to be merged and the merged corresponding fields are calculated. If the field text similarity is greater than the preset text similarity threshold, the fields to be merged corresponding to the field text similarity are used as the merged document fields, and the similarity average of the field text similarities is used as the similarity of the merged document fields; if the classification results include precise texts, and multiple fields to be merged are the same, any field to be merged is used as the merged document field; if the classification results include precise texts, and multiple fields to be merged are the same, any field to be merged is used as the merged document field; If the classification results include precise values and multiple fields to be merged are preset cumulative fields, the multiple fields to be merged will be summed and the document field after the sum will be used as the merged document field; if the classification results include precise values and multiple fields to be merged are the same, any field to be merged will be determined as the merged document field; if the classification results include floating values and multiple fields to be merged are preset cumulative fields, the multiple fields to be merged will be summed and the document field after the sum will be used as the merged document field; if the classification results include floating values and the difference between multiple fields to be merged is less than the preset floating threshold, the value range of the fields to be merged that meets the preset floating threshold will be determined as the merged document field.
[0055] In this embodiment, a double pointer search method is used to match one-to-many, i.e., one first document field corresponds to multiple second document fields, and many-to-one, i.e., multiple first document fields correspond to one second document field. Multiple data, i.e., multiple first document fields or multiple second document fields, are merged according to the following rules: If the classification result includes similar texts and satisfies the threshold requirement for the similarity of multiple text data, for example, there is commodity A in the invoice, and commodities B, C, and D in the statement, the similarity between A and B is 0.8, the similarity between A and C is 0.9, and the similarity between A and D is 0.7, and the set similarity threshold is 0.75, then only B and C meet the threshold, and after merging, subsequent one-to-one matching is performed according to the similarity (0.8+0.9) / 2=0.85. If the classification result includes precise text and satisfies the same requirements for multiple text data, any text is finally taken as the field value. If the classification result includes an exact value, and the document field has an additive feature, it is a preset additive field, such as the amount. For example, the amount of commodity A in the invoice is 100, the amount of commodity B in the statement is 40, and the amount of commodity C is 60. Then, when merging, sum B and C, and finally equal the amount of A. If other fields match, it is determined that A and B, and C match one-to-many. If the classification result includes an exact value, and the document field does not have an additive feature, it is not a preset additive field, such as unit price, but multiple numerical data are equal, and finally any value is taken as the field value; for example, the unit price of commodity A in the invoice is 10, the unit price of commodity B in the statement is 4, and the unit price of commodity C is 6, then it is determined that A does not have a one-to-many match with B and C, and B and C cannot be merged into 10. However, in another statement, the unit prices of commodities E and F are both 10, so A can be determined to match E and F if other conditions are met, and the unit price after merging is 10. If the classification result includes floating values, and multiple document fields are preset cumulative fields, the multiple data are summed and merged. If the classification result includes floating values, the document field is not a preset cumulative field, but the data difference of multiple data meets the threshold requirement, and is finally saved as a list as the field value; for example, assume that the threshold of the floating value is 0.1. The amount of commodity A in the invoice is 29.9, the amount of commodity B in the statement is 29.8, the amount of C is 30, and the amount of D is 29. The final merge considers that A can match B and C, and B and C are merged into a list [29.8,30] as the merged amount field value. The merged data, that is, the merged document field, is matched one-to-one with the first document field or the second document field. The specific matching method is the same as the matching method in "Determining the field matching results of the first document field and the second document field based on the classification results and preset matching rules". Please refer to the above description and will not be repeated here.
[0056] In one embodiment of the present application, if the above-mentioned one-to-many or many-to-one cannot satisfy the matching result, that is, the matching fails, a multi-pointer search method is used to match the many-to-many result, that is, multiple first document fields correspond to multiple second document fields. The data merging rule is the same as the above-mentioned merging rule and will not be repeated here. After the merging, the merged document field of the first document field and the merged document field of the second document field are obtained, and the merged data are matched one-to-one, that is, the merged document field of the first document field and the merged document field of the second document field are matched.
[0057] In this embodiment, the first field to be merged of the first matching document and the second field to be merged of the other corresponding documents are determined according to the preset merge rule, and the fields to be merged are merged based on the classification result and the preset merge rule to obtain the merged document field; the merged field matching result of the first merged document field and the second merged document field is determined according to the classification result and the preset matching rule; the document similarity of the first matching document and the other corresponding documents is calculated based on the first field to be merged, the second merged document field and the preset similarity weight whose merged field matching result matches; if the document similarity is greater than the preset document similarity threshold, the first matching document and the other corresponding documents are similarly matched. The compliance rules of this embodiment refer to the aforementioned merge rules and will not be repeated here.
[0058] In one embodiment of the present application, the document similarity of other corresponding documents is calculated based on the matching fields to be merged and the preset similarity weights; other corresponding documents whose document similarity is greater than the preset document similarity threshold are determined as similar matching documents, and the similar matching documents are similarly matched with the first matching document. According to different preset similarity thresholds, similar matching documents are determined as the first matching document, similar matching documents are similarly matched with the first matching document, and the first corresponding document is similarly matched with the first matching document; and finally the remaining list data to be matched is determined as unmatched. Specifically, different similarity thresholds can be set for similar text data and floating numerical data to distinguish between complete match results and similar match results. Generally, the complete match result is selected according to the highest threshold, and the similar match results can be divided into multiple categories according to other thresholds to meet the needs of business scenarios.
[0059] The matching method provided by the present invention has rich matching dimensions, intelligence, high computational efficiency, diversified parameters and high result accuracy, which can meet the business document matching needs in diversified enterprise settlement business, and can meet the needs of high real-time performance and high accuracy, and is applicable to a variety of application scenarios. It can greatly reduce tedious manual operations and can better adapt to business scenarios with high real-time requirements such as risk identification.
[0060] Figure 3is a block diagram of a document matching device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown in the figure is specifically configured in the computer device 102. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.
[0061] like Figure 3 As shown, the exemplary document matching device includes: an acquisition module 310 , a determination association module 320 , a field matching module 330 and a document matching module 340 .
[0062] Among them, the acquisition module 310 is configured to obtain the document information of the document to be matched, and the document information includes the document number and transaction data; the determination association module 320 is configured to determine the first matching document and the first corresponding document according to the document number and the transaction data and establish an association relationship between the first matching document and the first corresponding document; the field matching module 330 is configured to classify the first document field of the first matching document and the second document field of the first corresponding document respectively through a preset text classification model, and determine the field matching result of the first document field and the second document field according to the classification result and the preset matching rule; the document matching module 340 is configured to match the first matching document and the first corresponding document based on the field matching result and the association relationship.
[0063] It should be noted that the document matching device provided in the above embodiment and the document matching method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the document matching device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0064] An embodiment of the present invention also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the document matching method provided in the above-mentioned embodiments.
[0065] Figure 4 The structure diagram of the computer system of the electronic device suitable for implementing the embodiment of the present invention is shown. It should be noted that: Figure 4 The computer system 400 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0066] like Figure 4As shown, the computer system 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403, such as executing the methods provided in the above-mentioned various embodiments. In the RAM 403, various programs and data required for system operation are also stored. The CPU 401, the ROM 402 and the RAM 403 are connected to each other through the bus 404. The input / output (I / O) interface 405 is also connected to the bus 404.
[0067] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.
[0068] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 409, and / or installed from a removable medium 411. When the computer program is executed by a central processing unit (CPU) 401, various functions defined in the system of the present invention are executed.
[0069] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0070] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0071] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.
[0072] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of a computer, causes the computer to execute the document matching method provided in the above-mentioned embodiments. The computer-readable storage medium may be included in the electronic device described in the above-mentioned embodiments, or may exist independently without being assembled into the electronic device.
[0073] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0074] Another aspect of the present application also provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the document matching method provided in each of the above embodiments.
[0075] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0076] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0077] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A document matching method, characterized in that: include: Obtaining document information of the document to be matched, wherein the document information includes a document number and transaction data; Determine a first matching document and a first corresponding document according to the document number and the transaction data, and establish an association relationship between the first matching document and the first corresponding document; Classifying the first document field of the first matching document and the second document field of the first corresponding document respectively by using a preset text classification model, and determining a field matching result of the first document field and the second document field according to the classification result and a preset matching rule; The first matching document and the first corresponding document are matched based on the field matching result and the association relationship.
2. The document matching method according to claim 1, characterized in that: Determining a first matching document and a first corresponding document according to the document number and the transaction data and establishing an association relationship between the first matching document and the first corresponding document includes: Determine a first matching document according to the document number; Determine a document set corresponding to the first matching document based on the transaction identification identifier of the first matching document, match the transaction commodity information of the first matching document with the transaction commodity information of the document set, and determine the document with successful matching as the first corresponding document, wherein the transaction data includes the transaction identification identifier and the transaction commodity information; The association relationship is established between the first matching document and the first corresponding document according to the document number and transaction data of the first matching document and the document number and transaction data of the first corresponding document.
3. The document matching method according to claim 1, characterized in that: Classifying the first document field of the first matching document and the second document field of the first corresponding document respectively by using a preset text classification model, including: Classifying the first document field by using a preset text classification model to obtain a first classification result, wherein the preset text classification model is trained by sample document fields and sample classification results; The second document field is classified by a preset text classification model to obtain a second classification result, wherein the classification result includes at least one of precise text, similar text, precise numerical value and floating numerical value.
4. The document matching method according to claim 3, characterized in that: After respectively classifying the first document field of the first matching document and the second document field of the first corresponding document by using a preset text classification model, the method further includes: If the classification result includes the similar text, calculating the text similarity between the first document field and the second document field, and if the text similarity is greater than a preset similarity threshold, determining that the first document field matches the second document field; If the classification result includes the precise text, the text lengths of the first document field and the second document field are both less than a preset text length, and the texts of the first document field and the second document field are the same, then it is determined that the first document field and the second document field match; If the classification result includes the precise value, the numerical precisions of the first document field and the second document field are both within the preset precision threshold, and the numerical values of the first document field and the second document field are the same, then it is determined that the first document field and the second document field match; If the classification result includes the floating value, and the difference between the value of the first document field and the value of the second document field after conversion by a preset conversion ratio is less than a preset floating threshold, it is determined that the first document field matches the second document field.
5. The document matching method according to any one of claims 1 to 4, characterized in that: Matching the first matching document with the first corresponding document based on the field matching result and the association relationship includes: If the matching results of each classification data corresponding to the classification result are all matched, determining the first corresponding document as a candidate matching document; Calculating a final score for each candidate matching document based on a preset field type weight; The final scores are sorted, and the candidate matching document corresponding to the first-ranked final score is determined as a fully matching document of the first matching document, and the fully matching document is fully matched with the first matching document according to the association relationship.
6. The document matching method according to claim 5, characterized in that: After respectively classifying the first document field of the first matching document and the second document field of the first corresponding document by using a preset text classification model, the method further includes: Determine the fields to be merged and the merged corresponding fields according to the preset merge rule, merge the fields to be merged based on the classification result and the preset merge rule to obtain the merged document field, the fields to be merged are the document fields of at least one of the first matching document and the other corresponding documents, and the other corresponding documents are the other documents of the first corresponding document except the fully matching document; Determine the merge field matching result between the merged document field and the merged corresponding field according to the classification result and the preset matching rule; Calculate the document similarity of the other corresponding documents by using the merge field matching result as the matched field to be merged and the preset similarity weight; Other corresponding documents whose document similarity is greater than a preset document similarity threshold are determined as similar matching documents, and the similar matching documents are similarly matched with the first matching document.
7. The document matching method according to claim 6, characterized in that: Merging the fields to be merged based on the classification result and the preset merging rule to obtain a merged document field, including: If the classification result includes similar texts, the field text similarities between the plurality of fields to be merged and the field corresponding to the merge are calculated, and if the field text similarities are greater than a preset text similarity threshold, the field to be merged corresponding to the field text similarities is used as the merged document field; If the classification result includes accurate text, and multiple fields to be merged are the same, any of the fields to be merged is used as the merged document field; If the classification result includes an accurate value, and multiple fields to be merged are preset accumulable fields, then the multiple fields to be merged are summed, and the summed document field is used as the merged document field; If the classification result includes an accurate value, and multiple fields to be merged are the same, any field to be merged is determined as the merged document field; If the classification result includes floating values, and multiple fields to be merged are preset accumulative fields, then the multiple fields to be merged are summed, and the summed document field is used as the merged document field; If the classification result includes floating values, and the difference between the multiple fields to be merged is less than a preset floating threshold, the value range of the fields to be merged that meets the preset floating threshold is determined as the merged document field.
8. A document matching device, characterized in that: include: An acquisition module, used to acquire document information of a document to be matched, wherein the document information includes a document number and transaction data; a determination association module, configured to determine a first matching document and a first corresponding document according to the document number and the transaction data, and to establish an association relationship between the first matching document and the first corresponding document; a field matching module, configured to classify the first document field of the first matching document and the second document field of the first corresponding document respectively by using a preset text classification model, and determine a field matching result between the first document field and the second document field according to the classification result and a preset matching rule; A document matching module is used to match the first matching document with the first corresponding document based on the field matching result and the association relationship.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the document matching method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the document matching method according to any one of claims 1 to 7.
Citation Information
Cited By
Document management method and system for logistics transportation
CN119990944A