Judgment document generation method, device and system based on BERT-HiNT and GPT-3
Through the BERT-HiNT and GPT-3 method, key information on trial cases is extracted, similar case searches and judgment results are predicted, and judgment documents are generated, which solves the problem of low efficiency in writing existing judgment documents and achieves efficient and accurate judgments Document generation.
Patent Information
- Application Number
- CN202411278638.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-12
AI Technical Summary
The existing judicial documents are written in a relatively fixed way, relying on manual retrieval and filling, resulting in low efficiency, low information utilization, and difficulty in accurately capturing nuances in legal texts.
Using the BERT-HiNT and GPT-3 method, we obtain the text of the trial case to be judged, extract key information, search similar cases and predict the judgment result, generate judgment documents, and improve information retrieval efficiency and accuracy.
It realizes intelligent generation of judicial documents, improves generation efficiency and accuracy, reduces manual input and repetitive work, and saves information retrieval costs.
Smart Images

Figure CN118780252B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device and system for generating judicial documents based on BERT-HiNT and GPT-3. Background Art
[0002] With the development of paperless trials, more and more court trial and legal information is stored in the trial information database. The data in the trial information database can provide assistance to staff in writing judicial documents.
[0003] However, the current way of writing judicial documents is relatively fixed. Most of the time, staff manually search for relevant information in the trial information database and fill in the judicial documents in a semi-formatted manner. The utilization rate of the trial information data is low, which in turn affects the efficiency of writing judicial documents.
[0004] It should be noted that the above statements are only used to provide background technical information related to the present application and do not necessarily constitute prior art. Summary of the invention
[0005] In view of this, the purpose of this application is to propose a method, device and system for generating judicial documents based on BERT-HiNT and GPT-3. This application can specifically solve the problem of low efficiency in writing existing judicial documents.
[0006] Based on the above purposes, in the first aspect, the present application proposes a method for generating judgment documents based on BERT-HiNT and GPT-3, the method comprising: obtaining the text of a court case to be judged, extracting key information from the text, wherein the key information is used to characterize the facts of the court case to be judged; based on the key information, searching in a preset case vector index library to obtain similar cases of the court case to be judged; based on the key information and similar cases of the court case to be judged, predicting the judgment result of the court case to be judged, and obtaining a judgment prediction result; generating a judgment document corresponding to the court case to be judged based on the predicted judgment result and the key information; wherein the case vector index library is obtained based on a trained judgment prediction model, and training the judgment prediction model comprises extracting text information of each case in the case data set, calculating the paragraph similarity of the text information, condensing information according to the paragraph similarity, and generating a case vector, and the case vector is used to construct the case vector index library.
[0007] In some embodiments, before obtaining the text of the court case to be judged, the method also includes constructing the case vector index library, and the method of constructing the case vector index library includes: performing data processing on historical case data to obtain a case data set; based on the case data set, using the BERT-HiNT model to train a judgment prediction model, and the judgment prediction model is used to predict the judgment result of the case; and, based on the case features obtained by the BERT-HiNT model during training, constructing the case vector index library.
[0008] In some embodiments, the use of the BERT-HiNT model to train a decision prediction model includes: using the BERT-HiNT model to encode key information of each case in the case data set, performing paragraph similarity calculation based on the encoded text information to obtain the similarity of each paragraph; based on the similarity of each paragraph, condensing paragraph information to obtain a text vector for each paragraph; denoising, feature fusion, and weight calculation of the text vector of each paragraph to obtain a feature vector for each case; using the feature vector output by the BERT-HiNT model as input to the decision prediction model to train the decision prediction model.
[0009] In some embodiments, based on the key information, a search is performed in a preset case vector index library to obtain similar cases of the pending court case, including: combining the key information according to a preset format to obtain a reference text of a preset length; extracting a text vector of the reference text; based on the similarity between the text vector and the vector in the case vector index library, obtaining the target number of similar cases.
[0010] In some embodiments, after obtaining similar cases of the pending court case, the method further includes: sorting the target number of similar cases according to the degree of similarity between the similar cases and the pending court case; and outputting the target number of similar cases in the sorted order.
[0011] In some embodiments, a judgment document corresponding to the pending trial case is generated based on the predicted judgment result and the key information, including: searching a preset document template library for a target document template that matches the key information; writing the predicted judgment result and the key information into corresponding positions in the target document template, and generating a judgment document corresponding to the pending trial case.
[0012] In some embodiments, the step of writing the predicted judgment result and the key information into corresponding positions in the target document template to generate a judgment document corresponding to the pending court case includes:
[0013] The GPT-3 natural language model is adjusted based on preset adjustment data to obtain an adjusted document generation model, wherein the preset adjustment data includes at least one of the following: case text, judgment document, legal rule text, and judgment result; based on the adjusted document generation model, the information area to be filled in the target document template is identified, and the predicted judgment result and the key information are written into the corresponding positions in the target document template to generate a judgment document corresponding to the pending trial case.
[0014] In some embodiments, obtaining the text of the court case to be determined and extracting key information from the text includes: preprocessing the text of the court case to be determined; extracting key information from the preprocessed text of the court case to be determined and outputting the key information; and storing the key information in units of cases to obtain a case information resource library.
[0015] In the second aspect, a judgment document generation device based on BERT-HiNT and GPT-3 is also provided, and the device includes: a data processing module, which is used to obtain the text of the court case to be judged and extract key information from the text; a retrieval module, which is used to search in a preset case vector index library based on the key information to obtain similar cases of the court case to be judged; a prediction module, which is used to predict the judgment result of the court case to be judged based on the key information and similar cases of the court case to be judged, and obtain a judgment prediction result; a document generation module, which is used to generate a judgment document corresponding to the court case to be judged according to the predicted judgment result and the key information; wherein the case vector index library is obtained based on a trained judgment prediction model, and training the judgment prediction model includes extracting text information of each case in the case data set, calculating the paragraph similarity of the text information, condensing information according to the paragraph similarity, and generating a case vector, and the case vector is used to construct the case vector index library.
[0016] In some embodiments, the device also includes: a vector library construction unit, which is used to process historical case data to obtain a case data set; based on the case data set, a judgment prediction model is trained using a BERT-HiNT model, and the judgment prediction model is used to predict the judgment result of the case; based on the case features obtained by the judgment prediction model, the case vector index library is constructed; an interactive module is used to input the text of the trial case to be judged, and to display the key information, judgment documents and similar cases.
[0017] In the third aspect, a judicial document generation system based on BERT-HiNT and GPT-3 is also provided, characterized in that the system includes a BERT-HiNT model, a GPT-3 natural language model, and the device described in the second aspect.
[0018] In general, this application has at least the following beneficial effects:
[0019] Provided is a method for generating judgment documents, which can extract key information from the text of a court case to be judged, and search in a preset case vector index library based on the key information to obtain similar cases of the court case to be judged, thereby improving the efficiency, relevance and accuracy of information retrieval. Furthermore, based on the key information and similar cases of the court case to be judged, the judgment result of the court case to be judged can be predicted to obtain a judgment prediction result, and a judgment document corresponding to the court case to be judged can be generated based on the predicted judgment result and the key information, thereby realizing the intelligent generation of high-accuracy judgment documents and improving the generation efficiency of judgment documents.
[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application. In addition, the same reference numerals are used to represent the same parts in all the drawings.
[0022] Figure 1 A schematic diagram of an application environment system of a method for generating judicial documents based on BERT-HiNT and GPT-3 provided in this embodiment is shown;
[0023] Figure 2 A flowchart of the steps of a method for generating judgment documents based on BERT-HiNT and GPT-3 provided in this embodiment is shown;
[0024] Figure 3 A flowchart showing a method for constructing a case vector index library provided by this embodiment is shown;
[0025] Figure 4 The BERT-HiNT model structure diagram provided in this embodiment is shown;
[0026] Figure 5 A flowchart showing a method for generating a judgment document provided by this embodiment is shown;
[0027] Figure 6 A schematic diagram of the structure of a judgment document generation device based on BERT-HiNT and GPT-3 provided in this embodiment is shown;
[0028] Figure 7 Another schematic diagram of the structure of the judgment document generation device based on BERT-HiNT and GPT-3 provided in this embodiment is shown;
[0029] Figure 8 A data processing schematic diagram of a judgment document generation device based on BERT-HiNT and GPT-3 provided in this embodiment is shown;
[0030] Fig. 9 A schematic structural diagram of an electronic device provided in one embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0034] The current writing methods of judicial documents are relatively fixed. Most of the time, staff manually search for relevant information in the trial information database to fill in the semi-formatted judicial documents. Staff need to manually enter the core content keywords. The degree of intelligence and the degree of utilization of trial information data are low. For example, the writing of judicial documents requires the retrieval of previous judgment cases for reference, which requires multiple keyword searches, and the search results also need to be screened for secondary information to extract the judgment information needed for the current case. The procedure is complicated and the efficiency of information acquisition is low. For another example, the writing of judicial documents requires the extraction of case-related information according to certain rules and supplementation on this basis. During this period, it is necessary to compare previous prosecution documents and other documentary materials, and there is a phenomenon of repeated identical trial information. In addition, legal texts are highly professional and complex. Existing technologies are difficult to accurately capture and understand the subtle differences in the legal context, and it is impossible to directly use the relevant information of the current case to generate case judicial documents. The above factors all affect the writing efficiency of judicial documents.
[0035] Therefore, in order to solve the above problems, this embodiment provides a judgment document generation method based on BERT-HiNT and GPT-3, which can extract key information from the text of the court case to be judged, and search in the preset case vector index library based on the key information to obtain similar cases of the court case to be judged, thereby improving the efficiency, relevance and accuracy of information retrieval. And based on the key information and similar cases of the court case to be judged, the judgment result of the court case to be judged can be predicted to obtain the judgment prediction result, and the judgment document corresponding to the court case to be judged can be generated according to the predicted judgment result and the key information, so as to realize the intelligent generation of high-accuracy judgment documents and improve the generation efficiency of judgment documents.
[0036] Figure 1 A schematic diagram of an application environment system of a judgment document generation method based on BERT-HiNT and GPT-3 provided in this embodiment is shown, Figure 1 As shown, the application environment system may include a processor, a memory, a network adapter and other external devices. Among them, the memory includes a program module of the intelligent generation system of judicial documents. The memory may include a random access memory (RAM) or a cache memory, and may further include a read-only memory (ROM). The memory includes a set of program modules that perform specific tasks, including but not limited to an operating system, one or more program modules and a database. The processor may include a combination of one or more central processing units (CPUs), microprocessors, digital processing chips and various control chips. The processor executes various functional applications and data processing by running the computer program stored in the memory, including case information processing, case retrieval, document templates and judicial document generation.
[0037] The electronic device composed of a processor, memory, and network adapter can be connected to multiple other external devices through an I / O interface, including but not limited to a display, keyboard, mouse, device driver, data backup hard disk, etc.
[0038] The network adapter in the electronic device is connected to the Web terminal to provide a user interaction interface. At the same time, the electronic device communicates with multiple networks through the network adapter, thereby cooperating and transmitting data with other court information systems. The memory stores at least two instructions, and the at least two instructions are loaded and executed by the processor to implement the steps of the judgment document generation method of the present invention.
[0039] Specifically, Figure 2 A flowchart of the steps of a method for generating judgment documents based on BERT-HiNT and GPT-3 provided in this embodiment is shown, as shown in FIG. Figure 1 As shown, the judgment document generation method includes the following steps S101 to S104:
[0040] S101. Obtain the text of the court case to be decided and extract key information from the text.
[0041] In this embodiment, the text of the court case to be judged includes, but is not limited to, the indictment, the defense statement, the court trial transcript, and other text information that affects the judgment result.
[0042] In this embodiment, the key information is used to characterize the case of the pending court case. For example, the text content of the pending court case is a large-scale description text of the indictment. The text of the pending court case can be used as the input of the retrieval model through a pre-trained retrieval model. The retrieval model removes sensitive information such as names, time, and place, and extracts key information related to the case, such as "litigation request and basis", "agreed jurisdiction and litigation preservation", "facts and reasons", "defense matters and basis", and "relevant laws".
[0043] S102. Based on the key information, a search is performed in a preset case vector index library to obtain similar cases to the court case to be judged.
[0044] In this embodiment, the preset case vector index library is constructed based on historical case data. The case vector index library stores judged case data. Therefore, based on the key information obtained in step S101, a search can be performed in the case vector index library to obtain similar cases to the trial case to be judged.
[0045] S103. Based on the key information and similar cases of the court case to be decided, the judgment result of the court case to be decided is predicted to obtain the judgment prediction result.
[0046] In this embodiment, a judgment prediction model can be trained in advance according to training data, and based on key information and similar cases of the court case to be judged, the judgment result of the court case to be judged is predicted by the trained judgment prediction model to obtain a judgment prediction result.
[0047] S104. Generate a judgment document corresponding to the court case to be decided based on the predicted judgment result and key information.
[0048] In this embodiment, a matching judgment document can be obtained through the key information of the court case to be determined. The key information obtained in step S101 and the predicted judgment result obtained in step S103 are written into the matching judgment document to generate a judgment document corresponding to the court case to be determined.
[0049] The above-mentioned embodiment can reduce the work of manual keyword extraction by the staff by automatically extracting the key information in the text of the court case to be judged, and can save a lot of information retrieval costs by retrieving similar cases through the key information. The judgment result of the court case to be judged can be predicted based on similar cases, which can improve the accuracy of the judgment result prediction of the case. The judgment document can be automatically generated according to the obtained judgment prediction result and key information, which can improve the intelligence level of judgment document generation, and output the judgment document result that conforms to the writing style of the judgment document, so that the judge only needs to make a small adjustment to the judgment document after the case trial to complete the writing of the judgment document, saving energy on the core result judgment rather than the detailed comparison and format specification of the document details.
[0050] In this embodiment, step S101 obtains the text of the court case to be judged and extracts key information from the text, including: preprocessing the text of the court case to be judged; extracting key information from the preprocessed text of the court case to be judged and outputting the key information; and storing the key information in units of cases to obtain a case information resource library.
[0051] Preprocessing of the text of court cases to be judged includes removing information and formats irrelevant to the case itself, eliminating sensitive information such as names, time, and location, and combining the texts involved in the same case into the same case data on a case-by-case basis. Text processing such as text segmentation, cleaning, deduplication, and length restrictions can also be performed.
[0052] The BERT (Bidirectional Encoder Representations from Transformers) model can be used to extract key information from the preprocessed text of the pending court case and output the key information, which can facilitate users to obtain case information.
[0053] In addition, key information is stored in units of cases to obtain a case information resource library to facilitate effective query and subsequent processing of case information.
[0054] Before obtaining the text of the court case to be judged, this embodiment also includes constructing the case vector index library. The method of constructing the case vector index library is as follows: Figure 3 As shown, Figure 3 A flowchart of the steps of a method for constructing a case vector index library provided by this embodiment is shown as follows: Figure 3 As shown, the method for constructing a case vector index library includes:
[0055] S201. Process historical case data to obtain a case data set.
[0056] Data processing of historical case data includes pre-processing of historical case data, removing information and formats irrelevant to the case itself, eliminating sensitive information such as names, time, and location, and combining the texts involved in the same case into the same case data on a case-by-case basis. Text processing such as text segmentation, cleaning, deduplication, and length limitation can also be performed.
[0057] The judgment information of the judgment results of the judicial documents in the historical case data is extracted as the judgment label, and the legal information in the case data set is extracted as the legal label to obtain the labeled case data set. The judgment label is, for example, "×× crime", and the legal label is, for example, "in accordance with Article ×× of ×× Law".
[0058] S202. Based on the case data set, use the BERT-HiNT model to train a decision prediction model.
[0059] The judgment prediction model is used to predict the judgment result of a case. In an example, the input of the judgment prediction model is the case feature, and the output of the judgment prediction model is the judgment result.
[0060] Specifically, the BERT-HiNT model can be composed of a BERT (Bidirectional Encoder Representations from Transformers) model and a HiNT (Hierarchical Inference Network Text) model.
[0061] For example, the BERT model is used to obtain text vectors of key information, judgment information, and legal information, and the HiNT model is used to convert the text information of long texts into multiple different vectors. The attention mechanism of the BERT model can extract features from the text and convert them into computable feature vectors. The BERT model mainly consists of an input layer, an encoding layer, and an output layer. The input layer extracts text keywords to obtain a one-dimensional word embedding. In the encoding layer, the self-attention mechanism converts the input into a vector representation, and finally aggregates the input into a feedforward neural network for feature extraction.
[0062] It can be seen that the BERT-HiNT model is a model for processing complex text data, which can extract and learn useful features from a large amount of text data. In the context of legal text analysis, BERT-HiNT can be used for feature extraction to extract rich semantic features from court case texts, including case background information, evidence, legal provisions, etc. It can also be used for text representation to generate vector representations of court cases, which can capture the core information and semantic structure of the case.
[0063] Using the BERT-HiNT model to train the decision prediction model can improve the accuracy and efficiency of decision prediction.
[0064] S203. Based on the case features obtained by the BERT-HiNT model during training, a case vector index library is constructed.
[0065] It can be seen that historical cases with vector information can be obtained according to the above method. Furthermore, a retrieval model can be constructed, and the retrieval model uses the Milvus vector library for vector storage and retrieval. Milvus is a cloud-native vector database that has the characteristics of high availability, high performance, and easy scalability. Milvus focuses on efficient vector similarity search, can quickly retrieve images similar to the query vector, supports multiple similarity measurement methods, has good scalability, and can be easily deployed and expanded in the cluster. These advantages make it well suited for the trial case index library. The system can be expanded as the amount of data increases while maintaining efficient retrieval performance.
[0066] The above embodiment uses the BERT-HiNT model to perform judgment prediction, which can generate useful case features as model outputs. A trial case vector index library is constructed based on these outputs or features, which can effectively organize and retrieve case information.
[0067] Optionally, a hash function is used to reduce the dimension of the case text feature vector to reduce storage space and computing resources and speed up retrieval.
[0068] In this way, after obtaining the key information, the retrieval model can be used to search in the preset case vector index library to obtain similar cases to the pending court case.
[0069] Among them, the case vector index library is obtained based on the trained decision prediction model. The training of the decision prediction model includes extracting the text information of each case in the case data set, calculating the paragraph similarity of the text information, condensing the information according to the paragraph similarity, and generating a case vector.
[0070] Among them, the judgment prediction model trained by the BERT-HiNT model can be used. During the training process, the text information of each case in the case data set is extracted, the paragraph similarity of the text information is calculated, and the information is condensed according to the paragraph similarity to generate a case feature vector for each case. The case feature vector can be used to construct a case vector index library, so that when performing case retrieval, cases similar to the retrieved case can be quickly obtained.
[0071] Specifically, the above step S202 includes: using the BERT-HiNT model to encode the key information of each case in the case data set, performing paragraph similarity calculation based on the encoded text information to obtain the similarity of each paragraph; based on the similarity of each paragraph, condensing the paragraph information to obtain the text vector of each paragraph; denoising, feature fusion and weight calculation of the text vector of each paragraph to obtain the feature vector of each case; using the feature vector output by the BERT-HiNT model as the input of the decision prediction model to train the decision prediction model.
[0072] Below Figure 4 The above process is described as an example. Figure 4 As shown, Figure 4 This is a diagram of the BERT-HiNT model structure provided in this embodiment.
[0073] The input of the model is the text of the trial case including the indictment, the defense statement, the trial transcript, etc. After data processing, the label information is extracted from the text of the above trial case to obtain key information such as factual basis, trial findings, legal information, and crime verdict. These key information are annotated to obtain the key information of each case after annotation. The key information is encoded at the sentence level by BERT to obtain multiple encoded text information, such as Figure 4 The paragraphs S1, S2, S3, and S4 in the text are taken, and then the similarity of each paragraph is calculated, which is the paragraph-level similarity calculation.
[0074] Then, according to the similarity of each paragraph, the paragraph information is condensed to obtain the text vector of each paragraph. In this embodiment, the input of the model can be further selected based on the factual basis label with the highest content proportion, using the information level screening mechanism. Specifically, the following steps can be included:
[0075] ① Identify duplicate paragraphs: Divide the content of the paragraphs and calculate the text similarity between each pair of paragraphs. The paragraph similarity calculation method can be: ,in is the number of words in the paragraph information, The words that overlap in a sentence.
[0076] ② Set similarity threshold: Set a similarity threshold, such as 0.6. Paragraphs exceeding this threshold are considered duplicate paragraphs.
[0077] ③ Paragraph weighting and deduplication: For each paragraph, assign a preliminary weight , In the case of a case in which there are multiple descriptions of factual basis in different documents, the repeated paragraphs are given a higher weight based on the frequency of repetition.
[0078] ④ Calculate the similarity between two paragraphs. When the similarity is greater than 0.6, the two paragraphs are considered to have the same content. For paragraph A, its similarity is the accumulation of the similarities between paragraph A and other paragraphs, that is, The higher the similarity, the higher the weight should be. For example, for paragraphs A, B, and C, the similarity between A and B is 0.8, the similarity between B and C is 0.7, and the similarity between A and C is 0.6. Then the three paragraphs are considered to have the same content. For paragraphs A, B, and C, the similarities are 1.4, 1.5, and 1.3, respectively. Then delete paragraphs A and C and set the weight of B to 1.3.
[0079] ⑤ Normalized weights: In order to ensure the comparability of weights, the weights of all paragraphs of the same case data are normalized so that their sum is 1, forming the information weight matrix of the text before the original attention mechanism.
[0080] Finally, the model input meets the input restrictions of the BERT model while retaining the key information in the case data to a great extent, forming multiple label vectors. and label vector weight matrix . Where j is the order of the label semantic vector, are the parameters of the j-th attention layer.
[0081] like Figure 4 In the example, according to the similarities between paragraphs P1, P2, P3, and P4, the paragraph information is condensed, and finally P1 and P2 are deleted to obtain P3 and P4.
[0082] A dynamic pooling layer is then added to reduce the interference of redundant information in legal documents and further condense case information, that is, to denoise the text vector of each paragraph.
[0083] The BERT model converts the input into a vector representation through the self-attention mechanism in the encoding layer, and finally aggregates the input to the feedforward neural network for feature extraction. Finally, the query text features are obtained and document features , where h is the hidden layer dimension, n is the number of query texts, and m is the number of documents in the case dataset.
[0084] In order to ensure the globality of the vector, the training process also records the accumulation of the historical j attention weight distributions, and updates the attention weight distribution to prevent the model from focusing on the original position again, that is, .
[0085] Finally, the HiNT model is used to calculate the local semantic similarity matrix between case label vectors, that is, Figure 4 By calculating the HiNT vector in , we can obtain the feature vector corresponding to each input case data. The feature vector, i.e., the case feature, can be used as the input of the decision prediction model to train the decision prediction model. We can also calculate the final similarity through the competition of global signals, and output the correlation score.
[0086] The output after training the decision prediction model through the BERT-HiNT model may include multiple similar cases and the decision results of each similar case.
[0087] That is to say, the above-mentioned BERT-HiNT model can perform text processing on the text of court trials to obtain the case feature vector of each case. The case feature vector can be used to train the judgment prediction model to improve the accuracy and efficiency of the judgment prediction model. The case feature vector can also be used to construct a case vector index library to facilitate the rapid acquisition of cases similar to the retrieved case when performing case retrieval.
[0088] Furthermore, based on the key information, a search is performed in a preset case vector index library to obtain similar cases to the pending court case, including: combining the key information in a preset format to obtain a reference text of a preset length; extracting a text vector of the reference text; and obtaining a target number of similar cases based on the similarity between the text vector and the vector in the case vector index library.
[0089] In this embodiment, the preset format can be customized according to the actual retrieval accuracy requirements, and the key information is combined according to the preset format to obtain a reference text of a preset length, for example:
[0090] Information of the parties: Plaintiff: XX Company, registered address: No. XX, XX Road, XX District, XX City, legal representative: Zhang XX, position: general manager, authorized agent: Lawyer Li, law firm: XX Law Firm.
[0091] Defendant: YY Company, registered address: No. YY, YY Road, YY District, YY City, legal representative: Wang XX, position: Chairman.
[0092] Relevant laws: In accordance with the provisions of Article 214, paragraph 1, Article 181, and Article 153, paragraph 1, item 2 of the "XX Law".
[0093] Judgment result: The court ruled that the defendant YY Company should pay the plaintiff XX Company RMB XX million for goods and liquidated damages for late payment (calculated at XX% per day, from the date of breach of contract to the actual payment date) within ten days from the date the judgment takes effect.
[0094] The BERT-HiNT model can be used to extract the text vector of the reference text, and then based on the similarity between the text vector and the vector in the case vector index library, a target number of similar cases can be obtained.
[0095] In this embodiment, after obtaining similar cases to the court case to be determined, the method of this embodiment also includes: sorting the target number of similar cases according to the degree of similarity between the similar cases and the court case to be determined; and outputting the target number of similar cases in the sorted order.
[0096] Taking the target number of 10 as an example, similar cases are sorted according to their similarity to the pending court cases, and the top 10 similar cases are output in order and then displayed to the user to assist the user in making the final judgment.
[0097] It should be noted that, before step S103, this embodiment also creates a referee prediction model, which can also be obtained through the training of the above-mentioned BERT-HiNT model, using the historical case data as the training data of the referee prediction model to output the referee result.
[0098] In one example, based on key information and similar cases of the pending court case, the judgment result of the pending court case is predicted to obtain a judgment prediction result. Weights can be assigned according to the degree of similarity. After weighted calculation, the judgment prediction result corresponding to the key information is output. The judgment prediction result includes the result of the judgment or ruling and legal information and other judgment result information.
[0099] Figure 5 A flowchart of the steps of a method for generating a judgment document provided by this embodiment is shown as follows: Figure 5 As shown, in this embodiment, based on the predicted judgment result and the key information, a judgment document corresponding to the court case to be judged is generated, including:
[0100] S301. Search a preset document template library for a target document template that matches the key information.
[0101] In one example, this embodiment may preset a document template library that matches different types of cases based on the format characteristics of the judgment documents of different types of cases.
[0102] In this way, when predicting the judgment results of the court cases to be judged, the case type can be determined by the key information of the court cases to be judged, and then the target document template that matches the key information can be queried in the preset document template library according to the case type.
[0103] S302. Write the predicted judgment result and key information into the corresponding position in the target document template to generate a judgment document corresponding to the court case to be judged.
[0104] Specifically, the predicted judgment result and the key information are written into corresponding positions in the target document template to generate a judgment document corresponding to the pending trial case, including: adjusting the GPT-3 natural language model based on preset adjustment data to obtain an adjusted document generation model; identifying the information area to be filled in the target document template based on the adjusted document generation model, writing the predicted judgment result and the key information into corresponding positions in the target document template to generate a judgment document corresponding to the pending trial case.
[0105] The natural language model of this embodiment can be a GPT-3 natural language model, which is adjusted based on preset adjustment data. That is, the GPT-3 natural language model is trained by the above adjustment data. The preset adjustment data includes at least one of the following: case text, judgment document, legal rule text, and judgment result. The document generation model adjusted in this way is more compatible with the judgment document.
[0106] Based on the adjusted document generation model, the information area to be filled in the target document template is identified, and the predicted judgment result and key information are written into the corresponding positions in the target document template to generate a judgment document corresponding to the court case to be judged. In this way, the judgment document not only contains the key information of the court case to be judged but also includes the predicted judgment result, forming a complete judgment document.
[0107] In this embodiment, the decision prediction model and the retrieval model can also be evaluated and optimized, and a model evaluation system can be established. The performance of the decision prediction model and the retrieval model can be evaluated using test cases through indicators such as model accuracy and F1 value, including the accuracy, efficiency and response time of the retrieval, to obtain evaluation results; and the model can be adjusted and optimized based on the evaluation results to ensure that the retrieval and prediction effects of the model can meet the actual needs of different users.
[0108] In order to facilitate understanding of the above technical solutions of the present invention, the above technical solutions of the present invention are described in detail below through specific implementation.
[0109] The retrieval model and the judgment prediction model are created and trained in advance, the document template library is preset, and the natural language model is adjusted by preset adjustment data to obtain the adjusted document generation model. Among them, the input of the retrieval model and the judgment prediction model is the text of the court case to be judged, the output of the retrieval model is the target number of similar cases, the output of the judgment prediction model is the judgment prediction result, the input of the document generation model is the predicted judgment result and the key information, and the output is the judgment document.
[0110] This embodiment can provide a search interface. The user inputs the text of the judgment court case. This embodiment processes the text data, extracts key information, forms a case vector for retrieval, and calculates similarity in the case vector index library through the retrieval model, and displays the search results of the top ten similar cases with the highest similarity. At the same time, the judgment prediction model is used to obtain the judgment prediction result based on the key information and similar cases of the court case to be judged. Then, the document generation model is used to fill in the target document template according to the predicted judgment result and key information, and generate the judgment document corresponding to the court case to be judged. In the process of generating judgment documents by the model, users can also set parameters such as generation length and text style to control the generation effect of the judgment document.
[0111] For example, the text of the court case to be decided input in this embodiment is: "In this case, the plaintiff Li and the defendant Zhang had a dispute due to a traffic accident. The plaintiff claimed that the defendant violated traffic regulations, causing damage to the vehicle, and required the defendant to bear the liability for compensation. The defendant argued that the plaintiff was also at fault, and proposed that the compensation for the loss should be shared according to the proportion of liability."
[0112] The document output by the above method has the following content: "The court found that the case in which the plaintiff Li and the defendant Zhang had a dispute over a traffic accident was a traffic accident dispute case. The court held that, according to the specific circumstances of the traffic accident, the defendant Zhang did commit traffic violations and violated the relevant provisions of the Road Traffic Safety Law, and should bear the main responsibility. The plaintiff Li also acted negligently during driving and was partially responsible for the accident. In view of this, the court ruled that the defendant should bear 70% of the responsibility for the accident and the plaintiff should bear 30% of the responsibility. Therefore, the court ruled as follows: The defendant Zhang should compensate the plaintiff Li for the vehicle loss and related expenses totaling 3,500 yuan."
[0113] The judgment document generated in this embodiment may be a written judgment or a ruling or other adjudicative document.
[0114] The retrieval model of this embodiment can directly input the entire text, eliminating the step of manually refining keywords in related technologies, which can greatly improve retrieval efficiency and accuracy; the retrieval model and judgment prediction model of this embodiment can automatically extract key information from complex text information; and searching through text vectors can improve the relevance of retrieval results, and predicting the judgment results of pending court cases through similar cases can improve the accuracy of prediction results; generating judgment documents through the adjusted document generation model can improve the standardization of judgment documents.
[0115] Figure 6 A schematic diagram of the structure of the judgment document generation device based on BERT-HiNT and GPT-3 provided in this embodiment is shown as follows: Figure 6 As shown, a judgment document generation device 400 based on BERT-HiNT and GPT-3 includes:
[0116] The data processing module 401 is used to obtain the text of the court case to be decided and extract key information from the text;
[0117] A search module 402 is used to search in a preset case vector index library based on the key information to obtain similar cases to the pending trial case;
[0118] A prediction module 403 is used to predict the judgment result of the court case to be judged based on the key information and similar cases of the court case to be judged, so as to obtain a judgment prediction result;
[0119] The document generation module 404 is used to generate a judgment document corresponding to the trial case to be decided based on the predicted judgment result and the key information.
[0120] In one example, Figure 7 Another schematic diagram of the structure of the judgment document generating device provided in this embodiment is shown, referring to Figure 7 , the judgment document generation device 400 based on BERT-HiNT and GPT-3 also includes:
[0121] The vector library construction unit 405 is used to process the historical case data to obtain a case data set; based on the case data set, a judgment prediction model is trained using the BERT-HiNT model, and the judgment prediction model is used to predict the judgment result of the case; based on the case features obtained by the judgment prediction model, the case vector index library is constructed;
[0122] The interactive module 406 is used to input the text of the court case to be judged, and to display the key information, judgment documents and similar cases.
[0123] In this embodiment, the vector library construction unit 405 is also used to encode the key information of each case in the case data set using the BERT-HiNT model, perform paragraph similarity calculation based on the encoded text information to obtain the similarity of each paragraph; condense the paragraph information based on the similarity of each paragraph to obtain the text vector of each paragraph; denoise, feature fuse and weight calculate the text vector of each paragraph to obtain the feature vector of each case; use the feature vector output by the BERT-HiNT model as the input of the decision prediction model to train the decision prediction model.
[0124] The retrieval module 402 is used to combine the key information according to a preset format to obtain a reference text of a preset length; extract a text vector of the reference text; and obtain a target number of similar cases based on the similarity between the text vector and the vector in the case vector index library.
[0125] The retrieval module 402 is further configured to sort the target number of similar cases according to the similarity between the similar cases and the pending court case; and output the target number of similar cases in the sorted order.
[0126] The document generation module 404 is also used to search for a target document template that matches the key information in a preset document template library; write the predicted judgment result and the key information into corresponding positions in the target document template, and generate a judgment document corresponding to the trial case to be judged.
[0127] The document generation module 404 is also used to adjust the natural language model based on preset adjustment data to obtain an adjusted document generation model, wherein the preset adjustment data includes at least one of the following: case text, judgment document, legal rule text, and judgment result; based on the adjusted document generation model, the information area to be filled in the target document template is identified, and the predicted judgment result and the key information are written into the corresponding positions in the target document template to generate a judgment document corresponding to the pending trial case.
[0128] The data processing module 401 is also used to pre-process the text of the pending court case; extract key information from the pre-processed text of the pending court case and output the key information; and store the key information in units of cases to obtain a case information resource library.
[0129] The judgment document generation device provided in the above-mentioned embodiment of the present application and the judgment document generation method provided in the embodiment of the present application are based on the same application concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0130] Figure 8A data processing diagram of the judgment document generating device provided in this embodiment is shown, referring to Figure 8 In a specific example, the text input format of the pending trial case input by the judgment document generation device is a txt or word text file. The system will pre-process the text, and the system output content includes: similar case retrieval results, relevant legal rules text, extracted key information of the pending trial case, and generated judgment documents. Specifically, the judgment document is a text information that can be modified, and other output information is only for query display and cannot be updated or deleted.
[0131] Among them, the interactive module provides three parts: search interface, search result display unit, and judgment document display unit. Users input the text of the pending court case through the search interface; view the retrieved similar cases and the legal rules text related to the pending court case through the search result display unit, and similar cases are arranged in descending order of similarity; the generated judgment document is displayed through the judgment document display unit, and an editing page is provided to facilitate users to modify and correct the generated judgment document.
[0132] The input text is pre-processed through the data processing module to form a case information resource library to ensure that the data can be effectively queried and subsequently processed;
[0133] The retrieval module calculates the similarity between the vectorized key information and the internal case vectors stored in the case vector index library in the case vector index library, and displays the retrieval results on the user interaction page; the case information resources are connected to the Milvus database, including the storage of case information, legal provisions, document templates and other data. By encapsulating database operations, the system can achieve persistent storage and efficient query of data, providing users with stable and reliable services.
[0134] The prediction module performs judgment prediction based on the trained judgment prediction model to obtain the judgment prediction result.
[0135] The judgment prediction results and the extracted key case information are matched into the preset information area in the target document template through the document generation module, and the generated judgment document is passed to the user interaction interface of the interaction module.
[0136] The key information extracted in this embodiment is written into the judgment document template on the one hand, and is structured and displayed as a case summary through an interactive module in the window where the text of the original trial case to be judged is located.
[0137] In a feasible example, the judgment document generation device of this embodiment may also include a linkage module, thereby enabling data interaction between different courts to facilitate information transmission and case process processing.
[0138] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0139] The judgment document generation device provided in the above-mentioned embodiment of the present application and the judgment document generation method provided in the embodiment of the present application are based on the same application concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0140] This embodiment provides a judgment document generation system based on BERT-HiNT and GPT-3, the system comprising a BERT-HiNT model, a GPT-3 natural language model, and the judgment document generation device based on BERT-HiNT and GPT-3. The judgment document generation device based on BERT-HiNT and GPT-3 is as follows: Figure 6 Or as shown in 7, the architecture of the BERT-HiNT model is as follows Figure 4 shown.
[0141] The judgment document generation device provided in the above-mentioned embodiment of the present application and the judgment document generation method provided in the embodiment of the present application are based on the same application concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0142] The present application also provides an electronic device corresponding to the judgment document generation method provided in the above embodiment to execute the above judgment document generation method. Fig. 9 , which shows a schematic diagram of an electronic device provided in some embodiments of the present application.
[0143] The electronic device 20 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, wherein the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, it executes the method provided in any of the aforementioned embodiments of the present application.
[0144] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0145] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving the execution instructions. The judgment document generation method disclosed in any implementation of the above-mentioned embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.
[0146] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.
[0147] The electronic device provided in the embodiment of the present application and the method for generating judicial documents provided in the embodiment of the present application are based on the same application concept and have the same beneficial effects as the methods adopted, operated or implemented therein.
[0148] An embodiment of the present application also provides a computer-readable storage medium corresponding to the judgment document generation method provided in the aforementioned embodiment. The computer-readable storage medium may be a CD, on which a program product is stored. The program product may be an operating system, application software, game, tool software, etc. The program product includes a computer program. The computer program usually exists in source code or compiled binary form. When the computer program is run by a processor, it will execute the judgment document generation method provided in any of the aforementioned embodiments.
[0149] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0150] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the method for generating judicial documents provided in the embodiments of the present application are based on the same application concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0151] It should be noted that:
[0152] In the above text, the term "comprises", "includes" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0153] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0154] The embodiments of the present application are described above in conjunction with the accompanying drawings, which are only specific implementation modes of the present application. However, the present application is not limited to the above-mentioned specific implementation modes. The above-mentioned specific implementation modes are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for generating judicial documents based on BERT-HiNT and GPT-3, characterized in that: The method comprises: Obtaining the text of the court case to be decided, and extracting key information from the text, wherein the key information is used to characterize the facts of the court case to be decided; Based on the key information, searching in a preset case vector index library to obtain similar cases to the pending trial case; Based on the key information and similar cases of the pending court case, predict the judgment result of the pending court case to obtain a predicted judgment result; Adjust the GPT-3 natural language model based on preset adjustment data to obtain an adjusted document generation model, wherein the preset adjustment data includes at least one of the following: case text, judgment document, legal rule text, and judgment result; Based on the adjusted document generation model, the information area to be filled in the target document template is identified, the predicted judgment result and the key information are written into the corresponding positions in the target document template, and a judgment document corresponding to the trial case to be judged is generated; The case vector index library is obtained based on a trained judgment prediction model, and training the judgment prediction model includes extracting text information of each case in the case data set, calculating paragraph similarity of the text information, performing information condensation according to the paragraph similarity, and generating case vectors, and the case vectors are used to construct the case vector index library; Training the judgment prediction model specifically includes: using the BERT-HiNT model to encode the key information of each case in the case data set, performing paragraph similarity calculation based on the encoded text information to obtain the similarity of each paragraph; based on the similarity of each paragraph, performing paragraph information condensation to obtain the text vector of each paragraph; performing denoising, feature fusion and weight calculation on the text vector of each paragraph to obtain the feature vector of each case; using the feature vector output by the BERT-HiNT model as the input of the judgment prediction model to train the judgment prediction model.
2. The method according to claim 1, characterized in that Before obtaining the text of the court case to be judged, the method further includes constructing the case vector index library. The method of constructing the case vector index library includes: Perform data processing on historical case data to obtain case data sets; Based on the case data set, a judgment prediction model is trained using the BERT-HiNT model, where the judgment prediction model is used to predict the judgment result of the case; and Based on the case features obtained during the training of the BERT-HiNT model, the case vector index library is constructed.
3. The method according to claim 1, characterized in that Based on the key information, searching in a preset case vector index library to obtain similar cases of the pending trial case includes: Combining the key information according to a preset format to obtain a reference text of a preset length; Extracting a text vector of the reference text; Based on the similarity between the text vector and the vectors in the case vector index library, a target number of similar cases is obtained.
4. The method according to claim 3, characterized in that After obtaining similar cases to the pending court case, the method further includes: Sorting the target number of similar cases according to the similarity between the similar cases and the pending court cases; Output the target number of similar cases in the sorted order.
5. The method according to claim 1, characterized in that: The method further comprises: The target document template matching the key information is searched in the preset document template library.
6. The method according to claim 1, characterized in that The obtaining of the text of the court case to be decided and extracting key information from the text includes: Pre-processing the text of the court case to be decided; extracting key information from the preprocessed text of the pending court case and outputting the key information; and The key information is stored in units of cases to obtain a case information resource library.
7. A judgment document generation device based on BERT-HiNT and GPT-3, characterized in that: The device comprises: A data processing module, used to obtain the text of the court case to be decided and extract key information from the text; A retrieval module, used to search in a preset case vector index library based on the key information to obtain similar cases to the pending trial case; A prediction module, used to predict the judgment result of the pending court case based on the key information and similar cases of the pending court case, so as to obtain a predicted judgment result; A document generation module is used to adjust the GPT-3 natural language model based on preset adjustment data to obtain an adjusted document generation model, wherein the preset adjustment data includes at least one of the following: case text, judgment document, legal rule text, and judgment result; based on the adjusted document generation model, the information area to be filled in the target document template is identified, and the predicted judgment result and the key information are written into the corresponding positions in the target document template to generate a judgment document corresponding to the trial case to be judged; Among them, the case vector index library is obtained based on the trained decision prediction model, and training the decision prediction model includes extracting text information of each case in the case data set, calculating the paragraph similarity of the text information, condensing information according to the paragraph similarity, and generating case vectors, and the case vectors are used to construct the case vector index library; training the decision prediction model specifically includes: using the BERT-HiNT model to encode the key information of each case in the case data set, performing paragraph similarity calculation according to the encoded text information, and obtaining the similarity of each paragraph; according to the similarity of each paragraph, condensing paragraph information to obtain the text vector of each paragraph; denoising, feature fusion and weight calculation of the text vector of each paragraph to obtain the feature vector of each case; using the feature vector output by the BERT-HiNT model as the input of the decision prediction model, and training the decision prediction model.
8. A judicial document generation system based on BERT-HiNT and GPT-3, characterized in that: The system includes a BERT-HiNT model, a GPT-3 natural language model, and the device described in claim 7.
