Legal document structuring processing method and apparatus

CN116152019BActive Publication Date: 2026-09-18ZHAOLIAN CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310139272.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-10
Publication Date
2026-09-18
Estimated Expiration
2043-02-10

AI Technical Summary

Technical Problem

且不同性质的内容结构可能完全不同,法院法官的撰写风格、案件推进阶段可能也不一样,导致对文书的结构化处理变得困难,进而会影响对法律文书信息提取的准确性

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116152019B_ABST
    Figure CN116152019B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a legal document structural processing method and device, the method comprises the following steps: obtaining legal document data, the legal document data comprises at least one judgment document; obtaining at least one first structure label existing in each judgment document in the at least one judgment document, and determining fixed structure data and non-fixed structure data in the legal document data according to the at least one first structure label; inputting the non-fixed structure data into a legal document structural model to determine the second structure label corresponding to each paragraph in the non-fixed structure data; and determining the structure label corresponding to each paragraph in the legal document data according to the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data. By using the foregoing method, the structural processing of the legal document can be realized, and the inductive classification and subsequent retrieval of the legal document are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of general data processing technology, and in particular to a method and apparatus for structuring legal documents. Background Technology

[0002] Legal documents are used to record the investigation and trial process of legal cases. Important information such as the facts of the case and the scope of applicable law are crucial resources for studying legal texts. However, legal documents are published in plain text form, which is unstructured information. Furthermore, the structure of content of different natures can be completely different, and the writing style of judges and the stage of case progression may also vary, making it difficult to structure the documents and consequently affecting the accuracy of information extraction. Summary of the Invention

[0003] This application provides a method and apparatus for structuring legal documents, which determines the structural tags corresponding to each paragraph in a legal document through a legal document structuring model, thereby realizing the structuring processing of legal document data.

[0004] In a first aspect, embodiments of this application provide a method for structuring legal documents, the method comprising:

[0005] Acquire legal document data, which includes at least one judgment document;

[0006] Obtain at least one first structure tag existing in each of at least one judgment document, and determine fixed structure data and non-fixed structure data in the legal document data based on at least one first structure tag. The fixed structure data is the data in the legal document data that corresponds to at least one first structure tag.

[0007] Input non-fixed structure data into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data;

[0008] The structural label corresponding to each paragraph in the legal document data is determined based on the first structural label corresponding to the fixed structural data and the second structural label corresponding to the non-fixed structural data.

[0009] As can be seen, in this embodiment, legal document data is obtained, including at least one judgment document; at least one first structural tag exists in each of the at least one judgment document, and fixed-structure data and non-fixed-structure data in the legal document data are determined based on the at least one first structural tag; the non-fixed-structure data is input into a legal document structuring model to determine the second structural tag corresponding to each paragraph in the non-fixed-structure data; and the structural tag corresponding to each paragraph in the legal document data is determined based on the first structural tag corresponding to the fixed-structure data and the second structural tag corresponding to the non-fixed-structure data. Using the aforementioned method, the structuring processing of legal documents can be achieved, facilitating the summarization, classification, and subsequent retrieval of legal documents.

[0010] In one feasible embodiment, obtaining at least one first structural tag existing in each of at least one judgment document includes: obtaining historical legal document structure data, which includes multiple judgment documents, each paragraph of the multiple judgment documents having a corresponding structural tag; determining the paragraph position corresponding to all structural tags existing in each judgment document; and using the structural tags that have the same paragraph position in each of the multiple judgment documents as the first structural tag.

[0011] In this embodiment, the paragraph positions corresponding to all structural tags existing in the historical legal document structure data in each judgment document are determined, and the structural tags that have the same paragraph positions in each judgment document are taken as the first structural tags. Using the aforementioned method, the first structural tags can be accurately determined, and fixed structural data can also be directly determined based on the determined first structural tags.

[0012] In a feasible embodiment, before inputting the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the method further includes: acquiring historical legal document data, which includes multiple judgment documents; performing word segmentation processing on the multiple judgment documents according to the forward maximum matching algorithm to obtain text information corresponding to the multiple judgment documents respectively, and determining first text information based on the text information corresponding to the multiple judgment documents respectively, wherein the first text information is the text information contained in the judgment documents that account for more than a first percentage of the multiple judgment documents, and the text information includes words or phrases; acquiring judgment process information, and determining multiple second text information based on the judgment process information; performing text comparison on the first text information and the second text information to determine the third text information that is the same as the second text information in the first text information, determining the third text information as all structure tags, and taking the structure tags other than the first structure tags as the second structure tags.

[0013] In this embodiment, multiple court judgments are acquired and segmented using a forward maximum matching algorithm to obtain multiple first text information contained in judgments that account for a percentage greater than a first percentage. Judgment process information is then acquired, and multiple second text information is determined based on this information. A text comparison is performed between the multiple first and second text information to identify third text information that is identical to the multiple second text information. This third text information is then identified as all structural tags, and all structural tags other than the first structural tags are identified as second structural tags. Using this method, the second structural tags can be accurately and completely determined, facilitating subsequent structuring of unstructured data.

[0014] In a feasible embodiment, before inputting the non-fixed structure data into the legal document structure model to determine the structure label corresponding to each paragraph in the non-fixed structure data, the method further includes: obtaining historical legal document structure data, which includes multiple judgment documents, and each paragraph in the multiple judgment documents has a corresponding actual second structure label.

[0015] An initial model is created by inputting historical legal document structure data into the initial model. The initial model includes an input layer, an embedding layer, an encoding layer, and a computational layer. The input layer is used to divide the judgment document into multiple paragraphs based on natural paragraphs. The embedding layer is used to encode the judgment document of each paragraph in the multiple paragraphs according to the Bidirectional Encoder Representations from Transformers (BERT) to determine multiple vector matrices. The encoding layer is used to encode the multiple vector matrices according to the Bidirectional Long Short Term Memory (Bi-LSTM) neural network to obtain the output matrix. The computational layer determines the different predicted second structure labels corresponding to each paragraph based on the output matrix.

[0016] The actual and predicted second structure labels of each paragraph are used to calculate a loss function. When the result of the loss function calculation is greater than a preset threshold, the initial model is adjusted to obtain the adjusted model. Multiple paragraphs of the judgment document are input into the adjusted model, and the processing of the input layer, embedding layer, encoding layer and operation layer is repeated until it is determined that the result of the loss function calculation is not greater than the preset threshold. At this point, the adjusted model is determined to be the legal document structure model.

