Material contract text generation method and system based on semantic analysis
By performing semantic vector modeling and joint scoring on template variables and entities, the problem of semantic conflict of variables in the generation of material contracts is solved, and efficient, accurate generation and semantic rationality of contract text are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-13
AI Technical Summary
In existing material contract generation systems, when the semantic definition of template variables is not precise, semantic conflicts and overfitting mappings are prone to occur, resulting in content duplication, format chaos, and a lack of variable uniqueness constraints and conflict detection mechanisms.
By performing semantic vector modeling on template variables and entities, encoding them using a pre-trained language model, calculating semantic precision weights and variable exclusivity coefficients, and combining dependency parsing for joint scoring, we can ensure accurate matching and unique mapping between template variables and entities.
It improves the automation and accuracy of material contract generation, reduces manual intervention, ensures that contract texts meet requirements in terms of syntax, semantics, and logic, and improves generation efficiency and quality.
Smart Images

Figure CN121659953A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of material contract text generation technology, specifically to a material contract text generation method and system based on semantic analysis. Background Technology
[0002] Material contract generation refers to the process of automatically or manually drafting a legally binding contract based on the needs and agreements between the transacting parties regarding the procurement and supply of materials. These contracts typically include clauses specifying the material name, specifications, quantity, price, delivery method, payment terms, and liability for breach of contract. The aim is to regulate the rights and obligations of both parties, ensuring the smooth progress of the material transaction and mitigating risks.
[0003] The existing technology has the following shortcomings: In semantic analysis-based contract generation, the lack of strict semantic boundaries between template variables can easily lead to problems such as "semantic conflicts and overfitting." When there are semantically similar fields in the template (such as "material description" and "material name"), the system may fill in the same entity with multiple variables simultaneously when information is insufficient or semantics are ambiguous, resulting in duplicate content, formatting chaos, or non-standard expression. The root cause of these problems is that the semantic definition of template variables is not precise enough, lacking clear distinction rules. Furthermore, the template management system lacks uniqueness constraints or conflict detection mechanisms, making it unable to determine which information should be filled into which field, ultimately leading to errors such as field overwriting and mixed filling. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for generating material contract text based on semantic analysis, so as to overcome the shortcomings of the prior art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for generating material contract text based on semantic analysis, comprising: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable to construct a semantic vector for the template variable. Semantic analysis is performed on structured or unstructured contract requirement data input by users to extract key entities, and semantic vector encoding is performed on each entity as an entity semantic vector; Based on the constructed template variable semantic vector and the obtained entity semantic vector, the semantic precision weight SPW between each candidate entity and the template variable is calculated. For each candidate entity, check whether it has been mapped to other semantically similar template variables. If a mapping exists, calculate the variable exclusivity coefficient (VEC) of the entity based on the semantic overlap between the current variable and the bound variable. For the matching relationship between each candidate entity and the template variable, a joint score is calculated based on the SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship. The mapping results corresponding to the effective mapping relationships are filled into the corresponding variable positions in the contract template, and the sentence structure is dynamically adjusted according to the semantic role information, finally outputting the complete material contract text.
[0006] Preferably, the semantic vector modeling of each template variable in the preset material contract template includes: Multiple industry standard material contract texts were collected in advance, and key fields that frequently appear in the contracts were identified as template variables by combining rule extraction and manual annotation. Based on the identified template variables, a pre-trained language model is invoked to perform context enhancement processing on each template variable, embedding the variables into multiple typical sentence patterns to form a variable semantic context corpus; The generated variable semantic context corpus is input into a pre-trained language model for vector encoding processing to obtain the semantic vector representation corresponding to each template variable.
[0007] Preferably, the semantic analysis of the structured or unstructured contract requirement data input by the user includes: Natural language processing technology is used to preprocess the contract requirements data input by users, identify and separate key entities such as "Party A's name", "Party B's name", "Material type", "Delivery date" and "Payment amount". Named entity recognition technology is used to classify and label each identified entity to ensure that the type of each entity and its contextual relationship are accurately captured. The labeled entities are input into a pre-trained language model, and each entity is semantically encoded using context enhancement to generate a semantic vector representation of each entity. The semantic vector representation is the semantic embedding of the entity in the given contract scenario.
[0008] Preferably, the calculation of the semantic precision weight (SPW) between each candidate entity and the template variable includes: The constructed template variable semantic vector and the obtained entity semantic vector are input into a predetermined similarity calculation model. The cosine similarity algorithm is used to calculate the similarity value between each pair of entities and template variables. For each pair of entities and template variables, the semantic precision weight SPW is calculated based on the cosine similarity value of their semantic vectors.
[0009] Preferably, the variable exclusivity coefficient VEC of the computational entity includes: For each candidate entity, first check whether it has been mapped to other template variables, and identify all the sets of bound template variables; For each bound template variable, calculate the semantic overlap between the candidate entity and the bound template variable; Based on semantic overlap, the variable exclusivity coefficient (VEC) of candidate entities is calculated.
[0010] Preferably, the matching relationship between each candidate entity and the template variable is jointly scored based on the calculated SPW and VEC, including: For each pair of candidate entities and template variables, a joint score is performed based on the calculated semantic precision weight (SPW) and variable exclusivity coefficient (VEC). The joint score is obtained by multiplying the SPW and VEC values. If the joint score is greater than or equal to the set threshold, it is determined that there is a valid semantic matching relationship between the candidate entity and the template variable; If the combined score is lower than the preset threshold, the matching relationship between the candidate entity and the template variable is deemed invalid and marked as pending manual review or adjustment.
[0011] Preferably, the step of dynamically adjusting the sentence structure based on semantic role information includes: For mapping relationships that are determined to be valid through joint scoring, the values of the candidate entities are filled into the corresponding variable positions in the contract template. During the filling process, based on the semantic role information of each sentence in the template, the grammatical and semantic functions of each component in the sentence are identified, and the sentence structure is dynamically adjusted; For contract clauses with complex sentence structures, dependency parsing is used to analyze the dependencies of sentence components in order to generate and output a complete material contract text.
[0012] This invention also provides a material contract text generation system based on semantic analysis, comprising: Template variable modeling module: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable and construct the template variable semantic vector. Entity extraction module: Performs semantic analysis on the structured or unstructured contract requirement data input by the user, extracts key entities, and encodes each entity into a semantic vector as an entity semantic vector; SPW calculation module: Based on the constructed template variable semantic vector and the obtained entity semantic vector, calculate the semantic precision weight (SPW) between each candidate entity and the template variable; VEC Calculation Module: For each candidate entity, it checks whether it has been mapped to other semantically similar template variables. If a mapping exists, it calculates the entity's variable exclusivity coefficient (VEC) based on the semantic overlap between the current variable and the bound variable. Joint scoring module: For the matching relationship between each candidate entity and the template variable, a joint score is performed based on the calculated SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship. Contract generation module: It fills the corresponding variable positions in the contract template with the mapping results corresponding to the effective mapping relationship, and dynamically adjusts the sentence structure according to the semantic role information, and finally outputs the complete material contract text.
[0013] The technical effects and advantages provided by the present invention in the above technical solution are as follows: 1. This invention effectively improves the automation and accuracy of the material contract generation process through precise semantic vector modeling and calculation. By combining pre-trained language models to semantically encode template variables and entities, and using semantic precision weights (SPW) and variable exclusivity coefficients (VEC) for joint scoring, the system can achieve more intelligent entity mapping, thereby ensuring that each variable in the template can be correctly and accurately filled with the appropriate entity value. This method not only reduces the need for manual intervention but also significantly improves the efficiency and accuracy of contract clause generation.
[0014] 2. This invention, through in-depth analysis of the semantic relationships between template variables and entities, particularly by combining semantic role labeling and dependency parsing, ensures the rationality of the contract text's linguistic structure. The system dynamically adjusts the sentence structure based on semantic role information, ensuring that the generated contract text meets requirements in terms of syntax, semantics, and logic. This avoids common grammatical errors and semantic ambiguities in traditional automated generation systems, further improving the quality and compliance of the generated contracts. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0016] Figure 1 This is a flowchart of the method of the present invention.
[0017] Figure 2 This is a flowchart of the system modules of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Example 1, please refer to Figure 1 As shown in this embodiment, a method for generating material contract text based on semantic analysis includes: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable to construct the template variable semantic vector.
[0020] Collect at least 500 standard material procurement contract text samples from different industries to cover various business types and language styles. Perform preprocessing operations on the collected texts, including removing non-contractual text (such as cover pages and attachment pages), standardizing the encoding (such as UTF-8), and normalizing punctuation.
[0021] Template variable identification was performed using a rule-based field extraction method combined with manual semantic annotation. Specifically, frequently occurring semantic fields in the contracts, such as "Party A's Name," "Material Name," "Delivery Date," "Payment Method," and "Quantity Unit," were extracted through regular expressions and keyword pattern matching. The extraction results were then reviewed and annotated by professionals with legal or contract backgrounds. Only fields appearing more than 80% of the time in over 90% of the contract samples were retained as official template variables to ensure their universality and representativeness.
[0022] For the defined template variables, contextual semantic enhancement is performed. To this end, each template variable is embedded into at least 10 actual contractual context sentences to construct a variable context corpus. The embedding methods include two types: Original embedding: Directly insert template variables into the original contract sentence structure, such as inserting "material name" into the sentence "Party A agrees to purchase [variable] to meet project requirements".
[0023] Synonymous variant expansion: Construct synonymous sentences or semantically similar expressions, such as "The [variables] required for the project should be delivered by Party B within the specified time", to simulate diverse semantic environments.
[0024] The above sentence structures constitute the semantic context corpus of variables, with each template variable having no fewer than 100 entries, ensuring that vector training has contextual coverage.
[0025] This invention employs a pre-trained language model based on the Transformer architecture for semantic vector encoding. This model uses the BERT (Bidirectional Encoder Representations from Transformers) architecture, and the pre-training corpus includes legal texts, standard contract texts, and general Chinese encyclopedic knowledge. The word embedding dimension is set to 768 dimensions, the model has 12 layers, each containing 12 attention heads, and the activation function is GELU (Gaussian Error LinearUnit).
[0026] The generated semantic context corpus is used as input, with the input format being "sentence + variable label," for example, the input format being: "Party A will purchase [CLS] material name [SEP] to meet production needs." The [CLS] bit representation is extracted from the model output as the global vector representation of the variable's semantics.
[0027] Each template variable generates a fixed-dimensional (768-dimensional) semantic vector through the above process. To improve the comparability between vectors, all output vectors are normalized using the L2 norm to ensure a relatively balanced scale relationship in the semantic space.
[0028] All encoded and normalized template variable semantic vectors are uniformly stored in the contract variable semantic vector table, using a key-value pair structure. The key is the variable name, and the value is its corresponding semantic vector. This vector table serves as a standard semantic reference in the subsequent entity semantic matching step, used to calculate the semantic similarity (such as cosine similarity) between candidate entities and template variables, thereby assisting in the calculation of semantic precision weights and the determination of uniqueness constraints.
[0029] Semantic analysis is performed on structured or unstructured contract requirement data input by users to extract key entities, and semantic vector encoding is performed on each entity as an entity semantic vector.
[0030] First, the contract requirements data input by the user is preprocessed. Preprocessing includes removing irrelevant information (such as attachment pages and tables of contents) and standardizing the data to UTF-8 encoding to ensure text consistency. Then, natural language processing techniques (such as word segmentation and part-of-speech tagging) are used to parse the contract text, identifying potential key entities such as "Party A's Name," "Party B's Name," "Material Type," "Delivery Date," and "Payment Amount." By combining rule matching with machine learning methods, these key entities are identified and separated into independent entity elements for subsequent annotation and processing.
[0031] Building upon the first step, Named Entity Recognition (NER) technology is further utilized to classify and label the extracted key entities. NER employs entity classification algorithms based on deep learning models such as Conditional Random Fields (CRF) or BERT (Bidirectional Encoder Representations from Transformers). For each identified entity, the system uses the model to determine its specific type (e.g., company name, time, amount, material name, etc.) and labels its contextual relationship within the contract text. After entity classification, the system assigns a label to each entity, ensuring that its role and semantics within the contract terms are accurately captured and distinguished.
[0032] Each labeled entity is input into a pre-trained language model for semantic vector encoding. Using a BERT or RoBERTa-based pre-trained language model, the labeled entities are first augmented with contextual information, placing each entity into different contractual clauses to enrich its semantic expression. For example, the input format could be "Party A's requirement for [material type] is to be provided by Party B," where [material type] is the key entity.
[0033] The model employs the Transformer encoder structure from BERT, generating context-sensitive embedding vectors for entities through a multi-layered self-attention mechanism. In this model, each input entity is represented as a high-dimensional vector, typically with 768 dimensions. Training utilizes a large-scale contract dataset, maximizing the similarity of contextual information to ensure that entity vectors accurately represent their semantic features. The model outputs entity vectors that are semantic embeddings of the entity within a specific contract context. This ensures clear distinction between different entities in the semantic space and enables efficient matching with other contract entities.
[0034] Finally, the generated entity semantic vectors are normalized and stored in the entity semantic vector library. To avoid semantic inconsistencies, the vectors are standardized using the L2 norm, ensuring that all semantic vectors have the same length, facilitating subsequent comparison and matching. After storage, the entity semantic vector library serves as an important reference data source for subsequent contract template generation, entity matching, and contract clause generation, ensuring accurate identification and semantic consistency of entities during the contract content generation process.
[0035] Based on the constructed template variable semantic vector and the obtained entity semantic vector, the semantic precision weight (SPW) between each candidate entity and the template variable is calculated.
[0036] The template variable semantic vectors constructed in the previous steps, along with the entity semantic vectors extracted from the user input data, are input into the similarity calculation model. The template variable semantic vectors and entity semantic vectors are generated by pre-trained language models (such as BERT or RoBERTa), with each vector having a dimension of 768. Both the entity semantic vectors and template variable semantic vectors are normalized using the L2 norm to ensure they have a consistent scale within the same semantic space.
[0037] After obtaining the semantic vectors of template variables and entities, the cosine similarity algorithm is used to calculate the similarity value between each pair of template variables and candidate entities. Cosine similarity is calculated using the following formula: ;in, A semantic vector representing template variables. The semantic vector representing the candidate entity. They are vectors and The L2 norm of the cosine similarity. The cosine similarity value ranges from -1 to 1, where 1 means exactly the same, -1 means exactly opposite, and 0 means no similarity.
[0038] Based on the cosine similarity value of each pair of template variables and candidate entities, the semantic precision weight (SPW) between that pair of entities and template variables is calculated. Specifically, the formula for calculating the semantic precision weight is: SPW = CosineSimilarity; since cosine similarity itself can measure the semantic similarity between an entity and a template variable, the semantic precision weight SPW is directly equal to the cosine similarity value. The SPW value reflects the degree of similarity between the candidate entity and the template variable in the semantic space; a higher value indicates a better match.
[0039] After calculating the Semantic Precision Weight (SPW), it is compared with a preset threshold. If the SPW value is greater than or equal to the set threshold (e.g., 0.75), the entity is considered to have sufficient semantic matching with the template variable, and subsequent template filling operations can proceed. Otherwise, the entity is considered to have insufficient matching with the template variable, and further manual confirmation or adjustment is required.
[0040] For example, when the SPW value is 0.9, it indicates that the semantic matching degree between the entity and the template variable is high and meets the template requirements; while when the SPW value is 0.4, it is considered that the matching degree is low and additional processing or adjustment is required.
[0041] For each candidate entity, check whether it has been mapped to other semantically similar template variables. If a mapping exists, calculate the entity's variable exclusivity coefficient (VEC) based on the semantic overlap between the current variable and the bound variable.
[0042] Each candidate entity is examined to determine if it has already been mapped to other semantically similar template variables. This process is accomplished by consulting a stored template variable-entity mapping table. The mapping table records all completed entity-template variable bindings. If a candidate entity is already mapped to multiple template variables, further semantic overlap calculation is performed. This step achieves entity state detection by retrieving mapping records between entities and template variables, ensuring that the mapping relationship of each entity is accurately tracked.
[0043] For each bound template variable, the cosine similarity algorithm is used to calculate the semantic overlap between the candidate entity and the bound template variable, i.e., the Cosine Similarity value.
[0044] Based on the calculated semantic overlap, the variable exclusivity coefficient (VEC) of the candidate entity is further calculated. The VEC is used to evaluate the semantic overlap between a candidate entity and multiple template variables, ensuring that an entity is not simultaneously bound to multiple similar variables. The formula for calculating VEC is: ;in, It is the sum of the semantic overlap between the candidate entity and each bound template variable. Each overlap value is calculated using cosine similarity. This indicates the semantic overlap between the i-th bound template variable and the candidate entity.
[0045] Once the Variable Exclusivity Coefficient (VEC) is calculated, it is further evaluated. If the VEC value is below a set threshold (e.g., 0.5), the candidate entity is considered to have a high degree of semantic overlap with the already bound template variable and cannot be mapped to other template variables, requiring manual confirmation or adjustment. Conversely, if the VEC value is greater than or equal to the threshold, the mapping relationship between the candidate entity and the template variable is considered reasonable, and the entity can be mapped to the current template variable. This threshold is used to ensure the uniqueness of the mapping and avoid incorrectly binding the same entity to multiple template variables when there is a high degree of semantic overlap.
[0046] For the matching relationship between each candidate entity and the template variable, a joint score is calculated based on SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship.
[0047] For each candidate entity and template variable pair, a joint score is first calculated based on the previously calculated Semantic Precision Weight (SPW) and Variable Exclusivity Coefficient (VEC). The joint score is obtained by multiplying the SPW and VEC values, specifically: Joint Score = SPW × VEC; where SPW is the semantic precision weight between the candidate entity and the template variable, representing the degree of semantic matching between them; and VEC is the variable exclusiveness coefficient, representing the degree of semantic overlap between the candidate entity and other template variables. A higher VEC value indicates a stronger uniqueness in the entity mapping. This calculation allows the joint score to comprehensively consider both semantic matching and variable uniqueness, thus more accurately evaluating the mapping relationship between candidate entities and template variables.
[0048] Set a preset threshold to determine whether the mapping relationship between candidate entities and template variables is valid. The preset threshold can be set according to the actual application scenario. For example, a threshold of 0.75 means that the mapping relationship is considered valid only when the joint score reaches or exceeds 0.75.
[0049] When the calculated joint score is greater than or equal to a preset threshold, it is determined that there is a valid semantic matching relationship between the candidate entity and the template variable, and the subsequent contract text generation steps can continue. If the joint score meets this condition, the mapping relationship is considered to meet the semantic requirements, and the entity can be filled into the corresponding template variable position.
[0050] If the calculated joint score is lower than a preset threshold, the matching relationship between the candidate entity and the template variable is deemed invalid. In this case, the system will mark the invalid match as "awaiting manual review or adjustment" and exclude the mapping relationship between this entity and the template variable from the valid matches. Human reviewers can manually confirm or modify matches marked as invalid to ensure accuracy during the contract generation process.
[0051] The mapping results corresponding to the effective mapping relationships are filled into the corresponding variable positions in the contract template, and the sentence structure is dynamically adjusted according to the semantic role information, finally outputting the complete material contract text.
[0052] For mappings deemed valid through joint scoring, the values of candidate entities are filled into the corresponding variable positions in the contract template. The contract template consists of multiple predefined variables (such as "Party A Name," "Material Name," "Delivery Date," etc.), each corresponding to a specific entity. Through entity identification and joint scoring systems, it is determined which entities are suitable for filling which template variables, ensuring that each template variable is replaced with an appropriate entity value.
[0053] For example, if the template variable “Party A’s Name” is mapped to “a company in Beijing”, the system will automatically fill the value into all sentences in the template that involve the variable, ensuring that the word “Party A’s Name” in the template is correctly replaced with “a company in Beijing”.
[0054] During the completion process, the system further identifies the grammatical and semantic functions of each component in the sentence based on the semantic role information of each sentence in the template. The semantic role information is analyzed using a Semantic Role Labeling (SRL) model to identify components such as the subject, predicate, and object in the sentence. Through semantic role information, the system can dynamically adjust the sentence structure to ensure that the completed sentence is grammatically correct and semantically clear.
[0055] For example, in the sentence "Party A shall pay for the goods before the [delivery date]", the system identifies "Party A" as the subject, "pay for the goods" as the predicate, and "delivery date" as the time condition through semantic role labeling. If the entity corresponding to "Party A" is "Company X in X City", then the sentence is adjusted to "Company X in X City shall pay for the goods before the [delivery date]". The system ensures that each component is filled in the correct position to avoid grammatical errors or logical inconsistencies.
[0056] For contract clauses with complex sentence structures, dependency parsing is used to analyze the dependencies between sentence components. Dependency parsing can capture the grammatical dependencies (such as subject-verb, verb-object, etc.) between the components of a sentence, ensuring that the sentence structure remains consistent and grammatically correct after variable filling.
[0057] In this process, dependency parsing tools based on graph models, such as Stanford Parser or spaCy, are used to analyze the words in the sentence and their dependencies. For example, after filling template variables, the sentence "Party A and Party B shall deliver the goods according to the [delivery date] agreed in the contract" will undergo dependency parsing to adjust its grammatical structure, ensuring that the subject-verb-object relationship is not broken, and ultimately generating a grammatically and semantically correct sentence.
[0058] After processing, all valid mapping relationships have been correctly filled into the contract template, and the sentence structure has been reasonably adjusted. All filled and grammatically sound contract clauses will be synthesized to generate a complete materials contract text. This text conforms to grammatical norms and has a clear semantic structure, ensuring the accuracy and legality of the contract content. The generated contract text will be output in a standard format (such as PDF or Word) and can be used by users for further review or direct use.
[0059] Example 2, please refer to Figure 2As shown in this embodiment, a material contract text generation system based on semantic analysis includes: Template variable modeling module: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable and construct the template variable semantic vector. Entity extraction module: Performs semantic analysis on the structured or unstructured contract requirement data input by the user, extracts key entities, and encodes each entity into a semantic vector as an entity semantic vector; SPW calculation module: Based on the constructed template variable semantic vector and the obtained entity semantic vector, calculate the semantic precision weight (SPW) between each candidate entity and the template variable; VEC Calculation Module: For each candidate entity, it checks whether it has been mapped to other semantically similar template variables. If a mapping exists, it calculates the entity's variable exclusivity coefficient (VEC) based on the semantic overlap between the current variable and the bound variable. Joint scoring module: For the matching relationship between each candidate entity and the template variable, a joint score is performed based on the calculated SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship. Contract generation module: It fills the corresponding variable positions in the contract template with the mapping results corresponding to the effective mapping relationship, and dynamically adjusts the sentence structure according to the semantic role information, and finally outputs the complete material contract text.
[0060] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for generating material contract text based on semantic analysis, characterized in that: include: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable to construct a semantic vector for the template variable. Semantic analysis is performed on structured or unstructured contract requirement data input by users to extract key entities, and semantic vector encoding is performed on each entity as an entity semantic vector; Based on the constructed template variable semantic vector and the obtained entity semantic vector, the semantic precision weight SPW between each candidate entity and the template variable is calculated. For each candidate entity, check whether it has been mapped to other semantically similar template variables. If a mapping exists, calculate the variable exclusivity coefficient (VEC) of the entity based on the semantic overlap between the current variable and the bound variable. For the matching relationship between each candidate entity and the template variable, a joint score is calculated based on the SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship. The mapping results corresponding to the effective mapping relationships are filled into the corresponding variable positions in the contract template, and the sentence structure is dynamically adjusted according to the semantic role information, finally outputting the complete material contract text.
2. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The semantic vector modeling of each template variable in the preset material contract template includes: Multiple industry standard material contract texts were collected in advance, and key fields that frequently appear in the contracts were identified as template variables by combining rule extraction and manual annotation. Based on the identified template variables, a pre-trained language model is invoked to perform context enhancement processing on each template variable, embedding the variables into multiple typical sentence patterns to form a variable semantic context corpus; The generated variable semantic context corpus is input into a pre-trained language model for vector encoding processing to obtain the semantic vector representation corresponding to each template variable.
3. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The semantic analysis of the structured or unstructured contract requirement data input by the user includes: Natural language processing technology is used to preprocess the contract requirements data input by users, identify and separate key entities such as "Party A's name", "Party B's name", "Material type", "Delivery date" and "Payment amount"; Named entity recognition technology is used to classify and label each identified entity to ensure that the type of each entity and its contextual relationship are accurately captured. The labeled entities are input into a pre-trained language model, and each entity is semantically encoded using context enhancement to generate a semantic vector representation of each entity. The semantic vector representation is the semantic embedding of the entity in the given contract scenario.
4. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The calculation of the semantic precision weight (SPW) between each candidate entity and the template variable includes: The constructed template variable semantic vector and the obtained entity semantic vector are input into a predetermined similarity calculation model. The cosine similarity algorithm is used to calculate the similarity value between each pair of entities and template variables. For each pair of entities and template variables, the semantic precision weight SPW is calculated based on the cosine similarity value of their semantic vectors.
5. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The variable exclusivity coefficient (VEC) of the computational entity includes: For each candidate entity, first check whether it has been mapped to other template variables, and identify all the sets of bound template variables; For each bound template variable, calculate the semantic overlap between the candidate entity and the bound template variable; Based on semantic overlap, the variable exclusivity coefficient (VEC) of candidate entities is calculated.
6. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The matching relationship between each candidate entity and the template variable is scored jointly based on the calculated SPW and VEC, including: For each pair of candidate entities and template variables, a joint score is performed based on the calculated semantic precision weight (SPW) and variable exclusivity coefficient (VEC). The joint score is obtained by multiplying the SPW and VEC values. If the joint score is greater than or equal to the set threshold, it is determined that there is a valid semantic matching relationship between the candidate entity and the template variable; If the combined score is lower than the preset threshold, the matching relationship between the candidate entity and the template variable is deemed invalid and marked as pending manual review or adjustment.
7. The method for generating material contract text based on semantic analysis according to claim 1, characterized in that: The dynamic adjustment of sentence structure based on semantic role information includes: For mapping relationships that are determined to be valid through joint scoring, the values of the candidate entities are filled into the corresponding variable positions in the contract template. During the filling process, based on the semantic role information of each sentence in the template, the grammatical and semantic functions of each component in the sentence are identified, and the sentence structure is dynamically adjusted; For contract clauses with complex sentence structures, dependency parsing is used to analyze the dependencies of sentence components in order to generate and output a complete material contract text.
8. A material contract text generation system based on semantic analysis, used to implement the material contract text generation method based on semantic analysis as described in any one of claims 1-7, characterized in that: include: Template variable modeling module: Semantic vector modeling is performed on each template variable in the preset material contract template. A pre-trained language model is used to semantically encode each template variable and construct the template variable semantic vector. Entity extraction module: Performs semantic analysis on the structured or unstructured contract requirement data input by the user, extracts key entities, and encodes each entity into a semantic vector as an entity semantic vector; SPW calculation module: Based on the constructed template variable semantic vector and the obtained entity semantic vector, calculate the semantic precision weight (SPW) between each candidate entity and the template variable; VEC Calculation Module: For each candidate entity, it checks whether it has been mapped to other semantically similar template variables. If a mapping exists, it calculates the entity's variable exclusivity coefficient (VEC) based on the semantic overlap between the current variable and the bound variable. Joint scoring module: For the matching relationship between each candidate entity and the template variable, a joint score is performed based on the calculated SPW and VEC. When the joint score is greater than or equal to a preset threshold, it is determined to be a valid mapping relationship. Contract generation module: It fills the corresponding variable positions in the contract template with the mapping results corresponding to the effective mapping relationship, and dynamically adjusts the sentence structure according to the semantic role information, and finally outputs the complete material contract text.