A method, system, device and storage medium for automatically segmenting legal documents

Through iterative training and fine -tuning of the BERT model, a model for automatic cutting legal documents is generated to solve the problem of lack of accuracy of the field dependence and diversity documentation of legal documents in the existing technology, and realize the efficiency and accuracy. Accurate automatic cutting effect.

CN118334690BActive Publication Date: 2025-01-28BEIJING YINGYAN CHUANGXIN TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410109229.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2025-01-28
Estimated Expiration
2044-01-25

AI Technical Summary

Technical Problem

When handling legal documents, the prior art relies on the characteristics and rules of manual design, and there are problems such as strong field dependence, difficulty in dealing with diverse documents and insufficient accuracy of segmentation.

Method used

Use the Bert model for iterative training, capture the meaning of the text and the context information, and generate a second bert model by fine -tuning the classifier to automatically divide the legal documents.

Benefits of technology

The automatic segmentation of legal documents has been realized, the accuracy and efficiency of cutting points are improved, and it can adapt to different fields and diversity documents, and reduce the cost of manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334690B_ABST
    Figure CN118334690B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, system, device and storage medium for automatically segmenting legal documents. After receiving the legal document file to be segmented, the embodiment of the present invention uses OCR to identify the legal document file to obtain the first legal document information; performs a preset number of iterative training on the preset BERT model to generate a first BERT model that has completed preliminary training, and uses a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model; the first legal document information is input into the second BERT model for automatic segmentation to generate the segmented second legal document information. The embodiment of the present invention realizes the automatic segmentation of legal documents after OCR recognition, and the segmentation results are more accurate and efficient, and can segment a variety of document types, so that the content of different media types in the electronic file can be accurately segmented, which improves the comprehensiveness and practicality of electronic file processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and specifically to a method, system, device and storage medium for automatically segmenting legal documents. Background Art

[0002] With the development of society and the progress of the legal industry, the processing volume of legal documents has shown a rapid growth trend. Traditional legal document processing methods often rely on manual operations, using manually designed features and rules. The process includes data preprocessing, feature extraction, classification and segmentation, which is inefficient and prone to errors. Moreover, it is based on rules, keyword matching or traditional machine learning methods, but these methods have limited adaptability and generalization capabilities, have strong field dependence, and are difficult to process diverse documents, and the segmentation accuracy is insufficient. Summary of the invention

[0003] To this end, embodiments of the present invention provide a method, system, device and storage medium for automatically segmenting legal documents to solve the technical problems that the existing technology uses manually designed features and rules that have strong domain dependence and are difficult to process diverse documents, and the segmentation accuracy is insufficient.

[0004] In order to achieve the above purpose, the embodiment of the present invention provides the following technical solutions:

[0005] According to a first aspect of an embodiment of the present invention, a method for automatically segmenting a legal document is provided, wherein the method comprises:

[0006] S1. Receive a legal document file to be segmented, identify the legal document file by using OCR, and obtain first legal document information;

[0007] S2, iteratively train the preset BERT model for a preset number of times, capture the word meaning and context information of the text and extract features, automatically learn features and rules based on the extracted features, generate a first BERT model that has completed preliminary training, and use a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model;

[0008] S3. Input the first legal document information into the second BERT model for automatic segmentation to generate segmented second legal document information.

[0009] Furthermore, the preset BERT model is iteratively trained for a preset number of times to capture the meaning and context information of the text and extract features, including:

[0010] Acquire a large amount of unlabeled training document data and extract contextual relationships from the training document data;

[0011] Extract the bidirectional self-attention encoder from the preset BERT model;

[0012] The bidirectional self-attention encoder is deeply trained by jointly adjusting the contextual relationships in all layers to achieve deep semantic understanding and contextual relationship extraction.

[0013] Furthermore, features and rules are automatically learned based on the extracted features to generate a first BERT model that has completed preliminary training, including:

[0014] Determine whether the current number of training times is equal to the preset number of training times;

[0015] If the current number of training times is equal to the preset number of times, the iterative training is stopped and the first BERT model that has completed the preliminary training is generated;