[0017] In this embodiment, an initial model is created by inputting historical legal document structure data. This initial model includes an input layer, a word embedding layer, an encoding layer, and a computation layer. The historical legal document structure data is processed to obtain predicted second structure labels for each paragraph. A loss function is then calculated between the predicted and actual second structure labels for each paragraph to adjust the model, ultimately resulting in a final adjusted legal document structure model. Using this method, a model adapted for legal document structure processing can be obtained, enabling automated processing of legal document structure.

[0018] In a feasible embodiment, after inputting non-fixed structure data into a legal document structured model and determining the second structure label corresponding to each paragraph in the non-fixed structure data, the method further includes: if the non-fixed structure data includes a target paragraph with a corresponding second structure label that is not determined by the second structure label, then obtaining basic case information from the fixed structure data, the basic case information including party information, court information, and case number; determining the prior legal document data of the case corresponding to the fixed structure data based on the basic case information, the prior legal document data being used to indicate the court's publicized documents before the generation of the judgment document.

[0019] Text comparison is performed between the non-fixed structure data corresponding to the fixed structure data and the prior legal document data to identify similar paragraphs in the non-fixed structure data and their corresponding prior legal document data with a text similarity greater than the second percentage. If the similar paragraphs contain the target paragraph, the content of the similar paragraphs in the non-fixed structure data is corrected according to the content of the paragraphs corresponding to the similar paragraphs in the prior legal document data. The corrected non-fixed structure data is then input into the legal document structuring model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

[0020] In this embodiment, when a target paragraph in non-fixed structure data has a corresponding second structure tag that is not a determined second structure tag, the non-fixed structure data is checked and corrected based on the prior legal document data corresponding to the legal document data, and then the corrected data is input into the legal document structuring model. Using the aforementioned method, errors in legal document structuring processing caused by document content errors can be resolved.

[0021] In one feasible embodiment, the content of similar paragraphs in non-fixed structure data is checked and corrected based on the content of the paragraphs corresponding to similar paragraphs in prior legal document data. This includes: determining the differences between the similar paragraphs and their corresponding paragraphs in prior legal document data using a cosine similarity algorithm, where the differences include a first difference in the similar paragraphs and a second difference in the prior legal document data; determining a first text of a first length near the location of the first difference in the similar paragraphs; and performing text matching between the first text and other content in the non-fixed structure data using a cosine similarity algorithm to determine whether there is a second text identical to the first text in the other content of the non-fixed structure data.

[0022] If a second text identical to the first text exists in the non-fixed structure data, then determine whether the first difference content is the same as the third difference content corresponding to the first difference content in the second text position; if the first difference content and the third difference content are not the same, and the third difference content is the same as the second difference content, then correct the first difference content in the similar paragraphs to the second difference content; if no second text identical to the first text exists in the non-fixed structure data, then correct the first difference content in the similar paragraphs to the second difference content.

[0023] In this embodiment, a cosine similarity algorithm is used to determine the differences between similar paragraphs and their corresponding paragraphs in prior legal document data. It is then determined whether the statement containing the first difference in the similar paragraph contains other identical statements in the non-fixed-structure data. If identical statements exist, the algorithm checks whether the third difference in the identical statements corresponding to the first difference is the same as the first difference. If they are different, and the third difference is the same as the second difference in the prior legal document data, the first difference is corrected to the second difference. Using this method, accurate correction of erroneous text in the target paragraph can be achieved.

[0024] In a feasible embodiment, the method further includes: storing legal document data in a storage area, wherein the storage area includes a first storage area and a second storage area, the first storage area is used to store fixed structure data, the second storage area is used to store non-fixed structure data, and the storage space of the first storage area is smaller than the storage space of the second storage area; dividing the storage space of the first storage area according to a first structure label, and determining that the fixed structure data corresponding to each structure label in the first structure label is stored in a first sub-storage area of ​​the same storage space size in the first storage area.

[0025] Determine the data size and number of paragraphs of the non-fixed structure data corresponding to the second structure tag, and divide the storage space of the second storage area according to the data size and number of paragraphs. Determine that the non-fixed structure data corresponding to each structure tag in the second structure tag is stored in the second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed structure data in the second storage area. The larger the data size and the number of paragraphs, the larger the corresponding second sub-storage area.

[0026] In this embodiment, fixed-structure data and non-fixed-structure data in legal document data are stored in a first storage area and a second storage area, respectively. The first and second storage areas are then spatially divided such that fixed-structure data corresponding to the first structure tag are stored in a first sub-storage area of ​​the same size within the first storage area, while non-fixed-structure data corresponding to the second structure tag are stored in a second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed-structure data. Using this method, the retrieval of legal document data is facilitated after storage.

[0027] Secondly, embodiments of this application provide a legal document structuring processing apparatus, the apparatus comprising:

[0028] The acquisition unit is used to acquire legal document data, which includes at least one judgment document.

[0029] After the acquisition unit acquires at least one first structural tag existing in each of at least one judgment document, the determination unit is used to determine fixed structural data and non-fixed structural data in the legal document data based on at least one first structural tag. The fixed structural data is the data in the legal document data that corresponds to at least one first structural tag.

[0030] The input unit is used to input non-fixed structure data into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data;

[0031] The unit is also used to determine the structure label corresponding to each paragraph in the legal document data based on the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data.

[0032] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a communication interface. The processor, memory, and communication interface are interconnected and perform communication with each other. The memory stores executable program code, the communication interface is used for wireless communication, and the processor is used to retrieve the executable program code stored in the memory and execute some or all of the steps described in any of the methods in the first aspect.

[0033] Fourthly, embodiments of this application provide a computer-readable storage medium storing electronic data, which, when executed by a processor, is used to perform the electronic data to implement some or all of the steps described in the first aspect of embodiments of this application.

[0034] Fifthly, embodiments of this application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the first aspect of embodiments of this application. The computer program product may be a software installation package. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 A schematic diagram of a legal document structuring system provided in this application embodiment;

[0037] Figure 2 A flowchart illustrating a method for structuring legal documents, provided as an embodiment of this application;

[0038] Figure 3 A schematic diagram of the structure of an example of a court judgment document provided in this application embodiment;

[0039] Figure 4 A schematic diagram of a legal document structure tagging system provided in this application embodiment;

[0040] Figure 5 A flowchart illustrating a method for training a structured legal document model, provided as an embodiment of this application;

[0041] Figure 6a This is a block diagram of the functional units of a legal document structuring device provided in an embodiment of this application;

[0042] Figure 6b This is a block diagram of the functional units of another legal document structuring device provided in this application embodiment;

[0043] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0044] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0045] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps is not limited to the steps listed, but may optionally include steps not listed, or may optionally include other steps inherent to these processes, methods, products, or apparatuses.

