Method for determining legal events and training method for legal event detection model

By combining the legal event detection method of the BERT and GCN models, the problem of insufficient entity semantic information recognition in legal consultation is solved, high-accuracy detection of legal events is achieved, and more precise legal consulting services are provided.

CN119398055BActive Publication Date: 2025-10-03NANJING SILICON INTELLIGENCE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510005305.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-10-03
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

Existing technologies have difficulty in accurately identifying the semantic information of various entities in legal consulting information and their relationships, resulting in insufficient accuracy in legal event detection.

Method used

The legal event detection model combines the BERT model and the graph convolutional network (GCN) model. Through entity recognition and relationship extraction, it constructs a syntactic graph and updates hierarchical features to finally classify legal events.

Benefits of technology

The accuracy of legal event detection has been improved, which can better identify legal events in user input information and provide more accurate legal advice.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119398055B_ABST
    Figure CN119398055B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology and discloses a method for determining legal events and a method for training a legal event detection model. The method comprises: obtaining first question information input by a user and determining multiple entities in the first question information and the entity relationships between the entities; determining question information features and context information corresponding to each entity based on the first question information and the multiple entities; updating the initial features corresponding to each entity based on the syntactic graph corresponding to the first question information and the initial features corresponding to each entity through multiple neural network layers, thereby obtaining updated features corresponding to each entity determined by each neural network layer in the multiple neural network layers; determining the updated features corresponding to each entity determined by the last neural network layer as the core information corresponding to the first question information; and determining target event information based on the question information features and the core information corresponding to the first question information. The present application can improve the accuracy of determining legal events in question information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for determining legal events and a method for training a legal event detection model. Background Art

[0002] In legal consultation scenarios, users can use the legal consultation system to inquire about information related to legal cases. When generating responses based on user input, the legal consultation system needs to detect the legal events involved in the information. Legal events refer to the legal relationships that may involve legal entities. Based on the identified legal events, the legal consultation system can further process the information (such as searching for relevant cases and legal basis) to provide users with accurate advice. Summary of the Invention

[0003] The present embodiment provides a method for determining legal events and a method for training a legal event detection model, which can accurately obtain the core information of each entity and the core relationships between entities in the question information input by the user, thereby improving the accuracy of determining legal events in the question information. Specifically, the present embodiment discloses the following technical solutions:

[0004] A first aspect of an embodiment of the present application provides a method for determining a legal event, which is applied to a legal event detection model. The method includes: obtaining first question information input by a user, and determining multiple entities in the first question information and the entity relationships between each of the multiple entities through a first neural network model in the legal event detection model; determining question information features corresponding to the first question information and initial features corresponding to each of the entities through a second neural network model in the legal event detection model based on the first question information and the multiple entities; wherein the initial features corresponding to each of the entities represent the context information corresponding to each of the entities; determining question information features corresponding to the first question information and initial features corresponding to each of the entities through a second neural network model in the legal event detection model based on the first question information and the multiple entities; wherein the initial features corresponding to each of the entities represent the context information corresponding to each of the entities; and determining the entity relationships between the multiple entities in the third neural network model in the legal event detection model based on the first question information. The corresponding syntactic graph and the initial features corresponding to the above-mentioned entities are updated to obtain the updated features corresponding to the above-mentioned entities determined by each of the above-mentioned neural network layers; wherein the above-mentioned syntactic graph includes multiple nodes and multiple edges, each of the above-mentioned multiple nodes corresponds to the above-mentioned entities, and each of the above-mentioned multiple edges corresponds to the entity relationship between the above-mentioned entities; the updated features corresponding to the above-mentioned entities determined by the last neural network layer in the above-mentioned multiple neural network layers are determined as the core information corresponding to the above-mentioned first question information; the target event information corresponding to the above-mentioned first question information is determined by the fourth neural network model in the above-mentioned legal event detection model based on the above-mentioned question information features and the core information corresponding to the above-mentioned first question information.

[0005] In some embodiments, the above-mentioned determination of the entity relationships between the multiple entities in the first question information and each of the multiple entities through the first neural network model in the above-mentioned legal event detection model includes: obtaining historical event information, and vectorizing the above-mentioned historical event information through the above-mentioned first neural network model to obtain a supervision vector; extracting features of the legal elements in the above-mentioned first question information through the above-mentioned first neural network model to obtain multiple element features corresponding to the above-mentioned first question information; determining the content features corresponding to the above-mentioned first question information based on the above-mentioned multiple element features corresponding to the above-mentioned first question information and the above-mentioned supervision vector through the above-mentioned first neural network model, and determining the above-mentioned content features as the above-mentioned multiple entities; extracting entity relationships from the above-mentioned content features through the above-mentioned first neural network model to obtain entity relationships between each of the above-mentioned entities.

[0006] In some embodiments, the multiple neural network layers in the third neural network model in the legal event detection model update the initial features corresponding to each of the above-mentioned entities based on the syntactic graph corresponding to the first question information and the initial features corresponding to each of the above-mentioned entities, and obtain the updated features corresponding to each of the above-mentioned entities determined by each of the above-mentioned neural network layers, including: obtaining the first features corresponding to each of the above-mentioned entities determined by the first neural network layer among the above-mentioned multiple neural network layers based on the initial features corresponding to each of the above-mentioned entities, the adjacency matrix corresponding to the above-mentioned syntactic graph, the self-connection matrix and the weight matrix corresponding to the above-mentioned first neural network layer; wherein the above-mentioned first neural network layer is the first neural network layer among the above-mentioned multiple neural network layers; obtaining the second features corresponding to each of the above-mentioned entities determined by the second neural network layer based on the first features corresponding to each of the above-mentioned entities, the adjacency matrix corresponding to the above-mentioned syntactic graph, the self-connection matrix and the weight matrix corresponding to the above-mentioned second neural network layer; wherein the updated features corresponding to each of the above-mentioned entities include the first features corresponding to each of the above-mentioned entities and the second features corresponding to each of the above-mentioned entities.

[0007] In some embodiments, the fourth neural network model in the above-mentioned legal event detection model determines the target event information corresponding to the above-mentioned first question information based on the above-mentioned question information features and the core information corresponding to the above-mentioned first question information, including: fusing the above-mentioned question information features and the core information corresponding to the above-mentioned first question information to obtain fused features; classifying the legal events corresponding to the above-mentioned fused features through the above-mentioned fourth neural network model to obtain the above-mentioned target event information.

[0008] In some embodiments, the fourth neural network model in the legal event detection model determines the target event information corresponding to the first question information based on the question information characteristics and the core information corresponding to the first question information, including: determining the first event information corresponding to the first question information based on the question information characteristics and the core information corresponding to the first question information through the fourth neural network model; determining event determination information based on the first event information through the fifth neural network model, and determining and outputting the second question information based on the event determination information and the first question information; obtaining the reply information input by the user to the second question information, and determining the target question information based on the first question information and the reply information; determining the target event information based on the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information through the fourth neural network model.

[0009] In some embodiments, the above-mentioned determination of event judgment information based on the above-mentioned first event information by the fifth neural network model includes: determining a plurality of preset texts associated with the above-mentioned first event information in a preset database based on the above-mentioned first event information by the above-mentioned fifth neural network model; processing the first preset text by the above-mentioned fifth neural network model to obtain a plurality of retrieval pairs corresponding to the above-mentioned first preset text; wherein the above-mentioned first preset text is any preset text among the above-mentioned multiple preset texts, and each of the above-mentioned multiple retrieval pairs includes a retrieval identifier and a retrieval content; clustering processing is performed on the multiple retrieval pairs corresponding to the above-mentioned first preset text by the above-mentioned fifth neural network model to obtain a plurality of candidate seed retrieval pairs; determining a target seed retrieval pair that meets the preset conditions among the above-mentioned multiple candidate seed retrieval pairs by the above-mentioned fifth neural network model, and determining the retrieval content of the above-mentioned target seed retrieval pair as the above-mentioned event judgment information.

[0010] In some embodiments, the above-mentioned fifth neural network model is used to cluster the multiple retrieval pairs corresponding to the above-mentioned first preset text to obtain multiple candidate seed retrieval pairs, including: in the current round of clustering process, the above-mentioned fifth neural network model is used to obtain the multiple first seed retrieval pairs obtained in the previous round of clustering process and the multiple unclustered first retrieval pairs; wherein the above-mentioned multiple retrieval pairs include the above-mentioned multiple first seed retrieval pairs and the above-mentioned multiple first retrieval pairs, and the sum of the number of the above-mentioned multiple first seed retrieval pairs and the above-mentioned multiple first retrieval pairs is equal to the preset number; the above-mentioned multiple first seed retrieval pairs and the above-mentioned multiple first retrieval pairs are clustered by the above-mentioned fifth neural network model to obtain multiple first seed retrieval pairs corresponding to each of the above-mentioned legal categories in the multiple legal categories. two search pairs; determine the second seed search pairs corresponding to each of the above-mentioned legal categories among the above-mentioned multiple second search pairs corresponding to each of the above-mentioned legal categories through the above-mentioned fifth neural network model, and determine the multiple unclustered second search pairs in the above-mentioned multiple search pairs according to the above-mentioned preset number, the above-mentioned multiple first search pairs and the above-mentioned multiple second seed search pairs; cluster the multiple second seed search pairs and the above-mentioned multiple second search pairs in the next round of clustering process through the above-mentioned fifth neural network model until there are no unclustered search pairs in the above-mentioned multiple search pairs, and obtain the above-mentioned multiple candidate seed search pairs determined by the last round of clustering process; wherein, each of the above-mentioned multiple candidate seed search pairs corresponds to a different legal category.

[0011] In some embodiments, the above-mentioned determination of the second seed retrieval pairs corresponding to each of the above-mentioned legal categories among the above-mentioned multiple second retrieval pairs corresponding to each of the above-mentioned legal categories by the above-mentioned fifth neural network model includes: determining the semantic vector corresponding to each of the above-mentioned second retrieval pairs in each of the above-mentioned legal categories by the above-mentioned fifth neural network model; determining the total distance between each first semantic vector and the second semantic vector in each of the above-mentioned legal categories based on the semantic vector corresponding to each of the above-mentioned second retrieval pairs by the above-mentioned fifth neural network model; wherein the above-mentioned first semantic vector is the semantic vector corresponding to any second retrieval pair among the above-mentioned multiple second retrieval pairs corresponding to each of the above-mentioned legal categories, and the above-mentioned second semantic vector is the semantic vector corresponding to the second retrieval pair other than the second retrieval pair corresponding to the above-mentioned first semantic vector; determining the target semantic vector with the shortest total distance to the above-mentioned second semantic vector among the multiple first semantic vectors by the above-mentioned fifth neural network model, and determining the second retrieval pair corresponding to the above-mentioned target semantic vector as the above-mentioned second seed retrieval pair corresponding to each of the above-mentioned legal categories.

[0012] In some embodiments, the above-mentioned determination of the target seed retrieval pair that meets the preset conditions among the above-mentioned multiple candidate seed retrieval pairs through the above-mentioned fifth neural network model includes: determining the target confidence score of each of the above-mentioned candidate seed retrieval pairs among the above-mentioned multiple candidate seed retrieval pairs; wherein the above-mentioned target confidence score is related to the correlation between each of the above-mentioned candidate seed retrieval pairs and the above-mentioned first event information, and the number of retrieval pairs in the legal category corresponding to each of the above-mentioned candidate seed retrieval pairs; and determining the candidate seed retrieval pair among the above-mentioned multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to the preset score as the above-mentioned target seed retrieval pair.

