Contract generation method and device based on artificial intelligence, equipment and medium
By constructing a database of contract requirement features and template features for matching, selecting target contract templates and optimizing contract content, the problems of low efficiency and poor accuracy in contract generation in existing technologies are solved, and efficient and accurate contract text generation is achieved.
Patent Information
- Application Number
- CN202511401983.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2025-12-19
AI Technical Summary
Existing contract templates generated by large-scale language models are complex and lack a unified standard, making retrieval difficult. Salespeople spend a lot of time searching for suitable templates, resulting in low contract drafting efficiency and poor accuracy.
By acquiring the user's demand text from the target user, constructing contract demand features, using a pre-set contract template feature library for feature similarity matching and re-ranking, selecting the target contract template, generating initial contract content based on the initial contract semantics, and finally optimizing the text content to generate the target contract text.
It improves the efficiency and accuracy of contract generation, avoids missing clauses and compliance risks, and ensures that the generated contract content meets user needs and legal regulations.
Smart Images

Figure CN121168437A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent decision-making, and in particular to a contract generation method and device based on artificial intelligence, equipment and medium. BACKGROUND
[0002] As a key branch of the field of artificial intelligence, text understanding and generation, with the rapid increase in computing power and the continuous progress of computer technology, has given birth to a batch of large-scale language models (LLM) that perform outstandingly in the field of artificial intelligence, with a wide range of application scenarios covering multiple industries, especially in the application of large language models assisting contract drafting.
[0003] For example, in the field of financial technology, contract drafting for credit business is an extremely tedious and rigorous task. Taking enterprise loan contracts as an example, under the traditional way, the business personnel need to manually screen a large number of historical contract templates, compare clauses, and adapt to the complex needs of different enterprises such as loan amount, term, interest rate, etc. A slight oversight may cause risks. At the same time, the large language model can also check the contract clauses according to the financial regulations and industry practices, such as checking whether the loan purpose clause meets the regulatory requirements, whether the risk prompts are comprehensive, etc., to ensure that the contract is legal and compliant, and to help business personnel quickly complete contract drafting, significantly improving business promotion efficiency.
[0004] In the field of medical health, contract template drafting needs to take into account medical professional requirements and legal norms. The contract content covers complex clauses such as technical service scope, data use and protection, intellectual property ownership, medical responsibility definition, etc. It details the main blocks such as the rights and obligations of both parties, technical delivery standards, and data security measures.
[0005] However, the existing contract templates generated by large-scale language models are usually complex and lack uniform standards, and have not been systematically organized, making retrieval difficult. Business personnel need to spend a lot of time searching for and comparing appropriate templates, resulting in low efficiency in contract drafting. Secondly, the retrieval ability of existing large models is limited and cannot efficiently match based on natural language, making it difficult to quickly locate the most suitable contract type for the current business scenario, resulting in poor accuracy of contract generation.
[0006] Therefore, how to improve the efficiency and accuracy of contract generation has become a problem to be solved. SUMMARY
[0007] The present application provides a contract generation method, device, equipment and medium based on artificial intelligence to solve the problem of low efficiency and accuracy of contract generation.
[0008] In a first aspect, a contract generation method based on artificial intelligence is provided, comprising: obtaining a user demand text of a target user, and constructing contract demand features of the target user according to semantic features in the user demand text; performing feature similarity matching between the contract demand features and a preset contract template feature library to obtain a template matching degree sequence; reordering the template matching degree sequence to obtain a reordered template sequence, and selecting a target contract template corresponding to the target user from the reordered template sequence; extracting initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and the user demand text; performing text content optimization on the initial contract content to obtain a target contract text of the user demand text.
[0009] In a second aspect, a contract generation device based on artificial intelligence is provided, which includes: a contract demand feature construction module configured to obtain a user demand text of a target user, and construct contract demand features of the target user according to semantic features in the user demand text; a similarity matching module configured to perform feature similarity matching between the contract demand features and a preset contract template feature library to obtain a template matching degree sequence; a target contract template selection module configured to reorder the template matching degree sequence to obtain a reordered template sequence, and select a target contract template corresponding to the target user from the reordered template sequence; an initial contract content generation module configured to extract initial contract semantics of the target contract template, and generate initial contract content based on the initial contract semantics and the user demand text; a text content optimization module configured to perform text content optimization on the initial contract content to obtain a target contract text of the user demand text.
[0010] In a third aspect, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements steps of the contract generation method based on artificial intelligence when executing the computer program.
[0011] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program implements steps of the contract generation method based on artificial intelligence when executed by a processor.
[0012] The scheme realized by the contract generation method, device, equipment and medium based on artificial intelligence can obtain a user demand text of a target user through a client, construct contract demand features of the target user according to semantic features in the user demand text, perform feature similarity matching on the contract demand features and a preset contract template feature library to obtain a template matching degree sequence, reorder the template matching degree sequence to obtain a reordered template sequence, select a target contract template corresponding to the target user from the reordered template sequence, extract initial contract semantics of the target contract template, generate initial contract content based on the initial contract semantics and the user demand text, and perform text content optimization on the initial contract content to obtain a target contract text of the user demand text.
[0013] In the present application, contract demand features of a target user are constructed through a user demand text of the target user, key business elements for generating a target contract text in the user demand text can be extracted, and a basis is provided for subsequent matching of a target contract template. Feature similarity matching is performed on the contract demand features and a preset contract template feature library to obtain a template matching degree sequence, the template matching degree sequence is reordered, and a target contract template corresponding to the target user is selected, so that a target contract template with the greatest semantic relevance to the user demand text can be accurately located, and the accuracy of subsequent target contract text generation is improved. The initial contract semantics of the target contract template are extracted, and initial contract content is generated based on the initial contract semantics and the user demand text, so that the demand text can be automatically filled into a position of a contract template structure corresponding to the target contract template, the efficiency of initial contract text generation is improved, and the accuracy of initial contract content generation is improved while avoiding missing clauses and compliance risks. The initial contract content is subjected to text content optimization, the generation deviation of the initial contract content is avoided, contract invalidity caused by formal defects is avoided, and efficient and accurate generation of the target contract text is realized. BRIEF DESCRIPTION OF DRAWINGS
[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0015] Figure 1 is an application environment schematic diagram of the contract generation method based on artificial intelligence in an embodiment of the present application; Figure 2 is a flowchart schematic diagram of the contract generation method based on artificial intelligence in an embodiment of the present application; Figure 3 is Figure 2A specific embodiment flowchart of step S1 in the method; Figure 4 is Figure 2 A specific embodiment flowchart of step S3 in the method; Figure 5 is a structural schematic diagram of a contract generation device based on artificial intelligence in an embodiment of the present application; Figure 6 is a structural schematic diagram of a computer device in an embodiment of the present application; Figure 7 is another structural schematic diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0017] The contract generation method based on artificial intelligence provided by the embodiments of the present application can be applied in an application environment such as Figure 1 , wherein the client communicates with the server through the network. The server can obtain the user demand text of the target user through the client, construct the contract demand features of the target user according to the semantic features in the user demand text, perform feature similarity matching on the contract demand features and a preset contract template feature library to obtain a template matching degree sequence, reorder the template matching degree sequence to obtain a reordered template sequence, select a target contract template corresponding to the target user from the reordered template sequence, extract the initial contract semantics of the target contract template, generate initial contract content based on the initial contract semantics and the user demand text, and perform text content optimization on the initial contract content to obtain the target contract text of the user demand text.
[0018] In the present application, the user demand text of the target user is acquired, and the contract demand features of the target user are constructed according to the semantic features in the user demand text; the contract demand features are matched with the preset contract template feature library in terms of feature similarity, and a template matching degree sequence is obtained; the template matching degree sequence is reordered, and a reordered template sequence is obtained, and a target contract template corresponding to the target user is selected from the reordered template sequence; the initial contract semantics of the target contract template are extracted, and the initial contract content is generated based on the initial contract semantics and the user demand text; and the initial contract content is optimized in terms of text content, and the target contract text of the user demand text is obtained. The client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The present application will be described in detail through specific embodiments.
[0019] Please refer to Figure 2 , as shown in the figure, Figure 2 A flowchart of a contract generation method based on artificial intelligence provided by an embodiment of the present application is shown, which includes the following steps: S1, acquiring the user demand text of the target user, and constructing the contract demand features of the target user according to the semantic features in the user demand text.
[0020] In the embodiment of the present application, the user demand text is a text that the target user wants to obtain to meet the business or transaction demand, and is a core demand specification document for obtaining the target contract text, which can include transaction background, core rights and obligations, transaction content, risk avoidance key information and the like.
[0021] For example, in the field of financial technology, the user demand text can include the names, addresses, contact information, service content, financial service terms, breach of contract responsibilities and the like of the party A (financial service provider) and the party B (financial service recipient); in the field of medical health, the user demand text can include the collected specific diagnosis and treatment steps, medical identity information and important diagnosis and treatment time node information, and privacy requirements and the like.
[0022] Specifically, referring to Figure 3 , as shown in the figure, the contract demand features of the target user are constructed according to the semantic features in the user demand text, which includes: S31, performing text division on the user demand text to obtain a text sentence set; S32, performing sliding window overlap cutting on the text sentence set to obtain a sentence overlap text sequence; S33, constructing the contract demand features of the target user according to the text semantic features of each sentence overlap text in the sentence overlap text sequence.
[0023] In the embodiment of the present application, the text division is to split the longer user demand text into semantically complete sentences. For example, the text of "Party A needs to pay the money" and "Party B needs to deliver the goods on time" is obtained by splitting the text of "Party A needs to pay the money, and Party B needs to deliver the goods on time" into two text sentences, and a plurality of text sentence sets in the user demand text are obtained.
[0024] Specifically, the text division can be performed by using the punctuation marks in the user demand text, and the text division is performed by using the period (.), semicolon (;) and line feed (\n) in the user demand text to obtain the text sentence set. For example, the user demand text is "Party A shall pay 40% of the prepayment within 15 working days after signing the contract; Party B shall deliver the first batch of goods within 30 days after receiving the prepayment, and the goods shall meet the national GB standard; if the delivery is overdue, a breach of contract fine of 0.05% of the total amount shall be paid per day", and the user demand text can be split into a plurality of text sentences according to the punctuation marks, such as "Party A shall pay 40% of the prepayment within 15 working days after signing the contract", "Party B shall deliver the first batch of goods within 30 days after receiving the prepayment, and the goods shall meet the national GB standard", and "if the delivery is overdue, a breach of contract fine of 0.05% of the total amount shall be paid per day".
[0025] Preferably, before the text division of the user demand text, the user demand text can be cleaned, for example, repeated contract demand fragments are deleted, redundant symbols are removed, stop words are removed, and text formats are unified, so as to remove meaningless information in the user demand text, unify the text format, and improve the efficiency and accuracy of subsequent target contract text generation.
[0026] In the embodiment of the present application, the text division of the user demand text can avoid the semantic dispersion of the user demand text, focus on the specific semantic features in the local user demand text, and more comprehensively extract the contract demand features.
[0027] Further, the sliding window overlapping cutting of the text sentence set is to perform the sliding window overlapping cutting on the text sentence set to obtain a sentence overlapping text sequence containing overlapping text sentences. For example, the text sentence set is cut by using a window with a window size of 3, that is, each sentence overlapping text includes three text sentences, and the moving step of the sliding window is 2, so that each sentence overlapping text obtained in the next sliding window includes the last text sentence in the previous sentence overlapping text. The sliding window overlapping cutting on the text sentence set can obtain a sentence overlapping text sequence containing partially overlapping text sentences.
[0028] In detail, the construction of the contract demand features of the target user according to the text semantic features of each sentence overlapping text in the sentence overlapping text sequence includes: extracting a text semantic feature of each sentence overlap text in the sentence overlap text sequence; bitwise adding the text semantic features to obtain a semantic feature vector of the sentence overlap text sequence; extracting a context association of the semantic feature vector by using a pre-trained bidirectional long short-term memory network to obtain a contract demand feature of the target user.
[0029] In the embodiment of the application, the text semantic feature of each sentence overlap text in the sentence overlap text sequence can be extracted by using a pre-trained BERT (Bidirectional Encoder Representations from Transformers, Transformer-based bidirectional encoder representation model), and the text semantic features are stacked according to the vector dimension, that is, the text semantic features are bitwise added to obtain a semantic feature vector of the sentence overlap text sequence.
[0030] Further, the information of the context before and after the semantic feature vector is modeled by using a bidirectional long short-term memory network (BiLSTM, Bidirectional Long Short Short-Term Memory), and finally the semantic expression ability of the bidirectional long short-term memory network is enhanced by using a full connection layer to obtain a contract demand feature with richer feature information.
[0031] In detail, the bidirectional long short-term memory network includes a forward LSTM, which can capture historical information and previous context in the user demand text according to the semantic feature vector; and a backward LSTM, which can capture future information and subsequent context. Therefore, at each time step, the bidirectional long short-term memory network splices the outputs of the forward LSTM and the backward LSTM to form a contract demand feature containing both contexts.
[0032] In the embodiment of the application, by constructing the contract demand feature, the key business elements of the target contract text generated in the user demand text can be extracted, and a structured demand description of the target contract text is obtained, which provides a basis for subsequent matching of the target contract template.
[0033] S2, the contract demand feature is matched with a preset contract template feature library for feature similarity to obtain a template matching degree sequence.
[0034] In the implementation of the present application, the contract template feature library is a set of multiple contract template features, wherein the contract template feature refers to the core attributes and structured elements possessed by the contract template itself, used to distinguish different types of contracts, support template retrieval and adaptation, and ensure legal compliance. The contract template feature determines the availability (such as whether it is suitable for specific transaction needs) and compliance (such as whether it meets industry regulations) of each contract template in actual business scenarios.
[0035] For example, each contract template feature can include contract type, use subject, business attribute, compliance basis, legal clause, contract format, transaction size, and payment method. The contract template feature library can meet the needs of different business scenarios, thereby improving the efficiency of contract text generation.
[0036] Specifically, the contract demand feature and the preset contract template feature library are matched in feature similarity to obtain a template matching degree sequence, comprising: Calculate the feature vector of each contract template feature in the contract template feature library; Calculate the feature similarity between the feature vector and the contract demand feature; According to the feature similarity, the contract template features are sorted to obtain a template matching degree sequence.
[0037] In the embodiment of the present application, the feature vector of each contract template feature is converted from the contract template feature. Specifically, the vector conversion can be performed according to the key feature dimensions of the contract template feature, for example, the structured features are numerically coded, the unstructured text features are deep learning feature coded, and the feature coding of structured and unstructured text features is fused, that is, the feature vector of each contract template feature.
[0038] Further, the feature similarity between the feature vector and the contract demand feature can be calculated using cosine similarity or feature Euclidean distance, and the contract template features are sorted from large to small according to the size of the feature similarity to obtain a template matching degree sequence.
[0039] S3, reordering the template matching degree sequence to obtain a reordered template sequence, and selecting a target contract template corresponding to the target user from the reordered template sequence.
[0040] In the embodiment of the present application, the reordering is to reorder the contract templates in the template matching degree sequence according to the frequency of use, the applicable scene and other factors, so as to be able to find the required contract template more quickly. For example, in a library containing multiple types of procurement contract templates, the commonly used raw material procurement contract templates are arranged in the front, and the less commonly used special equipment procurement contract templates are arranged in the back; and the contract templates in the template matching degree sequence are further sorted to obtain the target contract template most related to the contract demand characteristics.
[0041] Specifically, referring to Figure 4 As shown in the figure, the reordering of the template matching degree sequence obtains a reordered template sequence, which comprises: S41, selecting a preset number of contract templates from the contract template characteristics according to the template matching degree sequence to form a candidate template sequence; S42, calculating the template matching score of each contract template in the contract template sequence according to the user demand text; S43, reordering the contract template sequence according to the template matching score to obtain a reordered template sequence.
[0042] In the embodiment of the present application, a preset number of contract templates are selected from the template matching degree sequence to form a candidate template sequence, which can eliminate contract templates with low similarity from the template matching degree sequence, thereby improving the efficiency of reordering.
[0043] Further, a reordering model based on a Cross-Encoder architecture can be used to calculate the semantic association between each contract template in the contract template sequence and the user demand text, and obtain a numerical score, i.e. the template matching score between each contract template and the user demand text, wherein the greater the value of the template matching score, the higher the relevance between the contract template and the user demand text.
[0044] Specifically, the reordering model based on the Cross-Encoder architecture is analyzed by a multi-layer Transformer structure, word by word, to analyze the semantic association between the query and the contract (such as the semantic association between “overdue payment” and “penalty for breach of contract”, and the semantic association between “procurement contract” and “delivery terms”), and the reordering model can capture the subtle semantic differences between the content of the contract templates and the user demand text (such as the opposite meanings of “Party A pays” and “Party A does not pay”). Further, a template matching score representing the relevance between the contract template and the user demand text is output, and the contract templates in the contract template sequence are reordered from large to small according to the template matching score to obtain a reordered template sequence.
[0045] In the embodiment of the present application, by reordering the template matching degree sequence, the subtle semantic differences of the clauses in the contract template can be distinguished to understand the relevance of the legal terms in the contract content, the core clauses of the contract template can be specifically focused on, the interference of redundant information can be avoided, and the accuracy of the target contract template selection can be effectively improved.
[0046] In detail, the contract template with the maximum template matching score can be selected from the reordered template sequence as the target contract template, so as to accurately locate the target contract template with the maximum semantic relevance to the user demand text, and improve the accuracy of subsequent target contract text generation.
[0047] S4, extracting the initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and the user demand text.
[0048] In the embodiment of the present application, the initial contract semantics is the semantic matching between the corresponding template structure in the contract template and the key clause information corresponding to the contract demand characteristics. The template structure can include the fixed structures of cooperation scope and technical service content clause, data sharing and compliance clause, fee settlement and intellectual property clause, cooperation termination and responsibility division clause, etc. It can also include the variable filling structures of cooperation subject information and cooperation period type, special agreement type.
[0049] Specifically, the extraction of the initial contract semantics of the target contract template includes: splitting the target contract template into multiple contract template structures; extracting the template structure semantics of each contract template structure in the multiple contract template structures; collecting the template structure semantics to obtain the initial contract semantics.
[0050] In the embodiment of the present application, splitting the target contract template into multiple contract template structures is to split all clauses in the target contract template from the target contract template as a contract template structure, extract each clause in the target contract template, and obtain multiple contract template structures corresponding to the target contract template.
[0051] The multiple contract template structures can include contract subject information such as the full name of Party A and Party B, the unified social credit code, the legal representative, the address, and the contact information, the cooperation scope, and the responsibility division clause. Specifically, the target contract template can be split into multiple contract template structures according to the clause keywords in the contract template.
[0052] For example, in the medical health field, the contract template structure can include contract template structures corresponding to contract terms such as medical insurance compliance requirements, medical system functions, patient privacy, and the like. In the financial technology field, the contract template structure can also include contract terms such as fee types such as technical service fees (such as API call fees, system deployment fees), authorization license fees, operation and maintenance annual fees, and excess service fees, risk control models and effects, algorithms, dispute resolution, and the like.
[0053] Further, the text semantics of each contract template structure, i.e., the template structure semantics, can be extracted using the pre-trained BERT (Bidirectional Encoder Representations from Transformers) described above.
[0054] In the embodiment of the application, generating the initial contract content based on the initial contract semantics and the user demand text comprises: extracting entity information and business rules from the user demand text; converting the business rules into fillable rule clause information; matching the entity information and the rule clause information with the template structure semantics in the initial contract semantics to obtain template structure information; filling the template structure information into the contract template structure corresponding to the template structure semantics to obtain the initial contract content.
[0055] In the embodiment of the application, the entity information is transaction subject information in the user demand text, such as the name of Party A / Party B, the ID number / unified social credit code, and the contact information; transaction information such as the name of the transaction subject, the quantity, the unit price, the total amount, the delivery location, and the time information such as the contract effective date, the performance period, and the payment node. The business rules are special agreements in the contract demand, such as the business rule in the user demand text: “If Party A pays late, 0.05% of the daily default interest is paid, and if the delay exceeds 15 days, Party B can suspend the supply”, which is converted into standardized rule clause information that can be directly filled in the contract, such as “Party A pays late, 0.05% of the daily default interest is paid; if the delay exceeds 15 days, Party B has the right to suspend the supply”.
[0056] Specifically, the entity information and the business rules in the user demand text can be extracted according to an NLP model (Natural Language Processing), and the business rules can be converted into fillable rule clause information using a pre-constructed regular expression.
[0057] Further, the information semantics of the entity information and the rule clause information are extracted, feature similarity calculation is performed between the information semantics and the template structure semantics, and the entity information or the rule clause information with the maximum similarity is the template structure information corresponding to the template structure semantics.
[0058] For example, the corresponding template structure information in the breach of contract responsibility contract template structure is: for the overdue payment of party A, 0.05% of the unpaid amount is paid as breach of contract per day (default: 0.05% of the overdue payment is paid as breach of contract per day), and if the overdue period exceeds 15 days, party B has the right to suspend the supply.
[0059] In the embodiment of the present application, the personalized requirements of the target user in the user requirement text, such as service period, fee amount, and special responsibility agreement, can be input in the form of text by generating the initial contract content, and the requirement text is automatically filled into the position of the contract template structure corresponding to the target contract template, thereby improving the efficiency of the initial contract text generation; at the same time, the missing clauses and compliance risks caused by unfamiliarity with industry regulations can be avoided, and the accuracy of the initial contract content generation is improved.
[0060] S5, performing text content optimization on the initial contract content to obtain the target contract text of the user requirement text.
[0061] In the embodiment of the present application, since the content in the user requirement text is artificially generated, there may be problems such as non-standard terminology, imprecise expression, and missing legal clauses, therefore, the initial contract content needs to be optimized to improve the accuracy of the contract text generation.
[0062] In the embodiment of the present application, the text content optimization on the initial contract content to obtain the target contract text of the user requirement text comprises: detecting the missing template structure in the initial contract content; performing structure filling on the missing template structure by using a pre-constructed sentence pattern library to obtain filled contract content; performing term correction on the filled contract content to obtain the target contract text corresponding to the user requirement text.
[0063] In the embodiment of the present application, the missing template structure is a contract template structure in the initial contract content which is not filled with the user requirement text, for example, the insurance contract does not highlight the exemption clause as required by the supervision, the medical data does not agree on the data confidentiality obligation, the compensation responsibility after data leakage, or the insurance contract does not clearly define the insurance responsibility range.
[0064] The pre-constructed sentence pattern library is a standardized contract sentence set built in advance to improve contract drafting efficiency, guarantee the standardization of clauses and legal rigor, and solidify the high-frequency clause logic, expression framework, legal compliance expression, etc. in the contract into reusable or fine-tunable sentence pattern templates. For example, the sentence pattern of the data confidentiality obligation can be "Party B shall regard all the data provided by Party A as confidential information and use it only within the scope of the purpose agreed in the contract, and shall not use it for any other purpose"; the sentence pattern of the insurance contract without clear insurance liability scope can be "After the insurance contract takes effect, if the parties fail to agree on the insurance liability scope, they can supplement the agreement; if they fail to reach a supplementary agreement, the relevant provisions of the contract or the transaction customs shall be followed". Then, the missing template structure is filled in.
[0065] Specifically, the missing template structure in the initial contract content can be detected by comparing the blank template of the target contract template with the initial contract content, or the missing template structure can be identified using an NLP term matching tool.
[0066] In the embodiment of the present application, the term correction of the filled contract content is to correct the colloquial expressions and non-standard terms in the filled contract content. For example, "sickness compensation" is corrected to "insurance accident occurs, pay insurance according to basic insurance amount", and "insurance company tries to compensate as soon as possible" is corrected to the standard sentence pattern verified by law and commonly used in the industry: "the insurance company shall make a determination and notify the beneficiary within xx days from the date of receiving the claim and complete materials; in the case of complexity, the determination shall be made within xx days".
[0067] Specifically, the text in the filled contract content can be detected using a professional term library in the financial insurance field or a professional term library in the medical health field to correct the terms in the filled contract content. For example, vague expressions such as "about", "appropriate", and "within a reasonable range" are converted into quantitative terms; prohibited expressions are replaced, etc. to obtain a more accurate target contract text.
[0068] In the embodiment of the present application, by optimizing the text content of the initial contract content, information bias can be eliminated, the terms can be ensured to be consistent with the law and industry standards, the contract invalidity caused by formal defects can be avoided, and the efficient and accurate generation of the target contract text can be realized.
[0069] As can be seen, in the above scheme, by constructing the contract requirement features of the target user through the user requirement text, the key business elements for generating the target contract text can be extracted from the user requirement text, providing a basis for subsequent matching of the target contract template; by performing feature similarity matching between the contract requirement features and the preset contract template feature library, a template matching degree sequence is obtained, and the template matching degree sequence is reordered to select the target contract template corresponding to the target user, which can accurately locate the target contract template with the greatest semantic relevance to the user requirement text, thereby improving the accuracy of subsequent target contract text generation; Extracting the initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and user requirement text, can automatically fill the requirement text into the corresponding contract template structure of the target contract template, improving the efficiency of initial contract text generation; at the same time, it avoids missing clauses and compliance risks, improving the accuracy of initial contract content generation; optimizing the text content of the initial contract can reduce deviations in the generation of initial contract content, avoid contract invalidity caused by formal defects, and achieve efficient and accurate generation of target contract text.
[0070] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0071] In one embodiment, an AI-based contract generation device 100 is provided, which corresponds one-to-one with the AI-based contract generation method described in the above embodiments. For example... Figure 5 As shown, the AI-based contract generation device 100 includes a contract requirement feature construction module 101, a similarity matching module 102, a target contract template selection module 103, an initial contract content generation module 104, and a text content optimization module 105. Detailed descriptions of each functional module are as follows: The contract requirement feature construction module 101 is used to obtain the user requirement text of the target user and construct the contract requirement feature of the target user based on the semantic features in the user requirement text. The similarity matching module 102 is used to perform feature similarity matching between the contract requirement features and a preset contract template feature library to obtain a template matching degree sequence; The target contract template selection module 103 is used to reorder the template matching degree sequence to obtain a reordered template sequence, and select the target contract template corresponding to the target user from the reordered template sequence. The initial contract content generation module 104 is used to extract the initial contract semantics of the target contract template and generate initial contract content based on the initial contract semantics and the user requirement text. The text content optimization module 105 is configured to perform text content optimization on the initial contract content to obtain a target contract text of the user demand text.
[0072] In an embodiment, the contract demand feature construction module 101 is configured to, when constructing the contract demand feature of the target user according to the semantic feature of each sentence in the user demand text: perform text segmentation on the user demand text to obtain a set of text sentences; perform sliding window overlap cutting on the set of text sentences to obtain a sequence of sentence overlap texts; construct the contract demand feature of the target user according to the text semantic feature of each sentence overlap text in the sequence of sentence overlap texts.
[0073] In an embodiment, the contract demand feature construction module 101 is configured to, when constructing the contract demand feature of the target user according to the text semantic feature of each sentence overlap text in the sequence of sentence overlap texts: extract the text semantic feature of each sentence overlap text in the sequence of sentence overlap texts; perform bit-by-bit addition on the text semantic features to obtain a semantic feature vector of the sequence of sentence overlap texts; perform context association extraction on the semantic feature vector by using a pre-trained bidirectional long short-term memory network to obtain the contract demand feature of the target user.
[0074] In an embodiment, the similarity matching module 102 is configured to, when performing feature similarity matching between the contract demand feature and a preset contract template feature library to obtain a template matching degree sequence: calculate a feature vector of each contract template feature in the contract template feature library; calculate a feature similarity between the feature vector and the contract demand feature; sort the contract template features according to the feature similarity to obtain a template matching degree sequence.
[0075] In an embodiment, the target contract template selection module 103 is configured to, when performing reordering on the template matching degree sequence to obtain a reordered template sequence: select a preset number of contract templates from the contract template features according to the template matching degree sequence to form a candidate template sequence; calculate a template matching score of each contract template in the contract template sequence according to the user demand text; reorder the contract template sequence according to the template matching score to obtain a reordered template sequence.
[0076] In an embodiment, the initial contract content generation module 104, when generating the initial contract content based on the initial contract semantics and the user demand text, is configured to: extract entity information and business rules from the user demand text; convert the business rules into fillable rule clause information; match the entity information and the rule clause information with template structure semantics in the initial contract semantics to obtain template structure information; fill the template structure information into a contract template structure corresponding to the template structure semantics to obtain the initial contract content.
[0077] In an embodiment, the text content optimization module 105, when performing text content optimization on the initial contract content to obtain the target contract text of the user demand text, is configured to: detect missing template structures in the initial contract content; perform structure filling on the missing template structures using a pre-constructed sentence pattern library to obtain filled contract content; perform term correction on the filled contract content to obtain the target contract text corresponding to the user demand text.
[0078] The present application provides a contract generation device based on artificial intelligence, which constructs contract demand characteristics of a target user through a user demand text of the target user, can extract key business elements for generating a target contract text in the user demand text, and provides a basis for subsequent matching of a target contract template; performs feature similarity matching on the contract demand characteristics and a pre-set contract template feature library to obtain a template matching degree sequence, reorders the template matching degree sequence, and selects a target contract template corresponding to the target user, which can accurately locate a target contract template with the greatest semantic relevance to the user demand text, and improves the accuracy of subsequent generation of the target contract text. Extracting initial contract semantics of the target contract template and generating initial contract content based on the initial contract semantics and the user demand text can automatically fill the demand text into a position of a contract template structure corresponding to the target contract template, improves the efficiency of generation of the initial contract text, avoids missing clauses and compliance risks, and improves the accuracy of generation of the initial contract content; performing text content optimization on the initial contract content can correct deviations in the generation of the initial contract content, avoid invalid contracts caused by formal defects, and achieve efficient and accurate generation of the target contract text.
[0079] The specific limitations of the contract generation device based on artificial intelligence can refer to the limitations of the contract generation method based on artificial intelligence described above, which will not be repeated here. Each module in the contract generation device based on artificial intelligence described above can be realized by software, hardware and their combination in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in the form of software, so that the processor calls and executes the operations corresponding to each module.
[0080] In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as shown in Figure 6 The computer device includes a processor, a memory, a network interface and a database connected by a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with the external client through the network connection. The computer program is executed by the processor to implement the functions or steps of the server side of the contract generation method based on artificial intelligence.
[0081] In one embodiment, a computer device is provided, which can be a client, and its internal structure diagram can be as shown in Figure 7 The computer device includes a processor, a memory, a network interface, a display screen and an input device connected by a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with the external server through the network connection. The computer program is executed by the processor to implement the functions or steps of the client side of the contract generation method based on artificial intelligence.
[0082] In one embodiment, a computer device is provided, including a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the following steps: Obtaining a user demand text of a target user, and constructing contract demand features of the target user according to semantic features in the user demand text; Matching the contract demand features with a preset contract template feature library to obtain a template matching degree sequence; reordering the template matching degree sequence to obtain a reordered template sequence, and selecting a target contract template corresponding to the target user from the reordered template sequence; extracting initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and the user demand text; optimizing the initial contract content to obtain target contract text of the user demand text.
[0083] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented: obtaining a user demand text of a target user, and constructing contract demand features of the target user according to semantic features in the user demand text; performing feature similarity matching between the contract demand features and a preset contract template feature library to obtain a template matching degree sequence; reordering the template matching degree sequence to obtain a reordered template sequence, and selecting a target contract template corresponding to the target user from the reordered template sequence; extracting initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and the user demand text; optimizing the initial contract content to obtain target contract text of the user demand text.
[0084] It should be noted that the functions or steps that the computer readable storage medium or the computer device can implement correspond to the related descriptions of the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0085] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0086] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0087] It should be noted that if non-company software tools or components appear in the embodiments of the present application, they are only used for example introduction and do not represent actual use.
[0088] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. An artificial intelligence-based contract generation method, characterized by, The method comprises the following steps: obtaining a user demand text of a target user, and constructing contract demand features of the target user according to semantic features in the user demand text; performing feature similarity matching between the contract demand features and a preset contract template feature library to obtain a template matching degree sequence; reordering the template matching degree sequence to obtain a reordered template sequence, and selecting a target contract template corresponding to the target user from the reordered template sequence; extracting initial contract semantics of the target contract template, and generating initial contract content based on the initial contract semantics and the user demand text; performing text content optimization on the initial contract content to obtain a target contract text of the user demand text.
2. The artificial intelligence-based contract generation method of claim 1, wherein, The method comprises the following steps: performing text division on the user demand text to obtain a text sentence set; performing sliding window overlap cutting on the text sentence set to obtain a sentence overlap text sequence; constructing the contract demand features of the target user according to text semantic features of each sentence overlap text in the sentence overlap text sequence. 3.The AI-based contract generation method of claim 2, wherein, The method comprises the following steps: extracting text semantic features of each sentence overlap text in the sentence overlap text sequence; performing bit-by-bit addition on the text semantic features to obtain a semantic feature vector of the sentence overlap text sequence; performing context association extraction on the semantic feature vector by using a pre-trained bidirectional long short-term memory network to obtain the contract demand features of the target user.
4. The artificial intelligence-based contract generation method of claim 1, wherein, The method comprises the following steps: calculating a feature vector of each contract template feature in the contract template feature library; calculating a feature similarity between the feature vector and the contract demand features; performing ordering on the contract template features according to the feature similarity to obtain a template matching degree sequence. 5.The artificial intelligence-based contract generation method of claim 1, wherein, The method comprises the following steps: selecting a preset number of contract templates from the contract template features to form a candidate template sequence according to the template matching degree sequence; calculating a template matching score of each contract template in the contract template sequence according to the user demand text; performing reordering on the contract template sequence according to the template matching score to obtain a reordered template sequence.
6. The artificial intelligence-based contract generation method of claim 1, wherein, The method comprises the following steps: extracting entity information and business rules in the user demand text; converting the business rules into fillable rule clause information; matching the entity information and the rule clause information with template structure semantics in the initial contract semantics to obtain template structure information; filling the template structure information into a contract template structure corresponding to the template structure semantics to obtain initial contract content.
7. The artificial intelligence-based contract generation method of claim 1, wherein, The text content optimization on the initial contract content obtains a target contract text of the user demand text, and the text content optimization includes: detecting a missing template structure in the initial contract content; performing structure filling on the missing template structure by using a pre-constructed sentence pattern library to obtain filled contract content; performing term correction on the filled contract content to obtain a target contract text corresponding to the user demand text. 8.A contract generation apparatus based on artificial intelligence, characterized by, The method includes: a contract demand feature construction module configured to obtain a user demand text of a target user, and to construct contract demand features of the target user according to semantic features in the user demand text; a similarity matching module configured to perform feature similarity matching between the contract demand features and a preset contract template feature library to obtain a template matching degree sequence; a target contract template selection module configured to reorder the template matching degree sequence to obtain a reordered template sequence, and to select a target contract template corresponding to the target user from the reordered template sequence; an initial contract content generation module configured to extract initial contract semantics of the target contract template, and to generate initial contract content based on the initial contract semantics and the user demand text; a text content optimization module configured to perform text content optimization on the initial contract content to obtain a target contract text of the user demand text.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the contract generation method based on artificial intelligence according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the contract generation method based on artificial intelligence according to any one of claims 1 to 7.