[0046] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0047] Please see Figure 1 , Figure 1 A schematic diagram of a legal document structuring system provided in this application embodiment is shown below. Figure 1 As shown, the legal document structuring system 100 includes a legal document acquisition interface 101 and a legal document structuring device 102. The legal document acquisition interface 101 is used to acquire legal document data and send the legal document data to the legal document structuring device 102. The legal document structuring device is used to perform structuring processing on the legal documents.

[0048] Based on this, the embodiments of this application provide a method for structuring legal documents. The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0049] Please see Figure 2 , Figure 2 A flowchart illustrating a method for structuring legal documents, as provided in this application embodiment, is shown below. Figure 2 As shown, the method includes the following steps:

[0050] Step 201: Obtain legal document data, which includes at least one judgment document.

[0051] Among them, judgment documents record the trial process and results of the people's court. They are the carrier of the outcome of litigation activities and the sole evidence for the people's court to determine and allocate the substantive rights and obligations of the parties. For example, please refer to... Figure 3 , Figure 3 A schematic diagram of the structure of an example of a court judgment document provided in this application embodiment, as shown below. Figure 3 As shown, judicial documents are divided into rulings and judgments. Rulings mainly address procedural issues in cases, while judgments mainly address substantive issues. Judgment documents include a title, case number, and basic content, which includes information about the plaintiff, defendant, plaintiff's claims, defendant's defense, and court findings.

[0052] Step 202: Obtain at least one first structure tag in each of the at least one judgment documents, and determine the fixed structure data and non-fixed structure data in the legal document data based on the at least one first structure tag.

[0053] Fixed-structure data refers to data in legal documents that corresponds to at least one first-structure tag. Fixed-structure data in judgment documents refers to formatted content whose placement remains unchanged, such as the court name, case number, and party information. Non-fixed-structure data, on the other hand, refers to non-formatted content whose placement can change, such as the plaintiff's and defendant's claims. The latter's placement varies depending on the judge's writing style or the case's progress. First-structure tags have fixed corresponding positions; fixed-structure data can be directly identified based on the data position corresponding to the first-structure tag. Data not corresponding to a first-structure tag is considered non-fixed-structure data.

[0054] In one feasible embodiment, obtaining at least one first structural tag existing in each of at least one judgment document includes: obtaining historical legal document structure data, which includes multiple judgment documents, each paragraph of the multiple judgment documents having a corresponding structural tag; determining the paragraph position corresponding to all structural tags existing in each judgment document; and using the structural tags that have the same paragraph position in each of the multiple judgment documents as the first structural tag.

[0055] The first structural tag refers to the structural tag corresponding to formatted content whose writing position remains unchanged. Based on historical legal document structure data, it is possible to intuitively identify formatted content with unchanged writing positions in judgments; that is, the same structural tags corresponding to the same paragraph positions are present in every judgment in the historical legal document structure data. This type of structural tag is designated as the first structural tag. Furthermore, the fixed structural data can be determined through the first structural tag; that is, the data corresponding to the first structural tag is the fixed structural data.

[0056] In this embodiment, the paragraph positions corresponding to all structural tags existing in the historical legal document structure data in each judgment document are determined, and the structural tags that have the same paragraph positions in each judgment document are taken as the first structural tags. Using the aforementioned method, the first structural tags can be accurately determined, and fixed structural data can also be directly determined based on the determined first structural tags.

[0057] Step 203: Input the non-fixed structure data into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

[0058] Fixed structure data can directly correspond to the first structure label because its position is fixed, so no additional structuring processing is required. However, non-fixed structure data cannot directly correspond to structure labels. It can also be understood that the specific paragraph position of the second structure label in non-fixed structure data cannot be determined before the judgment is written. Therefore, it needs to be processed according to the legal document structuring model to obtain its corresponding second structure label.

[0059] For example, please refer to Figure 4 , Figure 4 This application provides a schematic diagram of a legal document structure tagging system, as shown in the embodiments below. Figure 4 As shown, the legal document structure tag system includes structural tags such as "Document Title," "Court Name," "Document Name," and "Court Reasoning." Each structural tag has a corresponding paragraph position in the judgment document. Figure 4 The structural tags shown include first structural tags and second structural tags. First structural tags are those with a fixed corresponding paragraph position. For example, the "document title" structural tag exists in the first paragraph position in every judgment document, so "document title" belongs to the first structural tag. Second structural tags are those without a fixed corresponding paragraph position. The paragraph position corresponding to this type of structural tag may change with the judge's writing habits or the progress of the case. For example, the paragraph corresponding to "court reasoning" in the structural tag is in the middle of the judgment document. Its specific paragraph position cannot be determined before writing, so "court reasoning" belongs to the second structural tag.

[0060] In a feasible embodiment, before inputting the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the method further includes: acquiring historical legal document data, which includes multiple judgment documents; performing word segmentation processing on the multiple judgment documents according to the forward maximum matching algorithm to obtain text information corresponding to the multiple judgment documents respectively, and determining first text information based on the text information corresponding to the multiple judgment documents respectively, wherein the first text information is the text information contained in the judgment documents that account for more than a first percentage of the multiple judgment documents, and the text information includes words or phrases; acquiring judgment process information, and determining multiple second text information based on the judgment process information; performing text comparison on the first text information and the second text information to determine the third text information that is the same as the second text information in the first text information, determining the third text information as all structure tags, and taking the structure tags other than the first structure tags as the second structure tags.

[0061] Structural tags are used to mark paragraphs in legal documents, therefore they need to possess common characteristics of each legal document. This embodiment obtains historical legal document data and performs word segmentation on the legal documents in the historical legal document data according to the forward maximum matching algorithm. The forward maximum matching algorithm refers to matching several consecutive characters in the text to be segmented from left to right with the vocabulary. If a match is found, a word is segmented. The maximum matching algorithm also includes the reverse maximum matching algorithm, which refers to matching several consecutive characters in the text to be segmented from right to left with the vocabulary. If a match is found, a word is segmented. The reason why this embodiment uses the forward maximum matching algorithm is that after word segmentation, structural tags are determined based on the obtained words. Structural tags are a summary of the overall content of a paragraph and appear first in the paragraph. For example, if a paragraph contains "the party's name is xx" and the vocabulary includes "the party, the party's name, and the name", it is clear that the paragraph's content highlights the party's name. The forward maximum matching algorithm can obtain the phrase "the party's name", while the reverse maximum matching algorithm obtains the phrases "the party and the name", which violates the intention of this embodiment to use phrases after word segmentation.