[0013] A second aspect of an embodiment of the present application provides a training method for a legal event detection model, wherein the legal event detection model includes a third neural network model, and the method includes: obtaining a syntax graph sample and a target vector representation of each of the sample nodes in a plurality of nodes; wherein the syntax graph sample includes the plurality of sample nodes; performing vectorization processing on the plurality of nodes in the syntax graph sample to obtain an initial vector representation of each of the plurality of sample nodes; obtaining the syntax graph sample through the third neural network model to be trained, and performing vectorization processing on the plurality of nodes in the syntax graph sample based on the initial vector representation of each of the sample nodes and the initial vector representation of each of the plurality of sample nodes through each of the plurality of neural network layers to be trained; The initial vector representation of the adjacent sample nodes corresponding to the sample node is updated to obtain the updated vector representation of each of the above sample nodes determined by each of the above neural network layers to be trained; wherein the above third neural network model to be trained includes the above multiple neural network layers to be trained; based on the target vector representation of each of the above sample nodes and the updated vector representation of each of the above nodes determined by the last neural network layer in the above multiple neural network layers, the loss function corresponding to the above third neural network model to be trained is determined; based on the above loss function, the parameters in the above third neural network model are optimized to obtain the trained third neural network model.

[0014] According to a third aspect of an embodiment of the present application, there is provided a device for determining a legal event, which is configured in a legal event detection model, and the device includes: an acquisition module, configured to acquire a first question information input by a user, and determine the entity relationships between multiple entities in the first question information and each of the multiple entities through a first neural network model in the legal event detection model; a first determination module, configured to determine the question information features corresponding to the first question information and the initial features corresponding to each of the entities through a second neural network model in the legal event detection model based on the first question information and the multiple entities; wherein the initial features corresponding to each of the entities represent the context information corresponding to each of the entities; a first update module, configured to update the question information features corresponding to the first question information and the initial features corresponding to each of the entities through a plurality of neural network layers in a third neural network model in the legal event detection model based on the first question information and the multiple entities; The syntactic graph corresponding to the question information and the initial features corresponding to the above-mentioned entities are updated to obtain the updated features corresponding to the above-mentioned entities determined by each of the above-mentioned neural network layers; wherein the above-mentioned syntactic graph includes multiple nodes and multiple edges, each of the above-mentioned multiple nodes corresponds to the above-mentioned entities, and each of the above-mentioned multiple edges corresponds to the entity relationship between the above-mentioned entities; the second determination module is configured to determine the updated features corresponding to the above-mentioned entities determined by the last neural network layer in the above-mentioned multiple neural network layers as the core information corresponding to the above-mentioned first question information; the third determination module is configured to determine the target event information corresponding to the above-mentioned first question information based on the above-mentioned question information features and the core information corresponding to the above-mentioned first question information through the fourth neural network model in the above-mentioned legal event detection model.

[0015] According to a fourth aspect of an embodiment of the present application, there is provided a training device for a legal event detection model, wherein the legal event detection model includes a third neural network model, and the device includes: a second acquisition module, configured to acquire a syntax graph sample and a target vector representation of each of the sample nodes in a plurality of nodes; wherein the syntax graph sample includes the plurality of sample nodes; a vectorization processing module, configured to perform vectorization processing on the plurality of nodes in the syntax graph sample to obtain an initial vector representation of each of the plurality of sample nodes; a second update module, configured to acquire the syntax graph sample through the third neural network model to be trained, and update the syntax graph sample based on the initial vector representation of each of the sample nodes through each of the plurality of neural network layers to be trained. The fourth determination module is configured to determine the loss function corresponding to the third neural network model to be trained based on the target vector representation of each of the sample nodes and the updated vector representation of each of the nodes determined by the last neural network layer in the multiple neural network layers. The optimization module is configured to optimize the parameters in the third neural network model based on the loss function to obtain the trained third neural network model.

[0016] The fifth aspect of an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory, the memory being configured to: store one or more programs; wherein, when the one or more programs are executed by one or more processors, the one or more processors implement the method for determining legal events described in the first aspect above, or implement the method for training the legal event detection model described in the second aspect above.

[0017] The sixth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores computer program instructions. When the computer reads the instructions, it executes the method for determining legal events described in the first aspect, or implements the training method for the legal event detection model described in the second aspect.

[0018] A seventh aspect of an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method for determining legal events described in the first aspect, or implements the training method for the legal event detection model described in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A schematic diagram of a legal event detection model provided in some embodiments of the present application;

[0021] Figure 2 A flowchart of a method for determining a legal event provided in some embodiments of the present application;

[0022] Figure 3 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0023] Figure 4 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0024] Figure 5 A schematic diagram of a syntax diagram provided for some embodiments of the present application;

[0025] Figure 6 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0026] Figure 7 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0027] Figure 8 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0028] Figure 9 A scenario diagram for legal event detection provided in some embodiments of the present application;

[0029] Figure 10 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0030] Figure 11 A flowchart of another method for determining a legal event provided in some embodiments of the present application;

[0031] Figure 12 A flowchart of a method for training a legal event retrieval model provided in some embodiments of the present application;

[0032] Figure 13 A schematic diagram of a device for determining a legal event provided in some embodiments of the present application;

[0033] Figure 14 A schematic diagram of a training device for a legal event detection model provided in some embodiments of the present application;

[0034] Figure 15 This is a schematic diagram of an electronic device according to some embodiments of the present application. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention and to make the above-mentioned purposes, features and advantages of the embodiments of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0036] Since legal events are usually complex, it is usually difficult to accurately determine the semantic information of each entity in the consultation information and the relationship between each entity by detecting keywords in the consultation information input by the user, and thus it is impossible to accurately determine the legal events involved in the consultation information.

[0037] Based on the above technical problems, this application provides a method for determining legal events and a training method for a legal event detection model, which can combine the BERT model and the Graph Convolutional Networks (GCN) model to better identify the legal events involved in the consultation information input by the user.

[0038] It should be noted that the training samples used in the training process of the neural network model involved in this application are all from authorized legal documents, judgments, case descriptions, etc., and the conclusions obtained by the method for determining legal events provided in this application are only used to form consulting opinions for users' reference.

[0039] Figure 1 This is a schematic diagram of a legal event detection model provided in some embodiments of the present application. Figure 1 As shown, the legal event detection model 100 may include a first neural network model 110 , a second neural network model 120 , a third neural network model 130 , a fourth neural network model 140 and a sixth neural network model 150 .

[0040] In some examples, the first neural network model 110 may include a named entity recognition (NER) model and a relation extraction (RE) model. After receiving the consultation information input by the user (hereinafter referred to as the first question information), the legal event detection model 100 may use the NER model in the first neural network model 110 to identify the entities in the first question information and use the RE model to identify the relationships between the entities in the first question information, thereby obtaining the entities in the first question information and the entity relationships between the entities.

[0041] In some examples, the first neural network model 110 may also be a legal information extraction model that includes an information extraction layer and a relationship extraction layer; wherein the information extraction layer includes a supervision model and a content model; and the relationship extraction layer may include a graph neural network (GNN). After obtaining the first question information input by the user, the legal event detection model 100 can use the supervision model in the information extraction layer to extract features from the legal event detection results (i.e., historical legal events) obtained in the previous legal event detection process to obtain a supervision vector; and use the content model in the information extraction layer to extract legal elements from the first question information input by the user to obtain multiple element features; then, the content model determines content features based on the above multiple element features and the supervision vector. The content features are the entity information in the first question information. Then, the content features are processed by the relationship extraction layer in the first neural network model 110 to determine the entity relationships between the various entity information.

[0042] Exemplarily, the sixth neural network model 150 is a syntactic graph construction model. After obtaining the entities and the entity relationships between the entities in the first question information through the first neural network model 110, the sixth neural network model 150 can construct a corresponding syntactic graph based on the entities and the entity relationships between the entities. This syntactic graph can represent all possible relationships between entities (nodes).

[0043] For example, the second neural network model 120 may be a BERT model. The BERT model obtains the multiple entities determined by the first neural network model 110 and the first question information input by the user, and extracts the context information corresponding to each entity in the first question information. The BERT model may input the context information corresponding to each entity into the third neural network model 130 as the initial features corresponding to each entity.

[0044] Exemplarily, the third neural network model 130 may be composed of a multi-layer graph convolutional network (GCN) model. The third neural network model 130 obtains the syntactic graph determined by the syntactic graph construction model and the initial features corresponding to each entity determined by the BERT model. The model then updates the initial features corresponding to each entity layer by layer through each layer of the GCN, based on the syntactic graph and the initial features corresponding to each entity, using hierarchical propagation and aggregation of neighboring nodes. Finally, the updated features corresponding to each entity obtained by the last layer of the GCN are determined as the core information corresponding to the first question information, namely, the core information corresponding to each entity and the core relationships between the entities.

[0045] Exemplarily, fourth neural network model 140 may be a classification model, which may be implemented based on a fully connected layer, though this embodiment is not limited thereto. The core information corresponding to the first question information and the question information features corresponding to the first question information determined by the BERT model may be fused to generate fused features. The fused features are then classified using the classification model, and the resulting classification result is the legal event information corresponding to the first question information (i.e., the target event information).

[0046] Through the above scheme, the contextual relationship corresponding to each entity in the question information input by the user (that is, the initial features corresponding to each entity) can be extracted through the BERT model, and the initial features corresponding to each entity can be updated layer by layer through the multi-layer GCN model, so as to finally obtain the core information corresponding to each entity and the core relationship between each entity. Then, the legal event information corresponding to the first question information can be accurately determined based on the core information corresponding to each entity and the core relationship between each entity through the classification model.

[0047] The following is a detailed description of the method for determining legal events provided in this application.

[0048] Figure 2 A flowchart of a method for determining a legal event provided in some embodiments of the present application, wherein: Figure 2 The method of determining legal events shown can be applied to Figure 1 The legal event detection model shown in Figure 2 As shown, the method for determining a legal event may include steps 210 to 240 .

[0049] Step 210: Obtain first question information input by the user, and determine the entity relationships between multiple entities in the first question information and each of the multiple entities through the first neural network model in the legal event detection model.

[0050] In some embodiments, a user may enter legal consultation information (hereinafter referred to as first question information) into a user interface provided by a legal consultation system (hereinafter referred to as a central control system). In response to the first question information entered by the user, the central control system may invoke corresponding legal tools to process the first question information and obtain a processing result. The central control system then summarizes the processing results obtained by each legal tool to obtain a final consulting opinion and outputs it to the user. The legal tool may include a legal event detection model that can identify the legal events involved in the first question information entered by the user and obtain a legal event detection result. This legal event detection result can then be used to subsequently search for legal cases or legal provisions to provide legal consultation to the user.

[0051] For example, after the central control system invokes the legal event detection model, it can use the first neural network model in the legal event detection model to perform entity recognition and entity relationship extraction on the user input, thereby determining the entity information in the first question information and the entity relationships between the entities. In the legal consultation scenario, entities may include people, places, and time, and entity relationships between entities may include loan relationships, personal injury compensation relationships, etc.

[0052] For example, the first neural network model may include a named entity recognition (NER) model and a relation extraction (RE) model. The NER model may be used to identify entities in the first question information to obtain the entities in the first question information. The RE model may then be used to identify relationships between entities in the first question information to obtain entity relationships between the entities in the first question information.

[0053] Exemplarily, the first neural network model can also be a legal information extraction model that includes an information extraction layer and a relationship extraction layer. The information extraction layer includes a supervision model and a content model, both of which can adopt the BERT model or the Transformer model. The relationship extraction layer can include a graph neural network (GNN). The supervision model in the information extraction layer can be used to extract features from the legal event detection results (i.e., historical legal events) obtained in the previous legal event detection process to obtain a supervision vector. The content model in the information extraction layer can then be used to extract legal elements from the first question information input by the user to obtain multiple element features. The content model can then determine content features based on these multiple element features and the supervision vector. These content features are the entity information in the first question information. The content features are then processed by the relationship extraction layer in the first neural network model to determine the entity relationships between the entities.