[0016] If the current number of training times is less than the preset number, the iterative training continues until the current number of training times is equal to the preset number.

[0017] Further, fine-tuning the first BERT model using a fine-tuning classifier to generate a second BERT model includes:

[0018] Adding a new random initialization layer to the first BERT model, and updating the network parameters of the first BERT model to generate a second BERT model;

[0019] Among them, updating the network parameters of the first BERT model includes fixing the bottom layer parameters and adjusting the parameters of the top layer / specific layer to prevent the pre-trained parameters from changing too much.

[0020] Furthermore, the legal document information includes text, tables and images.

[0021] According to a second aspect of an embodiment of the present invention, a system for automatically segmenting legal documents is provided, the system comprising:

[0022] A preprocessing module, used for receiving the legal document image to be segmented, recognizing the legal document image by using OCR, and obtaining first legal document information;

[0023] A training module, used to perform a preset number of iterative training on a preset BERT model, capture the meaning of words and context information of the text and extract features, automatically learn features and rules based on the extracted features, generate a first BERT model that has completed preliminary training, and use a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model;

[0024] A segmentation module is used to input the first legal document information into the second BERT model for automatic segmentation to generate segmented second legal document information.

[0025] According to a third aspect of an embodiment of the present invention, there is provided a device for automatically segmenting legal documents, the device comprising: a processor and a memory;

[0026] The memory is used to store one or more program instructions;

[0027] The processor is used to run one or more program instructions to execute the steps of a method for automatically segmenting legal documents as described in any of the above items.

[0028] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of a method for automatically segmenting legal documents as described in any one of the above items are implemented.

[0029] The embodiments of the present invention have the following advantages:

[0030] After receiving the legal document file to be segmented, the embodiment of the present invention uses OCR to identify the legal document file to obtain the first legal document information; it iterates the preset BERT model for a preset number of times to capture the word meaning and context information of the text and extract features, automatically learns features and rules based on the extracted features, generates a first BERT model that has completed preliminary training, and uses a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model; the first legal document information is input into the second BERT model for automatic segmentation to generate the segmented second legal document information. The embodiment of the present invention realizes the automatic segmentation of legal documents after OCR recognition by utilizing the deep semantic understanding and contextual relationship extraction capabilities of the BERT model, combined with the specific task optimization of the fine-tuning classifier, and the segmentation results are more accurate and efficient, and can segment a variety of document types, so that the content of different media types in the electronic file can be accurately segmented, improving the comprehensiveness and practicality of electronic file processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0032] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0033] Figure 1 A schematic diagram of the logical structure of a system for automatically segmenting legal documents provided by an embodiment of the present invention;

[0034] Figure 2 A flowchart of a method for automatically segmenting legal documents provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] With the development of society and the progress of the legal industry, the processing volume of legal documents has shown a rapid growth trend. Traditional legal document processing methods often rely on manual operations, using manually designed features and rules. The process includes data preprocessing, feature extraction, classification and segmentation, which is inefficient and prone to errors. Moreover, it is based on rules, keyword matching or traditional machine learning methods, but these methods have limited adaptability and generalization capabilities, have strong field dependence, and are difficult to process diverse documents, and the segmentation accuracy is insufficient.

[0037] In order to solve the technical problems that the manually designed features and rules have strong domain dependence, are difficult to handle diverse documents, and have insufficient segmentation accuracy.

[0038] refer to Figure 1 The embodiment of the present invention discloses a system for automatically segmenting legal documents, the system comprising: a preprocessing module 1; a training module 2; and a segmentation module 3.

[0039] Corresponding to the above disclosed system for automatically segmenting legal documents, the embodiment of the present invention further discloses a method for automatically segmenting legal documents. The following describes in detail the method for automatically segmenting legal documents disclosed in the embodiment of the present invention in combination with the above described system for automatically segmenting legal documents.

[0040] refer to Figure 2 The present invention discloses a method for automatically segmenting legal documents, S1, receiving a legal document file to be segmented, identifying the legal document file by using OCR, and obtaining first legal document information;