[0062] After segmenting historical legal documents using a forward maximum matching algorithm, text information common to more than a first percentage of judgments is identified. This text information is considered a shared feature of the judgments. Since judgments are based on court proceedings, this embodiment also acquires and segments this process information. The forward maximum matching algorithm can also be used for segmenting this process information to identify multiple second text information entries. A text comparison is then performed between the first and second text information entries to identify third text information entries that are identical to the second text information entries. These third text information entries are then identified as all structural tags corresponding to the judgments, making the identified structural tags more accurate and complete. After identifying all structural tags, by excluding the first structural tags, all second structural tags corresponding to non-fixed structure data can be determined.

[0063] In addition, since the drafting of judgment documents is based on the information of the judgment process, the second structural label can also be determined based on the non-fixed process content in the judgment process information. For example, the judgment process information includes the content of evidence presentation and examination, but evidence is generally exchanged before the trial. However, there are special cases where new evidence is presented in court. In this case, the process is a non-fixed process, and the judge will make adjustments accordingly when drafting the judgment document.

[0064] In this embodiment, multiple court judgments are acquired and segmented using a forward maximum matching algorithm to obtain multiple first text information contained in judgments that account for a percentage greater than a first percentage. Judgment process information is then acquired, and multiple second text information is determined based on this information. A text comparison is performed between the multiple first and second text information to identify third text information that is identical to the multiple second text information. This third text information is then identified as all structural tags, and all structural tags other than the first structural tags are identified as second structural tags. Using this method, the second structural tags can be accurately and completely determined, facilitating subsequent structuring of unstructured data.

[0065] In a feasible embodiment, before inputting the non-fixed structure data into the legal document structure model to determine the structure label corresponding to each paragraph in the non-fixed structure data, the method further includes: obtaining historical legal document structure data, which includes multiple judgment documents, and each paragraph in the multiple judgment documents has a corresponding actual second structure label.

[0066] An initial model is created by inputting historical legal document structure data into the initial model. The initial model includes an input layer, an embedding layer, an encoding layer, and a computation layer. The input layer is used to divide the judgment document into multiple paragraphs based on natural paragraphs. The embedding layer is used to encode the judgment document of each paragraph in the multiple paragraphs using a bidirectional encoder BERT to determine multiple vector matrices. The encoding layer is used to encode the multiple vector matrices using a bidirectional long short-term memory neural network Bi-LSTM to obtain an output matrix. The computation layer determines different predicted second structure labels corresponding to each paragraph based on the output matrix.

[0067] The actual and predicted second structure labels of each paragraph are used to calculate a loss function. When the result of the loss function calculation is greater than a preset threshold, the initial model is adjusted to obtain the adjusted model. Multiple paragraphs of the judgment document are input into the adjusted model, and the processing of the input layer, embedding layer, encoding layer and operation layer is repeated until it is determined that the result of the loss function calculation is not greater than the preset threshold. At this point, the adjusted model is determined to be the legal document structure model.

[0068] In the model optimization process, the Adam optimizer or other optimizers such as SGD (Stochastic Gradientdescent) can be used, and the loss function can be expressed as: Where q(xi) is the probability value of each paragraph belonging to the structural label xi, and p(xi) is the actual structural label of the corresponding paragraph.

[0069] After obtaining the final structured model of legal documents, when inputting non-fixed-structure data into the model, the input layer divides the data into multiple paragraphs based on natural segments for subsequent paragraph labeling. After inputting multiple paragraphs into the embedding layer, the embedding layer feeds these paragraphs into the BERT model, obtaining multiple word embedding vector matrices. BERT is a bidirectional encoder based on the Transformer model, using a Transformer encoding structure with a self-attention mechanism to obtain context-based text representations. After feeding the multiple word embedding vector matrices into the computation layer, the computation layer can determine the structural label corresponding to each paragraph. This determination can be achieved by assessing the matching degree of each paragraph to different structural labels, and then determining the structural label based on this matching. This matching degree can be represented by probability values ​​or weight values. If determining the structural label by determining probability values, the computation layer can use a Conditional Random Field (CRF) model. CRF is a discriminative probability model, a type of random field, commonly used for labeling or analyzing sequential data.

[0070] For example, please refer to Figure 5 , Figure 5A flowchart illustrating a method for training a structured legal document model, as provided in this application embodiment, is shown below. Figure 5 As shown, in the input layer, legal documents {Xi,Y} are input... i} is divided into several paragraphs based on natural paragraphs, denoted as {(D1, D2, ..., Dn), Y}. In the word embedding layer, paragraphs (D1, D2, ..., Dn) are fed into the BERT model. The BERT model shares parameters for each paragraph, obtaining a word embedding vector matrix (e1, e2, ..., en). The word embedding vector matrix is ​​input into the encoding layer and encoded by context to obtain the output matrix (E1, E2, ..., En). The output matrix is ​​input into the computation layer to obtain the probability value of each paragraph belonging to different structural labels, thereby determining the different structural labels corresponding to each paragraph.

[0071] In this embodiment, an initial model is created by inputting historical legal document structure data. This initial model includes an input layer, a word embedding layer, an encoding layer, and a computation layer. The historical legal document structure data is processed to obtain predicted second structure labels for each paragraph. A loss function is then calculated between the predicted and actual second structure labels for each paragraph to adjust the model, ultimately resulting in a final adjusted legal document structure model. Using this method, a model adapted for legal document structure processing can be obtained, enabling automated processing of legal document structure.

[0072] In a feasible embodiment, after inputting non-fixed structure data into a legal document structured model and determining the second structure label corresponding to each paragraph in the non-fixed structure data, the method further includes: if the non-fixed structure data includes a target paragraph with a corresponding second structure label that is not determined by the second structure label, then obtaining basic case information from the fixed structure data, the basic case information including party information, court information, and case number; determining the prior legal document data of the case corresponding to the fixed structure data based on the basic case information, the prior legal document data being used to indicate the court's publicized documents before the generation of the judgment document.

[0073] Text comparison is performed between the non-fixed structure data corresponding to the fixed structure data and the prior legal document data to identify similar paragraphs in the non-fixed structure data and their corresponding prior legal document data with a text similarity greater than the second percentage. If the similar paragraphs contain the target paragraph, the content of the similar paragraphs in the non-fixed structure data is corrected according to the content of the paragraphs corresponding to the similar paragraphs in the prior legal document data. The corrected non-fixed structure data is then input into the legal document structuring model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

[0074] In this legal document structure model, the structural tags corresponding to the target paragraph are determined based on the matching degree between the target paragraph and all second structural tags. However, when the target paragraph has a similar and high matching degree with two of the second structural tags, it becomes impossible to determine the second structural tag corresponding to that paragraph. In this case, it is necessary to consider whether there is any erroneous content in the paragraph, as general document checking cannot accurately find erroneous content in paragraphs. This embodiment uses prior legal document data corresponding to the case for document checking and correction. Prior legal document data refers to court-published documents before the judgment is generated, such as complaints and answers. Judges copy the contents of complaints and answers when drafting judgments, and errors may occur during copying. Therefore, the judgment is corrected based on prior legal document data.