[0054] In some examples, the legal information extraction model can be a legal tool independent of the legal event detection model and can be called by the central control system. That is, in response to a first question input by a user, the central control system can call the legal information extraction model and the legal event detection model to determine the entity information and entity relationships corresponding to the first question using the legal information extraction model, and then determine the target event information corresponding to the first question using the legal event detection model based on the entity information and entity relationships output by the legal information extraction model.

[0055] For example, taking the first question information input by the user as "Zhang San borrowed 100,000 RMB from Li Si, and the two parties agreed to repay the loan in one year. One year later, Zhang San failed to repay the loan on time and ignored Li Si's reminders for payment", after the first neural network model performs entity extraction on the first question information, the multiple entities obtained may include: Zhang San (person), Li Si (person), 100,000 RMB (loan amount), one year (loan time); after performing entity relationship extraction on the above multiple entities, the entity relationships between the entities obtained may include: Zhang San borrowed money from Li Si (loan relationship), Zhang San failed to repay the loan on time (breach of contract), and Li Si urges for payment (repayment behavior).

[0056] Step 220 : Determine, by using a second neural network model in the legal event detection model, question information features corresponding to the first question information and initial features corresponding to each entity based on the first question information and the multiple entities.

[0057] In some embodiments, the contextual information corresponding to each entity in the first question information can be extracted by a second neural network model in the legal event detection model, and the contextual information corresponding to each entity can be determined as the initial features corresponding to each entity. The second neural network model can be a BERT model. The initial features corresponding to each entity determined by the BERT model generally cover a wide range, that is, generally cover all possible contextual relationships related to each entity in the first question information.

[0058] Continuing with the above example, the initial features corresponding to each entity in the first question information through the BERT model can be: Zhang San: [0.1, 0.2, 0.3, ...], Li Si: [0.2, 0.3, 0.4, ...], 100,000 RMB: [0.3, 0.4, 0.5, ...], and one year: [0.4, 0.5, 0.6, ...]. It should be noted that the numerical values ​​in the initial features corresponding to the above entities are only examples.

[0059] In some embodiments, the first question information may be vectorized using a second neural network model to obtain question information features corresponding to the first question information.

[0060] In step 230 , the third neural network model in the legal event detection model is used to determine the core information corresponding to the first question information based on the multiple entities, the entity relationships between the entities, and the initial features corresponding to the entities.

[0061] In some embodiments, since the initial features corresponding to each entity obtained by the above-mentioned second neural network model usually cover a wider range, the initial features corresponding to each entity can be processed by a third neural network model so that the initial features corresponding to each entity gradually converge to the core information corresponding to each entity and the core relationship between each entity.

[0062] Exemplarily, the third neural network model can be composed of a multi-layer graph convolutional network (GCN) model. Each GCN layer can update the initial features corresponding to each entity layer by layer, based on the syntactic graph and the initial features corresponding to each entity, using hierarchical propagation and aggregation of neighboring nodes. The syntactic graph can be determined based on the entities and the entity relationships between them. Finally, the updated features corresponding to each entity obtained by the last GCN layer are determined as the core information corresponding to the first question (i.e., the core information corresponding to each entity and the core relationships between entities).

[0063] Step 240 : Determine target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through the fourth neural network model in the legal event detection model.

[0064] In some embodiments, the target event information corresponding to the first question information can be determined by the fourth neural network model in the legal event detection model based on the question information features determined by the BERT model and the core information corresponding to the first question information determined by the GCN.

[0065] For example, the fourth neural network model can be a classification model. It can first fuse the core information corresponding to the first question information with the question information features corresponding to the first question information determined by the BERT model to obtain a fused feature, which is then input into the classification model. The classification model then classifies the fused feature, and the resulting classification result is the legal event information corresponding to the first question information (i.e., the target event information).

[0066] Through the above scheme, the contextual relationship corresponding to each entity in the question information input by the user (that is, the initial features corresponding to each entity) can be extracted, and the initial features corresponding to each entity can be updated by adopting the method of hierarchical propagation and aggregation of neighboring nodes, so as to finally obtain the core information corresponding to each entity and the core relationship between each entity, and then, based on the core information corresponding to each entity and the core relationship between each entity, the legal event information corresponding to the first question information can be accurately determined.

[0067] Figure 3 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 3 As shown, the above step 210 may include steps 310 to 340.

[0068] Step 310: Acquire historical event information and perform vectorization processing on the historical event information through a first neural network model to obtain a supervision vector.

[0069] In some embodiments, the first neural network model can be implemented using a named entity recognition (NER) model and a relation extraction (RE) model. However, existing NER and RE models typically focus only on common entity information such as names of people, places, and organizations when extracting entities and entity relationships. In legal consultation scenarios, however, legal entity information needs to be extracted, and this information varies across different legal cases. For example, the legal entity information involved in civil tort cases may include the tortious act, damage facts, causal relationships, and subjective fault; while the legal entity information involved in criminal cases may include the object of the crime, objective aspects of the crime, the subject of the crime, and subjective aspects of the crime. Therefore, extracting legal entity information using NER and RE models is complex, and supervised learning cannot be used to train the models to extract the required entities and entity relationships. Furthermore, the legal information in user-entered consultation information is often lengthy and does not appear in a continuous string. This means that legal entity information often overlaps to varying degrees, further hindering the ability of traditional NER and RE models to effectively extract legal entity information and entity relationships.

[0070] Therefore, the first neural network model can adopt a legal information extraction model consisting of an information extraction layer and a relationship extraction layer. The information extraction layer in the legal information extraction model is used to determine the entity information in the first question information input by the user; the relationship extraction layer in the legal information extraction model is used to determine the entity relationships between entities based on the entity information in the first question information. The information extraction layer includes a supervision model and a content model, and both the supervision model and the content model can be composed of a BERT model or a Transformer model.

[0071] In some examples, the legal information extraction model can use the event detection results (i.e., historical legal events) of the legal event detection model as input to the supervision model. This allows the supervision model to determine a supervision vector based on the historical legal events, thereby assisting the content model in more accurately determining the entity information in the first question. Subsequently, the legal event detection model can derive legal event information in the first question based on the entity information in the first question determined by the legal information extraction model. Furthermore, the legal event information obtained by the legal event detection model can be input as historical legal events into the supervision model to re-determine the entity information in the first question. The legal event detection model can then re-determine the legal event information in the first question based on the re-determined entity information. Furthermore, if the legal event information determined first and second times differs, the second time's determination can be used as input to the supervision model. This process continues until the legal event information determined twice is consistent, at which point the legal event information is determined as the final target event information.

[0072] Exemplarily, when the supervision model determines a supervision vector based on a historical legal event, it can determine the legal information type corresponding to the historical legal event and perform feature extraction (i.e., vectorization) on the legal information type to obtain a supervision vector.

[0073] Step 320 : extracting features of the legal elements in the first question information through the first neural network model to obtain multiple element features corresponding to the first question information.

[0074] In some embodiments, the content model in the first neural network model may include multiple element extraction models. Each element extraction model in the multiple element extraction models is used to extract different legal elements in the first question information, thereby obtaining multiple element features corresponding to the first question information, and these element features cover all possible entities in the first question information and the relationship between each entity. Among them, legal elements refer to common content existing in different legal fields, such as subject, object, behavior, object, subjective intention, etc. In other words, the subject, object, behavior, object, subjective intention and other element features in the first question information can be extracted respectively through each element extraction model to obtain the above-mentioned multiple element features corresponding to the first question information.

[0075] For example, when each factor model classifies and identifies legal factors, it can automatically complete the classification based on a large amount of training data, allowing each factor model to focus on specific factor features. Furthermore, manual annotation can be used to identify the factor features that need to be identified for each factor model to enhance the model's classification performance.

[0076] In step 330 , the first neural network model is used to determine content features corresponding to the first question information based on multiple element features and a supervision vector corresponding to the first question information, and the content features are determined as multiple entities.

[0077] In some embodiments, after obtaining the multiple element features and supervision vectors corresponding to the first question information, the content model can further fuse the multiple element features and supervision vectors to obtain content features corresponding to the first question information. The content features are the multiple entity information in the first question information.

[0078] Exemplarily, the content model may also include a feature fusion layer. When fusing multiple element features and supervision vectors, the content model may concatenate or perform dot multiplication on the element features determined by each element model and the supervision vector, thereby strengthening or weakening the representation of each element feature, thereby achieving remote supervision of each element feature through the supervision vector. Furthermore, the attention mechanism in the feature fusion layer may be used to assign weights to each element feature, and the weighted element features may be fused to obtain the content features corresponding to the first question information.

[0079] In some embodiments, based on the above-mentioned feature fusion layer, a Conditional Random Field (CRF) layer can also be set in the content model. The CRF layer can further optimize the extraction of entity information by obtaining the dependencies between each entity information, thereby improving the accuracy of entity information extraction.

[0080] Step 340: extract entity relationships from content features using the first neural network model to obtain entity relationships between entities.

[0081] In some embodiments, after obtaining the aforementioned content features through the information extraction layer, the relationship extraction layer in the first neural network model can extract entity relationships from the content features to obtain entity relationships between entities. The relationship extraction layer may include a graph neural network (GNN).

[0082] Through the above scheme, the legal event detection model can achieve better entity extraction effect through the legal information extraction model, and the iterative relationship between the legal event detection model and the legal information extraction model can further ensure the accuracy of legal event information recognition.

[0083] Figure 4 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 4 As shown, the above step 230 may include steps 410 to 430.

[0084] In step 410 , a sixth neural network model in the legal event detection model is used to determine a syntactic graph using each entity as a node and entity relationships between entities as edges.

[0085] In some embodiments, after obtaining the aforementioned multiple entities and the entity relationships between the entities, a syntactic graph may be constructed based on the multiple entities and the entity relationships between the entities using a sixth neural network model in the legal event detection model. The sixth neural network model is a syntactic graph construction model.

[0086] For example, when constructing a syntax graph, each entity is used as a node of the syntax graph, and the entity relationships between entities are used as edges between nodes. Figure 5 A schematic diagram of a syntax diagram is shown in Figure 5 As shown in the figure, taking the first question information as "Zhang San and Li Si are neighbors. Zhang San borrowed RMB 100,000 from Li Si, and the two parties agreed to repay the loan in one year. One year later, Zhang San did not repay the loan on time and ignored Li Si's reminders for repayment", the multiple nodes in the syntactic graph corresponding to the first question information are: Zhang San, Li Si, RMB 100,000, and one year; the edges in the syntactic graph include: Zhang San---Neighbor---> Li Si, Zhang San---Loan---> RMB 100,000-Li Si, Zhang San---Breach of Contract---> One Year-Li Si, Li Si---Repayment---> Zhang San.

[0087] For example, a syntactic graph can represent all relationships between entities (nodes), which may include some non-core relationships, such as "Zhang San and Li Si are neighbors." Therefore, the resulting entity relationships between entities can be processed through a third neural network model, gradually converging to the core relationships between entities and eliminating non-core relationships between entities.

[0088] Step 420: Update the initial features corresponding to each entity based on the syntactic graph and the initial features corresponding to each entity through multiple neural network layers in the third neural network model to obtain updated features corresponding to each entity determined by each neural network layer in the multiple neural network layers.

[0089] In some embodiments, after obtaining the aforementioned syntactic graph and the initial features corresponding to each entity determined by the BERT model, a third neural network model in the legal event detection model can be used to update the initial features corresponding to each entity based on the syntactic graph and the initial features corresponding to each entity. The third neural network model can include a multi-layer graph convolutional network (GCN).

[0090] Exemplarily, the third neural network model can update the features corresponding to each entity through a multi-layer GCN using hierarchical propagation and aggregation of neighbor node features. Taking a target node among multiple nodes as an example, the current features corresponding to the target node can be updated by the previous layer of GCN in the multi-layer GCN based on the current features corresponding to the target node and the current features corresponding to the neighboring nodes (i.e., adjacent nodes) of the target node, to obtain the updated features corresponding to the target node; and so on, until the updated features corresponding to the target node are obtained through the last layer of GCN in the multi-layer GCN. Among them, the current features corresponding to the target node in the first layer of GCN are the initial features corresponding to the target node.

