A dynamic credential generation method, program product, and storage medium
By using a dynamic voucher generation method, which leverages position offset matrices and field semantic features, adaptive matching of voucher templates is achieved. This solves the problems of inaccurate voucher processing and high manual maintenance costs in existing technologies, thereby improving the accuracy and efficiency of voucher processing.
Patent Information
- Application Number
- CN202611301832.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-20
AI Technical Summary
In the supply chain management of large enterprises, existing technologies rely on manual configuration of templates and static rules for voucher processing, which is difficult to adapt to heterogeneous data, resulting in inaccurate data mapping, large financial accounting errors, and high manual maintenance costs.
A dynamic voucher generation method is adopted, which selects between forward and reverse modes and combines position offset matrix and field semantic features to achieve bidirectional adaptation between business data and voucher templates, reducing the dependence on fixed templates and manual configuration.
It improves the accuracy and efficiency of voucher processing, reduces manual maintenance costs, and adapts to automated mapping and data filling under different voucher formats.
Smart Images

Figure CN123139976A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of IT technology, and in particular to a dynamic credential generation method, program product, and storage medium. Background Technology
[0002] In the supply chain management of large enterprises, the generation and filling of voucher templates are frequently required during supplier reconciliation and customer billing processes. These vouchers come from diverse sources, involving heterogeneous document formats generated by different systems, which places extremely high demands on the automated extraction and matching of voucher information. Currently, voucher processing typically employs a solution of manually configured templates plus a rule engine. The system pre-defines fixed field mapping rules and parsing templates manually, recognizes the text, and then fills the data into the corresponding positions based on preset static coordinates or regular expressions.
[0003] However, the above solutions have the following drawbacks: Because they rely on manually preset fixed templates and static rules, the system struggles to adaptively handle heterogeneous data with similar field names but different expressions, and it cannot adjust the parsing logic according to the actual layout of the vouchers. Furthermore, the data filling logic provided by these technologies cannot guarantee the accuracy of data mapping and the consistency of logic when faced with complex and ever-changing business rules, easily leading to financial accounting errors, and the manual maintenance costs are high.
[0004] Therefore, how to achieve template matching with reduced manual intervention and high-accuracy logical verification when faced with a large amount of heterogeneous voucher data is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] This disclosure provides a dynamic voucher generation method, program product, and storage medium, which can improve the accuracy and efficiency of voucher template generation and filling.
[0006] In a first aspect, this application provides a dynamic voucher generation method, comprising: acquiring business data; selecting a dynamic voucher generation mode according to a business model; wherein the generation mode includes a forward mode or a reverse mode, the forward mode being based on the field layout of a first voucher template, mapping the business data to placeholders in the first voucher template, the first voucher template being a standardized voucher template; the reverse mode being based on the semantics of the business data, matching the business data to placeholders in a second voucher template, the second voucher template being a voucher template generated based on the field positions and position offset matrices in the business data; the position offset matrix being constructed based on the spatial position distribution characteristics of each field in the voucher layout in a historical voucher sample library, the position offset matrix representing the relative positional relationship between fields and the distribution parameters of the fields; and generating a dynamic voucher based on the business data and the generation mode.
[0007] This application provides a dynamic voucher generation method that can construct a position offset matrix based on the spatial distribution of fields in historical voucher samples and perform standardized mapping by combining field names and semantic features, thereby reducing the reliance on fixed templates and manual configuration rules. At the same time, it selects between forward and reverse modes according to the business model to achieve bidirectional adaptation between business data and voucher templates, and performs mapping between business data and voucher templates based on field semantic relationships, thereby improving the accuracy of mapping relationships and the efficiency of voucher processing.
[0008] In some possible implementations, when the business model is a forward model, dynamic vouchers are generated based on business data and a generation model, including: identifying structured text data from the business data; inputting the structured text data into a natural language processing (NLP) model, and extracting at least one field value from the structured text data through the NLP model; mapping at least one field value to placeholders in the first voucher template based on a preset mapping rule and the field layout of the first voucher template to obtain a dynamic voucher; the preset mapping rule is a mapping rule between field names and field values.
[0009] In this embodiment, field values are extracted from structured text data using an NLP model, and the mapping between field values and placeholders is completed by combining preset mapping rules and the field layout of the first voucher template. This enables the conversion of business data from different sources into dynamic vouchers in a unified format, improving the automation of field extraction and template filling.
[0010] In some possible implementations, before mapping at least one field value to a placeholder in the first voucher template based on a preset mapping rule and the field layout of the first voucher template, the method further includes: mapping at least one field value to a position offset matrix and calculating the current position matching degree; performing cluster analysis based on the field name and semantic features of at least one field value to generate a standardized voucher template containing standardized field names and field layout; and using the standardized voucher template as the first voucher template.
[0011] In this embodiment, the relative spatial positions between fields are quantified by a position offset matrix, and cluster analysis is performed by combining field names and semantic features. This allows fields with similar semantics but different expressions to be mapped to the same standardized field name, thereby improving the template prediction capability under different voucher formats.
[0012] In some possible implementations, when the business model is a reverse model, a dynamic voucher is generated based on the business data and the generation model, including: performing optical character recognition (OCR) on the business data to obtain the position of at least one field; generating a second voucher template based on the position of at least one field and a position offset matrix; and matching the business data to placeholders in the second voucher template based on the semantics of at least one field in the business data to obtain the dynamic voucher.
[0013] In this embodiment, the position of fields in the business data is obtained by OCR, and the field layout of the second voucher template is predicted by the position offset matrix. Then, the matching between the business data and the placeholders is completed based on the field semantics, thereby reducing the dependence on fixed supplier voucher formats and realizing template self-adaptation.
[0014] In some possible implementations, if a new field exists in at least one field, the positional offset between the new field and at least one field is calculated; based on the positional offset, the positional offset matrix is updated to obtain the updated positional offset matrix; based on the position of at least one field and the positional offset matrix, a second voucher template is generated, including: generating a second voucher template based on the position of at least one field and the updated positional offset matrix.
[0015] In this embodiment, when a new field is detected, the position offset matrix is updated according to the position offset between the new field and the existing field, and the second voucher template is regenerated based on the updated position offset matrix. This allows the template to be dynamically expanded as the business fields change, reducing the workload of manually modifying the template.
[0016] In some possible implementations, structured text data is identified from business data; the structured text data is input into an NLP model, and the NLP model identifies the field value of at least one field in the structured text data and the semantic relationship between at least one field; if a derived field exists in at least one field, the field value of the derived field is calculated based on the field value of at least one field and the semantic relationship between at least one field.
[0017] In this embodiment, the NLP model is used to identify field values and semantic relationships between fields. When derived fields exist, the calculation basis of the derived fields is determined based on the field values and semantic relationships. This enables the generation or verification of derived fields using the business logic between fields, thereby improving the consistency of voucher data.
[0018] In some possible implementations, a semantic relationship graph is generated based on the field values of at least one field and the semantic relationships between at least one field; the semantic relationship graph is input into a graph attention network (GAT) model, and the attention weights between at least one field in the semantic relationship graph are determined by the GAT model, the attention weights being used to reflect the degree of association between fields; if a derived field exists in at least one field, the field value of the derived field is calculated based on the field values of at least one field and the semantic relationships between at least one field, including: if a derived field exists in at least one field, the field value of the derived field is calculated based on the field values of at least one field, the semantic relationships between at least one field, and the attention weights between at least one field.
[0019] In this embodiment, the attention weights between fields are determined by constructing a field semantic relationship graph and inputting it into the GAT model. When calculating derived fields, field values, semantic relationships, and attention weights are considered simultaneously, so that the correlation between fields can be dynamically represented, thereby improving the accuracy of field dependency modeling and derived field calculation under complex business rules.
[0020] In some possible implementations, the business data includes business data in at least one language.
[0021] In this embodiment, by performing unified semantic representation and cross-language field mapping on business data in different languages, fields in different languages can be mapped to unified standardized placeholders, and voucher templates in the corresponding languages can be used for generation, thereby expanding the applicability of the dynamic voucher generation method in multilingual business scenarios.
[0022] Secondly, this application provides a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the dynamic credential generation method of any of the above aspects.
[0023] Thirdly, this application provides a computer program product including computer program instructions that, when executed by a processor, implement the dynamic credential generation method of any of the above aspects.
[0024] The technical effects brought about by the second and third aspects can be referred to the technical effects brought about by the corresponding implementation of the first aspect, and will not be repeated here.
[0025] It should be noted that any of the possible implementations of any of the above aspects can be combined, provided that the solutions do not contradict each other. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in this disclosure, the accompanying drawings used in some embodiments of this disclosure will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings.
[0027] Figure 1 A schematic diagram of the architecture of a dynamic credential generation system provided in some embodiments of this disclosure; Figure 2 A flowchart illustrating a dynamic credential generation method provided in some embodiments of this disclosure; Figure 3 A flowchart illustrating another dynamic credential generation method provided in some embodiments of this disclosure; Figure 4 This is a schematic diagram illustrating the composition of a communication device provided in some embodiments of this disclosure; Figure 5 This is a schematic diagram of the structure of a communication device provided in some embodiments of this disclosure. Detailed Implementation
[0028] The technical solutions of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0029] It should be noted that, in this disclosure, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in this disclosure should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0030] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0031] In the description of this disclosure, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "more than one" means two or more.
[0032] To facilitate understanding, we will first provide a brief introduction and explanation of some terms or basic concepts of technology involved in the embodiments of this application.
[0033] 1. Position Offset Matrix: The position offset matrix is a statistical model used in this scheme to characterize the spatial layout features of voucher fields. Specifically, for any two field nodes... and Position offset matrix It is a parameter set of a two-dimensional Gaussian distribution, consisting of a vector of relative positions. and the standard deviation vector of relative position constitute.
[0034] This indicates that in historical samples, the field relative to field The average offset of the center point coordinates; This indicates the degree of dispersion (i.e., the range of fluctuation) of the aforementioned offset. In some embodiments, the position offset matrix serves as one of the input features of the graph attention network, used to quantify whether logically related fields exhibit stable positional dependencies in space, thereby assisting the model in predicting field positions in unseen template layouts.
[0035] 2. Named Entity Recognition (NER): NER refers to the process of automatically identifying and classifying keywords with specific semantics from unstructured text of documents using NLP technology. In some embodiments, the NER module adopts an architecture based on bidirectional encoder representations from transformers (BERT), bidirectional long short-term memory (BiLSTM), and conditional random field (CRF). The task of the NER module is to transform the original text sequence recognized by OCR into a sequence of labeled entities. Specifically, the entity categories identified by the system include, but are not limited to: monetary entities (such as "accounts receivable" and "tax amount"), date entities (such as "invoice date"), subject entities (such as "supplier name" and "customer code"), and identifier entities (such as "invoice number"). The output of NER will be constructed into node feature vectors in a graph neural network, serving as the basis for subsequent semantic matching and logical verification.
[0036] 3. Semantic Role Labeling (SRL): SRL refers to the technique of further analyzing the semantic function (i.e., who did what to whom) of each entity in a sentence or phrase, based on the identification of named entities. In some embodiments, SRL is used to parse the implicit logical relationships in voucher text, mapping entities to semantic roles such as agent, patient, value, or time. For example, in the statement that a payment of 5,000 yuan needs to be made to supplier A, SRL will identify "supplier A" as the patient (payment recipient) and "5,000 yuan" as the value role, constructing a triple relationship of "payment (action), supplier A (patient), 5,000 yuan (value)". These semantic role relationships are mapped to edge features in a graph neural network to capture complex business logic dependencies between fields, rather than just spatial relationships.
[0037] 4. GAT: GAT is a graph neural network model capable of adaptively learning the connection weights between nodes in a graph. In some embodiments, GAT is used to construct a semantic and spatial bimodal graph of credentials, where nodes represent identified field entities and edges represent semantic dependencies or spatial adjacency relationships between entities. The core mechanism of GAT lies in its attention mechanism: unlike traditional graph convolutional networks that assign the same weight to all neighboring nodes, it assigns weights based on the nodes... and nodes The attention weights are dynamically calculated based on the current features (including semantic embeddings and positional offset features). This coefficient reflects the node For nodes The contribution of the current state prediction. Through parallel computation and aggregation of multi-head attention mechanism, GAT can accurately capture complex business rules in dynamic scenarios (such as template fine-tuning and field name changes), and achieve generalized reasoning for unknown template layouts and accurate generation of field values.
[0038] The above is an introduction to the technical terms involved in the embodiments of this application, and will not be repeated below.
[0039] As mentioned in the background section, existing vouchers rely on manually preset fixed templates and static rules, making it difficult for the system to adaptively handle heterogeneous data with similar field names but different expressions, and also making it impossible to adjust the parsing logic according to the actual layout of the voucher. In addition, existing solutions generally adopt unidirectional data filling logic, which makes it difficult to guarantee the accuracy of data mapping and the consistency of logic when facing complex and ever-changing business rules, easily leading to financial accounting errors, and also incurring high manual maintenance costs.
[0040] To address the aforementioned technical problems, this disclosure provides a dynamic voucher generation method. The method involves: first, acquiring business data; then, selecting a dynamic voucher generation mode based on the business model; wherein the generation mode includes a forward mode or a reverse mode. The forward mode maps business data to placeholders in a first voucher template based on the field layout of the first voucher template, where the first voucher template is a standardized voucher template. The reverse mode matches business data to placeholders in a second voucher template based on the semantics of the business data, where the second voucher template is a voucher template generated based on the field positions and position offset matrices in the business data. The position offset matrix is constructed based on the spatial distribution characteristics of each field in the voucher layout from a historical voucher sample library, and the position offset matrix represents the relative positional relationships between fields and the distribution parameters of the fields. Finally, a dynamic voucher is generated based on the business data and the generation mode.
[0041] This solution can construct a position offset matrix based on the spatial distribution of fields in historical voucher samples and perform standardized mapping by combining field names and semantic features, thereby reducing the reliance on fixed templates and manual configuration rules. At the same time, it can select between forward and reverse modes according to the business model to achieve bidirectional adaptation between business data and voucher templates, and perform mapping between business data and voucher templates based on field semantic relationships, thereby improving the accuracy of mapping relationships and the efficiency of voucher processing.
[0042] In some embodiments, the dynamic credential generation method of this application can be executed by an electronic device.
[0043] For example, the electronic device can be a server, such as a single server or a server cluster consisting of multiple servers. In some embodiments, the server cluster can also be a distributed cluster.
[0044] For example, the electronic device can be a terminal device, such as a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, etc. This application embodiment does not impose any special limitations on the specific form of the terminal device.
[0045] The dynamic credential generation system provided in the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0046] See Figure 1 This is a schematic diagram of the architecture of a dynamic credential generation system provided in an embodiment of this disclosure. Figure 1 As shown, the dynamic certificate generation system includes: an input preprocessing layer 110, a natural language processing parsing layer 120, a template normalization and structure prediction layer 130, a graph attention network modeling layer 140, a bidirectional generation engine layer 150, and a result verification layer 160.
[0047] In one possible implementation, an input preprocessing layer 110 is used to perform preliminary processing of the original voucher.
[0048] For example, the input preprocessing layer 110 is specifically used to take the original voucher file in PDF or image format as input and output structured text data containing the content of the original voucher.
[0049] In one possible implementation, the input preprocessing layer 110 is also used to pass the output to the natural language processing parsing layer 120 and the template normalization and structure prediction layer 130.
[0050] In one possible implementation, a natural language processing parsing layer 120 is used to perform semantic understanding and field extraction.
[0051] For example, the natural language processing parsing layer 120 is specifically used to take the text data received from the input preprocessing layer 110 and output the identified key fields and their attributes (such as values, positions, and confidence levels) as well as the semantic relationship graph between the fields.
[0052] In one possible implementation, the natural language processing parsing layer 120 is also used to pass the output to the position offset matrix component in the template normalization and structure prediction layer 130.
[0053] In one possible implementation, template normalization and structure prediction layer 130 is used to achieve adaptive prediction and standardization of voucher templates.
[0054] For example, the template normalization and structure prediction layer 130 is specifically used to combine the fields and their position information output by the natural language processing parsing layer 120 and the historical voucher sample library to output a standardized voucher template, a standardized placeholder set, and a field semantic mapping rule library.
[0055] In one possible implementation, the template normalization and structure prediction layer 130 is also used to pass the output results to the bidirectional generation engine layer 150 as the basic framework for template generation.
[0056] In one possible implementation, a graph attention network modeling layer 140 is used to achieve accurate modeling of dependencies between fields.
[0057] For example, the graph attention network modeling layer 140 is specifically used to take the fields and their position information output by the template normalization and structure prediction layer 130 as input conditions, and output a semantic relationship graph structure with dynamic weights and a quantitative representation of the dependencies between fields.
[0058] In one possible implementation, the graph attention network modeling layer 140 is also used to pass the output to the bidirectional generation engine layer 150 for field logic validation and derived field calculation.
[0059] In one possible implementation, a bidirectional generation engine layer 150 is used to achieve bidirectional intelligent adaptation between data and templates.
[0060] For example, the bidirectional generation engine layer 150 is specifically used to normalize the template and the field dependency relationship output by the standardized credential template graph attention network modeling layer 140 output by the structure prediction layer 130. Both are used as input conditions to output standardized credentials (forward mode) and adapted template or field mapping rules (reverse mode).
[0061] In one possible implementation, the bidirectional generation engine layer 150 is also used to pass the output results to the result verification layer 160 for verification.
[0062] In one possible implementation, the result verification layer 160 is used to ensure the compliance and accuracy of the output credentials.
[0063] For example, the result verification layer 160 is specifically used to verify the credentials or templates output by the bidirectional generation engine layer 150, and output the final credentials that have passed verification and the anomaly report that requires manual intervention.
[0064] In one possible implementation, the result verification layer 160 is also used to feed the verification result back to the graph attention network modeling layer 140 to form a closed-loop optimization.
[0065] It is understood that the application scenarios of the embodiments of this disclosure are not limited. The system architecture and business scenarios described in the embodiments of this disclosure are for the purpose of more clearly illustrating the technical solutions of the embodiments of this disclosure, and do not constitute a limitation on the technical solutions provided by the embodiments of this disclosure. As those skilled in the art will know, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this disclosure are also applicable to similar technical problems.
[0066] The following is a detailed description of a dynamic credential generation method provided by an embodiment of this disclosure.
[0067] This disclosure provides a method for generating dynamic credentials, such as Figure 2 As shown, the method includes the following steps: S201. Obtain business data.
[0068] In one possible implementation, business data includes, but is not limited to, at least one of the following: business data provided by the business system, credential data provided by the supplier, and historical credential data.
[0069] In one possible implementation, the business data includes business data in at least one language.
[0070] S202. Select the dynamic voucher generation mode according to the business model.
[0071] In one possible implementation, the generation mode includes either a forward mode or a reverse mode.
[0072] In one possible implementation, the forward mode is based on the field layout of the first voucher template, mapping business data to placeholders in the first voucher template, which is a standardized voucher template.
[0073] In one possible implementation, the reverse pattern is based on the semantics of the business data, matching the business data to placeholders in the second voucher template, which is a voucher template generated based on the field positions and position offset matrices in the business data.
[0074] The position offset matrix is constructed based on the spatial distribution characteristics of each field in the historical voucher sample library on the voucher page. The position offset matrix represents the relative positional relationship between fields and the distribution parameters of the fields.
[0075] In one possible implementation, the spatial distribution characteristics of each field on the voucher page can be based on the relative positional relationships between the fields.
[0076] In one possible implementation, the relative positional relationship between fields includes: the horizontal distance between the two fields, the vertical distance between the two fields, and the size information of the two fields themselves.
[0077] In one possible implementation, the distribution parameters of the fields are determined by the position offset matrix, specifically including the average of the relative positions between the two fields and the standard deviation of the relative positions between the two fields.
[0078] S203. Generate dynamic vouchers based on business data and generation patterns.
[0079] In one possible implementation, a dynamic credential could be a credential that includes standardized field names, business data values, and coordinates automatically calculated based on a position offset matrix.
[0080] For example, when the business model is positive, the method for generating dynamic vouchers based on business data and generation model can refer to the following method 1, which will not be elaborated here.
[0081] For example, in the case of a reverse business model, the method of generating dynamic credentials based on business data and generation mode can refer to the following method 2, which will not be elaborated here.
[0082] The dynamic voucher generation method provided in this application can select between forward and reverse modes according to the business scenario, and achieve standardized mapping of fields through a position offset matrix, thereby reducing manual maintenance costs and improving the accuracy of voucher processing.
[0083] Below, we will introduce the method of generating dynamic vouchers based on business data and generation mode in S203 when the business mode is positive, in conjunction with the following method 1.
[0084] Method 1: Based on the field layout of the first voucher template, map the business data to the placeholders in the first voucher template.
[0085] In one possible implementation, such as Figure 3 As shown, Method 1 can be implemented by the following steps: S301. Identify structured text data from business data.
[0086] S302. Input the structured text data into the NLP model, and extract at least one field value from the structured text data through the NLP model.
[0087] S303. Based on the preset mapping rules and the field layout of the first voucher template, at least one field value is mapped to a placeholder in the first voucher template to obtain a dynamic voucher; the preset mapping rules are the mapping rules between field names and field values.
[0088] For example, business data is taken as input conditions through an input preprocessing layer, and structured text data is output. S301 can be implemented as follows: Step 1.1, Step 1.2, and Step 1.3: Step 1.1: Perform OCR recognition to convert the image into processable text data.
[0089] Step 1.2: Perform basic data cleaning on the text data to remove noise and irrelevant content.
[0090] Step 1.3: Extract text data from key areas (such as table areas and free text segments) to obtain structured text data.
[0091] For example, the NLP parsing layer receives the text data output from the preprocessing layer and outputs the identified key fields and their attributes (values, positions, confidence levels) as well as a semantic relationship graph between the fields. S302 can be implemented as follows: Steps 2.1, 2.2, and 2.3: Step 2.1: Perform NER using the BERT+BiLSTM+CRF model, including: identifying key fields such as amount, tax rate, and date; calculating the confidence score of key fields using the following formula:
[0092] in, This represents the probability that the model determines a candidate field belongs to a certain field category. This represents the field identified by NER, the Softmax function represents converting the multiple class scores output by the model into a probability distribution, W represents the parameters learned from the model, and h entity denoted as , representing the contextual semantic features of the field extracted from networks such as BERT, BiLSTM, and CRF, and b representing the bias parameters learned from the model, used to adjust the prediction scores for different field categories.
[0093] Step 2.2: Analyze sentence structure using SRL, including: identifying logical relationships between fields (e.g., the multiplicative relationship between amount and tax rate), and constructing a semantic relationship graph based on these relationships. .
[0094] in, This represents a graph structure composed of fields obtained through semantic role annotation and their semantic relationships. This represents all nodes in the semantic relationship graph. This indicates the semantic relationships that exist between nodes.
[0095] Step 2.3: Perform few-shot learning to handle rare field recognition.
[0096] For example, for rare field categories with a small number of samples during training, a pre-trained language model is used to extract semantic features from a small number of labeled samples, and the semantic similarity between the field to be identified and each field category is calculated by constructing a category prototype. This enables field category discrimination based on a small number of samples, thereby improving the model's ability to identify low-frequency fields and novel fields.
[0097] In one possible implementation, at least one field value is mapped to a position offset matrix, and the current position matching degree is calculated; cluster analysis is performed based on the field name and semantic features of at least one field value to generate a standardized voucher template containing standardized field names and field layouts; the standardized voucher template serves as the first voucher template.
[0098] For example, by combining the fields and their location information output by the NLP parsing layer, a standardized voucher template can be output as follows: steps 3.1 and 3.2.
[0099] Step 3.1: Construct the position offset matrix.
[0100] For example, based on the above-mentioned voucher field identification, semantic relationship analysis and field relationship graph construction, the embodiments of this application further utilize the spatial position information of voucher fields in the layout to establish a position offset matrix, and combine the semantic features of the fields to perform clustering and standardization processing on the fields in different vouchers, so as to improve the ability to identify the field correspondence under different voucher formats.
[0101] For example, in this embodiment of the application, the layout position information corresponding to each field in the certificate is first obtained. For any two fields f i and f j This retrieves the center coordinates, width, and height of the bounding box. The field f... i The center coordinates are represented as (x i y i ), field f j The center coordinates are represented as (x j y j ), x i and x j These represent the center position of the field in the horizontal direction of the document, y i and y jThese represent the center positions of the fields in the vertical direction of the document. The construction of the position offset matrix includes the following steps: Location feature extraction: First, calculate field f i With field f j The relative positions between them, Δx=x i -x j Δy=y i -y j Where Δx is the field f i Relative to field f j The horizontal positional offset, Δy, is the field f. i Relative to field f j The positional offset in the vertical direction, (x) i y i ) represents field f i The center coordinates, (x) j y j ) represents field f j The center coordinates.
[0102] Furthermore, after obtaining the relative positions between fields, the positional feature vector P of the field pair is constructed by combining the size information of the two fields themselves. ij = [Δx, Δy, width] i height i width j height j ], where P ij Represents field f i With field f j The positional feature vector between them, width i and height i They represent field f respectively i The width and height of the bounding box; width j and height j They represent field f respectively j The width and height of the bounding box. By using relative position and field size together as positional features, we can simultaneously characterize the spatial distance between fields, their top-bottom and left-right relationships, and differences in field size.
[0103] Position offset matrix generation: For N historical samples obtained under the same type of voucher or the same template, calculate field f respectively. i With field f j The positional feature vectors between the fields are used to obtain the average positional relationship between field pairs through statistical methods. The average positional offset of the positional features is also calculated. .
[0104] in, Represents field f i With field f j The average positional feature vector among N historical voucher samples, where N represents the number of historical voucher samples included in the statistics. This represents field f in the k-th voucher sample. i With field f j The location feature vector, where k represents the number of the historical sample.
[0105] Furthermore, the standard deviation of the positional features between fields is calculated:
[0106] Used to describe the degree of change in the positional relationship of fields in different voucher samples.
[0107] in, Represents field f i With field f j The standard deviation vector of location features This represents the positional feature vector of the k-th sample. This represents the average positional feature of the field across all samples, where N represents the number of samples.
[0108] Furthermore, by using the average position offset and the position standard deviation, the spatial layout statistical characteristics of the field pairs can be obtained, and a position offset matrix can be constructed. .
[0109] in, Represents field f i With field f j The corresponding position offset matrix elements are used to describe the positional relationships within the historical voucher samples. This represents the average positional characteristics of the field pairs. This indicates the degree of positional change of the field pair.
[0110] Template structure prediction: For the credential to be identified, first obtain field f based on the aforementioned field detection results. i With field f j The actual position feature vector P' ij , where P' ij Adopted with P ij They are generated using the same feature composition method.
[0111] Furthermore, the actual location feature vector P' ij The average location feature μ obtained from historical template statistics ij Compare and calculate the position matching degree.
[0112] in, This indicates the positional match degree between the current field pair and the corresponding field pair in the historical template, with a value ranging from 0 to 1, P' ij This indicates the field f in the credential to be identified. i With field f j The actual location feature vector, This represents the average positional feature of corresponding field pairs in historical samples. represents the standard deviation of the corresponding location feature, and exp represents the exponential function.
[0113] Furthermore, the closer the current location feature is to the average location relationship in the historical template, the better. The smaller, The closer it is to 1; when the current location feature differs significantly from the average location relationship in the historical template, Gradually decrease. In some embodiments, the location matching degree threshold is set to 0.7 to determine field f. i With field f j Determine if there is a high-confidence spatial layout relationship, and add the field to the corresponding template structure relationship set.
[0114] Step 3.2: Field clustering and standardized placeholder generation.
[0115] For example, after obtaining the positional relationship of the fields, in order to solve the problem of name differences of the same business fields in different vouchers, different suppliers or different templates, this embodiment further performs semantic clustering on the fields and establishes a unified standardized placeholder for fields with the same or similar semantics.
[0116] Furthermore, for the identified field f, field name features and field semantic features are extracted respectively, where w name w represents the feature vector corresponding to the field name. semantic The feature vector that represents the semantics of the field.
[0117] Furthermore, a field feature vector v is constructed according to preset weights. f =0.7w name +0.3w semantic .
[0118] Among them, v f w represents the comprehensive feature vector of field f. name This represents the feature vector of the field name, used to characterize the lexical and textual information of the field name. semantic This represents the semantic feature vector of a field, used to characterize the semantic information of a field in its context. 0.7 and 0.3 represent the weights of the field name feature and the field semantic feature, respectively.
[0119] Furthermore, the semantic distance between different fields is calculated based on the comprehensive feature vector of the fields. For field f i and field f j The semantic distance d(f) is calculated using cosine similarity. i f j ) = 1 - cos(vf i -vf j ).
[0120] Wherein d(f i f j ) represents field f i and field f j Semantic distance between, vf i Represents field f i The comprehensive feature vector, vf j Represents field f j The comprehensive feature vector, cos(vf i -vf j The cosine similarity () represents the cosine similarity between the feature vectors of two fields. The more semantically similar the two fields are, the closer the cosine similarity is to 1, and the closer the corresponding semantic distance is to 0; conversely, the greater the semantic difference, the greater the semantic distance.
[0121] Furthermore, a hierarchical clustering method is used to aggregate the fields step by step, and a semantic distance threshold is set. In some embodiments, the semantic distance threshold is 0.3.
[0122] Furthermore, for each semantic category c obtained by hierarchical clustering i Establish a mapping rule R(c) between this semantic category and the standard field name. i ) = {f j →standard name i}
[0123] Wherein, R(c i ) represents semantic category c i The corresponding field standardization mapping rule, c i f represents the i-th semantic category. j This indicates the specific field belonging to the semantic category, standard name. i This indicates the standard field name corresponding to this semantic category.
[0124] Furthermore, a standardized placeholder set is generated, which contains standard field names and their attributes.
[0125] In this approach, NLP models are used to extract field values and semantic relationships from business data. Combined with position offset matrices and field semantic clustering, field location and standardization are achieved under different voucher formats and different field descriptions, which can improve template prediction and field normalization capabilities. Furthermore, based on preset mapping rules, field values are mapped to corresponding placeholders in standardized voucher templates to generate dynamic vouchers, thereby improving the automation, processing efficiency, and accuracy of converting business data from different sources into vouchers in a unified format.
[0126] Below, we will introduce the method of generating dynamic vouchers based on business data and generation mode in S203 when the business mode is reverse mode, in conjunction with the following method 2.
[0127] Method 2: Based on the semantics of the business data, match the business data to the placeholders in the second voucher template.
[0128] In one possible implementation, the business data is subjected to OCR recognition to obtain the position of at least one field; a second voucher template is generated based on the position of at least one field and the position offset matrix; based on the semantics of at least one field in the business data, the business data is matched to the placeholders in the second voucher template to obtain a dynamic voucher.
[0129] For example, the implementation of OCR recognition of business data to obtain the location of at least one field can refer to steps 1.1, 1.2 and 1.3 in Method 1 above. In step 1.1, OCR recognition is performed on the image corresponding to the business data to convert the image into text data. In step 1.2, basic data cleaning is performed on the text data. In step 1.3, text data of key areas such as table areas and free text segments are extracted to obtain structured text data. This will not be elaborated here.
[0130] For example, the implementation of matching business data to placeholders in the second voucher template based on the semantics of at least one field in the business data can refer to steps 2.1, 2.2 and 2.3 in method 1 above. In step 2.1, key fields are identified and field confidence is obtained; in step 2.2, semantic relationships between fields are identified and a semantic relationship graph is constructed; and in step 2.3, rare fields are identified. These will not be elaborated here.
[0131] For example, the field positions, layout relationships, and standardized placeholder generation methods of the second voucher template can be referred to steps 3.1 and 3.2 in Method 1 above, which will not be repeated here.
[0132] In one possible implementation, if a new field is added to at least one field, the positional offset between the new field and at least one field is calculated; based on the positional offset, the positional offset matrix is updated to obtain the updated positional offset matrix.
[0133] For example, the method for calculating the positional offset between the newly added field and at least one field can refer to step 3.1 in method 1 above. Specifically, based on the positional information of the newly added field and the existing fields, the horizontal and vertical positional offsets between the newly added field and the existing fields can be calculated respectively, and the positional feature vector between the newly added field and the existing fields can be constructed by combining the width and height of the fields. This will not be elaborated further here.
[0134] In one possible implementation, generating a second voucher template based on the position of at least one field and a position offset matrix includes: generating a second voucher template based on the position of at least one field and an updated position offset matrix.
[0135] Unlike Method 1 described above, this implementation updates the existing position offset matrix for newly added fields appearing in the current business data. Specifically, the position feature vectors corresponding to the newly added fields can be added to the statistical data corresponding to the position offset matrix, and the position statistical features between fields can be recalculated based on the updated field position relationships to obtain the updated position offset matrix.
[0136] In this approach, the positional information of fields in business data is obtained through an OCR model, and the field layout is adaptively predicted under different voucher formats by combining the position offset matrix. This improves the generation and format adaptation capabilities of the second voucher template. When a new field is detected, the position offset matrix is updated according to the positional offset between the new field and the existing field, enabling the voucher template to dynamically expand as business fields change, reducing template maintenance costs. Furthermore, the field values are extracted and the semantic relationships are calculated through an NLP model, thereby improving the accuracy of dynamic voucher generation in reverse mode.
[0137] It should be noted that during the first voucher template filling process in the forward mode, and during the second voucher template verification and generation process in the reverse mode, the business data may contain derived fields that can only be obtained through logical deduction.
[0138] In one possible implementation, derived fields are not directly included in the original input business data or vouchers, but are fields that need to be derived and calculated from the values of one or more other basic fields according to business logic rules.
[0139] In one possible implementation, structured text data is identified from business data, and the structured text data is input into an NLP model. The NLP model identifies the field value of at least one field in the structured text data and the semantic relationship between at least one field. If there is a derived field in at least one field, the field value of the derived field is calculated based on the field value of at least one field and the semantic relationship between at least one field.
[0140] In one possible implementation, a semantic relationship graph is generated based on the field values of at least one field and the semantic relationships between at least one field; the semantic relationship graph is input into a GAT model, and the GAT model determines the attention weights between at least one field in the semantic relationship graph, where the attention weights reflect the degree of association between fields; if a derived field exists in at least one field, the field values of the derived field are calculated based on the field values of at least one field and the semantic relationships between at least one field, including: If a derived field exists in at least one field, the field value of the derived field is calculated based on the field value of at least one field, the semantic relationship between at least one field, and the attention weight between at least one field.
[0141] For example, the way the NLP parsing layer outputs the semantic relationship graph can be referred to steps 2.1 and 2.2 in method 1 above, which will not be repeated here.
[0142] Furthermore, the semantic relationship graph output by the NLP parsing layer is used as the input condition for the GAT model, outputting a semantic relationship graph structure with dynamic weights and a quantitative representation of the dependencies between fields. The processing flow includes the following steps 4.1 and 4.2.
[0143] Step 4.1: Construct a semantic relationship graph structure.
[0144] For example, the semantic relationship graph structure can be constructed as: G = (V, E), where node V represents all fields in the voucher, and edge E represents the association or dependency relationship between the fields. Then, for each field node, an initial node feature vector is constructed based on the characteristics of the field, thereby obtaining the node feature matrix: , where n represents the number of semantic relation nodes, h1 represents the initial feature vector of the first field node, and H represents the initial feature matrix of all field nodes.
[0145] Step 4.2: Calculate the dynamic weights of the fields based on the graph attention mechanism.
[0146] For example, firstly, for each field node in the semantic relationship graph, a graph attention mechanism is used to calculate the attention weight between that node and its neighboring nodes:
[0147] in, The attention weight represents the importance of node j to node i, where i is the current node, j is a neighboring node, and N is the number of nodes. i Let h be the set of neighboring nodes of node i, W be the learnable weight matrix, and h be the weight matrix. i For the features of node i, h j For the features of node j, The transformed node features, Let be the transformed neighbor node features, 'a' be the attention parameter vector, 'LeakyReLU' be the activation function used to perform a non-linear transformation on the attention score, 'exp' be the exponential function, and 'k' be the neighbor node index. Through the above calculations, fields with strong semantic or business dependencies on the current field receive higher attention weights, while fields with lower correlation receive lower attention weights, thus achieving dynamic adjustment of semantic relationship weights.
[0148] Furthermore, based on the obtained attention weights, the node v is... i The neighbor field information is weighted and aggregated to obtain the updated node representation:
[0149] Among them, h i Represents node v i The feature representation after graph attention aggregation, h j Represents neighbor node v j eigenvectors, a ij Represents node v j For node v i The attention weights, where W represents the feature transformation matrix. This represents a non-linear activation function. By weighted aggregation of neighboring nodes, the current field can incorporate information from other fields with strong dependencies, thereby enhancing the contextual semantic expressive power of the field features.
[0150] Furthermore, in order to learn the dependencies between semantic relations from different feature subspaces, a multi-head graph attention mechanism is used for feature extraction:
[0151] in, This represents the node representation obtained from the Kth attention head. This represents the attention weights between nodes calculated by the Kth attention head. This represents the feature transformation matrix corresponding to the Kth attention head. h represents a non-linear activation function.j Represents neighbor node v j The feature vectors. Through a multi-head attention mechanism, semantic dependencies, numerical dependencies, and business dependencies between fields can be learned from different relation subspaces, reducing the dependence of a single attention mechanism on specific relation patterns.
[0152] In some embodiments, after the dynamic voucher generation is completed in the forward mode (such as mode 1) and the reverse mode (such as mode 2), the result verification layer can be used to verify the integrity of the generated result, and the verification result can be used to provide feedback and optimization to the GAT graph modeling layer, thereby improving the accuracy of dynamic voucher generation.
[0153] Specifically, after generating the dynamic credentials, the generated dynamic credentials are sent to the result verification layer. Correspondingly, the result verification layer outputs the final dynamic credentials that have passed verification and an anomaly report requiring manual intervention. Finally, the result verification layer feeds the verification results back to the GAT graph modeling layer, forming a closed-loop optimization.
[0154] In one possible implementation, the result validation layer performs field integrity checks, verifying whether required fields are complete.
[0155] In one possible implementation, the result verification layer can also perform confidence checks on the fields in the dynamic credential based on the field confidence scores output from the NLP parsing layer.
[0156] In one possible implementation, fields with low confidence levels are manually reviewed during the manual review process.
[0157] In one possible implementation, the results verification layer feeds back the results of manual review to the GAT graph modeling layer for model optimization.
[0158] The dynamic credential generation method provided in this application will be further explained in detail below in combination with different application scenarios.
[0159] Application Scenario 1: Supplier Voucher Processing Scenario.
[0160] For example, due to differences in field names, order, position, and format among different suppliers, traditional fixed-template-based voucher processing methods struggle to achieve automatic adaptation to vouchers from different suppliers. This embodiment utilizes input preprocessing, NLP semantic parsing, template structure prediction and normalization, GAT field association modeling, and forward and reverse patterns to convert business data into standardized dynamic vouchers. Furthermore, it can reverse-generate or adjust corresponding voucher templates based on the actual vouchers submitted by the supplier. Specifically: In one possible implementation, the invoice document provided by the supplier is used as business data input, and the business data is preprocessed through an input preprocessing layer to obtain structured text data.
[0161] Specifically, OCR recognition is first performed to convert the image content in the invoice document into processable text data. After performing OCR recognition on the invoice document provided by the supplier, the resulting text content includes "Contract amount: ¥1,200,000; VAT rate: 9%; Payment cycle: monthly settlement".
[0162] Furthermore, the text data obtained from OCR recognition undergoes basic data cleaning, and text data from the table areas of the supplier's invoice is extracted to obtain structured text data. The structured text data obtained after the above processing can be represented as: { "content": "Contract amount: ¥1,200,000; VAT rate: 9%; Payment cycle: Monthly settlement", "key_regions": ["table range"] } Here, "content" represents the preprocessed text content, and "key_regions" represents the key regions identified from the business data.
[0163] In one possible implementation, the structured text data described above is input into an NLP parsing layer, and the semantic relationships between key fields are identified through an NLP model.
[0164] Specifically, by performing NER using BERT, BiLSTM, and CRF models, the amount field was identified as "1,200,000 yuan", with a confidence level of 0.98; the tax rate field was identified as "9%", with a confidence level of 0.95; and the payment cycle field was identified as "monthly settlement", with a confidence level of 0.92.
[0165] Furthermore, semantic relationship analysis is performed on the identified fields to determine a calculation association between the amount field and the tax rate field, and this association is defined as the tax calculation relationship between the amount and the tax rate. A semantic relationship graph is constructed based on the identified fields and the semantic relationships between them. The resulting semantic relationships can be represented as follows: { "entities": [ {"text": "1200000 yuan", "type": "AMOUNT", "confidence": 0.98}, {"text": "9%", "type": "RATE", "confidence": 0.95}, {"text": "Monthly billing", "type": "CYCLE", "confidence": 0.92}
[01] ], "relations": [ {"subject": "1,200,000 yuan", "relation": "HAS_RATE", "object": "9%"}
[02] ] } Here, entities represent the identified fields, and relations represent the semantic relationships between the fields.
[0166] In one possible implementation, the fields, field positions, and semantic relationships output by the NLP parsing layer are correlated with historical voucher samples to predict the template structure corresponding to the current voucher, and the field names used by different suppliers are semantically normalized.
[0167] Specifically, for fields such as "Accounts Receivable" and "Tax Rate" in historical voucher samples, the center position, width, and height of different fields are extracted, and the relative positional offset between fields is calculated. Furthermore, the average positional relationship and degree of positional change between fields are statistically analyzed to generate the corresponding positional offset matrix. For "Accounts Receivable" and "Tax Rate," the following matrix is obtained: M 应收金额,税率 =([50, 20,100,15,80,15],[5,3,2,1,2,1]) Among them, [50, [20,100,15,80,15] represents the average positional characteristic between the two fields, and [5,3,2,1,2,1] represents the standard deviation of the corresponding positional characteristic. Based on the above positional offset matrix, it can be determined that in historical vouchers, the "Tax Rate" field is usually located approximately 50 pixels to the right and 20 pixels above the "Accounts Receivable" field, allowing for corresponding spatial fluctuations.
[0168] Furthermore, comprehensive field features are constructed based on the identified field names and semantics, and clustering is performed according to the semantic distance between fields. The semantic distance between "Amount Receivable" and "Amount Pending Payment" is calculated as: d(Amount Receivable, Amount Pending Payment) = 0.23, which is less than the threshold (0.3) set in this application embodiment. Therefore, "Amount Receivable" and "Amount Pending Payment" are grouped into the same semantic category, and "Amount Receivable" is determined as the standardized field name corresponding to this semantic category, generating the field mapping rule: {"Amount Pending Payment" → "Amount Receivable"}. A standardized placeholder set S = {"Amount Receivable", "Amount Paid", "Amount Not Paid", "Tax Rate", "Tax Amount", ...} is further generated. After the above processing, a standardized template framework is generated:
[03] {
[04] "structure": "invoice_template_v1",
[05] "fields": [
[06] {"name": "Accounts Receivable", "position": [100, 200], "width": 100, "height": 15},
[07] {"name": "tax rate", "position": [150, 180], "width": 80, "height":15},
[08] {"name": "Tax Amount", "position": [150, 220], "width": 80, "height":15}
[09] ]
[10] } Here, "structure" represents the name of the standardized template framework, and "fields" represents the collection of fields.
[0169] In one possible implementation, the standardized fields and their semantic relationships are constructed into a semantic relationship graph, and a graph attention network is used to dynamically model the degree of association between different fields.
[0170] Specifically, a field graph is constructed using “Accounts Receivable,” “Tax Rate,” and “Tax Amount” as field nodes, based on the semantic relationships and business dependencies between the fields. The field graph includes the nodes “Accounts Receivable,” “Tax Rate,” and “Tax Amount,” and establishes relational edges from “Accounts Receivable” to “Tax Amount” and from “Tax Rate” to “Tax Amount.”
[0171] Furthermore, for each field node in the semantic relationship graph, the attention weight between that field node and its neighboring field nodes is calculated to determine the importance of neighboring fields to the current field. The GAT model then outputs a semantic relationship graph structure with dynamic weights.
[11] {
[12] "nodes": [
[13] {"id": "n1", "name": "Accounts Receivable", "value": "1,200,000 yuan"},
[14] {"id": "n2", "name": "tax rate", "value": "9%"},
[15] {"id": "n3", "name": "tax amount", "value": "108000 yuan"}
[16] ],
[17] "edges": [
[18] {"source": "n1", "target": "n3", "weight": 0.6},
[19] {"source": "n2", "target": "n3", "weight": 0.4}
[20] [twenty one]} Here, nodes represent the set of field nodes, and edges represent the set of attention weights between adjacent field nodes.
[0172] In one possible implementation, in a customer billing scenario where the business model is positive, the above-mentioned standardized template is used as the template basis, and the field mapping rules and field associations are used as the processing basis to generate standardized dynamic vouchers based on the customer-side business parameters.
[0173] For example, when receiving customer-side business data "Accounts Receivable: 1,200,000 yuan; Tax Rate: 9%; Payment Cycle: Monthly Settlement", the field values in the business data are mapped to standardized fields according to the field mapping rules. That is, "1,200,000 yuan" is mapped to "Accounts Receivable", "9%" is mapped to "Tax Rate", and "Monthly Settlement" is mapped to "Payment Cycle".
[0174] Furthermore, the predicted position of "tax rate" relative to "amount receivable" is determined based on the position offset matrix. When the position of "amount receivable" is (100, 200), and the average position offset of "tax rate" relative to "amount receivable" is (50, ... At time 20), the predicted position of the "tax rate" is: x=100+50=150±5, y=200-20=180±3 Furthermore, based on the semantic relationships between the fields, a calculation relationship is determined between "tax amount", "accounts receivable", and "tax rate": tax amount = accounts receivable × tax rate. The value of the "tax amount" field is calculated to be 108,000 yuan, and a standardized dynamic voucher is generated accordingly. [twenty two]{
[23] "template": {
[24] "structure": "standard_invoice_v2",
[25] "fields": [
[26] {
[27] "name": "Amount Receivable",
[28] "value": "1,200,000 yuan",
[29] "position": [100, 200],
[30] "width": 100,
[31] "height": 15
[32] },
[33] {
[34] "name": "Tax Rate",
[35] "value": "9%",
[36] "position": [150, 180],
[37] "width": 80,
[38] "height": 15
[39] },
[40] {
[41] "name": "Tax Amount",
[42] "value": "108000 yuan",
[43] "position": [150, 220],
[44] "width": 80,
[45] "height": 15
[46] }
[47]
[48] }
[49] } Here, "structure" represents the name of the standardized template framework, and "fields" represents the collection of fields.
[0175] In one possible implementation, in a supplier reimbursement scenario where the business model is reversed, the field layout and semantics are determined in reverse based on the actual vouchers submitted by the supplier, and the existing standardized templates are adapted based on the current business data.
[0176] In some embodiments, an invoice submitted by a supplier is received, the fields of which include "Amount to be paid: 50,000 yuan", "Actual amount paid: 48,000 yuan", "Unpaid amount: 2,000 yuan" and "Penalty: 500 yuan". First, OCR recognition is performed on the supplier's invoice to obtain the above fields and the corresponding position coordinates of each field. Based on the field positions and position offset matrices obtained from the OCR recognition, the field layout relationship in the supplier's voucher is predicted, thereby generating the corresponding second voucher template in reverse.
[0177] Furthermore, according to the aforementioned field semantic mapping rules, the "payment pending" in the supplier's voucher is mapped to the standardized field "accounts receivable", that is, "payment pending → accounts receivable". Therefore, the accounts receivable is 50,000 yuan.
[0178] Furthermore, based on the semantic relationships between fields, the business relationships between "Accounts Receivable," "Amount Paid," "Amount Unpaid," and "Penalty" are analyzed. For example, the default consistency relationship is: Accounts Receivable = Amount Paid + Amount Unpaid + Penalty. Substituting the values corresponding to the fields "Accounts Receivable," "Amount Paid," "Amount Unpaid," and "Penalty" yields: 50000 ≠ 48000 + 2000 + 500. Therefore, the system determines that there is an inconsistency anomaly in the field data of the current voucher.
[0179] In one possible implementation, when a new field is detected in the current business data, the position offset matrix is updated based on the positional relationship between the new field and existing fields. For example, if "penalty for breach of contract" is detected as a new field in the current template, the positional offset between the "penalty for breach of contract" field and the "accounts receivable" field is calculated, resulting in (Δx, Δy) = (0, 40). This positional relationship is then added to the position offset matrix to obtain the updated position offset matrix. M 应收金额,违约金 =([0,40,100,15,80,15],[2,2,1,1,1,1]) Here, [0,40,100,15,80,15] represents the positional statistical characteristics between the newly added field and "Accounts Receivable," and [2,2,1,1,1,1] represents the corresponding degree of positional change. Simultaneously, based on historical business data and field relationships, the initial association weight of "Penalty Fee" with "Accounts Receivable" is determined to be 0.02, and this field is added to the standardized template.
[0180] Based on the above processing results, the new field "penalty" is added to the standardized voucher template to obtain the adapted template:
[50] {
[51] "adapted_template": {
[52] "structure": "standard_invoice_v2_modified",
[53] "modification_log": [
[54] {
[55] "action": "add_field",
[56] "field_name": "penalty",
[57] "position_offset": [0, 40],
[58] "weight": 0.02,
[59] "mapping_rule": "penalty for breach of contract → penalty for breach of contract"
[60] }
[61] ],
[62] "fields": [
[63] {
[64] "name": "Amount Receivable",
[65] "value": "50000 yuan",
[66] "position": [100, 200]
[67] },
[68] {
[69] "name": "Actual amount paid",
[70] "value": "48000 yuan",
[71] "position": [100, 240]
[72] },
[73] {
[74] "name": "Unpaid Amount",
[75] "value": "2000 yuan",
[76] "position": [100, 280]
[77] },
[78] {
[79] "name": "penalty",
[80] "value": "500 yuan",
[81] "position": [100, 320]
[82] }
[83]
[84] }
[85] } In one possible implementation, the results of the dynamic voucher obtained in the forward mode and the adapted voucher template obtained in the reverse mode are verified to determine the field integrity, business calculation relationship and data consistency.
[0181] First, perform a field integrity check to check whether the required fields in the dynamic voucher are complete and whether each field has the corresponding field value.
[0182] Furthermore, a consistency check is performed according to the preset business rules. For the current field data in the reverse mode scenario, the following verification is performed: Accounts Receivable = Actual Payment + Unpaid Amount + Penalty. Substituting the current data, we get: 50000 ≠ 48000 + 2000 + 500. Therefore, the current "Penalty" field is determined to be abnormal. While maintaining "Accounts Receivable" at 50000 yuan, "Actual Payment" at 48000 yuan, and "Unpaid Amount" at 2000 yuan, to satisfy the above consistency relationship, the penalty is calculated according to the verification rule as: Penalty = 50000. 48000 2000 = 0 yuan. Therefore, mark the "penalty" field as a field to be reviewed, and output the current field value, the reason for the anomaly, and the suggested correction value to the manual review process. For example, the abnormal field is "penalty", the current value is 500 yuan, the reason for the anomaly is "the amount receivable is not equal to the sum of the amount actually paid, the amount not paid, and the penalty", and the suggested correction value is 0 yuan.
[0183] In one possible implementation, the results of the above field consistency checks and manual review are fed back to the GAT field association modeling layer to update the association parameters between the corresponding fields. For example, the association weight between "penalty" and "accounts receivable" is updated from 0.02 to 0.04 to increase the attention paid to this field during subsequent voucher processing that includes the "penalty" field. After completing the field integrity checks, business rule checks, and GAT parameter feedback, a verification report is generated, which can be represented as follows:
[86] {
[87] "validation_result": "failed",
[88] "issues": [
[89] {
[90] "field": "penalty",
[91] "error": "Amount Due != Actual Paid Amount + Unpaid Amount + Penalty",
[92] "suggestion": "The penalty should be 0 yuan"
[93] }
[94] ],
[95] "feedback": {
[96] "updated_weights": {
[97] "penalty": 0.04
[98] }
[99] }
[100] }
[101] Through the above first application scenario, in the forward mode scenario, dynamic vouchers can be automatically generated according to the standardized voucher template, field mapping rules, position offset matrix and field semantic relationships; in the reverse mode scenario, according to the vouchers actually submitted by the supplier, the field positions are identified through OCR, and the voucher template is reversely predicted in combination with the position offset matrix, while field semantic mapping is used to realize standardized matching between different field names; when a new field is detected, the position offset matrix can be updated and the standardized voucher template can be expanded according to the positional relationship between the new field and the existing fields; further, the GAT model is used to dynamically characterize the correlation degree between fields, and combined with business semantic relationships to perform derived field calculation and consistency verification, so as to realize adaptive processing and dynamic voucher generation for vouchers of different sources and different formats.
[0184] The specific implementation process of the dynamic voucher generation method provided by the present application in the multilingual voucher processing scenario will be described in detail below with the second application scenario.
[0185] Application scenario 2, multilingual voucher processing scenario.
[0186] In a possible implementation manner, a Chinese-English bilingual voucher sample library is used as input data, and the Chinese-English bilingual voucher sample library includes different language fields with the same or similar business meaning. For example, the Chinese field "应收金额" corresponds to the English field "Amount Due". A language dimension is added on the basis of the position offset matrix in the above first application scenario to obtain a multilingual position offset matrix: M lang =(μ lang , σ lang ) where M lang represents the multilingual position offset matrix, μ lang represents the average position feature between different language fields, σ lang represents the corresponding position variation degree.
[0187] For example, the position offset matrix corresponding to the Chinese field "应收金额" and the English field "Amount Due" is: M 中文_应收金额,英文_Amount Due =([10,0,100,15,120,15],[3,2,1,1,2,1]) Further, language features are added on the basis of the field features in the above first application scenario to construct a multilingual field feature vector: v f =0.5w name +0.3w semantic +0.2w lang where v f represents the multilingual feature vector of the field, w name represents the field name feature, w semantic represents the field semantic feature, and w lang represents the field language feature.
[0188] The semantic distance between "应收金额" and "Amount Due" is calculated to be: d=0.22, which is less than the threshold (0.3) set in the embodiments of the present application. Therefore, the two fields are classified into the same semantic category, and a cross-language field mapping rule is established: {"AmountDue" → "应收金额"}.
[0189] In a possible implementation, multilingual dynamic voucher generation is performed based on the above cross-language mapping rule.
[0190] Exemplarily, in the forward mode scenario, an English contract "Amount:$10000; Tax Rate:8%" is input, the corresponding fields are mapped to the Chinese standardized fields "应收金额" and "税率", and the tax amount is calculated according to the business relationship between the fields as 10000×8%=800. Thereby, a Chinese voucher template containing "应收金额: $10000", "税率: 8%" and "税额: $800" is generated.
[0191] Exemplarily, in the reverse mode scenario, an English invoice "Amount Due:$5000" is input, "Amount Due" is mapped to "应收金额" according to the cross-language field mapping rule, so as to generate an adapted Chinese voucher template.
[0192] Further, fields of different languages and their semantic relationships are constructed into a multilingual semantic relationship graph, and language identifiers are input into the GAT model as field node attributes to determine the attention weight between fields of different languages. The cross-language attention weight between the Chinese field "应收金额" and the English field "税额" is obtained as: α 中文_应收金额,英文_税额 =0.55.
[0193] Through the above application scenario two, in the multilingual voucher processing scenario, the spatial layout relationship between fields in different languages can be modeled using a multilingual position offset matrix. Cross-language field clustering and standardized mapping can be achieved by using a multilingual field representation that integrates field names, semantics, and language features. Furthermore, the degree of correlation between fields in different languages can be dynamically represented using a multilingual GAT model, thereby realizing field normalization, template adaptation, and forward and reverse dynamic voucher generation between vouchers in different languages, improving the automation level and cross-language adaptation capability of multilingual voucher processing.
[0194] The foregoing primarily describes the solutions of the embodiments of this disclosure from a methodological perspective. It is understood that, in order to achieve the aforementioned functions, the dynamic credential generation system includes at least one of the hardware structures and software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure.
[0195] This disclosure embodiment can divide the dynamic credential generation system into functional modules according to the above method embodiment. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one functional module. The integrated module can be implemented in hardware or software. It should be noted that the module division in this disclosure embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. The following description uses the example of dividing each functional module according to each function.
[0196] Figure 4 This is a schematic diagram illustrating the composition of a communication device provided in an embodiment of this application. Figure 4 As shown, the communication device 400 can be configured as an apparatus for executing a dynamic credential generation method. The communication device 400 includes a business data acquisition module 401, a generation mode determination module 402, and a dynamic credential generation module 403.
[0197] Among them, the business data acquisition module 401 is used to acquire business data.
[0198] The generation mode determination module 402 is used to select the generation mode of dynamic vouchers according to the business mode. The generation mode includes a forward mode or a reverse mode. The forward mode is based on the field layout of the first voucher template and maps the business data to the placeholders of the first voucher template. The first voucher template is a standardized voucher template. The reverse mode is based on the semantics of the business data and matches the business data to the placeholders of the second voucher template. The second voucher template is a voucher template generated based on the field positions and position offset matrices in the business data. The position offset matrix is constructed based on the spatial position distribution characteristics of each field in the voucher layout in the historical voucher sample library. The position offset matrix represents the relative positional relationship between fields and the distribution parameters of fields.
[0199] The dynamic voucher generation module 403 is used to generate dynamic vouchers based on business data and generation patterns.
[0200] In one possible implementation, the dynamic voucher generation module 403 is specifically used to identify structured text data from business data when the generation mode determination module 402 determines that the generation mode is a forward mode; input the structured text data into an NLP model, and extract at least one field value from the structured text data through the NLP model; based on a preset mapping rule and the field layout of the first voucher template, map at least one field value to a placeholder in the first voucher template to obtain a dynamic voucher; the preset mapping rule is the mapping rule between field names and field values.
[0201] In one possible implementation, the dynamic voucher generation module 403 is further configured to map at least one field value to a position offset matrix, calculate the current position matching degree; perform cluster analysis based on the field name and semantic features of at least one field value, generate a standardized voucher template containing standardized field names and field layouts; and use the standardized voucher template as the first voucher template.
[0202] In one possible implementation, the dynamic voucher generation module 403 is specifically used to perform OCR recognition on the business data and obtain the position of at least one field when the generation mode determination module 402 determines that the generation mode is the reverse mode; generate a second voucher template based on the position of at least one field and the position offset matrix; and match the business data to the placeholders in the second voucher template based on the semantics of at least one field in the business data to obtain a dynamic voucher.
[0203] In one possible implementation, the dynamic voucher generation module 403 is further configured to: calculate the positional offset between the newly added field and the at least one field if a new field exists in at least one field; update the positional offset matrix based on the positional offset to obtain the updated positional offset matrix; and generate a second voucher template based on the position of the at least one field and the updated positional offset matrix.
[0204] In one possible implementation, the dynamic credential generation module 403 is further configured to identify structured text data from business data; input the structured text data into an NLP model, and use the NLP model to identify the field value of at least one field in the structured text data and the semantic relationship between at least one field; and, if a derived field exists in at least one field, calculate the field value of the derived field based on the field value of at least one field and the semantic relationship between at least one field.
[0205] In one possible implementation, the dynamic credential generation module 403 is further configured to generate a semantic relationship graph based on the field values of at least one field and the semantic relationships between at least one field; input the semantic relationship graph into a GAT model, and determine the attention weights between at least one field in the semantic relationship graph through the GAT model, the attention weights being used to reflect the degree of association between fields; and, in the case where there is a derived field in at least one field, calculate the field value of the derived field based on the field values of at least one field, the semantic relationships between at least one field, and the attention weights between at least one field.
[0206] In one possible implementation, the business data acquisition module 401 is also used to acquire business data in at least one language.
[0207] For a more detailed description of the aforementioned business data acquisition module 401, generation mode determination module 402, and dynamic voucher generation module 403, as well as a more detailed description of each of their technical features and beneficial effects, please refer to the corresponding method embodiment section above, which will not be repeated here.
[0208] This application provides a possible structure for the communication device involved in the above embodiments, such as... Figure 5 As shown, the communication device 500 includes a processor 502 and a bus 504. Optionally, the device may also include a memory 501; optionally, the communication device 500 may also include a communication interface 503.
[0209] Processor 502 may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with embodiments of this application. Processor 502 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with embodiments of this application. Processor 502 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0210] Communication interface 503 is used to connect to other devices via a communication network. This communication network can be Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0211] The memory 501 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0212] In one possible implementation, the memory 501 can exist independently of the processor 502. The memory 501 can be connected to the processor 502 via a bus 504 and is used to store instructions or program code. When the processor 502 calls and executes the instructions or program code stored in the memory 501, it can implement the method for determining the timing of sending a wake-up signal provided in this embodiment. In another possible implementation, the memory 501 can also be integrated with the processor 502.
[0213] Bus 504 can be an extended industry standard architecture (EISA) bus, etc. Bus 504 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0214] Through the above description of the implementation methods, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the equipment or device can be divided into different functional modules to complete all or part of the functions described above.
[0215] Some embodiments of this application provide a computer-readable storage medium (e.g., a non-transitory computer-readable storage medium) storing computer program instructions that, when executed on a computer, cause the computer to perform a dynamic credential generation method as described in any of the above embodiments.
[0216] Exemplary examples show that the aforementioned computer-readable storage media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes), optical discs (e.g., compact disks (CDs), digital versatile disks (DVDs), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROMs), cards, sticks, or key drives, etc.). The various computer-readable storage media described herein may represent one or more devices and / or other machine-readable storage media for storing information. The term "machine-readable storage medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and / or carrying instructions and / or data.
[0217] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the dynamic credential generation method of any of the above embodiments.
[0218] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0219] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
[0220] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating dynamic vouchers, characterized in that, The method includes: Obtain business data; The generation mode of dynamic vouchers is selected according to the business model. The generation mode includes a forward mode or a reverse mode. The forward mode maps the business data to placeholders in a first voucher template based on the field layout of the first voucher template, where the first voucher template is a standardized voucher template. The reverse mode matches the business data to placeholders in a second voucher template based on the semantics of the business data. The second voucher template is a voucher template generated based on the field positions and position offset matrices in the business data. The position offset matrix is constructed based on the spatial distribution characteristics of each field in the voucher layout from a historical voucher sample library, and the position offset matrix represents the relative positional relationships between fields and the distribution parameters of the fields. Based on the business data and the generation mode, a dynamic credential is generated.
2. The method according to claim 1, characterized in that, When the business mode is a forward mode, generating dynamic credentials based on the business data and the generation mode includes: Identify structured text data from the aforementioned business data; The structured text data is input into an NLP model, and the NLP model extracts at least one field value from the structured text data. Based on the preset mapping rules and the field layout of the first voucher template, the at least one field value is mapped to the placeholder in the first voucher template to obtain the dynamic voucher; the preset mapping rules are the mapping rules between field names and field values.
3. The method according to claim 2, characterized in that, Before mapping the at least one field value to a placeholder in the first voucher template based on a preset mapping rule and the field layout of the first voucher template, the method further includes: Map the at least one field value to the position offset matrix to calculate the current position matching degree; Cluster analysis is performed based on the field name and semantic features of the at least one field value to generate a standardized voucher template containing standardized field names and field layouts. The standardized voucher template serves as the first voucher template.
4. The method according to claim 1, characterized in that, In the case where the business model is a reverse model, generating dynamic credentials based on the business data and the generation model includes: Perform OCR recognition on the business data to obtain the position of at least one field; A second voucher template is generated based on the position of the at least one field and the position offset matrix; Based on the semantics of at least one field in the business data, the business data is matched to the placeholder in the second voucher template to obtain the dynamic voucher.
5. The method according to claim 4, characterized in that, The method further includes: If a new field is added to at least one of the fields, calculate the positional offset between the new field and the at least one field. Based on the position offset, update the position offset matrix to obtain the updated position offset matrix; The process of generating a second voucher template based on the position of the at least one field and the position offset matrix includes: The second voucher template is generated based on the position of the at least one field and the updated position offset matrix.
6. The method according to claim 1, characterized in that, The method further includes: Identify structured text data from the aforementioned business data; The structured text data is input into an NLP model, which identifies the field value of at least one field in the structured text data and the semantic relationship between at least one field. If a derived field exists in the at least one field, the field value of the derived field is calculated based on the field value of the at least one field and the semantic relationship between the at least one field.
7. The method according to claim 6, characterized in that, The method further includes: Generate a semantic relationship graph based on the field values of at least one field and the semantic relationships between at least one field; The semantic relationship graph is input into the GAT model, and the attention weight between at least one field in the semantic relationship graph is determined by the GAT model. The attention weight is used to reflect the degree of association between the fields. When a derived field exists in the at least one field, the field value of the derived field is calculated based on the field values of the at least one field and the semantic relationships between the at least one field, including: If a derived field exists in the at least one field, the field value of the derived field is calculated based on the field value of the at least one field, the semantic relationship between the at least one field, and the attention weight between the at least one field.
8. The method according to claim 1, characterized in that, The business data includes business data in at least one language.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a processor, cause the processor to perform the dynamic credential generation method as described in any one of claims 1 to 8.
10. A computer program product, characterized in that, It includes a computer program; when the computer program is executed, it is capable of implementing the dynamic credential generation method as described in any one of claims 1 to 8.