[0075] Specifically, the non-fixed-structure data in the legal document data is compared with the corresponding prior legal document data to identify similar paragraphs in the non-fixed-structure data that have a text similarity greater than the second percentage in the prior legal document data. This text comparison can be performed using cosine similarity. If the target paragraph is found to be included in the similar paragraph, the corresponding part of the non-fixed-structure data is corrected based on the similar paragraph, and then the corrected non-fixed-structure data is re-input into the legal document structure model.

[0076] In this embodiment, when a target paragraph in non-fixed structure data has a corresponding second structure tag that is not a determined second structure tag, the non-fixed structure data is checked and corrected based on the prior legal document data corresponding to the legal document data, and then the corrected data is input into the legal document structuring model. Using the aforementioned method, errors in legal document structuring processing caused by document content errors can be resolved.

[0077] In one feasible embodiment, the content of similar paragraphs in non-fixed structure data is checked and corrected based on the content of the paragraphs corresponding to similar paragraphs in prior legal document data. This includes: determining the differences between the similar paragraphs and their corresponding paragraphs in prior legal document data using a cosine similarity algorithm, where the differences include a first difference in the similar paragraphs and a second difference in the prior legal document data; determining a first text of a first length near the location of the first difference in the similar paragraphs; and performing text matching between the first text and other content in the non-fixed structure data using a cosine similarity algorithm to determine whether there is a second text identical to the first text in the other content of the non-fixed structure data.

[0078] If a second text identical to the first text exists in the non-fixed structure data, then determine whether the first difference content is the same as the third difference content corresponding to the first difference content in the second text position; if the first difference content and the third difference content are not the same, and the third difference content is the same as the second difference content, then correct the first difference content in the similar paragraphs to the second difference content; if no second text identical to the first text exists in the non-fixed structure data, then correct the first difference content in the similar paragraphs to the second difference content.

[0079] Cosine similarity primarily calculates the similarity between texts based on word frequencies, without considering semantics. This embodiment modifies the content of the text and does not address its semantics; therefore, cosine similarity is more suitable for text similarity calculation in this embodiment. For example, the texts "This is not bad" and "This is acceptable" are considered the same text if semantics are taken into account, but not if semantics are disregarded.

[0080] The cosine similarity is used to determine the differences between the similar paragraph and the corresponding paragraph in a prior legal document. The second percentage is a relatively high percentage, and the differences correspond to words or phrases, not long text. Directly modifying based on the two differences would not determine which of the two differences is problematic. Therefore, the first difference in the similar paragraph is also determined by identifying a first text of a first length near the similar paragraph. Based on the first text, it is determined whether a second text identical to the first text exists in the non-fixed structure data, and the third difference corresponding to the second text's position and the first difference is determined. For example, if the first difference is "location" and the corresponding statement is "the defendant claimed his actions were legitimate," with a first length of five, then the first text would be "the actions were legitimate." If the first and third differences are different, but the third difference is identical to the second difference in a prior legal document, then the first difference is determined to have a writing error, and it needs to be modified to the second difference.

[0081] In addition, if there is no second text, the first difference content can be modified to the second difference content first. After inputting it into the legal document structure model, if the structure label corresponding to the target paragraph is a definite second structure label, it means that the modification is correct. If the structure label corresponding to the target paragraph is still an uncertain second structure label, it should be modified back to the original first difference content.

[0082] In this embodiment, a cosine similarity algorithm is used to determine the differences between similar paragraphs and their corresponding paragraphs in prior legal document data. It is then determined whether the statement containing the first difference in the similar paragraph contains other identical statements in the non-fixed-structure data. If identical statements exist, the algorithm checks whether the third difference in the identical statements corresponding to the first difference is the same as the first difference. If they are different, and the third difference is the same as the second difference in the prior legal document data, the first difference is corrected to the second difference. Using this method, accurate correction of erroneous text in the target paragraph can be achieved.

[0083] Step 204: Determine the structure label corresponding to each paragraph in the legal document data based on the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data.

[0084] After determining the second structural label corresponding to each paragraph in the non-fixed structure data based on the legal document structure model, the fixed structure data and non-fixed structure data can be integrated to determine the structural label corresponding to each paragraph in the entire legal document. The structuring of legal documents mainly involves assigning corresponding structural labels to their content, allowing direct retrieval of the relevant content based on these labels, facilitating categorization and subsequent document searching.

[0085] In a feasible embodiment, legal document data is stored in a storage area, which includes a first storage area and a second storage area. The first storage area is used to store fixed-structure data, and the second storage area is used to store non-fixed-structure data. The storage space of the first storage area is smaller than that of the second storage area. The storage space of the first storage area is divided according to the first structure label, and the fixed-structure data corresponding to each structure label in the first structure label is stored in a first sub-storage area of ​​the same storage space size in the first storage area.

[0086] Determine the data size and number of paragraphs of the non-fixed structure data corresponding to the second structure tag, and divide the storage space of the second storage area according to the data size and number of paragraphs. Determine that the non-fixed structure data corresponding to each structure tag in the second structure tag is stored in the second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed structure data in the second storage area. The larger the data size and the number of paragraphs, the larger the corresponding second sub-storage area.

[0087] After structuring legal documents, they need to be stored in a storage area. However, if they are stored directly in the storage area, document retrieval would require accessing all document data in the entire storage area, impacting retrieval speed. Therefore, in this embodiment, after structuring the legal document data, fixed-structure data and non-fixed-structure data are stored in the first and second storage areas of the storage area, respectively. Fixed-structure data consists of template content fixed by the judge during drafting, and its content is less than that of non-fixed-structure data. Therefore, the storage space in the first storage area is smaller than that in the second storage area. Furthermore, the data size of the paragraph content corresponding to each first structure tag in the fixed-structure data is roughly the same. Therefore, the fixed-structure data corresponding to each first structure tag in the first storage area is stored in a first sub-storage area of ​​the same size within the first storage area.

[0088] The data size of non-fixed structure data in different legal documents may vary significantly, and the data size of non-fixed structure data corresponding to each second structure tag may also vary significantly. Therefore, the storage space division method in the first storage area is not applicable to the storage space division in the second storage area. While the number of paragraphs is not directly proportional to the data size, the difference in the number of paragraphs corresponding to the same second structure tag in different legal documents is relatively small. Within a single legal document, the data size of non-fixed structure data corresponding to a second structure tag with fewer paragraphs may be larger than that corresponding to a second structure tag with more paragraphs. However, this is less likely to occur across multiple legal documents. Therefore, in this embodiment, the storage space division in the second storage area is based on the data size of the non-fixed structure data corresponding to the second structure tag and the number of paragraphs.