[0091] In step 430 , the updated features corresponding to the entities determined by the last neural network layer in the multiple neural network layers are determined as the core information corresponding to the entities and the core relationships between the entities.

[0092] In some embodiments, the updated features corresponding to each entity (node) obtained by the last GCN layer in the multi-layer GCN are the core information corresponding to each entity and the core relationship between the entities (i.e., the core information corresponding to the first question information).

[0093] Through the above scheme, the initial features corresponding to each entity output by the BERT model are updated based on the syntactic graph through multi-layer GCN, which can exclude non-core entity information and non-core relationships between entities, so that better classification results can be obtained when legal events are subsequently classified based on entity information and entity relationships.

[0094] Figure 6 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 6 As shown, the above step 420 may include steps 610 to 620.

[0095] Step 610: Obtain the first features corresponding to each entity determined by the first neural network layer based on the initial features corresponding to each entity, the adjacency matrix corresponding to the syntactic graph, the self-connection matrix and the weight matrix corresponding to the first neural network layer through the first neural network layer among the multiple neural network layers.

[0096] In some embodiments, taking a target node among multiple nodes and the first two layers of GCN in a multi-layer GCN as an example, the first layer of GCN (i.e., the first neural network layer) first updates the initial features corresponding to the target node based on the initial features corresponding to the target node and the initial features corresponding to the adjacent nodes of the target node to obtain the updated initial features corresponding to the target node (i.e., the first features).

[0097] Exemplarily, the first-layer GCN can update the initial features corresponding to the target node based on the adjacency matrix corresponding to the syntactic graph, the self-loop matrix, the weight matrix corresponding to the first-layer GCN, and the nonlinear activation function to obtain the first features corresponding to the target node.

[0098] In some examples, the method of updating the features of each entity (node) through multi-layer GCN can refer to formula (1):

[0099] ; (1)

[0100] in, For the The current features corresponding to each entity (node) determined by the layer GCN ( That is, the initial features corresponding to each entity (node); For the The updated features corresponding to each entity (node) of the layer.

[0101] , is the N×N adjacency matrix corresponding to the syntactic graph, which is used to represent the connection between each node and other nodes; if there is an edge between node i and node j, then [i][j]=1, if there is no edge between node i and node j, then [i][j]=0; is an N×N identity matrix, where N is the number of nodes; It means that each node in the syntactic graph is connected to itself, that is, the characteristics of the node itself are taken into account.

[0102] yes The degree matrix is ​​a diagonal matrix where each diagonal element [i][i] represents the degree of node i, that is, the number of edges connected to node i.

[0103] is the degree matrix The inverse square root of the adjacency matrix Normalization is performed to avoid the impact of large differences in node degrees on model training.

[0104] For the The weight matrix corresponding to the layer GCN is a trainable parameter matrix used to linearly transform node features.

[0105] A nonlinear activation function, such as the Rectified Linear Unit (ReLU), enables the third neural network model to capture complex patterns.

[0106] Indicates that the first The current feature corresponding to the node determined by the layer GCN To disseminate and aggregate; Indicates that the node features after propagation and aggregation are linearly transformed to obtain the node features after linear transformation; the updated node features are compared with Multiplication means applying a nonlinear activation function to the linearly transformed node features to increase the expressive power of the model, thereby obtaining the updated node features. .

[0107] Step 620: Obtain the second feature corresponding to each entity determined by the second neural network layer based on the first feature corresponding to each entity, the adjacency matrix corresponding to the syntactic graph, the self-connection matrix and the weight matrix corresponding to the second neural network layer through the second neural network layer among the multiple neural network layers.

[0108] In some embodiments, after the first layer GCN obtains the first feature corresponding to the target node, the second layer GCN (i.e., the second neural network layer) updates the first feature corresponding to the target node based on the first feature corresponding to the target node and the first features corresponding to the adjacent nodes of the target node to obtain the updated first feature corresponding to the target node (i.e., the second feature).

[0109] Through the above scheme, the multi-layer GCN structure can realize the layer-by-layer update of the relationship between entities represented by the syntactic graph and the entity context relationship represented by the entity initial features, thereby improving the convergence effect of entity core information and core relationships.

[0110] Figure 7 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 7 As shown, the above step 240 may include steps 710 to 720.

[0111] Step 710: Fuse the question information feature with the core information corresponding to the first question information to obtain a fused feature.

[0112] In some embodiments, after obtaining the core information corresponding to each entity and the core features between entities (i.e., the core information corresponding to the first question information) through a multi-layer GCN, the question information features corresponding to the first question information determined based on the BERT model can be fused with the core information corresponding to the first question information to obtain a fused feature representation. Exemplarily, the fusion of the question information features and the core information corresponding to the first question information can be achieved through concatenation, weighted summation, or an attention mechanism. The specific fusion method is not limited in this embodiment.

[0113] Step 720: Classify the legal events corresponding to the fusion features through the fourth neural network model to obtain target event information.

[0114] In some embodiments, after determining the aforementioned fusion features, a fourth neural network model can be used to classify the legal events corresponding to the fusion features to obtain one or more target event information. The fourth neural network model is a classification model, which can be implemented using a fully connected (FC) layer, for example, and is not limited to this in this embodiment.

[0115] For example, for the first question information input by the user, "Zhang San and Li Si are neighbors. Zhang San borrowed 100,000 yuan from Li Si, and the two parties agreed to repay the loan in one year. One year later, Zhang San failed to repay the loan on time and ignored Li Si's reminders for payment", after being processed by the legal event detection model, the target event information corresponding to the first question information can be obtained as "not repaying debts".

[0116] Through the above scheme, the question information features corresponding to the first question information and the core information corresponding to the first question information are integrated, so that the fourth neural network model can use the first question information as a reference in the process of classification prediction, avoiding the problem of not being able to obtain accurate legal event detection results when the output of the multi-layer GCN deviates from the first question information.

[0117] Figure 8 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 8 As shown, the above step 240 may include steps 810 to 840.

[0118] Step 810: Determine first event information corresponding to the first question information based on the question information feature and the core information corresponding to the first question information through a fourth neural network model.

[0119] In some embodiments, because the content of the first question information input by the user is often colloquial, it may not necessarily provide comprehensive information for legal event detection. If the first question information currently input by the user lacks relevant necessary information, the legal event detection model may produce inaccurate event detection results when performing legal event detection on the first question information. Necessary information refers to information required to accurately identify a legal event. Therefore, if the first question information provided by the user lacks necessary information, the central control system can, in response to the first question information input by the user, invoke a legal event establishment condition determination model (hereinafter referred to as the establishment condition determination model) and a legal event detection model. The legal event detection model will initially determine the first event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information (at this point, it is not yet certain whether the first event information corresponds to the actual legal event the user is inquiring about). The establishment condition determination model will then determine the event determination information corresponding to the first event information, thereby determining the necessary information missing from the first question information using this event determination information.

[0120] It can be understood that the method for determining the first event information corresponding to the first question information can refer to the description of the above steps 210 to 240, which will not be repeated here.

[0121] refer to Figure 9 A scene diagram of legal event detection is shown in FIG. Figure 9 As shown, for example, consider the following scenario: first question 901 entered by a user in the central control system's user interface 90: "I signed a three-year shop lease contract with Party A. However, since I'm not making any money, can I request an early termination?" In first question 901, since the cause of the operating losses is unclear, the basis for the party requesting contract termination could be a contract deadlock or a change of circumstances. Therefore, after the legal event detection model determines the first event information corresponding to first question 901 (e.g., determining that the first event information is "Contract Termination Due to Contract Deadlock"), the establishment condition determination model can then determine the event determination information corresponding to "Contract Termination Due to Contract Deadlock," thereby resolving the necessary information missing from the first question using this event determination information.

[0122] Step 820: Determine event determination information based on the first event information through the fifth neural network model, and determine and output second question information based on the event determination information and the first question information.

[0123] In some embodiments, the fifth neural network model (i.e., the establishment condition determination model) can then be used to determine the event determination information based on the first event information, so that the central control system can generate corresponding second question information (or called information slot) based on the event determination information and the first question information to ask questions to the user, so that the user can reply based on the second question information.

[0124] Using the above example, Figure 9 As shown, if the event determination information corresponding to "Contract Termination in Contract Deadlock" determined by the establishment condition determination model is: 1) Although the defaulting party breached the contract first, it was not in bad faith; 2) If the defaulting party continues to perform the contract, it would be unfair to the defaulting party; 3) The performing party refuses to terminate the contract, violating the principle of good faith. Based on the first question information, the user is determined to be the defaulting party, but the reason for the user's operating losses cannot be determined. Therefore, it is impossible to determine whether the user breached the contract in bad faith or whether continuing to perform the contract is unfair to the user. Therefore, based on the event determination information 1) and 2) above, the central control system can generate the corresponding second question information 902 and output it to the user. For example, the second question information 902 could be "What is the reason for your operating losses?" or "Have you fully negotiated with the other party?"

[0125] Step 830: Acquire the reply information input by the user to the second question information, and determine the target question information based on the first question information and the reply information.

[0126] In some embodiments, after the user inputs reply information to the second question information output by the central control system, the legal event detection model can supplement and improve the first question information based on the reply information to obtain the target question information.

[0127] Using the above example, Figure 9 As shown, if the user enters a reply 903 to the second question 902 as follows: "Because my capital chain has broken down, I can no longer operate. After negotiation with the other party, they insisted that I pay three years of rent," the legal event detection model can supplement the first question 901 based on the reply 903 to obtain the target question, such as "I signed a three-year shop lease contract with Party A to rent the other party's shop. However, because my capital chain has broken down, I can no longer operate. After negotiation with the other party, they insisted that I pay three years of rent. Can I request to terminate the lease early?" If the user enters a reply to the second question as follows: "Because municipal construction has blocked the road in front of the shop," the legal event detection model can supplement the first question based on the reply to obtain the target question, such as "I signed a three-year shop lease contract with Party A to rent the other party's shop. However, because municipal construction has blocked the road in front of the shop, can I request to terminate the lease early?"

[0128] Step 840 : Determine target event information based on the target question information features and core information corresponding to the target question information through a fourth neural network model.

[0129] In some embodiments, after obtaining the above-mentioned target question information, the legal event detection model can further determine the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information, thereby determining the second event information based on the target question information characteristics and the core information corresponding to the target question information.

[0130] For example, the second event information determined by the legal event detection model may be the same as or different from the first event information. If the second event information is the same as the first event information, then the second event information or the first event information may be determined as the target event information; if the second event information is different from the first event information, then the newly detected second event information is determined as the target event information.

[0131] Continuing with the above example, when the target question information is "I signed a three-year shop lease contract with Party A to rent the other party's shop, but because my capital chain was broken, I could not continue to operate. After negotiating with the other party, he insisted that I pay three years of rent. Can I request to terminate the lease contract early?", the legal event detection model can determine that the second event information corresponding to the target question information is "Contract termination under contract deadlock". Since the second event information is the same as the first event information, it can be determined that the target event information is "Contract termination under contract deadlock".

[0132] When the target question information is "A and I signed a three-year shop lease contract to rent each other's shop, but because of municipal construction, the road in front of the shop is blocked. Can I request to terminate the lease contract early?", the legal event detection model can determine that the second event information corresponding to the target question information is "change of circumstances". Therefore, the second event information is different from the first event information, so the second event information can be determined as the target event information, that is, the target event information is "change of circumstances".

[0133] In some embodiments, after determining the final target event information, the central control system can call other legal tools to search for legal cases or legal provisions based on the target event information to provide consulting opinions to users. Figure 9 As shown, if the target event information is determined to be "change of circumstances", the central control system can call other legal tools to retrieve legal cases or legal provisions related to contract termination under change of circumstances and integrate them to obtain consulting opinions 904 and output them to the user.

