Classification model generation method, electronic contract content automatic classification method and device
The deep learning-based classification model addresses manual intervention issues in contract classification by preprocessing and training on unified vectors, achieving accurate automatic classification of electronic contracts.
Patent Information
- Application Number
- CN201910234739.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-26
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2039-03-26
Smart Images

Figure CN110019819B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data and statistics, and in particular to a classification model generation method, an automatic classification method and device for electronic contract content. Background Art
[0002] The document with publication number CN106844554A mentions a method and system for automatic contract classification recognition. The method uses a deep learning algorithm with manual intervention to recognize and classify electronic contracts, eliminating the legal risks caused by inaccurate manual classification.
[0003] Since the method requires manual intervention to exclude non-keywords, when the method incorrectly excludes keywords through manual intervention, it will significantly affect the classification results of the electronic contracts. Summary of the invention
[0004] The embodiment of the present invention at least provides a method for generating a classification model of a clause text, which can solve the problem of requiring manual intervention for preprocessing the clause text in the prior art and the problem of inaccuracy of the existing classification model.
[0005] The method comprises:
[0006] Get a list of clauses with at least one clause text;
[0007] vectorizing the clause list into a clause matrix;
[0008] Get the classification label of the article text;
[0009] An initial deep learning classification model is trained based on at least one combination of the term matrix and the classification labels, and the classification model is generated.
[0010] In some embodiments of the present invention, obtaining the list of clauses is configured as follows:
[0011] Splitting the clause text into at least one sentence text having literal meaning;
[0012] Deleting non-word content in the sentence text to obtain a semantic text;
[0013] All the semantic texts are arranged according to the clause contents of the clause texts to form the clause list.
[0014] In some embodiments of the present invention, the clause list is vectorized into a clause matrix configured as:
[0015] Vectorizing the semantic text into sentence vectors;
[0016] All of the sentence vectors are arranged according to the clause list into the clause matrix.
[0017] In some embodiments of the present invention, vectorizing the semantic text into a sentence vector is configured as follows:
[0018] Load the word vector model that matches the locale of the article text;
[0019] The semantic text is vectorized into the sentence vector through the word vector model.
[0020] In some embodiments of the present invention, the initial deep learning classification model is trained according to a combination of at least one set of the term matrix and the classification label, and is configured to:
[0021] Unifying the vector lengths of all the sentence vectors in the clause matrix;
[0022] Filling at least one supplementary vector with the same vector length as the sentence vector in any of the clause matrices, so that the sum of the number of the supplementary vectors and the sentence vector is a preset number;
[0023] Unify the vector length of sentence vectors in all clause matrices;
[0024] The deep learning classification model is trained based on a combination of at least one populated term matrix and the classification label.
[0025] In some embodiments of the present invention, the vector lengths of all the sentence vectors in the clause matrix are uniformly configured as follows:
[0026] Mean pooling processes the vector lengths of all the sentence vectors in the clause matrix.
[0027] In some embodiments of the present invention, the preset number is the data of the maximum sentence vector in all the clause matrices.
[0028] In some embodiments of the present invention, the supplementary vector is a zero vector.
[0029] The embodiment of the present invention discloses at least one method for automatically classifying electronic contract content using the classification model.
[0030] The method comprises:
[0031] Get a list of contracts with at least one contract text;
[0032] Vectorizing the contract list into a contract matrix;
[0033] The classification model is loaded, and the contract matrix is selected as an input of the classification model to obtain a classification label.
[0034] The embodiment of the present invention discloses at least one device for automatically classifying electronic contract contents using the classification model.
[0035] The device comprises:
[0036] An input module configured to obtain a contract list of at least one contract text;
[0037] A vector module configured to vectorize the contract list into a contract matrix;
[0038] The classification module is configured to load the classification model and select the contract matrix as the input of the classification model to output a classification label.
[0039] In view of the above-mentioned solutions, the present invention will describe the disclosed exemplary embodiments in detail below with reference to the accompanying drawings, so as to make other features and advantages of the embodiments of the present invention clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 This is a flow chart of the classification model generation method of this embodiment;
[0042] Figure 2 This is a flow chart of the method for automatically classifying electronic contract content in this embodiment;
[0043] Figure 3 A structural diagram of the automatic classification device for electronic contract content in this embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0045] This embodiment preferentially provides a classification model generation method, which can be applied to a terminal device, such as a computer.
[0046] The implementation of the terminal device in this embodiment includes at least a memory and a processor. The memory mainly includes a program storage area and a data storage area; wherein the program storage area can store an operating system (such as: Android operating system, referred to as "Android system", or iOS operating system, or other operating systems, wherein the operating system can also be referred to as "system"), at least one application required for a function (such as a sound playback function, an image playback function, etc.). And, the data storage area can store data created according to the use of the electronic terminal, including relevant setting information or usage information of the application displayed on the display screen involved in the embodiment of the present application. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, and other volatile solid-state storage devices.
[0047] The processor is used to receive input data and execute steps such as the classification model generation method according to the input mass data; and load the preset classification model to realize automatic classification of the contract text according to the content.
[0048] Please refer to Figure 1 The processor executes the steps of the classification model generation method of this embodiment, which is used to train the classification model using 200 contract texts that are not completely identical and marked with classification labels as a training set.
[0049] S100. Segment the contract text into a number of sentence texts with certain semantics according to line breaks, blank line symbols, punctuation marks, etc. in the contract text.
[0050] S200, deleting special symbols, numbers, stop words and other characters in the sentence text to form a semantic text containing only main characters and / or words.
[0051] S300. Arrange all semantic texts in the order of the original contract contents of the contract text to form a contract list.
[0052] S410: Load a pre-trained word vector model that matches the language environment of the contract text.
[0053] S420. Use the word vector model to vectorize all semantic texts in the contract list into sentence vectors of uniform length, and arrange all sentence vectors according to the order of the semantic texts in the original contract list to form a contract matrix.
[0054] For example, the contract list has 3 semantic texts, and the 3 semantic texts are composed of 4, 5 and 6 characters or words respectively. According to the selected word vector model, such as Word2Vec, the vector length of the sentence vector is 128; then after the semantic text in the example is vectorized by the word vector model, 3 sentence vectors of different forms will be output, namely (4,128), (5,128) and (6,128); the three sentence vectors constitute the contract matrix of S420.
[0055] S500, mean pooling is performed on all sentence vectors in the contract matrix, and the vector lengths of all sentence vectors are unified. For example, the three sentence vectors of different forms in the example are unified into (3, 128).
[0056] S600, filling a number of supplementary vectors having the same vector length as the sentence vector in the contract matrix, so that the sum of the number of the supplementary vectors and the sentence vector meets a preset number.
[0057] S700, comparing the sentence vector forms of all contract matrices, and unifying the sentence vector forms of all contract matrices by filling a number of vector elements with values of 0 in the sentence vectors.
[0058] For example, there are two different contract texts A and B; the sentence vector form of contract text A is (3, 128); the sentence vector form of contract text B is (5, 128), then the contract text A needs to be filled as described above so that the sentence vector form of contract text A becomes (5, 128).
[0059] S800: Train a deep learning classification model based on the combination of the 200-point filled contract matrix and the classification labels, and generate and store a model file of the classification model.
[0060] In the embodiment, S600 preferably selects the contract text with the most semantic text among the 200 contract texts after preprocessing as the reference contract, and the number of semantic texts of the reference contract after preprocessing is selected as the preset number; the supplementary vector is a zero vector.
[0061] Please refer to Figure 2 , the classification model selected in this embodiment is a deep learning classification model.
[0062] The deep learning classification model is composed of an input layer, a mask layer, a one-dimensional convolution layer, a bidirectional long short-term memory layer, a batch normalization, a connection layer, a one-dimensional spatial drop layer, a temporal dense connection layer, and a linear chain conditional random field layer. Among them, the input layer is configured to receive 200 contract matrices processed by S800. The mask layer is configured to mark the vector elements filled in S700 as masks. If the value 0 is used for filling, the value 0 is marked as a mask; in addition, the other layer structures of the deep learning classification model of this embodiment are well known to those skilled in the art, and the utility is not repeated.
[0063] To further illustrate, the implementation of the deep learning classification model in this embodiment;
[0064] The training data mainly consists of two parts, namely the sentence vectors of the contract matrix and the classification labels corresponding to the sentence vectors. The number of classification labels is the same as the number of sentence vectors in the contract matrix. The vector form of all contract content used for training data is (B, N, V), where B is the number of contract texts in the training data, N is the number of sentence vectors and the number of supplementary vectors in a contract text, and V is the vector length of the sentence vector. The classification label form is (B, N, 1), where the length of the last dimension is 1, which is a one-dimensional sparse vector with a value of natural number, indicating a specific label category.
[0065] Preferably, this embodiment selects contract texts with the same structure as the training data, different contract contents and similar description semantics as the training data as verification data to test the accuracy of the classification model.
[0066] This embodiment discloses a method for automatically classifying the contents of a contract text using the above-mentioned trained classification model; the specific method steps are as follows.
[0067] S100, dividing the text to be classified into a number of sentence texts with certain semantics according to line break symbols, blank line symbols, punctuation marks, etc. in the text to be classified.
[0068] S200, deleting special symbols, numbers, stop words and other characters in the sentence text to form a semantic text containing only main characters and / or words.
[0069] S300: Arrange all semantic texts according to the order of the original contents of the texts to be classified to form a list to be classified.
[0070] S410, loading a word vector model of a training classification model;
[0071] S420, using a word vector model to vectorize all semantic texts in the list to be classified into sentence vectors of uniform length, and arranging all sentence vectors according to the order of the semantic texts in the original list to be classified to form a matrix to be classified.
[0072] S500, mean pooling is performed on all sentence vectors in the matrix to be classified to make the vector lengths of all sentence vectors uniform.
[0073] S600 , filling a number of supplementary vectors having the same vector length as the sentence vector in the matrix to be classified, so that the number of the supplementary vectors and the sentence vector is the aforementioned preset number.
[0074] S700, comparing the sentence vector forms of all matrices to be classified, and filling a number of vector elements with values of 0 in the sentence vectors so that the sentence vector forms of all matrices to be classified are the same as the sentence vector forms used to train the classification model.
[0075] S800, load the model file and obtain the classification label of the matrix to be classified.
[0076] Please refer to Figure 3 This embodiment discloses a device for automatically classifying the contents of a contract text using the above classification model. The device includes an input module, a vector module and a classification module.
[0077] The input module is configured to obtain a list of texts to be classified. Specifically, when the input module is executed, the texts to be classified are divided into a number of sentence texts with certain semantics according to line breaks, blank line symbols, punctuation marks, etc. in the texts to be classified. Special symbols, numbers, stop words and other characters in the sentence texts are deleted to form a semantic text containing only main characters and / or words. All semantic texts are arranged in the order of the original contents to be classified in the texts to be classified to form a list of texts to be classified.
[0078] The vector module is configured to vectorize the list to be classified into a matrix to be classified. Specifically, the vector module loads the word vector model of the training classification model; uses the word vector model to vectorize all semantic texts in the list to be classified into sentence vectors of uniform length, and arranges all sentence vectors according to the order of the semantic texts in the original list to be classified to form a matrix to be classified; performs mean pooling on all sentence vectors in the matrix to be classified to make the vector lengths of all sentence vectors uniform; fills the matrix to be classified with a number of supplementary vectors with the same vector length as the sentence vector, so that the number of supplementary vectors and sentence vectors is the aforementioned preset number; compares the sentence vector forms of all matrices to be classified, and fills the sentence vectors with a number of vector elements with a value of 0 to make the sentence vector forms of all matrices to be classified the same as the sentence vector forms used to train the classification model.
[0079] The classification module is configured to load the model file and select the matrix to be classified as the input of the model file to determine the classification label of the classified contract to be tested.
[0080] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating a classification model for a clause text, characterized in that: The method comprises: Obtain at least one copy of the terms and conditions; Segmenting the clause text into at least one sentence text having semantic meaning according to punctuation marks in the clause text; Deleting non-word content in the sentence text to form a semantic text containing words and / or phrases; Arrange all the semantic texts in the order of the clause contents of the clause texts into a clause list; Load the word vector model that matches the locale of the article text; Using the word vector model to vectorize all the semantic texts in the clause list into sentence vectors of uniform length; Arrange all the sentence vectors in the order of the clause list into a clause matrix; Get the classification label of the article text; Mean pooling processes the vector lengths of all the sentence vectors in the clause matrix; Filling at least one supplementary vector with the same vector length as the sentence vector in any of the clause matrices, so that the sum of the number of the supplementary vectors and the sentence vector is a preset number; Unify the vector length of sentence vectors in all clause matrices; A deep learning classification model is trained based on a combination of at least one of the populated term matrices and the classification labels.
2. The classification model generation method according to claim 1, characterized in that: The preset number is the data of the maximum sentence vector in all the clause matrices.
3. The classification model generation method according to claim 1, characterized in that: The supplementary vector is a zero vector.
4. A method for automatically classifying electronic contract content, characterized in that: The model generated by the classification model generation method according to any one of claims 1 to 3 comprises: Get a list of contracts with at least one contract text; Vectorizing the contract list into a contract matrix; The classification model is loaded, and the contract matrix is selected as an input of the classification model to obtain a classification label.
5. An automatic classification device for electronic contract content, characterized in that: The model generated by the classification model generation method according to any one of claims 1 to 3 comprises: An input module configured to obtain a contract list of at least one contract text; A vector module configured to vectorize the contract list into a contract matrix; The classification module is configured to load the classification model and select the contract matrix as the input of the classification model to output a classification label.