[0041] S2, performing a preset number of iterative training on a preset BERT (Bidirectional Encoder Representation from Transformers, a bidirectional language representation model based on masked language modeling, referred to as BERT) model, capturing the meaning and context information of the text and extracting features, automatically learning features and rules based on the extracted features, generating a first BERT model that has completed preliminary training, and fine-tuning the first BERT model using a fine-tuning classifier to generate a second BERT model;

[0042] S3. Input the first legal document information into the second BERT model for automatic segmentation to generate segmented second legal document information.

[0043] Furthermore, the preset BERT model is iteratively trained for a preset number of times to capture the meaning and context information of the text and extract features, including:

[0044] Acquire a large amount of unlabeled training document data and extract contextual relationships from the training document data;

[0045] Extract the bidirectional self-attention encoder from the preset BERT model;

[0046] The bidirectional self-attention encoder is deeply trained by jointly adjusting the contextual relationships in all layers to achieve deep semantic understanding and contextual relationship extraction.

[0047] Furthermore, features and rules are automatically learned based on the extracted features to generate a first BERT model that has completed preliminary training, including:

[0048] Determine whether the current number of training times is equal to the preset number of training times;

[0049] If the current number of training times is equal to the preset number of times, the iterative training is stopped and the first BERT model that has completed the preliminary training is generated;

[0050] If the current number of training times is less than the preset number, the iterative training continues until the current number of training times is equal to the preset number.

[0051] Further, fine-tuning the first BERT model using a fine-tuning classifier to generate a second BERT model includes:

[0052] Adding a new random initialization layer to the first BERT model, and updating the network parameters of the first BERT model to generate a second BERT model;

[0053] Among them, updating the network parameters of the first BERT model includes fixing the bottom layer parameters and adjusting the parameters of the top layer / specific layer to prevent the pre-trained parameters from changing too much.

[0054] Furthermore, the legal document information includes text, tables and images.

[0055] The embodiments of the present invention have the following advantages:

[0056] 1) Deep learning feature extraction: Fine-tuning the BERT model can fully capture the meaning and contextual information of the text. Compared with the traditional bag-of-words model and TF-IDF, it can provide richer and more meaningful text representation, thereby improving the accuracy of classification and segmentation;

[0057] 2) Automatically learning features: Different from manually designing features and rules, the solution automatically learns features and rules through pre-training and fine-tuning, which can adapt to different document structures and fields, reducing the cost of manual intervention and adjustment;

[0058] 3) Cross-domain adaptation: Since the BERT model is pre-trained on large-scale data, it has strong versatility in multiple fields and can be more easily adapted to different fields without redesigning features and rules, thus reducing the difficulty of deployment and maintenance;

[0059] 4) Multimodal processing: The solution has the potential to process a variety of documents, such as text, images, and tables, which can better meet the processing requirements of different types of documents in electronic files, further improving applicability and functionality;

[0060] 5) Improve processing efficiency: With the parallel computing power of deep learning models, the process of document cataloging and segmentation can be accelerated, processing efficiency can be improved, and it helps meet the needs of rapid archiving and retrieval under high workloads.

[0061] In addition, an embodiment of the present invention also provides a device for automatically segmenting legal documents, the device comprising: a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to execute the steps of a method for automatically segmenting legal documents as described in any of the above items.

[0062] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for automatically segmenting legal documents as described in any of the above items are implemented.

[0063] In the embodiment of the present invention, the processor may be an integrated circuit chip having the signal processing capability. The processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0064] The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general 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 invention can be directly embodied as a hardware decoding processor for execution, or can be executed by a combination of hardware and software modules in the decoding processor. 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 processor reads the information in the storage medium and completes the steps of the above method in combination with its hardware.

[0065] The storage medium may be a memory, which may be, for example, a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memory.

[0066] Among them, the non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.

[0067] The volatile memory may be a random access memory (RAM) which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDRSDRAM), enhanced synchronous DRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus DRAM (DRRAM).

[0068] The storage media described in the embodiments of the present invention are intended to include, but are not limited to, these and any other suitable types of memory.