[0134] Through the above scheme, when the necessary information is missing in the consultation information input by the user, the event judgment information can be determined by the legal event establishment condition judgment model, and an information slot can be generated based on the event judgment information; then, the user can be interacted with in the form of questions based on the information slot, so that the user can supplement and improve the consultation information to obtain the target question information, so that the legal event detection model can obtain more accurate legal event detection results based on the target question information.

[0135] Figure 10 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 10 As shown, the "determining event determination information based on the first event information through the fifth neural network model" in the above step 820 may include steps 1010 to 1040.

[0136] Step 1010: Determine multiple preset texts associated with the first event information in a preset database based on the first event information using a fifth neural network model.

[0137] In some embodiments, after the establishment condition determination model obtains the first event information output by the legal event detection model, it can search the preset database for judgment documents (i.e., preset text) related to the first event information. For example, if the first question information input by the user is "I rented A's shop and signed a three-year lease, but now due to an unexpected business loss, can I request to terminate the lease early?", and after the legal event detection model processes the first question information and obtains the first event information "Contract termination due to contract deadlock", the establishment condition determination model can search the preset database for judgment documents related to "Contract termination due to contract deadlock".

[0138] Step 1020: Process the first preset text through the fifth neural network model to obtain multiple retrieval pairs corresponding to the first preset text.

[0139] In some embodiments, the establishment condition determination model may then analyze any preset text (ie, the first preset text) among the plurality of preset texts using a large language model (LLM) to obtain a plurality of search pairs corresponding to the first preset text.

[0140] Each of the multiple search pairs includes a search identifier and search content. The search identifier is used to represent a legal act or legal event, such as "theft," "contract termination," or "tort." The search content is used to represent the entity associated with the legal act or legal event, such as "Zhang San," "5,000 yuan," or "malicious breach of contract." In the preset text, each legal act may correspond to one or more entities, and multiple different search pairs can be determined based on the legal acts and entities.

[0141] Step 1030: Clustering the multiple search pairs corresponding to the first preset text using a fifth neural network model to obtain multiple candidate seed search pairs.

[0142] In some embodiments, after determining the multiple search pairs corresponding to the first preset text, the condition determination model can cluster the multiple search pairs using the large language model (LLM) to determine multiple candidate seed search pairs. For example, to avoid overburdening the model by clustering multiple search pairs at once, multiple rounds of clustering can be used to cluster the multiple search pairs. Multiple rounds of clustering can also allow the next round of clustering to learn from the clustering results of the previous round, thereby improving the clustering effect.

[0143] For example, during each round of clustering, a preset number of search pairs (including seed search pairs obtained from the previous round of clustering and unclustered search pairs) can be selected and clustered to obtain multiple search pairs corresponding to each of one or more legal categories. Seed search pairs are then determined from the multiple search pairs corresponding to each legal category. A seed search pair is a representative search pair from the multiple search pairs corresponding to each legal category. After clustering all search pairs, a final plurality of candidate seed search pairs is obtained. Each candidate seed search pair corresponds to a legal category.