[0089] In addition, after calculating the amount of data corresponding to each structural tag in multiple legal document data, the storage space can be divided according to the amount of data corresponding to each structural tag. At the same time, since the drafting of legal documents is based on the trial process, the division of storage space can also refer to the trial process information, and allocate more storage space according to the structural tags corresponding to the processes that take more time in the trial process.

[0090] In this embodiment, fixed-structure data and non-fixed-structure data in legal document data are stored in a first storage area and a second storage area, respectively. The first and second storage areas are then spatially divided such that fixed-structure data corresponding to the first structure tag are stored in a first sub-storage area of ​​the same size within the first storage area, while non-fixed-structure data corresponding to the second structure tag are stored in a second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed-structure data. Using this method, the retrieval of legal document data is facilitated after storage.

[0091] As can be seen, in this embodiment, legal document data is obtained, including at least one judgment document; at least one first structural tag exists in each of the at least one judgment document, and fixed-structure data and non-fixed-structure data in the legal document data are determined based on the at least one first structural tag; the non-fixed-structure data is input into a legal document structuring model to determine the second structural tag corresponding to each paragraph in the non-fixed-structure data; and the structural tag corresponding to each paragraph in the legal document data is determined based on the first structural tag corresponding to the fixed-structure data and the second structural tag corresponding to the non-fixed-structure data. Using the aforementioned method, the structuring processing of legal documents can be achieved, facilitating the summarization, classification, and subsequent retrieval of legal documents.

[0092] For embodiments consistent with those shown above, please refer to... Figure 6a , Figure 6a This is a functional unit block diagram of a legal document structuring processing device provided in an embodiment of this application, such as... Figure 6a As shown, the legal document structuring device 60 includes:

[0093] The acquisition unit 601 is used to acquire legal document data, which includes at least one judgment document.

[0094] After the acquisition unit 601 acquires at least one first structure tag existing in each of the at least one judgment document, the determination unit 602 is used to determine the fixed structure data and non-fixed structure data in the legal document data based on at least one first structure tag. The fixed structure data is the data in the legal document data that corresponds to at least one first structure tag.

[0095] Input unit 603 is used to input non-fixed structure data into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data;

[0096] The determining unit 602 is also used to determine the structure label corresponding to each paragraph in the legal document data based on the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data.

[0097] In a feasible embodiment, the acquisition unit 601 is used to acquire at least one first structural tag existing in each of at least one judgment document, including: acquiring historical legal document structure data, which includes multiple judgment documents, each paragraph of the multiple judgment documents having a corresponding structural tag; determining the paragraph position corresponding to all structural tags existing in the judgment documents in each judgment document; and taking the structural tags that have the same paragraph position in each of the multiple judgment documents as the first structural tag.

[0098] In a feasible embodiment, before the input unit 603 inputs the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the device further includes: an acquisition unit 601, used to acquire historical legal document data, which includes multiple judgment documents; a processing unit 604, used to perform word segmentation processing on the multiple judgment documents according to the forward maximum matching algorithm to obtain text information corresponding to the multiple judgment documents respectively, and to determine first text information based on the text information corresponding to the multiple judgment documents respectively, wherein the first text information is the text information contained in the judgment documents that are greater than a first percentage among the multiple judgment documents, and the text information includes words or phrases; the acquisition unit 601, used to acquire judgment process information, and to determine multiple second text information based on the judgment process information; to perform text comparison on the first text information and the second text information, to determine the third text information that is the same as the second text information in the first text information, to determine the third text information as all structure tags, and to take the structure tags other than the first structure tags among all structure tags as the second structure tags.

[0099] In a feasible embodiment, before the input unit 603 inputs the non-fixed structure data into the legal document structure model to determine the structure label corresponding to each paragraph in the non-fixed structure data, the device further includes: an acquisition unit 601, used to acquire historical legal document structure data, which includes multiple judgment documents, and each paragraph in the multiple judgment documents has a corresponding actual second structure label.

[0100] An initial model is created by inputting historical legal document structure data into the input unit 603. The initial model includes an input layer, an embedding layer, an encoding layer, and a computation layer. The input layer divides the judgment document into multiple paragraphs based on natural paragraphs. The embedding layer encodes each paragraph of the judgment document using a bidirectional encoder representation from transformers (BERT) to determine multiple vector matrices. The encoding layer encodes the multiple vector matrices using a bidirectional long short-term memory neural network (Bi-LSTM) to obtain an output matrix. The computation layer determines different predicted second structure labels for each paragraph based on the output matrix.

[0101] The processing unit 604 is used to calculate the loss function for the actual second structure label and the predicted second structure label of each paragraph. When the loss function calculation result is greater than a preset threshold, the initial model is adjusted to obtain the adjusted model. Multiple paragraphs of the judgment document are input into the adjusted model, and the processing of the input layer, embedding layer, encoding layer and operation layer is repeated until it is determined that the loss function calculation result is not greater than the preset threshold. Then, the adjusted model is determined to be the legal document structure model.

[0102] In a feasible embodiment, after the input unit 603 inputs the non-fixed structure data into the legal document structured model and determines the second structure label corresponding to each paragraph in the non-fixed structure data, the device further includes: if the non-fixed structure data includes a target paragraph with a corresponding second structure label that is not determined by the second structure label, then the acquisition unit 601 acquires the basic case information in the fixed structure data, which includes party information, court information, and case number; and determines the prior legal document data of the case corresponding to the fixed structure data based on the basic case information, which is used to indicate the court's publicized documents before the generation of the judgment document.

[0103] Processing unit 604 performs text comparison between the non-fixed structure data corresponding to the fixed structure data and the prior legal document data, and determines similar paragraphs in the non-fixed structure data and the corresponding prior legal document data whose text similarity is greater than the second percentage; if the similar paragraphs contain the target paragraph, then the content of the similar paragraphs in the non-fixed structure data is corrected according to the content of the paragraphs corresponding to the similar paragraphs in the prior legal document data, and the corrected non-fixed structure data is input into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