[0069] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention can be implemented using a combination of hardware and software. When software is used, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. Storage media can be any available media that can be accessed by general or special-purpose computers.

[0070] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. A method for automatically segmenting legal documents, characterized in that: The method comprises: S1. Receive a legal document file to be segmented, identify the legal document file by using OCR, and obtain first legal document information; S2, iteratively train the preset BERT model for a preset number of times, capture the word meaning and context information of the text and extract features, automatically learn features and rules based on the extracted features, generate a first BERT model that has completed preliminary training, and use a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model; S3. Inputting the first legal document information into the second BERT model for automatic segmentation to generate segmented second legal document information; The preset BERT model is trained for a preset number of times to capture the meaning and context of the text and extract features, including: Acquire a large amount of unlabeled training document data and extract contextual relationships from the training document data; Extract the bidirectional self-attention encoder from the preset BERT model; The bidirectional self-attention encoder is deeply trained by jointly adjusting the contextual relationships in all layers to achieve deep semantic understanding and contextual relationship extraction; Automatically learn features and rules based on the extracted features to generate the first BERT model that has completed preliminary training, including: Determine whether the current number of training times is equal to the preset number of training times; If the current number of training times is equal to the preset number of times, the iterative training is stopped and the first BERT model that has completed the preliminary training is generated; If the current number of training times is less than the preset number, continue iterating training until the current number of training times is equal to the preset number; Fine-tuning the first BERT model using the fine-tuning classifier to generate a second BERT model, including: Adding a new random initialization layer to the first BERT model, and updating the network parameters of the first BERT model to generate a second BERT model; Wherein, updating the network parameters of the first BERT model includes fixing the bottom layer parameters and adjusting the parameters of the top layer / specific layer to prevent the pre-trained parameters from changing too much; The legal document information includes text, tables and images.

2. A system for automatically segmenting legal documents, characterized in that: The system comprises: A preprocessing module, used for receiving the legal document image to be segmented, recognizing the legal document image by using OCR, and obtaining first legal document information; A training module, used to perform a preset number of iterative training on a preset BERT model, capture the meaning of words and context information of the text and extract features, automatically learn features and rules based on the extracted features, generate a first BERT model that has completed preliminary training, and use a fine-tuning classifier to fine-tune the first BERT model to generate a second BERT model; A segmentation module, used for inputting the first legal document information into the second BERT model for automatic segmentation to generate segmented second legal document information; The preset BERT model is trained for a preset number of times to capture the meaning and context of the text and extract features, including: Acquire a large amount of unlabeled training document data and extract contextual relationships from the training document data; Extract the bidirectional self-attention encoder from the preset BERT model; The bidirectional self-attention encoder is deeply trained by jointly adjusting the contextual relationships in all layers to achieve deep semantic understanding and contextual relationship extraction; Automatically learn features and rules based on the extracted features to generate the first BERT model that has completed preliminary training, including: Determine whether the current number of training times is equal to the preset number of training times; If the current number of training times is equal to the preset number of times, the iterative training is stopped and the first BERT model that has completed the preliminary training is generated; If the current number of training times is less than the preset number, continue iterating training until the current number of training times is equal to the preset number; Fine-tuning the first BERT model using the fine-tuning classifier to generate a second BERT model, including: Adding a new random initialization layer to the first BERT model, and updating the network parameters of the first BERT model to generate a second BERT model; Wherein, updating the network parameters of the first BERT model includes fixing the bottom layer parameters and adjusting the parameters of the top layer / specific layer to prevent the pre-trained parameters from changing too much; The legal document information includes text, tables and images.

3. A device for automatically segmenting legal documents, characterized in that: The device comprises: a processor and a memory; The memory is used to store one or more program instructions; The processor is used to run one or more program instructions to execute the steps of a method for automatically segmenting legal documents as described in claim 1.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for automatically segmenting legal documents as claimed in claim 1 are implemented.

Citation Information

Patent Citations

  • Method and system for constructing text classification system, medium and electronic equipment

    CN111966826A

  • Information extraction method based on legal instruments

    CN114036933A