[0144] The legal category can be determined based on the legal field or specific type of legal case. For example, the legal categories may include criminal law (e.g., intentional injury, theft), civil law (e.g., contract disputes, property inheritance), administrative law (e.g., administrative penalties), intellectual property law (e.g., patents, trademarks, copyrights), labor law (e.g., labor contracts, workers' compensation), etc.; or contract law (e.g., lease contract disputes, sales contract disputes, service contract disputes), tort law (e.g., personal injury compensation, traffic accident liability), labor disputes (e.g., termination of labor contracts, unpaid overtime wages), etc. It should be noted that the specific contents of the above legal categories are merely examples and are not limited to these in this embodiment.

[0145] Step 1040: Determine a target seed retrieval pair that meets preset conditions from among multiple candidate seed retrieval pairs through the fifth neural network model, and determine the retrieval content of the target seed retrieval pair as event determination information.

[0146] In some embodiments, after determining the plurality of candidate seed search pairs, a target seed search pair that meets preset conditions can be determined from the plurality of candidate seed search pairs. The target seed search pair can be a candidate search pair with a high degree of semantic relevance to the first event information, and there can be one or more target seed search pairs. Event determination information corresponding to the first question information is then determined based on the search identifier and search content of the target seed search pair.

[0147] For example, if the first question information input by the user is "Can I terminate the shop lease contract?", the first event information obtained after legal event detection on the first question information is the termination of the contract under a contract deadlock, and the search identifier of the determined target seed search pair is "contract termination", and the search content is "It is obviously unfair for the defaulting party to continue to perform the contract", then the search content of the target seed search pair can be determined as the event judgment information corresponding to the first question information.

[0148] Through the above scheme, after the legal events involved in the consultation information input by the user are identified through the legal event detection model and the first event information is obtained, the corresponding event judgment information can be further determined based on the first event information through the establishment condition judgment model, so that the accuracy of the above first event information can be determined based on the event judgment information and the consultation information.

[0149] Figure 11 A flowchart of another method for determining a legal event provided in some embodiments of the present application, such as Figure 11 As shown, the above step 1030 may include steps 1110 to 1140.

[0150] Step 1110: In the current round of clustering, a plurality of first seed retrieval pairs obtained in the previous round of clustering and a plurality of unclustered first retrieval pairs are obtained through the fifth neural network model.

[0151] In some embodiments, during multiple rounds of clustering of multiple retrieval pairs corresponding to the first preset text, the current round of clustering process first obtains multiple seed retrieval pairs (i.e., first seed retrieval pairs) obtained by the previous round of clustering process and multiple retrieval pairs that have not been clustered (i.e., first retrieval pairs).

[0152] For example, assuming the number of search pairs is 1000 and the preset number is 100, in the first round of clustering, 100 search pairs are selected from the 1000 search pairs for unsupervised clustering, resulting in multiple search pairs corresponding to each of the multiple legal categories. First seed search pairs corresponding to each legal category are then determined from the multiple search pairs corresponding to each legal category. If the number of first seed search pairs is 30, in the second round of clustering, 70 unclustered first search pairs are selected from the remaining 900 search pairs (i.e., the sum of the number of first seed search pairs and first search pairs equals the preset number of 100), and these 50 first seed search pairs and 70 first search pairs are then clustered.

[0153] Step 1120 , clustering the plurality of first seed search pairs and the plurality of first search pairs using a fifth neural network model to obtain a plurality of second search pairs corresponding to each of the plurality of legal categories.

[0154] In some embodiments, after obtaining the plurality of first seed search pairs and the plurality of first search pairs through the previous round of clustering, the plurality of first seed search pairs and the plurality of first search pairs are subjected to unsupervised clustering in the current round of clustering to obtain a plurality of second search pairs corresponding to each of the plurality of legal categories. Continuing with the above example, after clustering the 50 first seed search pairs and the 70 first search pairs, a plurality of second search pairs corresponding to each legal category can be obtained, for example, a plurality of second search pairs corresponding to each of the 20 legal categories can be obtained.

[0155] In some examples, an upper limit on the number of legal categories obtained in each round of clustering can be set, such as setting the number of legal categories obtained when clustering 100 search pairs in each round to be at most 60.

[0156] In some examples, different weights can be assigned to the search identifier and the search content during the clustering process. For example, the weight assigned to the search identifier can be set smaller than the weight assigned to the search content (e.g., the weight assigned to the search identifier is 0.4, and the weight assigned to the search content is 0.6). This allows the conditional decision model to be more biased towards the search content of each search pair when clustering multiple search pairs.

[0157] In step 1130, a fifth neural network model is used to determine a second seed search pair corresponding to each legal category from among the multiple second search pairs corresponding to each legal category, and a plurality of unclustered second search pairs are determined from among the multiple search pairs based on a preset number, the plurality of first search pairs, and the plurality of second seed search pairs.

[0158] In some embodiments, after obtaining the plurality of second search pairs corresponding to the aforementioned legal categories through the current round of clustering process, a representative second seed search pair is determined from the plurality of second search pairs corresponding to the legal categories.

[0159] Exemplarily, the method for determining the second seed search pairs corresponding to each legal category can be based on the distance between each second search pair (such as Euclidean distance), or can be obtained by semantically summarizing multiple second search pairs corresponding to each legal category through a large language model. This is not limited in this embodiment.

[0160] In some embodiments, after completing the current round of clustering, a preset number of unclustered second search pairs are obtained from the plurality of search pairs, where the sum of the number of the plurality of second search pairs and the number of the plurality of second seed search pairs equals the preset number. Continuing with the above example, if a plurality of second search pairs corresponding to 20 legal categories are obtained, the number of the plurality of second seed search pairs determined is 20 (i.e., one second seed search pair for each legal category). Subsequently, 80 unclustered second search pairs are selected from the remaining 800 search pairs (i.e., the sum of the number of second seed search pairs and the number of second search pairs equals the preset number of 100). The next round of clustering is then performed on these 20 second seed search pairs and 80 second search pairs.

[0161] Step 1140: Cluster the multiple second seed retrieval pairs and the multiple second retrieval pairs in the next round of clustering process through the fifth neural network model until there are no unclustered retrieval pairs in the multiple retrieval pairs, and obtain multiple candidate seed retrieval pairs determined by the last round of clustering process.

[0162] In some embodiments, the plurality of second seed search pairs and the plurality of second search pairs are clustered in the next round of clustering, and so on, until all the plurality of search pairs are clustered (i.e., no unclustered search pairs exist in the plurality of search pairs), and a plurality of candidate seed search pairs are determined by the final round of clustering. Each candidate seed search pair in the plurality of candidate seed search pairs corresponds to a different legal category.

[0163] Through the above scheme, the establishment condition judgment model can cluster multiple retrieval pairs corresponding to the first preset text through multiple rounds of clustering, thereby improving the clustering effect, that is, obtaining more accurate classification results, and then determining more accurate event judgment information based on the seed retrieval pairs.

[0164] In some embodiments, the above step 1130 of "determining the second seed retrieval pair corresponding to each legal category among the multiple second retrieval pairs corresponding to each legal category through the fifth neural network model" includes: determining the semantic vector corresponding to each second retrieval pair in each legal category through the fifth neural network model; determining the total distance between each first semantic vector and the second semantic vector in each legal category based on the semantic vector corresponding to each second retrieval pair through the fifth neural network model; determining the target semantic vector with the shortest total distance to the second semantic vector among the multiple first semantic vectors through the fifth neural network model, and determining the second retrieval pair corresponding to the target semantic vector as the second seed retrieval pair corresponding to each legal category.

[0165] In some embodiments, when determining the second seed search pairs corresponding to each legal category based on the distance (e.g., Euclidean distance) between each second search pair, the semantic vector corresponding to each second search pair in each legal category may be determined first. For example, the semantic vector corresponding to the search content of each second search pair may be determined.

[0166] For example, in the legal category of "contract termination," the search terms for the second search pair and the corresponding semantic vectors for each search term are: S1 = "Although the defaulting party breached the contract first, it did so not in bad faith," V1 = [0.8, 0.5]; S2 = "It is obviously unfair for the defaulting party to continue to perform the contract," V2 = [0.7, 0.6]; S3 = "The non-breaching party refuses to terminate the contract, which violates the principle of good faith," V3 = [0.9, 0.4]. It should be noted that the specific values ​​of the semantic vectors corresponding to the above search terms are only examples.

[0167] In some embodiments, after determining the semantic vectors corresponding to each second search pair in each legal category, the distance (e.g., Euclidean distance) between the semantic vectors of each second search pair in each legal category and the semantic vectors of other second search pairs in the legal category is determined, that is, the distance between each first semantic vector and the second semantic vector in each legal category is determined, and the distances between each first semantic vector and the second semantic vector are added together to obtain the total distance between each first semantic vector and the second semantic vector. The first semantic vector is a semantic vector corresponding to any second search pair among the multiple second search pairs corresponding to each legal category, and the second semantic vector is a semantic vector corresponding to a second search pair other than the second search pair corresponding to the first semantic vector.

[0168] Continuing with the above example, in the second search pair S1, S2 and S3, the Euclidean distance between the semantic vector V1 of the second search pair S1 and the semantic vector V2 of S2 is ; The second search pair S1 semantic vector V1 and S3 semantic vector V3 distance Euclidean distance The total distance between the semantic vector V1 of the second search pair S1 and the semantic vectors of the second search pair S2 and S3 is .

[0169] Similarly, the total distance between the semantic vector V2 of the second search pair S2 and the semantic vector V1 of the second search pair S1 and the semantic vector V3 of the second search pair S3 can be determined. ; and the total distance between the semantic vector V3 of the second retrieval pair S3 and the semantic vector V1 of the second retrieval pair S1 and the semantic vector V2 of the second retrieval pair S2 .

[0170] In some embodiments, after obtaining the total distances corresponding to the above-mentioned first semantic vectors, the first semantic vector with the shortest total distance can be determined as the target semantic vector, and the second search pair corresponding to the target semantic vector is the second seed search pair corresponding to the legal category to which it belongs.

[0171] Continuing with the above example, the total distance corresponding to the semantic vector V1 of the second search pair S1 is , the total distance corresponding to the semantic vector V2 of the second search pair S2 And the total distance corresponding to the semantic vector V3 of the second search pair S3 Total distance The value of is the smallest, so the semantic vector V1 of the second search pair S1 can be determined as the target semantic vector, and the second search pair S1 is the second seed search pair in the legal category of "contract termination".

[0172] Through the above scheme, when determining the seed retrieval pairs, by determining the sum of the distances between the semantic vectors of each retrieval pair in each legal category and the semantic vectors of all other retrieval pairs, and selecting the retrieval pair with the smallest sum of distances as the seed retrieval pair, the representativeness and centrality of the seed retrieval pairs can be ensured, thereby ensuring the accuracy of the event judgment information determined based on the seed retrieval pairs.

[0173] In some embodiments, the above-mentioned step 1040 of "determining a target seed retrieval pair that meets the preset conditions among multiple candidate seed retrieval pairs through the fifth neural network model" includes: determining a target confidence score for each candidate seed retrieval pair among the multiple candidate seed retrieval pairs; wherein the target confidence score is related to the correlation between each candidate seed retrieval pair and the first event information, and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair; and determining the candidate seed retrieval pair among the multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to the preset score as the target seed retrieval pair.

[0174] In some embodiments, after finally obtaining candidate seed retrieval pairs corresponding to each legal category through multiple rounds of clustering, a target confidence score for each candidate seed retrieval pair may be determined according to a preset scoring rule.

[0175] The target confidence score may be related to the degree of association between each candidate seed search pair and the first event information, and the number of search pairs in the legal category corresponding to each candidate seed search pair. For example, the higher the degree of association between each candidate seed search pair and the first event information, and the greater the number of search pairs in the legal category corresponding to each candidate seed search pair, the higher the target confidence score of each candidate seed search pair; conversely, the lower the degree of association between each candidate seed search pair and the first event information, and the fewer the number of search pairs in the legal category corresponding to each candidate seed search pair, the lower the target confidence score of each candidate seed search pair.

[0176] In some embodiments, candidate seed retrieval pairs whose target confidence scores are greater than or equal to a preset score can then be determined from the plurality of candidate seed retrieval pairs, and these candidate seed retrieval pairs can be determined as target seed retrieval pairs. For example, if the target confidence score corresponding to candidate seed retrieval pair S1 is 80, the target confidence score corresponding to candidate seed retrieval pair S2 is 60, the target confidence score corresponding to candidate seed retrieval pair S3 is 50, the target confidence score corresponding to candidate seed retrieval pair S4 is 30, the target confidence score corresponding to candidate seed retrieval pair S5 is 70, and the preset score is 60, then the candidate seed retrieval pairs S1, S2, and S5 whose target confidence scores are greater than or equal to 60 are the target seed retrieval pairs.

[0177] Through the above scheme, the confidence score of each candidate seed retrieval pair is determined based on the correlation between each candidate seed retrieval pair and the first event information and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair, so that the target seed retrieval pair determined based on the confidence score of each candidate seed retrieval pair can be more relevant to the first event information and can more accurately represent each legal category, thereby further improving the accuracy of subsequent determination of whether the first event information is valid based on the target seed retrieval pair.

[0178] In some embodiments, when determining the target confidence score for each candidate seed retrieval pair, a first confidence score for each candidate seed retrieval pair may be determined based on the degree of association between each candidate seed retrieval pair and the first event information. The higher the degree of association between each candidate seed retrieval pair and the first event information, the higher the first confidence score for each candidate seed retrieval pair.

[0179] Furthermore, the second confidence score of each candidate seed search pair can be determined based on the number of search pairs in the legal category corresponding to each candidate seed search pair. The greater the number of search pairs corresponding to each candidate seed search pair, the higher the second confidence score of each candidate seed search pair.

[0180] In some embodiments, after determining the first confidence score and the second confidence score corresponding to each candidate seed retrieval pair, a target confidence score corresponding to each candidate seed retrieval pair can be determined based on the sum of the first confidence score and the second confidence score. For example, if the first confidence score score1 corresponding to candidate seed retrieval pair S1 is 80 and the second confidence score score2 is 60, then the target confidence score corresponding to candidate seed retrieval pair S1 is score = score1 + score2 = 80 + 60 = 140.

[0181] For example, different weights can be set for the first confidence score and the second confidence score, and a target confidence score can be determined based on the first confidence score, the second confidence score, and the corresponding weights. Continuing with the above example, if the weight of the first confidence score is set to 0.6 and the weight of the second confidence score is set to 0.4, then the target confidence score for the candidate seed retrieval pair S1 is score = 0.6 × score1 + 0.4 × score2 = 0.6 × 80 + 0.4 × 60 = 72.

[0182] In some embodiments, after obtaining multiple candidate seed retrieval pairs and determining the target confidence score of each candidate seed retrieval pair, it is possible to further determine whether the number of target seed retrieval pairs reaches a certain proportion among all candidate seed retrieval pairs. For example, the ratio of the number of target seed retrieval pairs to the number of all candidate seed retrieval pairs can be determined, and whether the ratio is greater than or equal to a preset ratio can be determined. If the proportion of the target seed retrieval pair among all candidate seed retrieval pairs is greater than the preset ratio, the retrieval content of the target seed retrieval pair is determined as the event determination information corresponding to the first question information.

[0183] For example, if the total number of candidate seed search pairs is 5, the number of target seed search pairs is 3, and the preset ratio is 0.6, then the proportion of target seed search pairs in the candidate seed search pairs is 3 / 5 = 0.6, that is, the proportion of target seed search pairs is equal to the preset ratio. Therefore, the search content of the target seed search pair can be determined as the event determination information corresponding to the first question information. For example, if the search content of target seed search pair S1 is "Although the defaulting party breached the contract first, it was not in bad faith," the search content of target seed search pair S2 is "The defaulting party continues to perform the contract, which is obviously unfair to it," and the search content of target seed search pair S3 is "The non-breaching party refuses to terminate the contract, which violates the principle of good faith," then the event determination information corresponding to the first question information is the above search content.

[0184] In some embodiments, if the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is less than a preset ratio, and the number of times multiple rounds of clustering are re-executed (i.e., the number of times clustering is cyclically executed) is less than or equal to the preset number of executions, then multiple rounds of clustering can be re-performed on the multiple retrieval pairs corresponding to the first preset text until the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs obtained is greater than or equal to the preset ratio, or the number of times multiple rounds of clustering are re-executed is greater than the preset number of executions.

[0185] For example, if the total number of candidate seed retrieval pairs corresponding to the first preset text is 10, the number of target seed retrieval pairs is 2, the preset ratio is 0.6, and the preset number of executions is 5 times, then the proportion of target seed retrieval pairs in the candidate seed retrieval pairs is 2 / 10=0.2, that is, the proportion of target seed retrieval pairs is less than the preset ratio. Then, when the number of times multiple rounds of clustering are re-executed is less than or equal to 5 times, multiple rounds of clustering can be re-performed on the multiple retrieval pairs corresponding to the first preset text until the proportion of target seed retrieval pairs corresponding to the first preset text in the candidate seed retrieval pairs is greater than the preset ratio of 0.6, or the number of times multiple rounds of clustering are re-executed is greater than 5 times.

[0186] In some embodiments, if after multiple re-clustering (such as the number of cyclic clustering executions is greater than the preset number of executions), the ratio of the number of target seed retrieval pairs to the number of multiple candidate seed retrieval pairs is still less than the preset ratio, then any preset text other than the first preset text (i.e., the second preset text) can be reselected from the multiple preset texts.

[0187] Similarly, the conditional determination model processes the second preset text to obtain multiple search pairs corresponding to the second preset text. Multiple rounds of clustering are then performed on the multiple search pairs corresponding to the second preset text to determine multiple candidate seed search pairs and a target seed search pair corresponding to the second preset text. If the ratio of the number of target seed search pairs corresponding to the second preset text to the number of candidate seed search pairs corresponding to the second preset text is greater than or equal to a preset ratio, the search content of the target seed search pair is determined as event determination information. If the ratio of the number of target seed search pairs corresponding to the second preset text to the number of candidate seed search pairs is less than a preset ratio, and the number of clustering cycles executed is less than or equal to a preset number of executions, clustering processing continues for the multiple search pairs. This process continues in this manner until the ratio of the number of target seed search pairs corresponding to the second preset text to the number of candidate seed search pairs is greater than or equal to a preset ratio, or the number of multiple rounds of clustering cycles executed is greater than a preset number of executions.

[0188] If it is impossible to obtain a target seed retrieval pair from the second preset text that can serve as the event determination information corresponding to the first question information, then continue to obtain any preset text other than the first preset text and the second preset text (i.e., the third preset text) from the multiple preset texts, and process the third preset text...and so on, until the target seed retrieval pair corresponding to any preset text in the multiple preset texts can serve as the event determination information corresponding to the first question information, or all the preset texts cannot provide event determination information corresponding to the first question information.

[0189] Figure 12 A flowchart of a method for training a legal event retrieval model provided in some embodiments of the present application, such as Figure 12 As shown, the method may include steps 1210 to 1250.

[0190] Step 1210 , obtaining a syntax graph sample and a target vector representation of each sample node in a plurality of nodes.

[0191] In some embodiments, when training a multi-layer GCN model in a legal event detection model, a syntactic graph sample is first obtained. The syntactic graph sample includes multiple nodes (i.e., sample nodes) and multiple edges connecting each node. Each node in the syntactic graph sample represents a different entity in a legal event, such as a person, location, or time. Each edge in the syntactic graph sample represents a relationship between entities corresponding to adjacent nodes, such as the association between a person and a location. Next, a target vector representation for each sample node can be determined in a supervised or unsupervised manner. This target vector representation is used as a reference for the output of the subsequent multi-layer GCN to be trained to optimize the multi-layer GCN.

[0192] Step 1220 : performing vectorization processing on multiple nodes in the syntax graph sample to obtain an initial vector representation of each sample node in the multiple sample nodes.

[0193] In some embodiments, the context information of each sample node may then be determined using the BERT model, that is, the initial vector representation of each sample node may be determined.

[0194] It can be understood that the implementation of step 1220 can refer to the description of step 220 and will not be repeated here.

[0195] Step 1230: Obtain a syntactic graph sample through the third neural network model to be trained, and update the vector representation of each sample node based on the initial vector representation of each sample node and the initial vector representation of the adjacent sample nodes corresponding to each sample node through each of the multiple neural network layers to be trained, so as to obtain an updated vector representation of each sample node determined by each neural network layer to be trained.

[0196] In some embodiments, the syntax graph samples and the initial vector representation of each sample node are input into a multi-layer GCN to be trained, and the initial vector representation of each sample node is updated layer by layer by each GCN layer in the multi-layer GCN to be trained based on the initial vector representation of each sample node and the initial vector representations of the adjacent sample nodes corresponding to each sample node. Exemplarily, each GCN layer can update the initial vector representation corresponding to each sample node based on the adjacency matrix and self-connectivity matrix corresponding to the syntax graph samples, the weight matrix corresponding to each GCN layer, and the nonlinear activation function, thereby obtaining an updated vector representation of each sample node determined by each GCN layer to be trained.

[0197] It can be understood that the implementation of step 1230 can refer to the description of steps 610 to 620, which will not be repeated here.

[0198] Step 1240: Determine a loss function corresponding to a third neural network model to be trained based on the target vector representation of each sample node and the updated vector representation of each node determined by the last neural network layer in the multiple neural network layers.

[0199] In some embodiments, after each layer of GCN determines the updated vector representation of each sample node, the loss function corresponding to the third neural network model is determined based on the updated vector representation of each sample node obtained by the last layer of GCN and the target vector representation of each sample node.

[0200] For example, the loss function corresponding to the third neural network model can be determined by using a mean square error or other method, which is not limited in this embodiment. In some examples, the mean square error loss function corresponding to the third neural network model can be determined according to formula (2):

[0201] ; (2)

[0202] in, is the mean square error loss function, is the updated vector representation of each sample node obtained by the last layer of GCN, is the target vector representation of each sample node.

[0203] Step 1250: Optimize the parameters in the third neural network model based on the loss function to obtain a trained third neural network model.

[0204] In some embodiments, a backpropagation algorithm can be used to calculate the gradient of the loss function corresponding to the third neural network model with respect to its parameters (including the weight matrices of each GCN layer), and an optimization algorithm (such as a gradient descent algorithm) can be used to update the parameters to gradually reduce the loss function. Furthermore, the third neural network model can be trained iteratively until the model's loss function converges to a smaller value or a preset number of training rounds is reached.

[0205] For example, the weight matrix corresponding to each layer of GCN can be updated according to the gradient descent algorithm of formula (3):

[0206] ; (3)

[0207] in, is the weight matrix corresponding to each layer of GCN; is the learning rate, which is used to control the step size of each parameter update; is the loss function right The gradient of The rate of change of the loss function; Formula (3) indicates that the adjustment is made in the negative direction of the gradient (i.e., the direction in which the loss function decreases). .

[0208] By applying the above technical solution, the contextual relationship corresponding to each entity in the question information input by the user (that is, the initial features corresponding to each entity) can be extracted through the BERT model, and the initial features corresponding to each entity can be updated layer by layer through the multi-layer GCN model, so as to finally obtain the core information corresponding to each entity and the core relationship between each entity. Then, the legal event information corresponding to the first question information can be accurately determined based on the core information corresponding to each entity and the core relationship between each entity through the classification model.

[0209] Figure 13 This is a schematic diagram of a device for determining a legal event provided in some embodiments of the present application. Figure 13 As shown, the legal event determination device 1300 can be configured to Figure 1 The legal event detection model shown in FIG. 1 is a diagram illustrating a legal event detection model. The legal event determination apparatus 1300 includes a first acquisition module 1310 , a first determination module 1320 , a first update module 1330 , a second determination module 1340 , and a third determination module 1350 .

[0210] The first acquisition module 1310 is configured to acquire first question information input by the user, and determine the entity relationships between multiple entities in the first question information and each of the multiple entities through the first neural network model in the legal event detection model.

[0211] The first determination module 1320 is configured to determine the question information features corresponding to the first question information and the initial features corresponding to each entity based on the first question information and multiple entities through the second neural network model in the legal event detection model; wherein the initial features corresponding to each entity represent the context information corresponding to each entity.

[0212] The first update module 1330 is configured to update the initial features corresponding to each entity based on the syntactic graph corresponding to the first question information and the initial features corresponding to each entity through multiple neural network layers in the third neural network model in the legal event detection model, and obtain the updated features corresponding to each entity determined by each neural network layer in the multiple neural network layers; wherein the syntactic graph includes multiple nodes and multiple edges, each node in the multiple nodes corresponds to each entity, and each edge in the multiple edges corresponds to the entity relationship between the entities.

[0213] The second determination module 1340 is configured to determine the updated features corresponding to each entity determined by the last neural network layer in the multiple neural network layers as the core information corresponding to the first question information.

[0214] The third determination module 1350 is configured to determine the target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through the fourth neural network model in the legal event detection model.

[0215] In some embodiments, the first determination module 1320 is specifically configured to: obtain historical event information, and vectorize the historical event information through the first neural network model to obtain a supervision vector; extract features of the legal elements in the first question information through the first neural network model to obtain multiple element features corresponding to the first question information; determine the content features corresponding to the first question information based on the multiple element features and the supervision vector corresponding to the first question information through the first neural network model, and determine the content features as multiple entities; extract entity relationships from the content features through the first neural network model to obtain entity relationships between entities.

[0216] In some embodiments, the first update module 1330 is specifically configured to: obtain the first features corresponding to each entity determined by the first neural network layer based on the initial features corresponding to each entity, the adjacency matrix corresponding to the syntactic graph, the self-connection matrix and the weight matrix corresponding to the first neural network layer among multiple neural network layers; wherein the first neural network layer is the first neural network layer among multiple neural network layers; obtain the second features corresponding to each entity determined by the second neural network layer based on the first features corresponding to each entity, the adjacency matrix corresponding to the syntactic graph, the self-connection matrix and the weight matrix corresponding to the second neural network layer among multiple neural network layers; wherein the updated features corresponding to each entity include the first features corresponding to each entity and the second features corresponding to each entity.

[0217] In some embodiments, the third determination module 1350 is specifically configured to: fuse the question information features and the core information corresponding to the first question information to obtain a fused feature; classify the legal events corresponding to the fused feature through the fourth neural network model to obtain target event information.

[0218] In some embodiments, the third determination module 1350 is specifically configured to: determine the first event information corresponding to the first question information based on the question information characteristics and the core information corresponding to the first question information through the fourth neural network model; determine the event judgment information based on the first event information through the fifth neural network model, and determine and output the second question information based on the event judgment information and the first question information; obtain the reply information input by the user to the second question information, and determine the target question information based on the first question information and the reply information; determine the target event information based on the target question information characteristics corresponding to the target question information and the core information corresponding to the target question information through the fourth neural network model.

[0219] In some embodiments, the third determination module 1350 is specifically configured to: determine multiple preset texts associated with the first event information in a preset database based on the first event information through the fifth neural network model; process the first preset text through the fifth neural network model to obtain multiple retrieval pairs corresponding to the first preset text; wherein the first preset text is any preset text among the multiple preset texts, and each retrieval pair in the multiple retrieval pairs includes a retrieval identifier and a retrieval content; cluster the multiple retrieval pairs corresponding to the first preset text through the fifth neural network model to obtain multiple candidate seed retrieval pairs; determine the target seed retrieval pair that meets the preset conditions among the multiple candidate seed retrieval pairs through the fifth neural network model, and determine the retrieval content of the target seed retrieval pair as the event judgment information.

[0220] In some embodiments, the third determination module 1350 is specifically configured to: in the clustering process of the current round, obtain multiple first seed retrieval pairs obtained in the clustering process of the previous round and multiple unclustered first retrieval pairs through the fifth neural network model; wherein the multiple retrieval pairs include multiple first seed retrieval pairs and multiple first retrieval pairs, and the sum of the number of the multiple first seed retrieval pairs and the multiple first retrieval pairs is equal to a preset number; cluster the multiple first seed retrieval pairs and the multiple first retrieval pairs through the fifth neural network model to obtain multiple second retrieval pairs corresponding to each legal category in the multiple legal categories; and cluster the multiple first seed retrieval pairs and the multiple first retrieval pairs through the fifth neural network model. The model determines the second seed retrieval pairs corresponding to each legal category among the multiple second retrieval pairs corresponding to each legal category, and determines the multiple unclustered second retrieval pairs among the multiple retrieval pairs based on the preset number, the multiple first retrieval pairs and the multiple second seed retrieval pairs; the multiple second seed retrieval pairs and the multiple second retrieval pairs are clustered in the next round of clustering process through the fifth neural network model until there are no unclustered retrieval pairs in the multiple retrieval pairs, and multiple candidate seed retrieval pairs determined by the last round of clustering process are obtained; wherein each candidate seed retrieval pair in the multiple candidate seed retrieval pairs corresponds to a different legal category.

[0221] In some embodiments, the third determination module 1350 is specifically configured to: determine the semantic vector corresponding to each second retrieval pair in each legal category through the fifth neural network model; determine the total distance between each first semantic vector and the second semantic vector in each legal category based on the semantic vector corresponding to each second retrieval pair through the fifth neural network model; wherein the first semantic vector is the semantic vector corresponding to any second retrieval pair in the multiple second retrieval pairs corresponding to each legal category, and the second semantic vector is the semantic vector corresponding to the second retrieval pair other than the second retrieval pair corresponding to the first semantic vector; determine the target semantic vector with the shortest total distance to the second semantic vector among the multiple first semantic vectors through the fifth neural network model, and determine the second retrieval pair corresponding to the target semantic vector as the second seed retrieval pair corresponding to each legal category.

[0222] In some embodiments, the third determination module 1350 is specifically configured to: determine the target confidence score of each candidate seed retrieval pair among multiple candidate seed retrieval pairs; wherein the target confidence score is related to the correlation between each candidate seed retrieval pair and the first event information, and the number of retrieval pairs in the legal category corresponding to each candidate seed retrieval pair; and determine the candidate seed retrieval pair among multiple candidate seed retrieval pairs whose target confidence score is greater than or equal to the preset score as the target seed retrieval pair.

[0223] Figure 14 Schematic diagram of a training device for a legal event detection model provided in some embodiments of the present application. Figure 14As shown, the training device 1400 of the legal event detection model can be configured to Figure 1 The legal event detection model training apparatus 1400 includes a second acquisition module 1410 , a vectorization processing module 1420 , a second updating module 1430 , a fourth determination module 1440 and an optimization module 1450 .

[0224] The second acquisition module 1410 is configured to acquire a syntax graph sample and a target vector representation of each sample node in a plurality of nodes.

[0225] The syntax graph sample includes multiple sample nodes.

[0226] The vectorization processing module 1420 is configured to perform vectorization processing on multiple nodes in the syntax graph sample to obtain an initial vector representation of each sample node in the multiple sample nodes.

[0227] The second updating module 1430 is configured to obtain syntactic graph samples through the third neural network model to be trained, and update the vector representation of each sample node based on the initial vector representation of each sample node and the initial vector representation of the adjacent sample nodes corresponding to each sample node through each of the multiple neural network layers to be trained, to obtain the updated vector representation of each sample node determined by each neural network layer to be trained.

[0228] The third neural network model to be trained includes multiple neural network layers to be trained.

[0229] The fourth determination module 1440 is configured to determine the loss function corresponding to the third neural network model to be trained based on the target vector representation of each sample node and the update vector representation of each node determined by the last neural network layer in the multiple neural network layers.

[0230] The optimization module 1450 is configured to optimize the parameters in the third neural network model based on the loss function to obtain a trained third neural network model.

[0231] Figure 15 A schematic diagram of an electronic device provided for some embodiments of the present application. In some embodiments, the electronic device includes one or more processors and a memory. The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining a legal event or the method for training a legal event detection model in the above-described embodiments.

[0232] like Figure 15As shown, the electronic device 1500 includes a processor 1501 and a memory 1502 . Exemplarily, the electronic device 1500 may further include a communication interface 1503 and a communication bus 1504 .

[0233] The processor 1501, the memory 1502 and the communication interface 1503 communicate with each other via a communication bus 1504. The communication interface 1503 is used to communicate with other devices such as a client or other server network elements.

[0234] In some embodiments, processor 1501 is configured to execute program 1505, specifically, to execute the relevant steps in the above-mentioned method for determining legal events or the method for training a legal event detection model. Specifically, program 1505 may include program code, which includes computer-executable instructions.

[0235] For example, processor 1501 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement some embodiments of the present application. The one or more processors that electronic device 1500 may include may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0236] In some embodiments, the memory 1502 is used to store the program 1505. The memory 1502 may include a high-speed RAM memory, and may also include a non-volatile memory (NVM), such as at least one disk storage.

