A legal document drafting guidance processing method and system based on a language model
By constructing a spatiotemporal graph and combining interactive actions and handwriting pressure data, and utilizing counterfactual reasoning and reinforcement learning, the problems of rigid narration and insufficient persuasiveness in existing technologies are solved, enabling personalized dynamic optimization of legal documents and logically rigorous document generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING NEW ORANGE TECH CO LTD
- Filing Date
- 2026-04-03
- Publication Date
- 2026-06-19
AI Technical Summary
Existing legal document drafting technologies struggle to dynamically adjust narrative flexibility and persuasiveness, cannot deeply simulate the possibilities of event connections, and are difficult to personalize and optimize.
By constructing an initial spatiotemporal graph, using a temporal knowledge graph embedding model to process interactive actions and handwriting pressure data, dynamically adjusting the relevance of events, and simulating multi-perspective logical paths through counterfactual reasoning and reinforcement learning decision frameworks, a logically rigorous and perspective-appropriate first draft of the document is finally generated.
It enables personalized and dynamic optimization of legal documents and enhances the persuasiveness of arguments, generating logically rigorous and position-appropriate drafts of documents, and providing specific operational guidance.
Smart Images

Figure CN121961784B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of legal document drafting, and in particular to a language model-based method and system for guiding legal document drafting. Background Technology
[0002] In the field of intelligent legal document drafting, automated processing technology can help writers construct factual narratives from complex evidence. It is particularly valuable in case descriptions that require clarifying timelines and causal relationships, and it helps improve the efficiency and logic of document output.
[0003] Currently, this type of technology mainly relies on automatically extracting key event and time information from evidence texts and organizing this information into linear narrative paragraphs through predefined rules or templates to generate document drafts.
[0004] However, these existing methods have obvious limitations. Their narrative logic is fixed and cannot be dynamically adjusted or personalized according to the writer's real-time thoughts. At the same time, the system is also difficult to deeply simulate the multiple possibilities of event connections and evaluate the impact of different writing strategies on the final persuasiveness. Summary of the Invention
[0005] The purpose of this application is to provide a language model-based method and system for guiding the drafting of legal documents, in order to solve the problems of poor narrative flexibility and difficulty in proactively optimizing the persuasiveness of arguments in existing legal documents.
[0006] To address the aforementioned technical problems, firstly, this application provides a language model-based legal document drafting guidance processing method, comprising:
[0007] Acquire evidence materials for various legal cases, as well as the sequence of interactive actions generated by users during operation and pressure data of handwriting when writing;
[0008] Based on the aforementioned evidence, an initial spatiotemporal graph is constructed, the interaction sequence is parsed into editing instructions, and the initial spatiotemporal graph is updated in real time according to the editing instructions to obtain an optimized spatiotemporal graph;
[0009] The optimized spatiotemporal graph is processed using a temporal knowledge graph embedding model, and the semantic correlation between legal events in the optimized spatiotemporal graph is dynamically adjusted using the stress data to obtain an enhanced spatiotemporal graph.
[0010] Based on the enhanced spatiotemporal graph, the evolution of various legal events under different perspectives is simulated in parallel using counterfactual reasoning methods to obtain multiple logic graphs;
[0011] The logic diagram and the preset strategy template library are input into the reinforcement learning decision framework. The reinforcement learning decision framework is used to conduct multiple rounds of adversarial evaluation with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position.
[0012] Based on the target logical structure and the text construction strategy, a first draft of text is generated, and based on the decision path corresponding to the first draft of text, the interaction action sequence is traced back to obtain guidance information, which is then presented on the visualization interface where the user performs the operation.
[0013] Optionally, the step of processing the optimized spatiotemporal graph using a temporal knowledge graph embedding model and dynamically adjusting the semantic correlation between legal events in the optimized spatiotemporal graph using the stress data to obtain an enhanced spatiotemporal graph includes:
[0014] The optimized spatiotemporal graph is input into the temporal knowledge graph embedding model, and the encoding module of the temporal knowledge graph embedding model is used to convert the timestamps of each legal event into time feature vectors.
[0015] The fusion module of the temporal knowledge graph embedding model is used to fuse the time feature vector with the initial feature vector of the corresponding legal event to generate a node feature vector;
[0016] The pressure data is mapped to the semantic correlation between legal event nodes using the mapping module of the temporal knowledge graph embedding model;
[0017] The computation module of the temporal knowledge graph embedding model is used to calculate the dynamic modulation factor between corresponding legal event nodes based on the semantic relevance, and the dynamic modulation factor is used to weight the node feature vector to generate the target relationship vector.
[0018] By utilizing the graph attention module of the temporal knowledge graph embedding model, and combining the node feature vector and the target relation vector, the attention coefficient between corresponding legal event nodes is calculated, and the neighborhood information of each legal event node is aggregated based on the attention coefficient to obtain a deep semantic vector.
[0019] The graph reconstruction module of the temporal knowledge graph embedding model is used to reconstruct an enhanced spatiotemporal graph based on all the aforementioned deep semantic vectors.
[0020] Optionally, the graph reconstruction module utilizing the temporal knowledge graph embedding model reconstructs the enhanced spatiotemporal graph based on all the deep semantic vectors, including:
[0021] The deep semantic vector is input into the calculator of the graph reconstruction module to calculate the correlation score between the deep semantic vectors corresponding to any two legal event nodes;
[0022] The edge generator of the graph reconstruction module filters out legal event node pairs whose correlation scores exceed a preset dynamic threshold to generate an initial edge set. The preset dynamic threshold is calculated based on the statistical distribution of correlation scores among all legal event node pairs.
[0023] By combining the temporal and semantic features in the deep semantic vector, a confidence weight is calculated for each edge in the initial edge set to generate a weighted edge set;
[0024] The assembler of the graph reconstruction module uses the deep semantic vector as node features and assigns them to the corresponding legal event nodes. Each edge in the weighted edge set and its corresponding confidence weight are assigned to the corresponding legal event node pair to generate an enhanced spatiotemporal graph.
[0025] Optionally, the step of conducting multi-round adversarial evaluation through the reinforcement learning decision framework with the goal of maximizing persuasiveness, to obtain a target logical structure and text construction strategy adapted to the target position, includes:
[0026] Each of the logical graphs is graph-embedded to obtain a corresponding graph embedding vector. Each policy template in the preset policy template library is encoded to obtain a policy encoding vector.
[0027] Each graph embedding vector is paired and concatenated with each policy encoding vector to generate multiple candidate action vectors. The semantic vector corresponding to the target position is then combined with each candidate action vector to generate a combined vector.
[0028] By using the policy evaluation network in the reinforcement learning decision-making framework, the combined vectors are forward propagated to obtain the initial value evaluation value of each candidate action vector under the target position.
[0029] The candidate action vectors are subjected to adversarial scoring to generate feedback values. The initial value assessment value and the feedback value are then input into a reward function, which uses maximum persuasiveness as the calculation criterion to generate a comprehensive reward value.
[0030] The policy evaluation network is iteratively updated using a dual-delay deep deterministic policy gradient algorithm. When a preset convergence condition is reached, the iteration stops. The final policy evaluation network is then used to calculate the combined vector to obtain the target value evaluation value.
[0031] The action selector in the reinforcement learning decision framework selects the optimal action vector from all candidate action vectors based on the target value assessment.
[0032] The graph embedding vector and policy encoding vector corresponding to the optimal action vector are decoded into the target logical structure and text construction strategy, respectively.
[0033] Optionally, based on the enhanced spatiotemporal graph, the evolution of various legal events under different perspectives is simulated in parallel using counterfactual reasoning methods to obtain multiple logic graphs, including:
[0034] Extract the state attributes of each legal event node and the relationship attributes between legal events from the enhanced spatiotemporal graph, and convert the multiple positions corresponding to each legal event into multiple semantic vectors;
[0035] For each of the semantic vectors, a counterfactual reasoning method is applied to perform position-aware hypothesis analysis to generate an intervention instruction, wherein the intervention instruction contains a hypothetical state to be imposed on the legal event node;
[0036] Based on the intervention instructions and the state attributes, the enhanced spatiotemporal graph is modified to generate a final spatiotemporal graph corresponding to the semantic vector;
[0037] The final spatiotemporal graph and the semantic vector are input into a temporal graph neural network. Using the temporal graph neural network, based on the relational attributes, the state evolution process triggered by the hypothetical state is simulated in the final spatiotemporal graph to obtain the state evolution sequence of each legal event node.
[0038] For each semantic vector, the final spatiotemporal graph is reconstructed based on the state evolution sequence to generate a logical graph corresponding to each position.
[0039] Optionally, constructing an initial spatiotemporal diagram based on the evidence materials includes:
[0040] Extract key text describing each legal event from the evidence materials, and generate legal event nodes corresponding to each legal event based on the key text;
[0041] For each legal event node, the occurrence time information and occurrence location information are extracted from the corresponding key text, and the occurrence time information and occurrence location information are converted into corresponding timestamps and geographic coordinates, respectively;
[0042] Based on the logical or temporal relationships between legal events described in the evidence materials, connection edges are established between the nodes of the legal events.
[0043] All the legal event nodes, timestamps, geographic coordinates, and connecting edges are combined to construct an initial spatiotemporal graph.
[0044] Optionally, parsing the interactive action sequence into editing instructions includes:
[0045] For each interactive action in the interactive action sequence, the legal event node corresponding to each interactive action is determined according to the action type and spatial coordinates of each interactive action.
[0046] Based on the action trajectory corresponding to each of the aforementioned interactive actions, the type of editing operation that the user wants to perform on the legal event node is identified;
[0047] By combining the legal event node with the editing operation type, an operation instruction is generated;
[0048] Arrange all the operation instructions according to the chronological order of the interactive action sequence to obtain the editing instructions.
[0049] Secondly, this application provides a language model-based legal document drafting guidance processing system, including:
[0050] The acquisition module is used to acquire evidence materials for various legal events, as well as the sequence of interactive actions generated by the user during operation and the pressure data of the handwriting when writing.
[0051] The construction module is used to construct an initial spatiotemporal diagram based on the evidence materials, parse the interaction action sequence into editing instructions, and update the initial spatiotemporal diagram in real time according to the editing instructions to obtain an optimized spatiotemporal diagram;
[0052] The adjustment module is used to process the optimized spatiotemporal graph using a temporal knowledge graph embedding model, and dynamically adjust the semantic correlation between legal events in the optimized spatiotemporal graph through the stress data to obtain an enhanced spatiotemporal graph.
[0053] The simulation module is used to simulate the evolution of various legal events under different perspectives in parallel based on the enhanced spatiotemporal graph using counterfactual reasoning methods, so as to obtain multiple logic graphs;
[0054] The evaluation module is used to input the logic diagram and the preset strategy template library into the reinforcement learning decision framework. Through the reinforcement learning decision framework, multiple rounds of adversarial evaluation are carried out with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position.
[0055] The generation module is used to generate a draft text based on the target logical structure and the text construction strategy, and to trace back to the sequence of interactive actions based on the decision path corresponding to the draft text to obtain guidance information, and to present the guidance information on the visualization interface where the user performs the operation.
[0056] Thirdly, this application provides an electronic device, comprising:
[0057] Memory, used to store computer programs;
[0058] A processor, used to execute the computer program to implement the steps of the language model-based legal document drafting guidance processing method as described in the first aspect above.
[0059] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the language model-based legal document drafting guidance processing method described in the first aspect above.
[0060] The language model-based legal document drafting guidance method provided in this application has the following beneficial effects: This application structures legal events by constructing a real-time editable spatiotemporal graph and dynamically enhances event correlation by incorporating handwriting pressure data, enabling the system to accurately capture the user's focus. Furthermore, it uses counterfactual reasoning to parallelly deduce the event logic under different perspectives, and then autonomously selects the most persuasive narrative structure and strategy through reinforcement learning adversarial evaluation. Ultimately, it not only generates logically rigorous and position-appropriate draft documents but also provides retrospective operational guidance. This method achieves a leap from passive filling to active collaboration, significantly improving the performance of documents in complex fact-finding and persuasive argumentation.
[0061] Furthermore, this application constructs a node representation containing temporal semantics by encoding time information into vectors and fusing them with event features; it also innovatively maps handwriting pressure to semantic relevance and uses this as a dynamic weight to adjust the strength of connections between events; and then aggregates deep contextual information through a graph attention mechanism to finally reconstruct an enhanced spatiotemporal graph that reflects both objective temporal sequence and internalizes the user's subjective emphasis. This mechanism enables the calculation of the event association network to have both objective accuracy and personalized adaptability, laying a precise data foundation for subsequent reasoning and strategy generation. Attached Figure Description
[0062] To more clearly illustrate the technical solutions of the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0063] Figure 1 A flowchart illustrating a language model-based legal document drafting guidance processing method provided for embodiments of this application;
[0064] Figure 2A schematic diagram illustrating a specific implementation of a language model-based legal document drafting guidance processing method provided in this application embodiment;
[0065] Figure 3 A schematic diagram of the structure of a language model-based legal document drafting guidance processing system provided in this application embodiment;
[0066] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0067] Current technologies for automatically generating legal documents rely heavily on fixed templates and preset rules, making it difficult to respond to users' editing intentions in real time or to deeply simulate the evolution of arguments under different litigation positions. This results in rigid generated narrative logic and weak strategy adaptability.
[0068] To address this, this application introduces a language model-based method for guiding legal document drafting. The core idea is to construct and optimize an event relationship graph by integrating user interaction and handwriting data in real time; then, to deduce multi-perspective logical paths in parallel; and finally, through reinforcement learning adversarial evaluation, to autonomously select the most persuasive narrative strategy. This method not only achieves personalized and dynamic optimization of document logic but also enhances the positional adaptability and persuasiveness of the argument, fundamentally overcoming the shortcomings of existing technologies in terms of flexibility and specificity.
[0069] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0070] The core of this application is to provide a language model-based method for guiding the drafting of legal documents. A flowchart illustrating one specific implementation is shown below. Figure 1 As shown, the method includes:
[0071] S101. Obtain evidence materials for each legal event, as well as the sequence of interactive actions generated when the user performs operations and the pressure data of the handwriting when writing.
[0072] Evidence materials refer to various original documents related to a specific legal event, such as contract texts, communication records, on-site photos, or official documents.
[0073] Interactive action sequence refers to a series of ordered interface operation records generated by the user during the use of the document writing system, such as click, drag, delete or mark.
[0074] Pressure data refers to the information on changes in pen pressure collected by hardware sensors when a user writes or annotates using a stylus or a pressure-sensitive touchscreen. This data can indirectly reflect the user's level of focus, hesitation, or emphasis when writing different parts.
[0075] In step S101, evidence materials related to legal events provided by the user are obtained through a file upload interface or database retrieval method; at the same time, by recording all user operations on the front-end interface, a sequence of interactive actions arranged in chronological order is obtained, and pressure data generated by the user during the writing or annotation process is synchronously collected and obtained through the pressure sensor of the terminal device.
[0076] S102. Based on the evidence materials, construct an initial spatiotemporal diagram, parse the interaction action sequence into editing instructions, and update the initial spatiotemporal diagram in real time according to the editing instructions to obtain an optimized spatiotemporal diagram.
[0077] In one specific implementation, step S102 includes:
[0078] Step 1021: Extract key text describing each legal event from the evidence materials, and generate legal event nodes corresponding to each legal event based on the key text.
[0079] Among them, key texts refer to statements or fragments that independently describe a single legal fact, identified from the original content of evidentiary materials through information extraction technology. Their content usually includes core elements such as the subject, behavior, and object of the event.
[0080] In step 1021, a pre-trained language model based on the Transformer architecture is used to perform sequence labeling and semantic segmentation on the evidence materials, and the structured key text is extracted by identifying event trigger words and arguments in the sentences. Subsequently, a legal event node is instantiated for each key text segment, and the text vector obtained by the word embedding model is stored as the initial feature vector of the node.
[0081] Step 1022: For each legal event node, extract the occurrence time information and occurrence location information from the corresponding key text, and convert the occurrence time information and occurrence location information into corresponding timestamps and geographic coordinates, respectively.
[0082] In step 1022, named entity recognition is performed on the key text to identify and classify time entities and location entities; then, the extracted time entities are normalized by a date and time parsing library to generate machine-readable timestamps; the extracted location entities are queried and their precise geographic coordinates are returned by calling the geocoding API of Amap or Baidu Maps, and the timestamps and geographic coordinates are associated as attribute pairs with the corresponding legal event nodes.
[0083] Step 1023: Based on the logical or temporal relationships between legal events described in the evidence materials, establish connecting edges between the nodes of the legal events.
[0084] In this context, a connecting edge is a line segment in a graph data structure that connects two legal event nodes. It is used to characterize the specific relationship between the legal facts represented by these two nodes, and its type can include causal relationship, conditional relationship, or temporal relationship.
[0085] In step 1023, a method combining rule matching and dependency parsing is used to extract discourse-level relations from the evidence materials. Then, by analyzing the conjunctions, referential relations and verb tenses between sentences, the causal, conditional or sequential relations between events are identified. For each group of identified relations, a connection edge with directionality and type label is established between the two corresponding legal event nodes.
[0086] Step 1024: Combine all the legal event nodes, timestamps, geographic coordinates, and connecting edges to construct an initial spatiotemporal graph.
[0087] The initial spatiotemporal graph refers to an attribute graph whose vertex set is legal event nodes, edge set is connecting edges, and each vertex has temporal and spatial attributes.
[0088] In step 1024, the legal event nodes, timestamps, and geographic coordinates are integrated, and a graph Ginitial=(V, E, A) is defined, where V is the set of legal event nodes, E is the set of connecting edges, and A is the set of node attributes, which includes timestamps and geographic coordinates. Then, this defined graph is instantiated through a graph database or a graph structure object in memory, thereby completing the construction of the initial spatiotemporal graph.
[0089] Step 1025: For each interactive action in the interactive action sequence, determine the legal event node corresponding to each interactive action based on the action type and spatial coordinates.
[0090] Among them, the action type is the event type recorded in the interaction log, such as CLICK or DROP; the spatial coordinates refer to the pixel coordinates of the cursor in the client viewport when the interaction event occurs.
[0091] In step 1025, the sequence of interactive actions is traversed sequentially, and for each interactive action, its type and coordinates fields are read. Then, a collision test is performed by comparing the spatial coordinates with the bounding box of each legal event node maintained by the front-end rendering layer. When the coordinates fall within the rendering area of a legal event node, the legal event node of this interactive action is determined.
[0092] Step 1026: Based on the action trajectory corresponding to each of the interactive actions, identify the type of editing operation that the user wants to perform on the legal event node.
[0093] Among them, the action trajectory refers to a sequence of continuous, timestamped spatial coordinate points; the editing operation type refers to the operation mapped to a specific graph editing primitive.
[0094] In step 1026, a trajectory recognition algorithm based on a finite state machine is applied. For example, if the trajectory starts from region A and ends at region B, the state machine transitions to the "create edge" state; if the trajectory is represented by a long press and displacement on a single node, it transitions to the "move node" state, and finally outputs the recognized editing operation type.
[0095] Step 1027: Combine the legal event node with the editing operation type to generate operation instructions.
[0096] An operation instruction is a structured data object that conforms to a predetermined pattern, which includes operators, operands, and parameters.
[0097] In step 1027, the ID of the legal event node, the enumeration value of the edit operation type, and the parameters calculated from the trajectory, such as the displacement vector and the endpoint coordinates, are encapsulated to generate, for example, operation instructions in JSON format.
[0098] Step 1028: Arrange all the operation instructions according to the time sequence of the interactive action sequence to obtain the editing instructions.
[0099] Among them, the editing instructions refer to a list of operation instructions arranged in ascending order of timestamps, which defines the operation sequence of graph state transitions.
[0100] In step 1028, all generated operation instructions in this batch are collected and sorted according to the timestamps of their interaction actions to form editing instructions. The graph processing engine receives these instructions and applies each operation instruction in the editing instructions in sequence to perform atomic add, delete, and modify operations on the initial spatiotemporal graph, thereby completing the real-time update of the graph and finally generating an optimized spatiotemporal graph of state evolution.
[0101] This application encodes the temporal characteristics of legal events using a deep learning model and transforms the abstract user handwriting pressure intelligence into a quantitative factor that affects the strength of event correlation. This results in an enhanced spatiotemporal graph that not only objectively reflects the facts and time sequence in the evidence materials but also deeply integrates the author's subjective judgments and emphases during the creative process. This lays a precise semantic foundation for the subsequent generation of legal arguments that are clear in their stance and logically consistent.
[0102] S103. The optimized spatiotemporal graph is processed using a temporal knowledge graph embedding model, and the semantic correlation between legal events in the optimized spatiotemporal graph is dynamically adjusted using the pressure data to obtain an enhanced spatiotemporal graph.
[0103] In one specific implementation, such as Figure 2 As shown, step S103 includes:
[0104] Step 1031: Input the optimized spatiotemporal graph into the temporal knowledge graph embedding model, and use the encoding module of the temporal knowledge graph embedding model to convert the timestamps of each legal event into time feature vectors.
[0105] Among them, the time feature vector refers to the timestamp of the legal event, which is transformed into a continuous numerical vector in a high-dimensional space through the encoding module. This vector is encoded by a periodic function, which can simultaneously record time points and reflect the time interval pattern.
[0106] In step 1031, the optimized spatiotemporal graph is input into a pre-trained temporal knowledge graph embedding model. Subsequently, the encoding module of the model reads the timestamp of each legal event node and encodes the timestamp t using sine and cosine periodic functions to generate a fixed-dimensional time feature vector. The formula for calculating its i-th dimension is: ,in, It is a set of preset frequency parameters used to capture the periodic characteristics of different time scales. By transforming abstract timestamps into vectors containing periodic patterns, it can give events a computable temporal context, so that legal events that are temporally close will also be close to each other in the vector space.
[0107] Step 1032: Use the fusion module of the temporal knowledge graph embedding model to fuse the time feature vector with the initial feature vector of the corresponding legal event to generate a node feature vector.
[0108] The initial feature vector refers to the semantic feature vector extracted from the key textual descriptions of the evidence materials of legal events. This vector is generated by a pre-trained natural language processing model and contains core semantic information such as entities, actions, and objects of legal events.
[0109] In step 1032, the fusion module of the temporal knowledge graph embedding model receives the temporal feature vector and the initial feature vector extracted from the text description of the legal event. Then, the module concatenates the two vectors through a fully connected neural network layer. The input dimension of the network layer is the sum of the initial feature vector dimension and the temporal feature vector dimension, and the output dimension is the target node feature vector dimension, which includes a bias term. Then, it is processed by the ReLU function to achieve deep information fusion, thereby generating a unified node feature vector. This step constructs a spatiotemporal integrated comprehensive representation for each legal event, enabling it to carry both content and temporal information in subsequent calculations, thus providing a multi-dimensional basis for accurately assessing the complex relationships between events.
[0110] Step 1033: Use the mapping module of the temporal knowledge graph embedding model to map the pressure data into the semantic correlation between each legal event node.
[0111] Among them, semantic relevance refers to a scalar value calculated by the mapping module, which is used to quantify the strength of the logical connection between two legal event nodes in the current argument. Its value is generated based on handwriting pressure data.
[0112] In step 1033, the mapping module of the temporal knowledge graph embedding model analyzes the collected pressure data, which records the pen pressure applied by the user when associating specific event nodes. The module then first normalizes the original pressure values and inputs them into a lightweight feedforward neural network. This network uses document fragments labeled with key legal logical connections and their corresponding simulated writing pressure data as training samples to learn the mapping relationship from "pressure patterns labeled near specific legal event nodes" to "the importance of the event pair in the current argumentative context". It outputs a semantic relevance score between 0 and 1 for each pair of related event nodes. This step transforms the subjective attention and judgment focus of the document writer into quantifiable and fusionable objective parameters, enabling the system to perceive the user's argumentative intent.
[0113] Step 1034: Using the computation module of the temporal knowledge graph embedding model, calculate the dynamic modulation factor between the corresponding legal event nodes based on the semantic relevance, and use the dynamic modulation factor to weight the node feature vector to generate the target relationship vector.
[0114] Among them, the dynamic modulation factor refers to the weight coefficient generated in real time by the calculation module based on the semantic relevance.
[0115] In step 1034, for the edge connecting nodes u and v, the computation module of the temporal knowledge graph embedding model is used to... Calculate the dynamic modulation factor ,in, It is a preset gain coefficient. It is the semantic relevance, the original relation vector of the edge. quilt Modulation, generating target relation vector ,That This step, by directly converting the semantic relevance quantified in the previous step into a dynamic adjustment of the strength of legal relationships in the graph, enables subsequent calculations to prioritize key logical connections emphasized by the user.
[0116] Step 1035: Using the graph attention module of the temporal knowledge graph embedding model, combined with the node feature vector and the target relation vector, calculate the attention coefficient between the corresponding legal event nodes, and aggregate the neighborhood information of each legal event node according to the attention coefficient to obtain the deep semantic vector.
[0117] Among them, neighborhood information refers to the sum of the features and relationship information carried by all neighboring nodes directly connected to the central node; deep semantic vector refers to the high-order feature representation obtained by aggregating neighborhood information, which contains rich local context information.
[0118] In step 1035, the graph attention module of the temporal knowledge graph embedding model takes the node feature vectors of all nodes and the target relation vectors of all edges as input. For the central node and each of its neighboring nodes, the module comprehensively considers the node's own features and the relation vectors corresponding to the connections to calculate a non-normalized attention coefficient for preliminary assessment of the importance of the neighbors. Subsequently, the attention coefficients of all neighbors are normalized using the Softmax function to obtain standardized attention weights. Finally, the features of all neighboring nodes are aggregated according to these weights to generate the deep semantic vector of the central node. This step simulates the thought process of weighing the importance of different facts in legal argumentation, so that the final representation of each event absorbs the contextual information that is determined to be key.
[0119] Step 1036: Using the graph reconstruction module of the temporal knowledge graph embedding model, reconstruct the enhanced spatiotemporal graph based on all the aforementioned deep semantic vectors.
[0120] Step 1036 may specifically include the following steps:
[0121] Step a1: Input the deep semantic vector into the calculator of the graph reconstruction module to calculate the correlation score between the deep semantic vectors corresponding to any two legal event nodes.
[0122] In step a1, the calculator in the graph reconstruction module of the temporal knowledge graph embedding model receives the deep semantic vectors of all nodes and calculates the association score between any two nodes u and v. ,in ,in, and Let represent the depth semantic vectors of node u and node v, respectively. and These represent the magnitudes of the two vectors, respectively.
[0123] Step a2: Using the edge generator of the graph reconstruction module, filter out the pairs of legal event nodes whose correlation scores exceed a preset dynamic threshold to generate an initial edge set. The preset dynamic threshold is calculated based on the statistical distribution of correlation scores among all pairs of legal event nodes.
[0124] In step a2, the edge generator of the graph reconstruction module calculates the mean μ and standard deviation σ of the association scores of all node pairs, and then sets a dynamic threshold T: ,in, It is an adjustable hyperparameter; then, all node pairs with correlation scores exceeding this dynamic threshold are selected to form the initial edge set.
[0125] Step a3: Combining the temporal and semantic features in the deep semantic vector, calculate a confidence weight for each edge in the initial edge set to generate a weighted edge set.
[0126] In step a3, for each edge in the initial edge set, the temporal and semantic features in the depth semantic vectors of its two endpoints are combined, and a confidence weight is calculated through a multilayer perceptron neural network to form a weighted edge set. It should be noted that the multilayer perceptron neural network is a well-known technology in the field, and its specific implementation process can be referred to relevant technologies. The embodiments of this application will not be elaborated here.
[0127] Step a4: Using the assembler of the graph reconstruction module, the deep semantic vector is used as a node feature and assigned to the corresponding legal event node. Each edge in the weighted edge set and the corresponding confidence weight are assigned to the corresponding legal event node pair to generate an enhanced spatiotemporal graph.
[0128] In step a4, the assembler of the graph reconstruction module performs the final reconstruction, which uses the depth semantic vector of each node as the new node feature and assigns each edge in the weighted edge set and its confidence weight to the graph, thereby generating a brand-new enhanced spatiotemporal graph. This step intelligently reconstructs the initial graph based on high-order semantic representation, removes noisy associations and strengthens key logical connections, and finally outputs a logically rigorous and high-quality factual skeleton that incorporates user intent.
[0129] This application not only objectively presents the spatiotemporal and logical chain of the evidence, but also more accurately highlights the core connections that are crucial to the current legal argument, laying a highly accurate and personalized data foundation for generating a clear-cut and logically rigorous legal discourse.
[0130] S104. Based on the enhanced spatiotemporal graph, the evolution of each legal event under different perspectives is simulated in parallel using counterfactual reasoning methods to obtain multiple logic graphs.
[0131] Different positions include those that are consistent with, opposite to, or neutral to the target position.
[0132] In one specific implementation, step S104 includes:
[0133] Step 1041: Extract the state attributes of each legal event node and the relationship attributes between legal events from the enhanced spatiotemporal graph, and convert the multiple positions corresponding to each legal event into multiple semantic vectors.
[0134] Among them, the state attribute refers to the feature vector parsed from the node features of the augmented spatiotemporal graph, which describes the current nature and degree of the legal event, such as the type, severity, and completion status of the event; the relation attribute refers to the feature vector parsed from the edges of the augmented spatiotemporal graph, which describes the type of association between legal events, such as "leads to", "occurs after", "conditional with", etc.; the position refers to the pre-set specific perspective used to simulate legal argumentation, such as "plaintiff's position", "defendant's position" or "neutral reviewer's position", and each position has a unique set of argumentation goals and value judgment criteria.
[0135] In step 1041, firstly, the deep semantic vector of each legal event node is read from the enhanced spatiotemporal graph, and a property parsing module is used to extract the state attributes that represent the current state of the event; at the same time, the feature vector of each connecting edge in the graph is read, and the relation attributes it represents are parsed out; secondly, according to the preset task requirements, multiple positions to be simulated are loaded, which are usually defined in natural language, such as "Plaintiff: claims that the defendant is grossly negligent"; then, a pre-trained natural language processing model is called to encode the text descriptions of these positions into fixed-length semantic vectors respectively.
[0136] Step 1042: For each of the semantic vectors, apply counterfactual reasoning to perform position-aware hypothesis analysis and generate an intervention instruction, wherein the intervention instruction contains a hypothetical state to be imposed on the legal event node.
[0137] In step 1042, the semantic vector corresponding to each position is processed in parallel. For each semantic vector, it is input together with the current state attributes of all legal event nodes into a counterfactual reasoning method. The core of this method is a decision model based on a neural network. This model takes the semantic vector of the position and the state attributes of all nodes in the graph as input. Its training objective is to output an intervention suggestion that maximizes the argument advantage of the position. That is, for which legal event node should its state be modified to what hypothetical value? For example, for the position "the plaintiff claims that the defendant is grossly negligent", the model may determine that modifying the state of the event node "the defendant's duty of care" from "exerted ordinary care" to "not exercised basic care" will be most beneficial to constructing the plaintiff's logical chain. The decision-making process ultimately generates a specific intervention instruction.
[0138] Step 1043: Modify the enhanced spatiotemporal graph according to the intervention command and the state attribute to generate the final spatiotemporal graph corresponding to the semantic vector.
[0139] In step 1043, the target legal event node that needs to be modified in the enhanced spatiotemporal graph is located according to the instructions in the intervention command. Then, the state attribute of the node is replaced with the new hypothetical state vector in the intervention command as required by the command. This new state vector represents the hypothetical redefinition of the event under this specific position. After this modification is completed, the structure of the enhanced spatiotemporal graph remains unchanged, but the state value of the target node has been updated, thus obtaining the final spatiotemporal graph corresponding to this position.
[0140] Step 1044: Input the final spatiotemporal graph and the semantic vector into the temporal graph neural network. Using the temporal graph neural network, based on the relational attributes, simulate the state evolution process triggered by the hypothetical state in the final spatiotemporal graph to obtain the state evolution sequence of each legal event node.
[0141] In step 1044, the final spatiotemporal graph and its corresponding position semantic vector are input into a pre-trained temporal graph neural network. This model is usually composed of multiple graph convolutional layers and recurrent neural network layers. Its training data consists of a large number of real legal cases and their state change sequences over time. Then, inside the network, firstly, the graph convolutional layer calculates the mutual influence between nodes at each simulated time step according to the connection method defined by the relation attributes. The strength of the influence depends on the current state of the neighboring nodes, the relation attributes of the connecting edges, and the guidance of the position semantic vector.
[0142] Subsequently, the recurrent neural network layer is responsible for maintaining and updating the temporal state memory of the nodes, and predicting the state of each node in the next time step based on the impact of the current time step. This process is carried out iteratively within the model to simulate the entire process of the hypothetical state propagating, spreading, and triggering new states in the event network. Finally, the model outputs the state vector of each legal event node at a series of time steps, i.e., the state evolution sequence.
[0143] Step 1045: For the final spatiotemporal graph corresponding to each semantic vector, reconstruct the causal connections between each legal event node according to the state evolution sequence to generate a logical graph corresponding to each position.
[0144] In step 1045, an offline analysis is performed on the state evolution sequence generated by each position simulation. That is, the time points when the state of different event nodes changes are first detected, and then the temporal relationship and statistical correlation between these changes are analyzed. For example, if the state change of node A is always earlier than the state change of node B, and the magnitude of the changes is correlated, then it is inferred that there is a causal connection from A to B.
[0145] Then, all node pairs are traversed to identify all causal patterns, and these causal connections are reconstructed in the graph in the form of directed edges. Finally, the nodes in the original final spatiotemporal graph are combined with these newly constructed causal connection edges representing the results of logical deduction to generate a completely new logical graph representing the complete argumentation system under this position.
[0146] This application automatically and in parallel generates multiple complete logic diagrams, providing a rich and well-defined resource library for subsequent strategy evaluation and selection. It also fundamentally ensures that the final legal documents closely align with the argumentation needs of specific litigation strategies, further enhancing the documents' logical rigor, strategic relevance, and overall persuasiveness.
[0147] S105. Input the logic diagram and the preset strategy template library into the reinforcement learning decision framework. Through the reinforcement learning decision framework, conduct multiple rounds of adversarial evaluation with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position.
[0148] Maximizing persuasiveness can be achieved through quantification, which can be found in relevant technologies and will not be elaborated here.
[0149] In one specific implementation, step S105 includes:
[0150] Step 1051: Perform graph embedding encoding on each of the logical graphs to obtain the corresponding graph embedding vector, and encode each policy template in the preset policy template library to obtain the policy encoding vector.
[0151] Among them, the strategy template library refers to a predefined set, where each strategy template describes a high-level rhetorical or argumentation pattern for legal document writing, such as "general-to-specific statement", "progression along a timeline", "highlighting the core fault", etc., and usually exists in the form of structured text.
[0152] In step 1051, firstly, each logical graph is input into a pre-trained graph neural network model. This model aggregates the information of all nodes in the graph through multi-layer graph convolution and pooling operations, and outputs a fixed-length vector, namely the graph embedding vector, which represents the overall structure and semantics of the logical graph. At the same time, a preset policy template library is read, and for each policy template in the library, a text encoding model is called to convert its description text into another fixed-length vector, namely the policy encoding vector.
[0153] Step 1052: Pair and concatenate each graph embedding vector with each policy encoding vector to generate multiple candidate action vectors, and combine the semantic vector corresponding to the target position with each candidate action vector to generate a combined vector.
[0154] In step 1052, each graph embedding vector and each policy encoding vector are traversed, and each pair of vectors is concatenated to generate multiple candidate action vectors, the number of which is equal to the product of the number of logic graphs and the number of policy templates. Then, the semantic vector of the target position is obtained, and for each candidate action vector, it is concatenated with the semantic vector of the target position again to generate a combined vector that includes specific logic, specific policy, and macro position.
[0155] Step 1053: Perform forward propagation calculation on the combined vectors through the policy evaluation network in the reinforcement learning decision framework to obtain the initial value evaluation value of each candidate action vector under the target position.
[0156] In step 1053, the policy evaluation network in the reinforcement learning decision framework is typically a multi-layer fully connected feedforward neural network. Each combination vector is then sequentially input into the network, which performs a series of linear transformations and ReLU function processing on the combination vectors through its internal weight parameters, i.e., forward propagation calculation. The last layer of the network is usually a linear output layer, and finally outputs a single scalar value for each input combination vector, i.e., the initial value assessment value. This value represents a preliminary estimate of the expected "persuasive" reward that can be obtained by adopting the logic and policy combination represented by the candidate action vector to achieve the target position under the current network parameters.
[0157] Step 1054: Perform adversarial scoring on the candidate action vectors to generate feedback values, and input the initial value assessment value and the feedback value into a reward function. The reward function uses maximum persuasiveness as the calculation criterion to generate a comprehensive reward value.
[0158] In step 1054, firstly, for each candidate action vector, one or more opposing positions are simulated. If the target position is the plaintiff, then the defendant's position is simulated. A trained logical adversarial evaluation model is invoked. This model, trained on a large number of legal defense texts, can analyze a given logical structure and narrative strategy, and predict its vulnerability when facing rebuttals from opposing positions. It identifies weaknesses such as logical contradictions, missing evidence, or leaps in argumentation, ultimately generating a feedback value F. The lower the value of F, the more vulnerable the proposal. Next, a comprehensive reward value R is designed. The calculation criterion for this comprehensive reward value is to maximize the overall persuasiveness of the final document. This requires the proposal to both strongly support its own position and withstand attacks from the opposing side. Its form is as follows: ,in, and These are preset positive weighting coefficients, and >| The primary objective is to ensure support for one's own position. This is the initial valuation value.
[0159] Step 1055: The policy evaluation network is iteratively updated using the dual-delay deep deterministic policy gradient algorithm. When the preset convergence condition is reached, the iteration stops. The combined vector is calculated using the final policy evaluation network to obtain the target value evaluation value.
[0160] In step 1055, the parameters of the policy evaluation network are updated using the dual-delay deep deterministic policy gradient algorithm. In this algorithm, the current state is represented by a combination vector, the action to be evaluated corresponds to a candidate action vector, and the immediate reward obtained after executing the action is the comprehensive reward value. In each iteration, the algorithm calculates the loss function using the current combination vector, the comprehensive reward value, and the simulated next state vector, and fine-tunes the network weights through backpropagation. This process is repeated, i.e., continuously generating new evaluations, receiving adversarial feedback, calculating rewards, and updating the network.
[0161] Then, the preset convergence condition is usually that the predicted value of the policy evaluation network changes less than a threshold in multiple consecutive iterations, or reaches a fixed number of training rounds. When the condition is met and the iteration stops, a well-trained and stable final policy evaluation network is obtained. At this time, using this final network, all the combination vectors generated in step 1052 are re-propagated to calculate the target value evaluation value. It should be noted that the convergence condition can be set according to the actual application, and this application embodiment does not limit it.
[0162] Step 1056: Based on the target value evaluation value, the action selector in the reinforcement learning decision framework selects the optimal action vector from all candidate action vectors.
[0163] In step 1056, the action selector in the reinforcement learning decision framework is a simple decision logic module. Its core rule is to select the action with the highest corresponding value. Then, it reads all candidate action vectors and their corresponding target value evaluation values. The action selector then performs a comparison operation to select the candidate action vector that maximizes the target value evaluation value. This vector is then determined as the optimal action vector.
[0164] Step 1057: Decode the graph embedding vector and policy encoding vector corresponding to the optimal action vector into the target logical structure and text construction strategy, respectively.
[0165] In step 1057, the optimal action vector is parsed to decompose it into the two previously concatenated parts: a graph embedding vector and a policy encoding vector. Then, by reverse lookup or using a decoder network, the graph embedding vector is mapped back to its corresponding original logical graph, which is then determined as the target logical structure. At the same time, by looking up the policy template library, the policy encoding vector is mapped back to the detailed text description and execution rules of its corresponding original policy template, which is then determined as the text construction policy.
[0166] This application enables the efficient selection of the combination of solutions that best supports the target position, is logically rigorous, and has the strongest arguability from a massive number of logic diagrams and strategy template combinations. This not only improves the intelligence and efficiency of legal document strategy formulation, but also fundamentally enhances the argumentative strength and persuasiveness of the generated documents.
[0167] S106. Based on the target logical structure and the text construction strategy, generate a first draft of text, and based on the decision path corresponding to the first draft of text, backtrack to the sequence of interactive actions to obtain guidance information, and present the guidance information on the visualization interface where the user performs the operation.
[0168] In step S106, a pre-trained sequence-to-sequence model specifically designed for legal text generation is first invoked. This model takes the target logical structure and text construction strategy as dual conditional inputs. Specifically, the target logical graph is converted into a serialized feature vector through a graph encoder, and the descriptive text of the text construction strategy is converted into a strategy feature vector through an encoder. These two conditional vectors are concatenated and used as additional context for the decoder of the generation model at each time step to guide the direction and style of text generation. Then, based on these two strong conditional guides, the model generates coherent and rigorous narrative paragraphs word by word according to the language norms of legal documents, thereby outputting the final draft text. At the same time, the decision path on which this draft was generated is fully recorded.
[0169] Next, the guidance generation process is initiated. It first analyzes the target logical structure selected in the decision path and compares it with the optimized spatiotemporal graph obtained by the user through the interactive action sequence in step S102. This analysis identifies key differences between the two in terms of event nodes, connections, or attributes. For example, it finds that there is a "cause" edge from event C to event D in the target logical structure, while these two events in the user's optimized spatiotemporal graph are isolated or only have a temporal relationship. Then, based on these differences, it maps back to the interactive action sequence that generated the current optimized spatiotemporal graph. It infers which supplementary or modifying interactive operations the user needs to perform in order to edit the user's graph to a state closer to the target logical structure, and transforms these inferred operational intentions into specific, natural language-described guidance information.
[0170] Finally, the above guidance information is presented on the visual interface in a highly contextual and context-aware manner. It is then positioned in the interface area that the user is currently operating on or viewing, and the guidance is displayed in a non-intrusive way, such as a sidebar prompt, a floating label on a graphic element, or a slight animated guide.
[0171] This application upgrades a single document generation tool into an "expert assistant" capable of intelligent collaboration with users, guiding them to improve the logic and persuasiveness of their fact-building, and achieving a deep integration and mutual enhancement of artificial intelligence and human expert wisdom.
[0172] Figure 3 A schematic diagram illustrating a specific implementation of a language model-based legal document drafting guidance processing system provided in this application, with reference to... Figure 3 The system may include:
[0173] The acquisition module 31 is used to acquire evidence materials for various legal events, as well as the sequence of interactive actions generated when the user performs operations and the pressure data of the handwriting when writing.
[0174] The construction module 32 is used to construct an initial spatiotemporal diagram based on the evidence materials, parse the interaction action sequence into editing instructions, and update the initial spatiotemporal diagram in real time according to the editing instructions to obtain an optimized spatiotemporal diagram.
[0175] The adjustment module 33 is used to process the optimized spatiotemporal graph using a temporal knowledge graph embedding model, and dynamically adjust the semantic correlation between legal events in the optimized spatiotemporal graph through the pressure data to obtain an enhanced spatiotemporal graph.
[0176] The simulation module 34 is used to simulate the evolution of various legal events under different perspectives in parallel using the counterfactual reasoning method based on the enhanced spatiotemporal graph to obtain multiple logic graphs.
[0177] Evaluation module 35 is used to input the logic diagram and the preset strategy template library into the reinforcement learning decision framework. Through the reinforcement learning decision framework, multiple rounds of adversarial evaluation are carried out with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position.
[0178] The generation module 36 is used to generate a draft text based on the target logical structure and the text construction strategy, and to trace back to the sequence of interactive actions based on the decision path corresponding to the draft text to obtain guidance information, and to present the guidance information on the visualization interface where the user performs the operation.
[0179] The language model-based legal document drafting guidance processing system of this application is used to implement the aforementioned language model-based legal document drafting guidance processing method. Therefore, the specific implementation of the language model-based legal document drafting guidance processing system can be found in the embodiment section of the language model-based legal document drafting guidance processing method above. The specific implementation can be referred to the description of the corresponding embodiment, and will not be repeated here.
[0180] like Figure 4 As shown, this application also provides an electronic device, including: a memory 41 for storing a computer program; and a processor 42 for executing the computer program to implement the steps of any of the above-described language model-based legal document drafting guidance processing methods.
[0181] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-described language model-based legal document drafting guidance processing methods.
[0182] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, random access memory, portable hard drives, magnetic disks, or optical disks.
[0183] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the language model-based legal document drafting guidance processing method.
[0184] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0185] The foregoing has provided a detailed description of the language model-based legal document drafting guidance method and system provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A method for guiding legal document drafting based on a language model, characterized in that, include: Acquire evidence materials for various legal cases, as well as the sequence of interactive actions generated by users during operation and pressure data of handwriting when writing; Based on the aforementioned evidence, an initial spatiotemporal graph is constructed, the interaction sequence is parsed into editing instructions, and the initial spatiotemporal graph is updated in real time according to the editing instructions to obtain an optimized spatiotemporal graph; The optimized spatiotemporal graph is processed using a temporal knowledge graph embedding model, and the semantic correlation between legal events in the optimized spatiotemporal graph is dynamically adjusted using the stress data to obtain an enhanced spatiotemporal graph. Based on the enhanced spatiotemporal graph, the evolution of various legal events under different perspectives is simulated in parallel using counterfactual reasoning methods to obtain multiple logic graphs; The logic diagram and the preset strategy template library are input into the reinforcement learning decision framework. The reinforcement learning decision framework is used to conduct multiple rounds of adversarial evaluation with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position. Based on the target logical structure and the text construction strategy, a first draft of text is generated, and based on the decision path corresponding to the first draft of text, the interaction action sequence is traced back to obtain guidance information, which is then presented on the visualization interface where the user performs the operation.
2. The method according to claim 1, characterized in that, The process of using a temporal knowledge graph embedding model to process the optimized spatiotemporal graph, and dynamically adjusting the semantic correlation between legal events in the optimized spatiotemporal graph using the stress data, to obtain an enhanced spatiotemporal graph, includes: The optimized spatiotemporal graph is input into the temporal knowledge graph embedding model, and the encoding module of the temporal knowledge graph embedding model is used to convert the timestamps of each legal event into time feature vectors. The fusion module of the temporal knowledge graph embedding model is used to fuse the time feature vector with the initial feature vector of the corresponding legal event to generate a node feature vector; The pressure data is mapped to the semantic correlation between legal event nodes using the mapping module of the temporal knowledge graph embedding model; The computation module of the temporal knowledge graph embedding model is used to calculate the dynamic modulation factor between corresponding legal event nodes based on the semantic relevance, and the dynamic modulation factor is used to weight the node feature vector to generate the target relationship vector. By utilizing the graph attention module of the temporal knowledge graph embedding model, and combining the node feature vector and the target relation vector, the attention coefficient between corresponding legal event nodes is calculated, and the neighborhood information of each legal event node is aggregated based on the attention coefficient to obtain a deep semantic vector. The graph reconstruction module of the temporal knowledge graph embedding model is used to reconstruct an enhanced spatiotemporal graph based on all the aforementioned deep semantic vectors.
3. The method according to claim 2, characterized in that, The graph reconstruction module utilizing the temporal knowledge graph embedding model reconstructs an enhanced spatiotemporal graph based on all the deep semantic vectors, including: The deep semantic vector is input into the calculator of the graph reconstruction module to calculate the correlation score between the deep semantic vectors corresponding to any two legal event nodes; The edge generator of the graph reconstruction module filters out legal event node pairs whose correlation scores exceed a preset dynamic threshold to generate an initial edge set. The preset dynamic threshold is calculated based on the statistical distribution of correlation scores among all legal event node pairs. By combining the temporal and semantic features in the deep semantic vector, a confidence weight is calculated for each edge in the initial edge set to generate a weighted edge set; The assembler of the graph reconstruction module uses the deep semantic vector as node features and assigns them to the corresponding legal event nodes. Each edge in the weighted edge set and its corresponding confidence weight are assigned to the corresponding legal event node pair to generate an enhanced spatiotemporal graph.
4. The method according to claim 1, characterized in that, The process of conducting multi-round adversarial evaluations through the reinforcement learning decision framework with the goal of maximizing persuasiveness, in order to obtain a target logical structure and text construction strategy adapted to the target position, includes: Each of the logical graphs is graph-embedded to obtain a corresponding graph embedding vector. Each policy template in the preset policy template library is encoded to obtain a policy encoding vector. Each graph embedding vector is paired and concatenated with each policy encoding vector to generate multiple candidate action vectors. The semantic vector corresponding to the target position is then combined with each candidate action vector to generate a combined vector. By using the policy evaluation network in the reinforcement learning decision-making framework, the combined vectors are forward propagated to obtain the initial value evaluation value of each candidate action vector under the target position. The candidate action vectors are subjected to adversarial scoring to generate feedback values. The initial value assessment value and the feedback value are then input into a reward function, which uses maximum persuasiveness as the calculation criterion to generate a comprehensive reward value. The policy evaluation network is iteratively updated using a dual-delay deep deterministic policy gradient algorithm. When a preset convergence condition is reached, the iteration stops. The final policy evaluation network is then used to calculate the combined vector to obtain the target value evaluation value. The action selector in the reinforcement learning decision framework selects the optimal action vector from all candidate action vectors based on the target value assessment. The graph embedding vector and policy encoding vector corresponding to the optimal action vector are decoded into the target logical structure and text construction strategy, respectively.
5. The method according to claim 1, characterized in that, Based on the enhanced spatiotemporal graph, the evolution of various legal events under different perspectives is simulated in parallel using counterfactual reasoning methods to obtain multiple logic graphs, including: Extract the state attributes of each legal event node and the relationship attributes between legal events from the enhanced spatiotemporal graph, and convert the multiple positions corresponding to each legal event into multiple semantic vectors; For each of the semantic vectors, a counterfactual reasoning method is applied to perform position-aware hypothesis analysis to generate an intervention instruction, wherein the intervention instruction contains a hypothetical state to be imposed on the legal event node; Based on the intervention instructions and the state attributes, the enhanced spatiotemporal graph is modified to generate a final spatiotemporal graph corresponding to the semantic vector; The final spatiotemporal graph and the semantic vector are input into a temporal graph neural network. Using the temporal graph neural network, based on the relational attributes, the state evolution process triggered by the hypothetical state is simulated in the final spatiotemporal graph to obtain the state evolution sequence of each legal event node. For each semantic vector, the final spatiotemporal graph is reconstructed based on the state evolution sequence to generate a logical graph corresponding to each position.
6. The method according to claim 1, characterized in that, The construction of the initial spatiotemporal diagram based on the aforementioned evidence materials includes: Extract key text describing each legal event from the evidence materials, and generate legal event nodes corresponding to each legal event based on the key text; For each legal event node, the occurrence time information and occurrence location information are extracted from the corresponding key text, and the occurrence time information and occurrence location information are converted into corresponding timestamps and geographic coordinates, respectively; Based on the logical or temporal relationships between legal events described in the evidence materials, connection edges are established between the nodes of the legal events. All the legal event nodes, timestamps, geographic coordinates, and connecting edges are combined to construct an initial spatiotemporal graph.
7. The method according to claim 1, characterized in that, The step of parsing the interactive action sequence into editing instructions includes: For each interactive action in the interactive action sequence, the legal event node corresponding to each interactive action is determined according to the action type and spatial coordinates of each interactive action. Based on the action trajectory corresponding to each of the aforementioned interactive actions, the type of editing operation that the user wants to perform on the legal event node is identified; By combining the legal event node with the editing operation type, an operation instruction is generated; Arrange all the operation instructions according to the chronological order of the interactive action sequence to obtain the editing instructions.
8. A legal document drafting guidance and processing system based on a language model, characterized in that, include: The acquisition module is used to acquire evidence materials for various legal events, as well as the sequence of interactive actions generated by the user during operation and the pressure data of the handwriting when writing. The construction module is used to construct an initial spatiotemporal diagram based on the evidence materials, parse the interaction action sequence into editing instructions, and update the initial spatiotemporal diagram in real time according to the editing instructions to obtain an optimized spatiotemporal diagram; The adjustment module is used to process the optimized spatiotemporal graph using a temporal knowledge graph embedding model, and dynamically adjust the semantic correlation between legal events in the optimized spatiotemporal graph through the stress data to obtain an enhanced spatiotemporal graph. The simulation module is used to simulate the evolution of various legal events under different perspectives in parallel based on the enhanced spatiotemporal graph using counterfactual reasoning methods, so as to obtain multiple logic graphs; The evaluation module is used to input the logic diagram and the preset strategy template library into the reinforcement learning decision framework. Through the reinforcement learning decision framework, multiple rounds of adversarial evaluation are carried out with the goal of maximizing persuasiveness, so as to obtain the target logic structure and text construction strategy that are adapted to the target position. The generation module is used to generate a draft text based on the target logical structure and the text construction strategy, and to trace back to the sequence of interactive actions based on the decision path corresponding to the draft text to obtain guidance information, and to present the guidance information on the visualization interface where the user performs the operation.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the language model-based legal document drafting guidance processing method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the processing method for legal document drafting guidance based on any one of claims 1 to 7.