A method for intelligently generating contract templates based on user contract habits
By analyzing the keyword characteristics and structural characteristics of user historical contract text, combining the similarity screening of public contract text data sets, optimizing the clustering process, and training pre-trained text generation models, the problem that the existing technology cannot meet user contract habits is solved. It has achieved contract template generation and efficiency improvement that is more in line with user needs.
Patent Information
- Application Number
- CN202410954296.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The existing contract template generation technology cannot meet users' contract habits, resulting in the generated contract text being difficult to meet users' actual needs and affecting the efficiency of contract drafting.
By obtaining user historical contract text data, extracting keywords and analyzing their expression and structural features, combining with the public contract text data set, calculating user habit similarity, optimizing clustering distance, filtering public contract texts as training data to pre-pre- Training the text generation model for transfer learning training.
The generated contract template is more in line with user needs, improving the efficiency of contract formulation, and ensuring that the template is more in line with user contractual habits.
Smart Images

Figure CN118520862B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data screening, and in particular to a method for intelligently generating contract templates based on user contract habits. Background Art
[0002] Drafting a contract template is a tedious and complicated task. Traditionally, the drafting of contract templates is usually done manually. This method has disadvantages such as low efficiency and high cost, and requires a lot of time and effort. With the rapid development of artificial intelligence technology and natural language processing technology, the drafting of contract templates has become one of the important applications of natural language processing technology.
[0003] The existing contract template generation technology mainly uses transfer learning training of pre-trained text generation models, and then generates contract templates through the trained pre-trained text generation model. Specifically, the pre-trained text generation model is usually fine-tuned to achieve the process of migrating from the source domain to the target domain, but the dataset used for fine-tuning is usually a public contract text dataset. Therefore, the contract template generated by this method usually does not have the user's contract habits, and the generated contract text is difficult to meet the user's actual needs, affecting the efficiency of contract drafting. Summary of the invention
[0004] In order to overcome the problem that the above-mentioned prior art is difficult to meet the actual needs of users and affects the efficiency of contract drafting, the present invention provides a method for intelligently generating contract templates based on user contract habits, which analyzes user contract habits in combination with user historical contract data and screens contract text data, so that the fine-tuned pre-trained text generation model can meet the user's contract habits and improve the efficiency of contract drafting.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A method for intelligently generating a contract template based on user contract habits, the method comprising the following steps:
[0007] Obtain a user historical contract text dataset, and extract several first keywords from each user historical contract text;
[0008] By analyzing the first keywords extracted from each user's historical contract text, the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits are obtained;
[0009] Analyze the contract structure characteristic parameters representing the user's historical contract habits based on the contract expression characteristics of each first keyword in each user's historical contract text;
[0010] Obtain a public contract text dataset, and calculate the user habit similarity of the public contract text based on the contract expression features and contract structure feature parameters;
[0011] The clustering distance is optimized according to the similarity of user habits, and the public contract text data set is clustered and screened to obtain the public contract texts that meet the conditions;
[0012] The screened public contract texts are used as training data to perform transfer learning training on the pre-trained text generation model.
[0013] Preferably, by analyzing the first keyword extracted from each user's historical contract text, the contract expression feature corresponding to each first keyword in the user's historical contract text that represents the user's historical contract habits is obtained, including:
[0014] Divide each user's historical contract into multiple clause text intervals;
[0015] Calculate the mean value of the number of each first keyword in each clause text interval;
[0016] Calculate the proportion of other first keywords in each clause text interval;
[0017] Based on the average of the number of first keywords and the proportion of other first keywords in each clause text interval, the calculated results are normalized with extreme values to obtain the contract expression features of each first keyword in the user's historical contract text that represent the user's historical contract habits.
[0018] Preferably, the step of analyzing the contract structure characteristic parameters representing the user's historical contract habits according to the contract expression characteristics of each first keyword in each user's historical contract text includes:
[0019] According to the contract expression characteristics of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated;
[0020] Calculate the average of the second weighted number of occurrences of all first keywords in the user's historical contract texts;
[0021] Calculate the difference between the first weighted average and the second weighted average;
[0022] After the difference is squared and amplified, the difference between the text intervals of each clause in the user's historical contract text is averaged to obtain the contract structure characteristic parameters representing the historical contract habits of each user.
[0023] Furthermore, according to the contract expression feature of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated, including:
[0024] Obtain the contract expression features of each first keyword in each user's historical contract text;
[0025] Obtain the number of each first keyword in each clause text interval in each user's historical contract text;
[0026] Get the number of types of the first keyword in all users' historical contract texts;
[0027] According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated.
[0028] Furthermore, the step of calculating the second weighted average of the number of occurrences of all first keywords in the user's historical contract texts includes:
[0029] Obtain the contract expression features of each first keyword in all users' historical contract texts;
[0030] Get the number of each first keyword in all user's historical contract texts;
[0031] Get the number of types of the first keyword in all users' historical contract texts;
[0032] According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, a second weighted average number of occurrences of each first keyword in the user's historical contract texts is calculated.
[0033] Preferably, extracting a plurality of first keywords from each user's historical contract text further comprises: converting the plurality of first keywords extracted from each user's historical contract text into a first word vector;
[0034] The obtained public contract text dataset and the calculation of user habit similarity of the public contract text according to the contract expression features and contract structure feature parameters include:
[0035] Obtain a public contract text dataset through crawler technology, extract the second keyword in the public contract text dataset, and convert it into a second word vector;
[0036] Calculate the contract structure characteristic parameters and contract expression characteristics corresponding to the second keyword in the selected public contract text;
[0037] Calculating the contract structure similarity according to the contract structure characteristic parameter corresponding to the selected second keyword and the contract structure characteristic parameter corresponding to the selected first keyword;
[0038] Calculating the contract expression feature similarity according to the contract expression feature corresponding to the selected second keyword and the contract expression feature corresponding to the selected first keyword;
[0039] Calculate the word vector similarity based on the first word vector of the selected first keyword and the second word vector of the selected second keyword;
[0040] The user habit similarity of public contract texts is calculated by combining the contract structure similarity, contract expression feature similarity, and word vector similarity.
[0041] Furthermore, before converting the second keyword extracted from the public contract text dataset into the second word vector, after calculating the contract structure feature parameters and contract expression features corresponding to the second keyword in the selected public contract text, the method further includes:
[0042] According to the contract expression characteristics of the first keyword in the user's historical contract text, the first keyword sequence is arranged from largest to smallest;
[0043] Sequentially and without repetition, select a second keyword in a public contract text whose contract expression feature has the smallest difference with the first keyword in the user's historical contract text; arrange the selected second keywords into a second keyword sequence according to the selection order;
[0044] The first keyword and the second keyword are selected according to the arrangement order of the first keyword sequence and the second keyword sequence respectively.
[0045] Furthermore, the clustering distance is optimized according to the similarity of user habits, and the public contract text dataset is clustered and screened to obtain the public contract texts that meet the conditions, including:
[0046] The word vectors of the public contract text are combined into multi-dimensional data according to the sequence of the second keywords;
[0047] Calculate the user habit feature distance based on the obtained user habit similarity of the public contract text;
[0048] The number of clusters k is obtained through the elbow method, and the user habit feature distance is used as the distance measurement between different public contract texts. The multidimensional data is clustered to obtain k clusters.
[0049] Calculate the mean similarity of user habits of each cluster, and sort the clusters in descending order according to the mean similarity of user habits;
[0050] Before selection After the clusters are formed, the difference between the mean similarities of user habits of adjacent clusters is calculated;
[0051] The two clusters with the largest difference are selected, and the cluster with a user habit similarity mean greater than or equal to the larger user habit similarity mean of the two clusters is used as the screened public contract text.
[0052] Furthermore, the user habit feature distance is calculated based on the obtained user habit similarity of the public contract text, including:
[0053] Calculate the difference in user habit similarity between two different public contract texts in the public contract text dataset;
[0054] Calculate the difference in contract expression features of the second keyword represented by the corresponding dimension data in two different public contract texts;
[0055] Calculate the difference in contract expression features of the first keyword corresponding to the historical contracts of two users;
[0056] Calculate the average of the contract expression feature difference values based on the obtained contract expression feature difference value of the second keyword and the contract expression feature difference value of the first keyword;
[0057] Calculate the difference between the corresponding dimension data in two different public contract texts;
[0058] The user habit feature distance is calculated by combining the difference in user habit similarity, the mean of the contract expression feature difference, and the difference in dimensional data.
[0059] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for intelligently generating contract templates based on user contract habits is implemented.
[0060] Compared with the prior art, the present invention has the following beneficial effects:
[0061] Based on the intelligent generation method of contract templates based on user contract habits described in the present invention, after obtaining the user's historical contract text and extracting the keywords of the user's historical contract text, the contract expression characteristics of the keywords are analyzed in combination with the distribution characteristics of the keywords in the user's historical contract text, and the contract structure characteristic parameters of each historical contract are analyzed using the contract expression characteristics of each keyword; then, the user habit similarity of the public contract text is calculated by the contract structure characteristic parameters of the public contract text data set and the user's historical contract text data set and the contract expression characteristics of different keywords, so as to optimize the clustering distance according to the user habit similarity and realize the clustering screening process of the public contract text data set. Compared with the prior art, the clustering process is adjusted by the similarity with the user's historical contract text, so that the clustering result is more in line with the user's historical contract habits; the pre-trained text generation model is trained for transfer learning by using the screened data as training data, so that the generated contract template is more in line with user needs and the contract generation efficiency is improved at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a flow chart of the steps of a method for intelligently generating contract templates based on user contract habits of the present invention.
[0063] Figure 2 It is a schematic block diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. The present invention is described in detail below in combination with the drawings and specific implementation methods.
[0065] Example 1
[0066] like Figure 1 As shown, a method for intelligently generating a contract template based on user contract habits comprises the following steps:
[0067] Obtain a user historical contract text dataset, and extract several first keywords from each user historical contract text;
[0068] By analyzing the first keywords extracted from each user's historical contract text, the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits are obtained;
[0069] Analyze the contract structure characteristic parameters representing the user's historical contract habits based on the contract expression characteristics of each first keyword in each user's historical contract text;
[0070] Obtain a public contract text dataset, and calculate the user habit similarity of the public contract text based on the contract expression features and contract structure feature parameters;
[0071] The clustering distance is optimized according to the similarity of user habits, and the public contract text data set is clustered and screened to obtain the public contract texts that meet the conditions;
[0072] The screened public contract texts are used as training data to perform transfer learning training on the pre-trained text generation model.
[0073] Based on the intelligent generation method of contract templates based on user contract habits described in the present invention, after obtaining the user's historical contract text and extracting the keywords of the user's historical contract text, the contract expression characteristics of the keywords are analyzed in combination with the distribution characteristics of the keywords in the user's historical contract text, and the contract structure characteristic parameters of each historical contract are analyzed using the contract expression characteristics of each keyword; then, the user habit similarity of the public contract text is calculated by the contract structure characteristic parameters of the public contract text data set and the user's historical contract text data set and the contract expression characteristics of different keywords, so as to optimize the clustering distance according to the user habit similarity and realize the clustering screening process of the public contract text data set. Compared with the prior art, the clustering process is adjusted by the similarity with the user's historical contract text, so that the clustering result is more in line with the user's historical contract habits; the pre-trained text generation model is trained for transfer learning by using the screened data as training data, so that the generated contract template is more in line with user needs and the contract generation efficiency is improved at the same time.
[0074] In this embodiment, a user historical contract text data set is obtained, and a number of first keywords are extracted from each user historical contract text, specifically including:
[0075] In this embodiment, to analyze the user's contract habits and intelligently generate contract templates, it is necessary to combine the user's historical contract data analysis and train the pre-trained text generation model by screening training data. For contract text data, the user's contract habits can be reflected by analyzing the keyword information in the contract text. Therefore, it is necessary to extract the keywords of the user's historical contract text in the preprocessing part of the user's historical contract text data and convert them into data form.
[0076] Specifically, this embodiment can use the LDA algorithm to extract keywords from the user's historical contract text, and record the keywords obtained at this time as the first keyword; it should be noted that the number of keywords extracted from the historical contract texts of each user should be the same, and then Word2vec can be used to convert the keywords into word vectors, and these word vectors are used as description information of the user's historical contract text.
[0077] In a specific embodiment, since the user's contract habits are in the contract text data, they can be reflected by using the keywords in the contract text and the contract structure. For the user's historical contract text, the embodiment of the user's habits in the contract structure can be represented by the keywords in the contract text; after the keyword extraction of the user's historical contract text, the position of the keywords in the contract text and the keyword density at different positions are analyzed, and the contract structure characteristic parameters of the user's contract habits can be obtained. However, different keywords in the contract text reflect the user's habits to different degrees. In order to obtain the contract structure characteristics of the user's historical contract text, it is also necessary to combine the contract expression characteristics reflected by the keywords in the contract text for analysis.
[0078] In this embodiment, by analyzing the first keyword extracted from each user's historical contract text, the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits are obtained, including:
[0079] Divide each user's historical contract into multiple clause text intervals;
[0080] Calculate the mean value of the number of each first keyword in each clause text interval;
[0081] Calculate the proportion of other first keywords in each clause text interval;
[0082] Based on the average of the number of first keywords and the proportion of other first keywords in each clause text interval, the calculated results are normalized with extreme values to obtain the contract expression features of each first keyword in the user's historical contract text that represent the user's historical contract habits.
[0083] In this embodiment, in a user's historical contract text, different keywords have different importance in the contract text, and their ability to reflect user habits is also different. The importance of a keyword in a contract text can usually be reflected by its distribution in the contract text or its density with other keywords.
[0084] In this embodiment, the user's historical contract text is divided into a plurality of clause text sections according to the clauses in the contract text.
[0085] Then the contract expression characteristics of the jth keyword in a user's historical contract text that reflects the user's habits can be expressed by the following formula:
[0086] ;
[0087] In the formula, Represents the contract expression feature of the jth keyword in a user's historical contract text; represents the range normalization function; T represents the number of clause text intervals in the historical contract text of the current user; represents the number of the jth keyword in the tth clause text interval; Indicates the number of characters in the t-th clause text interval, represents the number of other keywords in the t-th clause text interval, Represents an exponential function with a natural constant as base.
[0088] The main characteristics of keywords reflecting user habits are reflected in the number of keyword appearances, keyword descriptions and uniqueness in the text of each clause of the contract.
[0089] It is used to calculate the average number of occurrences of the jth keyword in each clause text interval. For the user's historical contract text, the more a certain keyword appears in each clause text interval of the contract, the more critical the current keyword is to the user's contractual habits. Therefore, by calculating the average number of occurrences of the jth keyword in the contract clause text interval, we can roughly analyze the jth keyword's ability to express the characteristics of the user's historical contract text.
[0090] In addition, for keywords in different clause text intervals of the contract, the amount of description of keywords by the text in the clause text interval can also reflect the ability of keywords to express contract characteristics; that is, the more text there is in the clause text interval, the more important the keyword is in the contract text, and the stronger its ability to express contract characteristics. In addition, if there are many other keywords in the current clause text interval, the text in the clause text interval does not necessarily only describe the target keyword.
[0091] In summary, through Calculate the proportion of other keywords in the number of words in the current user's historical contract text. The purpose of setting the total number of words as the denominator is to ensure that the denominator is not 0. Then use (-) Exponential function adjusts the logical relationship, As a coefficient adjustment ,pass Represents the contract expression feature of the jth keyword in a user's historical contract text.
[0092] In a specific embodiment, the contract structure characteristic parameters representing the user's historical contract habits are analyzed according to the contract expression characteristics of each first keyword in each user's historical contract text, including:
[0093] According to the contract expression characteristics of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated;
[0094] Calculate the average of the second weighted number of occurrences of all first keywords in the user's historical contract texts;
[0095] Calculate the difference between the first weighted average and the second weighted average;
[0096] After the difference is squared and amplified, the difference between the text intervals of each clause in the user's historical contract text is averaged to obtain the contract structure characteristic parameters representing the historical contract habits of each user.
[0097] In a specific embodiment, according to the contract expression feature of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated, including:
[0098] Obtain the contract expression features of each first keyword in each user's historical contract text;
[0099] Obtain the number of each first keyword in each clause text interval in each user's historical contract text;
[0100] Get the number of types of the first keyword in all users' historical contract texts;
[0101] According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated.
[0102] Furthermore, the step of calculating the second weighted average of the number of occurrences of all first keywords in the user's historical contract texts includes:
[0103] Obtain the contract expression features of each first keyword in all users' historical contract texts;
[0104] Get the number of each first keyword in all user's historical contract texts;
[0105] Get the number of types of the first keyword in all users' historical contract texts;
[0106] According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, a second weighted average number of occurrences of each first keyword in the user's historical contract texts is calculated.
[0107] In this embodiment, after obtaining the contract expression features of each keyword in a user's historical contract text, the user's habitual contract structure feature parameters can be analyzed through the position features of the keywords of different contract expression features in the contract text. This embodiment provides a specific calculation formula as follows:
[0108] ;
[0109] ;
[0110] In the formula, Represents the contract structure characteristic parameters of the historical contract text of the i-th user, represents the number of clause text intervals in the historical contract text of the i-th user, Indicates the number of keyword types. represents the contract expression feature of the jth keyword in the historical contract text of the i-th user, represents the number of occurrences of the jth keyword in the tth clause text interval of the i-th user's historical contract text, represents the contract expression feature of the jth keyword in each user's historical contract text, represents the number of occurrences of the jth keyword in each user's historical contract text; represents the mean value of A, where A represents the weighted mean value of the occurrence of the j-th keyword in all clause text intervals of the corresponding user's historical contract text modified by the contract expression feature of the j-th keyword in the historical contract text of each user.
[0111] To analyze the contract structure characteristic parameters of the user's historical contract text, we can analyze the differences in the positions of different keywords in the contract text; It represents the weighted mean number of occurrences of the jth keyword in the tth clause text interval of the i-th user's historical contract text modified by the contract expression feature of the jth keyword in the i-th user's historical contract text.
[0112] According to the above analysis, in order to analyze the contract structure characteristic parameters of the user's historical contract text through the positions where different keywords appear in the contract text, the difference in the weighted number of keywords in different clause text intervals can be used. It represents the difference between the weighted quantity mean and the average value of the t-th clause text interval. The larger the difference is, the more obvious the structural characteristics of the user's historical contract text are in the current clause text interval.
[0113] The overall variance calculation formula calculates the variance of the weighted mean of the number of occurrences of the jth keyword in the tth clause text interval of the i-th user's historical contract text and the weighted mean of the number of occurrences of the jth keyword in the user's historical contract text; this embodiment amplifies the difference between the weighted mean and the average value by squaring, and then averages the differences between the clause text intervals. The larger the mean, the more discrete the distribution of keywords in the user's historical contract text. The contract structure characteristic parameters reflecting the historical contract text of the i-th user.
[0114] In a specific embodiment, extracting a plurality of first keywords from each user's historical contract text further includes: converting the plurality of first keywords extracted from each user's historical contract text into a first word vector;
[0115] The obtained public contract text dataset and the calculation of user habit similarity of the public contract text according to the contract expression features and contract structure feature parameters include:
[0116] Obtain a public contract text dataset through crawler technology, extract the second keyword in the public contract text dataset, and convert it into a second word vector;
[0117] Calculate the contract structure characteristic parameters and contract expression characteristics corresponding to the second keyword in the selected public contract text;
[0118] Calculating the contract structure similarity according to the contract structure characteristic parameter corresponding to the selected second keyword and the contract structure characteristic parameter corresponding to the selected first keyword;
[0119] Calculating the contract expression feature similarity according to the contract expression feature corresponding to the selected second keyword and the contract expression feature corresponding to the selected first keyword;
[0120] Calculate the word vector similarity based on the first word vector of the selected first keyword and the second word vector of the selected second keyword;
[0121] The user habit similarity of public contract texts is calculated by combining the contract structure similarity, contract expression feature similarity, and word vector similarity.
[0122] In this embodiment, clustering is performed in the public contract text dataset in combination with the user's historical contract texts, and the contracts in the public contract text dataset need to be evaluated in combination with the user's contract texts.
[0123] Multiple public contract text datasets are obtained through the Internet, and keyword vectors in these contract text data are extracted using the same operation as the user's historical contract text dataset.
[0124] In addition to the similarity reflected in the contract structure, it is also necessary to analyze the similarity of the contract content through the keywords in the contract. After sorting the keywords extracted from the contract according to their contract expression feature values, for the public contract text dataset, the keywords in the keyword sequence corresponding to each user's historical contract text are closer to the keywords in the user's historical contract text sorted according to the contract expression feature value; the keywords with greater contract expression features in the user's historical contract text are given priority to select the keywords closest to their word vectors.
[0125] In this embodiment, before converting the second keyword extracted from the public contract text data set into the second word vector, after calculating the contract structure feature parameters and contract expression features corresponding to the second keyword in the selected public contract text, the method further includes:
[0126] According to the contract expression characteristics of the first keyword in the user's historical contract text, the first keyword sequence is arranged from largest to smallest;
[0127] Sequentially and without repetition, select a second keyword in a public contract text whose contract expression feature has the smallest difference with the first keyword in the user's historical contract text; arrange the selected second keywords into a second keyword sequence according to the selection order;
[0128] The first keyword and the second keyword are selected according to the arrangement order of the first keyword sequence and the second keyword sequence respectively.
[0129] This embodiment provides a specific formula for calculating the user habit similarity of the public contract text, as follows:
[0130] ;
[0131] In the formula, represents the user habit similarity of the u-th public contract text in the public contract text dataset, N represents the number of historical contract texts of the user, represents the contract structure characteristic parameters of the u-th public contract text in the public contract text dataset, represents the contract structure feature parameter of the i-th user's historical contract text in the user's historical contract text dataset, and m represents the number of keyword types; denote the contract expression features of the jth keyword in the keyword sequence of the i-th user's historical contract text and the u-th public contract text, respectively, and d() denotes the Euclidean distance calculation function; Represent the jth keyword vector in the keyword sequence of the i-th user's historical contract text and the u-th public contract text respectively; Represents the Euclidean distance between the jth keyword vector in the keyword sequence of the i-th user's historical contract text and the u-th public contract text.
[0132] To analyze the user habit similarity between the public contract text dataset and the user's historical contract text dataset, we can analyze it by comparing the contract structure feature parameters of the contract text. represents the difference in contract structure features between the uth public contract text and the ith user's historical contract text. After calculating the contract structure features of the public contract text through the same keyword extraction steps, the difference in contract structure features is used to analyze the structural similarity of the two contract texts; the smaller the difference, the higher the contract structure similarity between the two contracts. Finally, Represents the contract structure similarity between the u-th public contract text and the i-th user's historical contract text.
[0133] pass Indicates the selection result. The smaller the value, the closer the two keywords are. In addition, in addition to the meaning of the keywords themselves, the similarity of their contract expression characteristics in the contract can also indicate the similarity of the two contracts. Adjust the calculation process of the mean of the Euclidean distance of keywords, then adjust the mean using the contract structure similarity and correct the logical relationship through exp (-), and then use Represents the user habit similarity of the u-th public contract text in the public contract text dataset.
[0134] In a specific embodiment, the clustering distance is optimized according to the similarity of user habits, so as to perform clustering screening on the public contract text data set to obtain the public contract texts that meet the conditions, including:
[0135] The word vectors of the public contract text are combined into multi-dimensional data according to the sequence of the second keywords;
[0136] Calculate the user habit feature distance based on the obtained user habit similarity of the public contract text;
[0137] The number of clusters k is obtained through the elbow method, and the user habit feature distance is used as the distance measurement between different public contract texts. The multidimensional data is clustered to obtain k clusters.
[0138] Calculate the mean similarity of user habits of each cluster, and sort the clusters in descending order according to the mean similarity of user habits;
[0139] Before selection After the clusters are formed, the difference between the mean similarities of user habits of adjacent clusters is calculated;
[0140] The two clusters with the largest difference are selected, and the cluster with a user habit similarity mean greater than or equal to the larger user habit similarity mean of the two clusters is used as the screened public contract text.
[0141] In a specific embodiment, the step of calculating the user habit feature distance based on the obtained user habit similarity of the public contract text includes:
[0142] Calculate the difference in user habit similarity between two different public contract texts in the public contract text dataset;
[0143] Calculate the difference in contract expression features of the second keyword represented by the corresponding dimension data in two different public contract texts;
[0144] Calculate the difference in contract expression features of the first keyword corresponding to the historical contracts of two users;
[0145] Calculate the average of the contract expression feature difference values based on the obtained contract expression feature difference value of the second keyword and the contract expression feature difference value of the first keyword;
[0146] Calculate the difference between the corresponding dimension data in two different public contract texts;
[0147] The user habit feature distance is calculated by combining the difference in user habit similarity, the mean of the contract expression feature difference, and the difference in dimensional data.
[0148] This embodiment provides a specific calculation formula for calculating the user habit feature distance, as follows:
[0149] ;
[0150] In the formula, Indicates the user habit feature distance; They respectively represent the user habit similarity of the a-th data point and the b-th data point in the training data, where the data point is the public contract text; Indicates the number of dimensions of multidimensional data, that is, the number of keyword types; They represent the mean of the difference between the contract expression feature of the keyword represented by the vth dimension data in the ath and bth data points and the contract expression feature of the vth keyword in the keyword sequence of each user's historical contract text, Represent the vth dimension data in the ath and bth data points respectively.
[0151] In order to reflect the contract's reflection on the user's contract habits in the clustering process, it is necessary to add feature data about the user's contract habits in the clustering process. Indicates the user habit similarity difference between the two public contract texts a and b in the training data set, and uses the user habit similarity difference as one of the calculation parameters of the clustering distance. In addition, in the process of calculating the distance of each dimension data, the ability of different keywords in the keyword sequence of each user's historical contract text to express the overall characteristics of the contract should also be reflected. Therefore, Adjust the distances in each dimension and then add them to the parameters about user similarity. Represents the user habit feature distance, also known as the clustering distance.
[0152] The pre-trained text generation model is trained by transfer learning using the screened training data in combination with the existing pre-trained text generation model. In this embodiment, GPT-3 is selected as the pre-trained text generation model. The specific transfer learning training method is a prior art, and the following existing literature can be referred to.
[0153] [1] Duan Yu. A conditional text generation framework based on pre-training model[D]. Wuhan University, 2019.
[0154] [2] Li Hao. Transfer learning for general text generation based on high-level semantics[D]. Zhejiang University, 2019.
[0155] See also Figure 2 , Figure 2 5 is a schematic block diagram of a computer device provided by an embodiment of the present invention. The computer device 500 is a server, which can be an independent server or a server cluster composed of multiple servers.
[0156] See also Figure 2 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0157] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a method for intelligently generating a contract template based on user contract habits.
[0158] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0159] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for intelligently generating contract templates based on user contract habits.
[0160] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Figure 2 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0161] The processor 502 is used to run a computer program 5032 stored in the memory to implement the method for intelligently generating contract templates based on user contract habits disclosed in an embodiment of the present invention.
[0162] Those skilled in the art will understand that Figure 2 The embodiments of the computer device shown in the figure do not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are the same as those of the embodiment of the present invention. Figure 2 The embodiments shown are consistent and will not be described again here.
[0163] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0164] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the method for intelligently generating a contract template based on user contract habits disclosed in an embodiment of the present invention is implemented.
[0165] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0166] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0167] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0168] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0169] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), disk or optical disk and other media that can store program codes.
Claims
1. A method for intelligently generating contract templates based on user contract habits. Features: The method comprises the following steps: Obtain a user historical contract text dataset, and extract several first keywords from each user historical contract text; By analyzing the first keywords extracted from each user's historical contract text, the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits are obtained; Analyze the contract structure characteristic parameters representing the user's historical contract habits based on the contract expression characteristics of each first keyword in each user's historical contract text; Obtain a public contract text dataset, and calculate the user habit similarity of the public contract text based on the contract expression features and contract structure feature parameters; The clustering distance is optimized according to the similarity of user habits, and the public contract text data set is clustered and screened to obtain the public contract texts that meet the conditions; Use the screened public contract texts as training data to perform transfer learning training on the pre-trained text generation model; The acquisition of the first keyword includes: using an LDA algorithm to extract keywords from the user's historical contract text and recording them as the first keyword; By analyzing the first keyword extracted from each user's historical contract text, the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits are obtained, including: Divide each user's historical contract into multiple clause text intervals; Calculate the mean value of the number of each first keyword in each clause text interval; Calculate the proportion of other first keywords in each clause text interval; The average of the number of first keywords and the proportion of the number of other first keywords in each clause text interval are calculated, and the calculated results are normalized by range, so as to obtain the contract expression features corresponding to each first keyword in the user's historical contract text that represent the user's historical contract habits; The contract structure characteristic parameters representing the user's historical contract habits are analyzed based on the contract expression characteristics of each first keyword in each user's historical contract text, including: According to the contract expression characteristics of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated; Calculate the average of the second weighted number of occurrences of all first keywords in the user's historical contract texts; Calculate the difference between the first weighted average and the second weighted average; After the difference is squared and amplified, the difference between the text intervals of each clause in the user's historical contract text is averaged to obtain the contract structure characteristic parameters representing the historical contract habits of each user.
2. According to claim 1, a method for intelligently generating a contract template based on user contract habits, Features: According to the contract expression characteristics of each first keyword in the user's historical contract text, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated, including: Obtain the contract expression features of each first keyword in each user's historical contract text; Obtain the number of each first keyword in each clause text interval in each user's historical contract text; Get the number of types of the first keyword in all users' historical contract texts; According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, the first weighted average number of occurrences of each first keyword in each clause text interval is calculated.
3. According to claim 1, a method for intelligently generating a contract template based on user contract habits, Features: The calculating the second weighted average number of occurrences of all first keywords in the user's historical contract texts includes: Obtain the contract expression features of each first keyword in all users' historical contract texts; Get the number of each first keyword in all user's historical contract texts; Get the number of types of the first keyword in all users' historical contract texts; According to the obtained contract expression features, the number of each first keyword, and the number of types of the first keywords, a second weighted average number of occurrences of each first keyword in the user's historical contract texts is calculated.
4. According to claim 1, a method for intelligently generating a contract template based on user contract habits, Features: The extracting a plurality of first keywords from each user's historical contract text also includes: converting the plurality of first keywords extracted from each user's historical contract text into a first word vector; Obtain a public contract text dataset and calculate the user habit similarity of the public contract text based on the contract expression features and contract structure feature parameters, including: Obtain a public contract text dataset through crawler technology, extract the second keyword in the public contract text dataset, and convert it into a second word vector; Calculate the contract structure characteristic parameters and contract expression characteristics corresponding to the second keyword in the selected public contract text; Calculating the contract structure similarity according to the contract structure characteristic parameter corresponding to the selected second keyword and the contract structure characteristic parameter corresponding to the selected first keyword; Calculating the contract expression feature similarity according to the contract expression feature corresponding to the selected second keyword and the contract expression feature corresponding to the selected first keyword; Calculate the word vector similarity based on the first word vector of the selected first keyword and the second word vector of the selected second keyword; The user habit similarity of public contract texts is calculated by combining the contract structure similarity, contract expression feature similarity, and word vector similarity.
5. According to claim 4, a method for intelligently generating a contract template based on user contract habits, Features: Before converting the second keyword extracted from the public contract text data set into the second word vector, after calculating the contract structure feature parameters and contract expression features corresponding to the second keyword in the selected public contract text, the method further includes: According to the contract expression characteristics of the first keyword in the user's historical contract text, the first keyword sequence is arranged from largest to smallest; Sequentially and without repetition, select a second keyword in a public contract text whose contract expression feature has the smallest difference with the first keyword in the user's historical contract text; arrange the selected second keywords into a second keyword sequence according to the selection order; The first keyword and the second keyword are selected according to the arrangement order of the first keyword sequence and the second keyword sequence respectively.
6. According to claim 4, a method for intelligently generating a contract template based on user contract habits, Features: The clustering distance is optimized according to the similarity of user habits, and the public contract text dataset is clustered and screened to obtain the public contract texts that meet the conditions, including: The word vectors of the public contract text are combined into multi-dimensional data according to the sequence of the second keywords; Calculate the user habit feature distance based on the obtained user habit similarity of the public contract text; The number of clusters k is obtained through the elbow method, and the user habit feature distance is used as the distance measurement between different public contract texts. The multidimensional data is clustered to obtain k clusters. Calculate the mean similarity of user habits of each cluster, and sort the clusters in descending order according to the mean similarity of user habits; Before selection After the clusters are formed, the difference between the mean similarities of user habits of adjacent clusters is calculated; The two clusters with the largest difference are selected, and the cluster with a user habit similarity mean greater than or equal to the larger user habit similarity mean of the two clusters is used as the screened public contract text.
7. According to claim 6, a method for intelligently generating contract templates based on user contract habits, Features: The step of calculating the user habit feature distance based on the obtained user habit similarity of the public contract text includes: Calculate the difference in user habit similarity between two different public contract texts in the public contract text dataset; Calculate the difference in contract expression features of the second keyword represented by the corresponding dimension data in two different public contract texts; Calculate the difference in contract expression features of the first keyword corresponding to the historical contracts of two users; Calculate the average of the contract expression feature difference values based on the obtained contract expression feature difference value of the second keyword and the contract expression feature difference value of the first keyword; Calculate the difference between the corresponding dimension data in two different public contract texts; The user habit feature distance is calculated by combining the difference in user habit similarity, the mean of the contract expression feature difference, and the difference in dimensional data.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, it implements a method for intelligently generating contract templates based on user contract habits as described in any one of claims 1 to 7.