[0237] Program 1505 can be specifically called by processor 1501 to enable electronic device 1500 to execute a method for determining a legal event or a method for training a legal event detection model.

[0238] Some embodiments of the present application provide a computer-readable storage medium storing at least one executable instruction. When the executable instruction runs on the electronic device 1500, the electronic device 1500 executes the method for determining legal events or the method for training the legal event detection model in the above-mentioned embodiment.

[0239] The executable instructions may be specifically used to enable the electronic device 1500 to execute a method for determining a legal event or a method for training a legal event detection model.

[0240] For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0241] The beneficial effects that can be achieved by the computer-readable storage medium provided in some embodiments of the present application can be referred to the beneficial effects of the corresponding legal event determination method or legal event detection model training method provided above, and will not be repeated here.

[0242] It should be noted that, in the application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0243] Each embodiment in this specification is described in a related manner. Similar portions between the embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For related portions, refer to the description of the method embodiments.

[0244] The logic and / or steps represented in the flowchart or otherwise described herein may be considered, for example, as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device).

[0245] For the purposes of this specification, a "computer-readable medium" can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with an instruction execution system, apparatus, or device.

[0246] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic device, and a portable compact disk read-only memory (CDROM).

[0247] In addition, the computer readable medium can even be paper or other suitable medium on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in the computer memory. It should be understood that various parts of the present application can be implemented in hardware, software, firmware or a combination thereof.