[0104] In a feasible embodiment, the processing unit 604 checks and corrects the content of similar paragraphs in the non-fixed structure data based on the content of the paragraphs corresponding to the similar paragraphs in the prior legal document data. This includes: determining the differences between the similar paragraphs and the paragraphs corresponding to the similar paragraphs in the prior legal document data based on a cosine similarity algorithm, wherein the differences include a first difference in the similar paragraphs and a second difference in the prior legal document data; determining a first text of a first length near the location where the first difference exists in the similar paragraphs, and performing text matching between the first text and other content in the non-fixed structure data based on a cosine similarity algorithm to determine whether there is a second text in the other content of the non-fixed structure data that is identical to the first text.

[0105] If a second text identical to the first text exists in the non-fixed structure data, then determine whether the first difference content is the same as the third difference content corresponding to the first difference content in the second text position; if the first difference content and the third difference content are not the same, and the third difference content is the same as the second difference content, then correct the first difference content in the similar paragraphs to the second difference content; if no second text identical to the first text exists in the non-fixed structure data, then correct the first difference content in the similar paragraphs to the second difference content.

[0106] In one feasible embodiment, the device further includes: a storage unit 605 for storing legal document data in a storage area, wherein the storage area includes a first storage area and a second storage area, the first storage area is used to store fixed structure data, the second storage area is used to store non-fixed structure data, and the storage space of the first storage area is smaller than the storage space of the second storage area; the first storage area is divided into storage spaces according to a first structure label, and it is determined that the fixed structure data corresponding to each structure label in the first structure label is stored in a first sub-storage area of ​​the same storage space size in the first storage area.

[0107] Determine the data size and number of paragraphs of the non-fixed structure data corresponding to the second structure tag, and divide the storage space of the second storage area according to the data size and number of paragraphs. Determine that the non-fixed structure data corresponding to each structure tag in the second structure tag is stored in the second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed structure data in the second storage area. The larger the data size and the number of paragraphs, the larger the corresponding second sub-storage area.

[0108] It is understood that since the method embodiments and the device embodiments are different presentations of the same technical concept, the content of the method embodiment section in this application should be adapted to the device embodiment section in a synchronous manner, and will not be repeated here.

[0109] When using integrated units, such as Figure 6b As shown, Figure 6b This is a block diagram of the functional units of another legal document structuring processing device provided in this application embodiment. Figure 6b The legal document structure processing apparatus 61 includes a processing module 612 and a communication module 611. The processing module 612 controls and manages the operations of the legal document structure processing apparatus, such as the steps of the acquisition unit 601, the determination unit 602, the input unit 603, the processing unit 604, and the storage unit 605, and / or other processes for performing the techniques described herein. The communication module 611 supports interaction between the legal document structure processing apparatus and other devices. Figure 6b As shown, the legal document structuring processing device 61 may further include a storage module 613, which is used to store the program code and data of the legal document structuring processing device.

[0110] The processing module 612 can be a processor or controller, such as a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an ASIC, an FPGA, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. The communication module 611 can be a transceiver, RF circuitry, or a communication interface, etc. The storage module 613 can be a memory.

[0111] All relevant content in each scenario involved in the above method embodiments can be referenced from the functional descriptions of the corresponding functional modules, and will not be repeated here. The above-mentioned legal document structuring processing device 61 can execute the above-mentioned... Figure 2 The method for structuring legal documents is shown.

[0112] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. A computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media. Semiconductor media can be solid-state drives.

[0113] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of this application. For example... Figure 7 As shown, the electronic device 700 may include one or more of the following components: a processor 701 and a memory 702 coupled to the processor 701, wherein the memory 702 may store one or more computer programs, which may be configured to implement the methods described in the above embodiments when executed by one or more processors 701.

[0114] Processor 701 may include one or more processing cores. Processor 701 connects to various parts within the electronic device 700 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 702, and by calling data stored in memory 702. Optionally, processor 701 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 701 may integrate one or more of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. It is understood that the aforementioned modem may also not be integrated into processor 701, but may be implemented separately through a communication chip.

[0115] The memory 702 may include random access memory (RAM) or read-only memory (ROM). The memory 702 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 702 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described above. The data storage area may also store data created by the electronic device 700 during use.

[0116] It is understood that the electronic device 700 may include more or fewer structural elements than those shown in the above block diagram, such as a power module, physical buttons, a WiFi (Wireless Fidelity) module, a speaker, a Bluetooth module, sensors, etc., without limitation.

[0117] This application provides a computer-readable storage medium storing program data, which, when executed by a processor, is used to perform some or all of the steps of any of the legal document structuring methods described in the above method embodiments.

[0118] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the legal document structuring processing methods described in the above method embodiments. The computer program product can be a software installation package.

[0119] It should be noted that, for the sake of simplicity, all the aforementioned embodiments of the legal document structuring method are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to this application.

[0120] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce a good effect.

[0121] Those skilled in the art will understand that all or part of the steps in the various method embodiments of any of the above-described legal document structuring methods can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk, or an optical disk, etc.

[0122] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principle and implementation of a legal document structuring method and apparatus of this application. The description of the above embodiments is only for the purpose of helping to understand the method and its core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the ideas of a legal document structuring method and apparatus of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

[0123] This application is described with reference to flowchart illustrations and / or block diagrams of methods, hardware products, and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0124] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0125] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0126] It is understood that any product that is controlled or configured to execute the processing method described in the flowchart of the method embodiment of the legal document structuring processing method of this application, such as the terminal and computer program product of the above flowchart, falls within the scope of the related products described in this application.

[0127] Obviously, those skilled in the art can make various modifications and variations to the legal document structuring processing method and apparatus provided in this application without departing from the spirit and scope of this application. Therefore, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.

Claims

1. A method for structuring legal documents, characterized in that, The method includes: Acquire legal document data, wherein the legal document data includes at least one judgment document; Obtain at least one first structure tag existing in each of the at least one judgment document, and determine fixed structure data and non-fixed structure data in the legal document data based on the at least one first structure tag, wherein the fixed structure data is the data in the legal document data corresponding to the at least one first structure tag; The non-fixed structure data is input into the legal document structure model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data; The structure label corresponding to each paragraph in the legal document data is determined based on the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data. After inputting the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the method further includes: If the non-fixed structure data includes a target paragraph with a corresponding second structure label that is not a determined second structure label, then the basic case information in the fixed structure data is obtained. The basic case information includes party information, court information, and case number. Based on the basic information of the case, the prior legal document data of the case corresponding to the fixed structure data is determined, and the prior legal document data is used to indicate the court's public documents before the judgment is generated; Text comparison is performed between the non-fixed structure data corresponding to the fixed structure data and the prior legal document data to determine the similar paragraphs in the non-fixed structure data and the corresponding prior legal document data with a text similarity greater than the second percentage. If the target paragraph is found to be included in the similar paragraphs, the content of the similar paragraphs in the non-fixed structure data is corrected according to the content of the paragraph corresponding to the similar paragraph in the prior legal document data. The corrected non-fixed structure data is then input into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