[0248] In the above-described embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one or a combination of the following technologies known in the art may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.

[0249] The above-described embodiments of the present application do not constitute a limitation on the scope of protection of the present application.

Claims

1. A method for determining a legal event, characterized in that: Applied to a legal event detection model, the method includes: Obtaining first question information input by a user, and determining, through a first neural network model in the legal event detection model, a plurality of entities in the first question information and entity relationships between each of the plurality of entities; Determining, by a second neural network model in the legal event detection model, question information features corresponding to the first question information and initial features corresponding to each of the entities based on the first question information and the multiple entities; wherein the initial features corresponding to each of the entities represent context information corresponding to each of the entities; The method further comprises: updating the initial features corresponding to the entities based on the syntax graph corresponding to the first question information and the initial features corresponding to the entities by multiple neural network layers in the third neural network model in the legal event detection model, thereby obtaining updated features corresponding to the entities determined by each of the multiple neural network layers; wherein the syntax graph includes multiple nodes and multiple edges, each of the multiple nodes corresponds to each of the entities, and each of the multiple edges corresponds to an entity relationship between the entities; Determining the updated features corresponding to each of the entities determined by the last neural network layer in the multiple neural network layers as the core information corresponding to the first question information; determining, by a fourth neural network model in the legal event detection model, target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information; The determining of target event information corresponding to the first question information by the fourth neural network model in the legal event detection model based on the question information features and the core information corresponding to the first question information includes: determining, by the fourth neural network model, first event information corresponding to the first question information based on the question information feature and the core information corresponding to the first question information; determining, by a fifth neural network model, a plurality of preset texts associated with the first event information in a preset database based on the first event information; Processing the first preset text through the fifth neural network model to obtain a plurality of search pairs corresponding to the first preset text; wherein the first preset text is any preset text among the plurality of preset texts, and each of the plurality of search pairs includes a search identifier and a search content; performing clustering processing on the multiple search pairs corresponding to the first preset text using the fifth neural network model to obtain multiple candidate seed search pairs; Determining a target seed retrieval pair that meets a preset condition from among the plurality of candidate seed retrieval pairs by using the fifth neural network model, and determining the retrieval content of the target seed retrieval pair as event determination information; determining and outputting second question information based on the event determination information and the first question information; Acquiring a reply information input by the user to the second question information, and supplementing the first question information based on the reply information to obtain target question information; The target event information is determined by the fourth neural network model based on the target question information features corresponding to the target question information and the core information corresponding to the target question information.

2. The method according to claim 1, characterized in that The determining, by using the first neural network model in the legal event detection model, the entity relationships between the multiple entities in the first question information and each of the multiple entities includes: Acquire historical event information, and perform vectorization processing on the historical event information through the first neural network model to obtain a supervision vector; extracting features of legal elements in the first question information using the first neural network model to obtain multiple element features corresponding to the first question information; determining, by the first neural network model, content features corresponding to the first question information based on the multiple element features corresponding to the first question information and the supervision vector, and determining the content features as the multiple entities; Entity relationships between the content features are extracted using the first neural network model to obtain entity relationships between the entities.

3. The method according to claim 1, characterized in that The updating of the initial features corresponding to the entities by the multiple neural network layers in the third neural network model in the legal event detection model based on the syntactic graph corresponding to the first question information and the initial features corresponding to the entities, to obtain the updated features corresponding to the entities determined by each of the multiple neural network layers, includes: Obtaining, by a first neural network layer among the multiple neural network layers, a first feature corresponding to each of the entities determined by the first neural network layer based on the initial features corresponding to each of the entities, the adjacency matrix and the self-connection matrix corresponding to the syntactic graph, and the weight matrix corresponding to the first neural network layer; wherein the first neural network layer is the first neural network layer among the multiple neural network layers; The second neural network layer among the multiple neural network layers obtains the second feature corresponding to each of the entities determined by the second neural network layer based on the first feature corresponding to each of the entities, the adjacency matrix corresponding to the syntactic graph, the self-connection matrix and the weight matrix corresponding to the second neural network layer; wherein the updated feature corresponding to each of the entities includes the first feature corresponding to each of the entities and the second feature corresponding to each of the entities.

4. The method according to any one of claims 1 to 3, characterized in that The determining, by the fourth neural network model in the legal event detection model, target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information, includes: fusing the question information feature and the core information corresponding to the first question information to obtain a fused feature; The legal events corresponding to the fusion features are classified through the fourth neural network model to obtain the target event information.

5. The method according to claim 1, wherein The clustering process of the plurality of search pairs corresponding to the first preset text by the fifth neural network model to obtain a plurality of candidate seed search pairs includes: In the current round of clustering, the fifth neural network model is used to obtain a plurality of first seed retrieval pairs obtained in the previous round of clustering and a plurality of unclustered first retrieval pairs; wherein the plurality of retrieval pairs includes the plurality of first seed retrieval pairs and the plurality of first retrieval pairs, and the sum of the plurality of first seed retrieval pairs and the plurality of first retrieval pairs is equal to a preset number; performing clustering processing on the plurality of first seed search pairs and the plurality of first search pairs by the fifth neural network model to obtain a plurality of second search pairs corresponding to each of the plurality of legal categories; Determining, by the fifth neural network model, a second seed search pair corresponding to each legal category among the plurality of second search pairs corresponding to each legal category, and determining a plurality of unclustered second search pairs among the plurality of search pairs based on the preset number, the plurality of first search pairs, and the plurality of second seed search pairs; The fifth neural network model is used to cluster the multiple second seed retrieval pairs and the multiple second retrieval pairs in the next round of clustering process until there are no unclustered retrieval pairs in the multiple retrieval pairs, and the multiple candidate seed retrieval pairs determined by the last round of clustering process are obtained; wherein each of the multiple candidate seed retrieval pairs corresponds to a different legal category.

6. The method according to claim 5, characterized in that Determining, by the fifth neural network model, a second seed search pair corresponding to each of the legal categories from among the plurality of second search pairs corresponding to each of the legal categories includes: Determining, by the fifth neural network model, a semantic vector corresponding to each of the second search pairs in each of the legal categories; Determining, by the fifth neural network model, a total distance between each first semantic vector and a second semantic vector in each of the legal categories based on the semantic vectors corresponding to each of the second search pairs; wherein the first semantic vector is a semantic vector corresponding to any second search pair among the plurality of second search pairs corresponding to each of the legal categories, and the second semantic vector is a semantic vector corresponding to a second search pair other than the second search pair corresponding to the first semantic vector; The fifth neural network model is used to determine a target semantic vector with the shortest total distance to the second semantic vector among multiple first semantic vectors, and the second retrieval pair corresponding to the target semantic vector is determined as the second seed retrieval pair corresponding to each legal category.

7. The method according to claim 1, characterized in that Determining a target seed retrieval pair that meets a preset condition from among the plurality of candidate seed retrieval pairs by using the fifth neural network model includes: Determining a target confidence score for each of the plurality of candidate seed search pairs; wherein the target confidence score is related to a degree of association between each candidate seed search pair and the first event information, and the number of search pairs in the legal category corresponding to each candidate seed search pair; A candidate seed retrieval pair whose target confidence score is greater than or equal to a preset score among the multiple candidate seed retrieval pairs is determined as the target seed retrieval pair.

8. A device for determining a legal event, characterized in that: Configured in a legal event detection model, the apparatus comprises: a first acquisition module configured to acquire first question information input by a user, and determine, through a first neural network model in the legal event detection model, a plurality of entities in the first question information and entity relationships between each of the plurality of entities; a first determination module configured to determine, based on the first question information and the multiple entities, a question information feature corresponding to the first question information and an initial feature corresponding to each of the entities using a second neural network model in the legal event detection model; wherein the initial feature corresponding to each of the entities represents context information corresponding to each of the entities; A first updating module is configured to update the initial features corresponding to each of the entities based on the syntax graph corresponding to the first question information and the initial features corresponding to each of the entities through multiple neural network layers in a third neural network model in the legal event detection model, thereby obtaining updated features corresponding to each of the entities determined by each of the multiple neural network layers; wherein the syntax graph includes multiple nodes and multiple edges, each of the multiple nodes corresponds to each of the entities, and each of the multiple edges corresponds to an entity relationship between the entities; a second determining module configured to determine the updated features corresponding to each of the entities determined by the last neural network layer in the multiple neural network layers as the core information corresponding to the first question information; a third determination module configured to determine target event information corresponding to the first question information based on the question information features and the core information corresponding to the first question information through a fourth neural network model in the legal event detection model; The third determining module is specifically configured to: determining, by the fourth neural network model, first event information corresponding to the first question information based on the question information feature and the core information corresponding to the first question information; determining, by a fifth neural network model, a plurality of preset texts associated with the first event information in a preset database based on the first event information; Processing the first preset text through the fifth neural network model to obtain a plurality of search pairs corresponding to the first preset text; wherein the first preset text is any preset text among the plurality of preset texts, and each of the plurality of search pairs includes a search identifier and a search content; performing clustering processing on the multiple search pairs corresponding to the first preset text using the fifth neural network model to obtain multiple candidate seed search pairs; Determining a target seed retrieval pair that meets a preset condition from among the plurality of candidate seed retrieval pairs by using the fifth neural network model, and determining the retrieval content of the target seed retrieval pair as event determination information; determining and outputting second question information based on the event determination information and the first question information; Acquiring a reply information input by the user to the second question information, and supplementing the first question information based on the reply information to obtain target question information; The target event information is determined by the fourth neural network model based on the target question information features corresponding to the target question information and the core information corresponding to the target question information.

9. An electronic device, characterized in that: include: one or more processors; and a memory configured to: store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining a legal event according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the method for determining a legal event according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Legal document generation method and system based on reading understanding and intention recognition model

    CN114297342A