2. The method according to claim 1, characterized in that, The step of obtaining at least one first structural tag existing in each of the at least one judgment document includes: Obtain historical legal document structure data, which includes multiple judgment documents, and each paragraph in the multiple judgment documents has a corresponding structure tag; Determine the paragraph positions of all structural tags present in the judgment documents in each judgment document; The structural tag that has the same paragraph position in each of the multiple judgment documents is used as the first structural tag.

3. The method according to claim 2, characterized in that, Before inputting the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the method further includes: Obtain historical legal document data, which includes multiple judgment documents; The multiple judgment documents are segmented according to the forward maximum matching algorithm to obtain the text information corresponding to each of the multiple judgment documents. The first text information is determined according to the text information corresponding to each of the multiple judgment documents. The first text information is the text information contained in the judgment documents that account for more than a first percentage of the multiple judgment documents. The text information includes words or phrases. Obtain referee process information and determine multiple second text information based on the referee process information; The first text information and the second text information are compared to identify the third text information that is the same as the second text information. The third text information is identified as all structural tags, and the structural tags other than the first structural tag are identified as the second structural tags.

4. The method according to any one of claims 1-3, characterized in that, Before inputting the non-fixed structure data into the legal document structured model to determine the structure tag corresponding to each paragraph in the non-fixed structure data, the method further includes: Obtain historical legal document structure data, which includes multiple judgment documents, and each paragraph in the multiple judgment documents has a corresponding actual second structure tag; An initial model is created by inputting the historical legal document structure data into the initial model. The initial model includes an input layer, an embedding layer, an encoding layer, and a computation layer. The input layer is used to divide the judgment document into multiple paragraphs based on natural paragraphs. The embedding layer is used to encode the judgment document of each paragraph in the multiple paragraphs using a bidirectional encoder BERT to determine multiple vector matrices. The encoding layer is used to encode the multiple vector matrices using a bidirectional long short-term memory neural network Bi-LSTM to obtain an output matrix. The computation layer determines different predicted second structure labels corresponding to each paragraph based on the output matrix. The actual second structure label and the predicted second structure label of each paragraph are used to calculate the loss function. When the result of the loss function calculation is greater than a preset threshold, the initial model is adjusted to obtain the adjusted model. Multiple paragraphs of the judgment document are input into the adjusted model, and the processing of the input layer, the embedding layer, the encoding layer and the operation layer is repeated until the loss function calculation result is determined to be no greater than the preset threshold. Then, the adjusted model is determined to be the legal document structured model.

5. The method according to claim 1, characterized in that, The step of checking and correcting the content of similar paragraphs in the non-fixed structure data based on the content of the corresponding paragraphs in the prior legal document data includes: The cosine similarity algorithm is used to determine the differences between the similar paragraph and its corresponding paragraph in the prior legal document data. The differences include a first difference in the similar paragraph and a second difference in the prior legal document data. Determine a first text of a first length near the location where the first difference content exists in the similar paragraph, and perform text matching between the first text and other content in the non-fixed structure data according to the cosine similarity algorithm to determine whether there is a second text in the other content of the non-fixed structure data that is the same as the first text; If there is a second text in the non-fixed structure data that is the same as the first text, then determine whether the first difference content is the same as the third difference content corresponding to the position of the first difference content in the second text; If the first difference content is not the same as the third difference content, and the third difference content is the same as the second difference content, then the first difference content in the similar paragraphs is corrected to the second difference content.

6. The method according to claim 1, characterized in that, The method further includes: The legal document data is stored in a storage area, which includes a first storage area and a second storage area. The first storage area is used to store fixed-structure data, and the second storage area is used to store non-fixed-structure data. The storage space of the first storage area is smaller than that of the second storage area. Based on the first structural label, the first storage area is divided into storage spaces, and the fixed structural data corresponding to each structural label in the first structural label is stored in the first sub-storage area with the same storage space size in the first storage area. The data size and number of paragraphs of the non-fixed structure data corresponding to the second structure tag are determined, and the storage space of the second storage area is divided according to the data size and the number of paragraphs. The non-fixed structure data corresponding to each structure tag in the second structure tag is stored in a second sub-storage area corresponding to the data size and number of paragraphs of the non-fixed structure data in the second storage area. The larger the data size and the number of paragraphs, the larger the corresponding second sub-storage area.

7. A legal document structuring processing device, characterized in that, The device includes: An acquisition unit is used to acquire legal document data, wherein the legal document data includes at least one judgment document; After the acquisition unit acquires at least one first structural tag existing in each of the at least one judgment document, the determination unit is used to determine fixed structural data and non-fixed structural data in the legal document data according to the at least one first structural tag, wherein the fixed structural data is the data in the legal document data that corresponds to the at least one first structural tag; An input unit is used to input the non-fixed structure data into a legal document structured model to determine the second structure label corresponding to each paragraph in the non-fixed structure data; The determining unit is further configured to determine the structure label corresponding to each paragraph in the legal document data based on the first structure label corresponding to the fixed structure data and the second structure label corresponding to the non-fixed structure data; After inputting the non-fixed structure data into the legal document structured model to determine the second structure tag corresponding to each paragraph in the non-fixed structure data, the device further includes: If the non-fixed structure data includes a target paragraph with a corresponding second structure tag that is not a determined second structure tag, then the acquisition unit is further configured to: Obtain basic case information from the fixed structure data, including party information, court information, and case number; Based on the basic information of the case, the prior legal document data of the case corresponding to the fixed structure data is determined, and the prior legal document data is used to indicate the court's public documents before the judgment is generated; The processing unit is also used for: Text comparison is performed between the non-fixed structure data corresponding to the fixed structure data and the prior legal document data to determine the similar paragraphs in the non-fixed structure data and the corresponding prior legal document data with a text similarity greater than the second percentage. If the target paragraph is found to be included in the similar paragraphs, the content of the similar paragraphs in the non-fixed structure data is corrected according to the content of the paragraph corresponding to the similar paragraph in the prior legal document data. The corrected non-fixed structure data is then input into the legal document structure model to determine the second structure label corresponding to each paragraph in the non-fixed structure data.

8. An electronic device, characterized in that, The device includes: The processor, the memory, and the communication interface are interconnected and perform communication between them. The memory stores executable program code, and the communication interface is used for wireless communication. The processor is configured to retrieve the executable program code stored in the memory and execute the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer program for storing electronic data interchange is provided, wherein the computer program causes a computer to perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Case legal regulation recommending method and system

    CN107818138A

  • Text error correction method and device, electronic equipment and storage medium

    CN114282546A