A Sentence Prediction Method Based on an Adaptive Sentencing Knowledge Graph

By constructing sparse matrix and non-negative matrix decomposition and reconstruction of knowledge graphs, the sentencing accuracy problem of redundant nodes in the existing technology is solved, and the sentence prediction of adaptive sentencing is achieved, which improves the sentencing accuracy of complex cases.

CN120031212BActive Publication Date: 2025-07-11CHINA UNIVERSITY OF POLITICAL SCIENCE AND LAW
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510502839.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-07-11
Estimated Expiration
2045-04-22

AI Technical Summary

Technical Problem

The existing prison term prediction methods rely on single semantic matching when constructing knowledge graphs, resulting in redundant nodes and edges, affecting the accuracy of sentencing judgment, and lacking an adaptive sentencing mechanism, making it unable to adapt to complex case scenarios.

Method used

By extracting the crime labels and situational characteristics of historical case samples, a sparse matrix is constructed and non-negative matrix decomposition is performed, invalid factors are eliminated, knowledge graphs are reconstructed, and the sentence prediction model of multiple crime labels is trained to achieve adaptive sentencing.

Benefits of technology

It improves the accuracy and adaptability of sentence prediction, can accurately sentence complex cases, and reduce reasoning deviations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120031212B_ABST
    Figure CN120031212B_ABST
Patent Text Reader

Abstract

The present invention discloses a sentence prediction method based on an adaptive sentencing knowledge graph, specifically relating to the fields of knowledge graph and model prediction, including: extracting charge labels, context features and sentence labels based on historical case samples, constructing a sparse association matrix between context features and charge labels, and generating an initial knowledge graph accordingly. After extracting latent factors through non-negative matrix factorization, factors with low contribution to the labels are removed, and the optimized graph structure is reconstructed. Based on the graph, a key context feature set in multi-charge cases is extracted, and a training set is constructed in combination with the corresponding sentence labels to train a sentence prediction model for multi-charge labels. In practical applications, the context features of the case to be judged are extracted, combined with the reconstructed graph and the trained model, and the corresponding predicted sentence result is output to realize intelligent sentence prediction driven by structure optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knowledge graphs and model prediction, and more specifically, to a sentence prediction method based on an adaptive sentencing knowledge graph. Background Art

[0002] Existing sentence prediction methods usually perform reasoning based on the node and edge structures of knowledge graphs, and predict the sentencing results by constructing the semantic relationships between case elements and legal provisions. However, such methods rely mostly on a single semantic matching method in the graph construction stage. Due to the high abstraction and generality of the scope of application of legal provisions, it is difficult for this method to accurately identify the irrelevant dependencies in complex cases, resulting in a large number of invalid or weakly related connection relationships in the graph structure. These redundant nodes and edges not only weaken the accuracy of semantic expression, but also cause the reasoning path to deviate, affecting the accuracy of the overall sentencing judgment.

[0003] In addition, traditional knowledge graph construction methods usually use fixed templates or rules for structure generation, lacking an adaptive sentencing mechanism for specific case characteristics and unable to perform adaptive sentencing according to different case scenarios. Therefore, when facing cases with complex coupling relationships or large semantic spans of case scenario characteristics, there are large deviations in the sentence prediction results.

[0004] To solve the above problems, a technical solution is provided now. Summary of the Invention

[0005] To overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a sentence prediction method based on an adaptive sentencing knowledge graph to solve the problems raised in the above background art.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] S1: Extract the charge labels, scenario features and sentence labels of historical case samples, and numerically transform the association relationship between the scenario features and the charge labels into a sparse matrix;

[0008] S2: Construct an initial knowledge graph based on the association relationship between the charge labels and the scenario features in the sparse matrix;

[0009] S3: Perform non-negative matrix factorization on the sparse matrix, extract the potential association between the scenario features and the charge labels, and obtain a latent factor matrix;

[0010] S4: Eliminate the latent factors with low contribution to the charge label features, and reconstruct the initial knowledge graph;

[0011] S5: Extract the crime labels and sentence labels of the historical sentencing case samples containing multiple crime labels, extract the key scenario feature set based on the reconstructed knowledge graph, and train the sentence prediction model for multiple crime labels;

[0012] S6: Input the actual case scenario features into the sentence prediction model based on the reconstructed knowledge graph and multiple crime labels, and output the corresponding predicted sentence results.

[0013] In a preferred embodiment, in S1, when extracting the crime labels, scenario features and sentence labels of the historical case samples and numericalizing the association relationship between the scenario features and the crime labels into a sparse matrix, it specifically includes:

[0014] Extract the crime labels, scenario features and sentence labels from the historical sentencing case sample dataset, and construct the corresponding case feature set;

[0015] Convert the scenario features and crime labels in the case feature set into vector forms, and use the word embedding algorithm to generate feature vectors represented numerically;

[0016] Calculate the association weights based on the co-occurrence frequencies of the scenario features and crime labels in the case feature set, and generate an association weight matrix;

[0017] Convert the calculated association weight matrix into a sparse matrix structure, with rows representing scenario features, columns representing crime labels, and matrix elements representing the association weights between scenario features and labels.

[0018] In a preferred embodiment, in S2, when constructing the initial knowledge graph based on the association relationship between the crime labels and scenario features of the sparse matrix, it specifically includes:

[0019] Extract the set of scenario feature and crime label elements with non-zero association weights in the sparse matrix, and represent the element association relationship in the form of node pairs;

[0020] Connect the nodes according to the element association relationship of the node pairs, establish the initial numerical expression of the edges in combination with the association weights, and generate the initial knowledge graph;

[0021] Obtain the mapping relationship between single crime labels and sentence labels, and embed the sentence labels corresponding to the single crime labels into the initial knowledge graph.

[0022] In a preferred embodiment, in S3, perform non-negative matrix factorization on the sparse matrix, extract the potential associations between scenario features and crime labels, and obtain the potential factor matrix, which specifically includes:

[0023] Perform numerical conversion operations on the elements of the sparse matrix through the normalization algorithm, and standardize the matrix data according to the numerical distributions of the scenario feature dimension and the crime label dimension;

[0024] Construct a set of potential factors and configure initial parameter values ​​based on the situational features and crime labels of the standardized sparse matrix;

[0025] Perform non-negative matrix factorization on the sparse matrix to establish a scenario feature matrix and a crime label matrix associated with the latent factor matrix;

[0026] The matrix elements of the scenario feature matrix and the crime label matrix are the numerical mapping relationships between scenario features and latent factors, and crime labels and latent factors, respectively;

[0027] The matrix element values ​​of the latent factor matrix are reconstructed, and the numerical mapping between the latent factor matrix and the scenario feature matrix and the crime label matrix is ​​iteratively corrected according to the numerical changes of the set loss function.

[0028] In a preferred embodiment, in S4, removing potential factors with low contribution to the crime label feature and reconstructing the initial knowledge graph specifically includes:

[0029] Perform dimensionality simplification on the decomposed sparse matrix and eliminate potential factors whose feature contribution is lower than the set contribution threshold through principal component analysis;

[0030] Reconstruct the sparse matrix based on the matrix product of the scenario feature matrix and the crime label matrix corresponding to the remaining latent factors;

[0031] Based on the association weights between situational features and crime labels in the reconstructed sparse matrix, the edges of the initial knowledge graph are adjusted.

[0032] In a preferred embodiment, in S5, the crime labels and sentence labels of historical sentencing case samples containing multiple crime labels are extracted, and the key scenario feature set is extracted based on the reconstructed knowledge graph. The training of the sentence prediction model for multiple crime labels specifically includes:

[0033] Extract case feature sets containing multiple crime labels from historical sentencing case samples, take each individual crime label as the starting node, and search for the scenario feature node set connected to the starting node in the reconstructed knowledge graph;

[0034] Obtain scenario features from a case feature set containing multiple crime labels, and mark the intersection of the corresponding scenario features and the search results of the connected scenario feature nodes in the knowledge graph as a key scenario feature set;

[0035] The multi-crime label set, the key scenario feature set and the sentence label are combined to form a sentence prediction training feature set;

[0036] A sentence prediction model with multiple crime labels is trained based on the sentence prediction training feature set.

[0037] In a preferred embodiment, training a sentence prediction model for multiple charge labels based on the sentence prediction training feature set specifically includes:

[0038] Establish a supervised learning structure, initialize the model weight parameters, and set the type of loss function;

[0039] Adopt a batch training method to divide the sentence prediction training feature set into several subsets, and calculate the model output results through forward propagation;

[0040] Execute a preset loss function calculation based on the numerical deviation between the model output result and the target sentence label to generate an error signal sequence;

[0041] Input the error signal sequence into the optimizer structure, perform weight update operations, and iteratively train until the loss converges to the preset index requirements.

[0042] In a preferred embodiment, in S6, inputting the actual case scenario features into the sentence prediction model based on the reconstructed knowledge graph and multiple charge labels, and outputting the corresponding predicted sentence results specifically includes:

[0043] Extract the scenario features of the actual case through semantic recognition, input the scenario features into the reconstructed knowledge graph to retrieve the corresponding charge labels, and determine whether the charge labels are single charge labels;

[0044] If so, output the sentence label corresponding to the label charge node in the knowledge graph as the sentence prediction result;

[0045] If not, combine the multiple charge labels and the scenario features and input them into the sentence prediction model, and use the sentence label output by the sentence prediction model as the sentence prediction result.

[0046] The technical effects and advantages of a sentence prediction method based on an adaptive sentencing knowledge graph according to the present invention:

[0047] By introducing a sparse matrix decomposition and latent factor elimination mechanism, the problem of reduced inference accuracy caused by semantic redundancy and graph sparsity in the traditional knowledge graph structure is solved. Compared with the method of constructing a graph only based on explicit fields, this solution extracts the latent semantic structure from the numerical association between scenario features and charge labels, eliminates the graph information that makes no contribution or has weak association to sentencing, and improves the accuracy and simplicity of graph expression. At the same time, by jointly modeling with multiple charge labels and the key scenario feature set under the reconstructed graph, the sentence prediction model has stronger semantic adaptability and structural discrimination ability when facing complex and multi-label cases.

[0048] This technical path avoids the inference bias generated by traditional knowledge graphs when the structure is fixed and cannot be self-adjusted, can automatically locate the key scenario fields for case input, and improve the accuracy of sentence prediction in complex situations such as multiple crimes combined punishment. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a schematic diagram of a method for predicting sentence based on an adaptive sentencing knowledge graph according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0050] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0051] Embodiment 1, Figure 1 A method for predicting sentence based on an adaptive sentencing knowledge graph according to the present invention is given, which includes the following steps:

[0052] S1: Extract the crime labels, scenario features and sentence labels of historical case samples, and numericalize the association relationship between the scenario features and the crime labels into a sparse matrix;

[0053] S2: Construct an initial knowledge graph based on the association relationship between the crime labels and the scenario features in the sparse matrix;

[0054] S3: Perform non-negative matrix factorization on the sparse matrix, extract the potential association between the scenario features and the crime labels, and obtain a potential factor matrix;

[0055] S4: Eliminate the potential factors with low contribution to the crime label features, and reconstruct the initial knowledge graph;

[0056] S5: Extract the crime labels and sentence labels of historical sentencing case samples containing multiple crime labels, extract the key scenario feature set based on the reconstructed knowledge graph, and train a sentence prediction model for multiple crime labels;

[0057] S6: Input the actual case scenario features into the sentence prediction model based on the reconstructed knowledge graph and multiple crime labels, and output the corresponding predicted sentence result.

[0058] In S1, the crime labels, scenario features and sentence labels of historical case samples are extracted, and the association relationship between the scenario features and the crime labels is numericalized into a sparse matrix.

[0059] A sample data set of historical criminal cases with a public judgment document structure is selected. The data sources include case number, crime field, case description segment, sentence field, etc. In the data set, the crime field is given in a structured manner, including a single crime label or a combination of multiple crime labels, such as "robbery", "intentional injury", "illegal detention", etc. The case description segment is a natural language text, including specific situations such as "breaking into the house late at night", "multiple people in a group", and "armed threats". The sentence field is presented in the form of a combination of years and months.

[0060] The case data is uniquely processed by number, and samples with missing fields, invalid text or incomplete labels are eliminated. The case description segment is structured and parsed using rule templates (such as regular expression matching) and domain dictionaries (such as the "sentencing circumstances vocabulary") to extract keyword groups that characterize the crime situation. Each case is ultimately organized into a triple form: (situational feature set, crime label set, sentence label), where the situational feature is a combination of multiple keywords, the crime label is a set of one or more labels, and the sentence is a numerical value. After all case samples are standardized, they form a complete case feature set.

[0061] The extracted situational feature keywords and crime labels are encoded using a word embedding algorithm. In this embodiment, the Word2Vec word embedding method of the Skip-Gram model structure is used to build a corpus for all situational feature texts in the case and train a word vector model. After the input corpus is processed by word segmentation, stop word removal, and low-frequency filtering, a training model with a window length of 5 and an embedding dimension of 100 is built.

[0062] After training, the contextual feature words will be mapped to a 100-dimensional vector space to form a semantic embedding vector for each keyword. For multiple contextual words in the same case, the contextual vector representation of the case is generated by averaging the embedding vectors.

[0063] After completing the vectorized encoding, the co-occurrence frequency of each situational feature and the crime label in the case feature set is counted. Suppose the complete set of situational features is , the full set of crime labels is , m and n are the total number of situational features and crime label types respectively. Establish the co-occurrence frequency statistical matrix C, with elements Represents the i-th situational feature With the jth crime label The number of times a co-occurrence occurs in a case set. The original co-occurrence frequency is normalized in the form of TF-IDF, and the specific expression is:

[0064] ;

[0065] In the formula, N is the total number of case samples, To contain the label The number of cases, where k is The total frequency of occurrences across all label dimensions, with each element representing the normalized weight between features and labels. After processing they are combined to form a weight matrix and transformed into a sparse matrix structure, with rows representing situational features, columns representing crime labels, and matrix elements representing the association weights between situational features and labels.

[0066] In S2, an initial knowledge graph is constructed based on the association relationship between crime labels and situational features in the sparse matrix.

[0067] After completing the construction of the sparse matrix, traverse all positions in the matrix and extract the positions of elements with non-zero association weights. Each non-zero weight corresponds to a combination of situational features and crime labels, indicating a significant co-occurrence relationship between the feature and the label in historical cases. Extract all valid feature-label combinations and construct a set of "node pairs". Each pair of nodes consists of a situational feature word and a crime label, indicating a semantic connection between the two elements in the graph.

[0068] During the node extraction process, both situational features and crime labels need to be standardized in naming, unified to lowercase, punctuation removed, and synonyms merged to ensure the consistency of node identifiers in the graph structure. Attach a category attribute to each node to distinguish its semantic role in the graph, such as labeled as "feature class" or "label class", as the structural basis for controlling the direction of the edges in the graph.

[0069] After completing the extraction of node pairs, traverse each pair of nodes of situational features and crime labels in turn and establish a directed edge between them in the graph. During the construction process, first confirm whether either node in the node pair already exists in the graph structure. If not, add it to the node set. Subsequently, establish a connection edge according to the order of the two elements in the node pair, usually setting the direction from the situational feature to the crime label to construct the directionality of the semantic relationship. When each edge is established, assign an initial weight value to the edge. This weight is derived from the value at the corresponding position in the sparse matrix, indicating the semantic association strength between the feature and the label in historical samples.

[0070] After completing the construction of the initial graph structure, for each crime label node in the graph, introduce the corresponding sentence label information in historical samples. For each label node, count all the sentence data when the label appears. One can select the sentence interval, average sentence, or the sentence value under a specified conversion rule (stipulated by legal provisions) as the representative sentence label for the label. Attach the sentence label information as an attribute directly to the crime label node, for example, add a field such as "label sentence mean" or "typical sentence interval" in the attribute field of the node.

[0071] In S3, non - negative matrix factorization is performed on the sparse matrix to extract the potential associations between context features and crime labels, and a latent factor matrix is obtained.

[0072] Normalization is performed on all non - zero elements in the sparse matrix. The normalization is performed jointly using maximum value normalization and row - vector normalization. In the first step, by scanning the entire matrix, the maximum co - present value is extracted, and each element in the matrix is divided by this maximum value, so that all element values are compressed into the 0 - 1 interval. In the second step, L1 normalization is performed on each row of the matrix (corresponding to a context feature), and the weights of this feature on all labels are adjusted proportionally, so that the label distributions of each context feature are comparable.

[0073] The number of latent factor dimensions is preset as a fixed value (not less than the sum of the context features and crime labels in the historical case samples, and by default is set to the number of permutations and combinations of context features). Each dimension of the latent factor is regarded as describing a type of implicit case behavior structure, but its specific semantics are not visible before modeling. Set the initial factor value distribution to match the matrix dimensions. The dimension of the context feature matrix is the number of context features×the number of latent factors, and the dimension of the crime label matrix is the number of latent factors×the number of crime labels. The product of the two matrices should approximately restore the input sparse matrix. The initial values are set randomly using a Gaussian distribution, restricting the elements to be non - negative to meet the constraints of non - negative matrix factorization.

[0074] Non - negative matrix factorization is performed on the sparse matrix. Based on the set loss function (mean square error), the standardized sparse matrix is disassembled into the product of two low - rank matrices with the goal of being closest to the sparse matrix. The specific implementation method selects the non - negative matrix factorization algorithm of the multiplicative update method. This algorithm aims to minimize the reconstruction error between the original matrix and the decomposed matrix. Under the premise of keeping all matrix elements non - negative, the values of the two sub - matrices are optimized by alternating iteration. Among them, the product of the low - rank matrices is specifically calculated as follows: the context feature matrix is used as the left - multiplying matrix, and each row represents the activation degree of a context feature on different latent factor dimensions; the crime label matrix is used as the right - multiplying matrix, and each column represents the response intensity of a certain crime label on each latent factor. The product of the two constitutes an estimated value matrix. In each iteration, the elements in the factor matrix are adjusted according to the gradient direction of the loss function. The update strategy uses an adaptive learning rate to control parameter changes, and within the set maximum number of iteration steps, the product result closest to the actual structure of the sparse matrix is selected as the decomposition result.

[0075] After non - negative matrix factorization is completed, the two obtained matrices have a clear semantic mapping function. Each element in the context feature matrix represents the expression intensity of a certain context feature on a certain latent factor, and each element in the crime label matrix represents the response degree of the crime label in a certain latent factor space. The larger the value, the more dependent it is on this factor.

[0076] In S4, potential factors with low contribution to the crime label features are eliminated, and the initial knowledge graph is reconstructed.

[0077] Perform principal component analysis (PCA) on the decomposed sparse matrix to extract the proportion of characteristic variances corresponding to each principal component, that is, the explanatory ability of each potential factor for the overall semantic expression. Set a cumulative contribution rate threshold (default set to 50%), and sequentially select the first several principal components from the principal component sequence until the cumulative contribution rate reaches the threshold. The corresponding factor dimensions are retained, and the remaining dimensions are regarded as low contribution factors that have no substantial impact on the overall structure. PCA does not directly act on the original non-negative matrix, but uses the normalized sparse reconstruction matrix as the input to maintain structural consistency. When performing dimensionality reduction, ensure that the extracted principal components are positive linear combinations without destroying the non-negative structure of the original matrix.

[0078] Based on the set of potential factors after principal component screening, reconstruct the refined scenario feature matrix and crime label matrix. Specifically, intercept the retained dimensions from the original factor matrix to generate a new left multiplication matrix and right multiplication matrix, and the product of the two constitutes the reconstructed sparse matrix. During the reconstruction process, the product dimension of the new matrix is consistent with the original sparse matrix (i.e., the number of rows is equal to the number of scenario features, and the number of columns is equal to the number of crime labels). The product result is a newly generated numerical matrix, where each element represents the semantic weight between the scenario feature and the corresponding crime label under the retained factor expression.

[0079] For elements with extremely small but non-zero values in the matrix reconstruction result, set a boundary threshold (such as 0.01) for numerical clipping. For the edges that already exist in the graph, retrieve the corresponding feature-label combination elements in the reconstruction matrix and perform edge weight coverage or weight increment update operations, updating them to the weight values in the new matrix.

[0080] In S5, extract the crime labels and sentence labels of historical sentencing case samples containing multiple crime labels, and based on the reconstructed knowledge graph, extract the key scenario feature set to train the sentence prediction model for multiple crime labels.

[0081] Screen the cases involving multiple crimes in the historical judgment case dataset to form a subset of multi-crime case features. Through structured extraction operations, select all cases with two or more labels in the crime field, and construct a case feature set indexed by case number. Each case in this set includes: a set of crime labels (such as "robbery", "illegal detention"), a set of scenario features extracted from the structured case situation (such as "committing crimes at night", "multiple people forming a gang", "threatening with weapons"), and their corresponding sentence labels.

[0082] Traverse its set of crime tags one by one. Take each crime tag as the starting node and perform a one-way semantic search operation in the previously reconstructed knowledge graph. The search operation limits the search depth to 1 and only extracts the set of scenario feature nodes that have a direct edge connection with the tag node. During the execution, the graph structure is loaded in the form of an adjacency list, and each crime tag node can quickly index the set of context nodes pointed to by its outgoing edges.

[0083] Filter the set of scenario features for each case to determine whether the case description contains feature items that are structurally related to the actual sentence. The specific operation is to calculate the intersection of the set of scenario features extracted from the original structure of the case and the search results of the knowledge graph corresponding to each crime tag selected previously. Finally, merge multiple intersection results into a unified set of key scenario features. The intersection calculation is based on the feature name (or code) for matching, and a unified naming rule and semantic alignment strategy are adopted to eliminate synonymous expressions (such as "committing a crime at night" and "committing a crime during the night") to ensure the accuracy of intersection matching. The matching uses a boolean union intersection judgment method, and corresponding terms are marked in the case feature set and the graph results respectively, and the hits in the intersection are listed as key features.

[0084] If there is no intersection between the search results of a certain tag in the case and the case features, then this tag is marked as "not semantically paired" and forcibly excluded in this modeling.

[0085] Input the constructed training feature set into the selected model structure for training. In this embodiment, a multi-layer perceptron structure is selected as the basic model framework, and at the same time, the performance of the random forest and XGBoost models is compared as a control. The input layer accepts the concatenated multi-label encoded vector and the key scenario feature vector, and the output layer is a continuous sentence value prediction unit or a multi-class sentence interval output unit.

[0086] During the model training process, the mean squared error is used as the loss function for continuous sentence prediction. If it is in the form of discrete label classification, the cross-entropy loss function is used. The Adam optimizer is used in the training process, the initial learning rate is set to 0.001, and the error signal sequence of the validation set is evaluated after each round of training. An early stopping mechanism is adopted to prevent overfitting.

[0087] Select the label attention mechanism to explicitly model the association relationship between each type of crime tag and the key features. After the model training is completed, evaluate its sentence prediction accuracy for complex label combinations in the validation set and the independent test set. Finally, output the trained multi-label sentence prediction model, which can be embedded in the graph reasoning structure or used independently as a prediction engine to provide model support for assisting in sentencing.

[0088] In S6, the actual case scenario features are input into the sentence prediction model based on the reconstructed knowledge graph and multiple crime labels, and the corresponding predicted sentence results are output.

[0089] Using a semantic recognition engine built based on a domain keyword library and a natural language parser, syntactic decomposition and keyword extraction are performed on the text. The keyword library is constructed from semantic plots that frequently appear in historical cases and has typical labeling characteristics, such as "late at night", "armed", "multiple people", "indoors", "causing minor injuries to others", etc. Through part-of-speech tagging, chunk combination, and rule matching, the case text is mapped to a standardized set of scenario features. For terms that cannot be precisely matched in the keyword library, the original phrases are retained for manual post-processing or use by a secondary matching model.

[0090] After the scenario feature extraction is completed, it enters the knowledge graph retrieval stage. The extracted scenario feature items are used as input nodes, and a semantic edge upward search is performed in the reconstructed knowledge graph to obtain the set of crime label nodes that have a directed connection with the scenario feature nodes. This operation relies on the established feature-label association edges in the graph, and the search is restricted to direct connections (i.e., the edge length is 1), without performing striding reasoning or fuzzy matching to ensure the clarity and uniqueness of label positioning. Determine whether the obtained set of crime labels contains only one label.

[0091] If the case features are only connected to one crime label node in the graph, enter the direct label mapping path, and directly output the sentence label embedded or connected to this label node in the graph.

[0092] When it is determined that there are two or more crime labels connected to the input scenario features in the graph, the previously trained multiple-crime sentence prediction model is used to receive the case feature input in a structured manner and output the corresponding sentence label results. The sentence labels are output in a standardized structure, including label encoding, upper and lower limits of the interval, unit description, and label source. The output results support numerical expressions and structured JSON object formats and are suitable for visualization rendering on the platform.

[0093] The above formulas are all dimensionless and take their numerical values for calculation. The formulas are obtained by collecting a large amount of data for software simulation to get a formula that is closest to the actual situation. The preset parameters and threshold selection in the formulas are set by those skilled in the art according to the actual situation.

[0094] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that the computer can access, or a data storage device such as a server or data center that contains one or more collections of available media. The available media can be magnetic media (such as floppy disks, hard disks, magnetic tapes), optical media (such as DVDs), or semiconductor media. The semiconductor media can be a solid-state drive.

[0095] Those of ordinary skill in the art will realize that the modules and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0096] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0097] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.

[0098] The module described as a separation component may or may not be physically separated. The component shown as a module may or may not be a physical module. It may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0099] In addition, in each embodiment of this application, each functional module can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.

[0100] If the described function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art or part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0101] As described above, this is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

[0102] Finally: The above are only the preferred embodiments of the present invention and are not used to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should all be included in the protection scope of the present invention.

Claims

1. A sentence prediction method based on an adaptive sentencing knowledge graph, characterized in that, It includes the following steps: S1: Extract the charge labels, situational features, and sentence labels of historical case samples, and numerically transform the association relationship between the situational features and the charge labels into a sparse matrix; S2: Construct an initial knowledge graph based on the association relationship between the charge labels and situational features in the sparse matrix; S3: Perform non-negative matrix factorization on the sparse matrix to extract the potential association between the situational features and the charge labels, and obtain a potential factor matrix; S4: Eliminate the potential factors with low contribution to the charge label features, and reconstruct the initial knowledge graph; S5: Extract the charge labels and sentence labels of historical sentencing case samples containing multiple charge labels, extract the key situational feature set based on the reconstructed knowledge graph, and train a sentence prediction model for multiple charge labels; S6: Input the actual case situational features into the sentence prediction model based on the reconstructed knowledge graph and multiple charge labels, and output the corresponding predicted sentence results; In S3, performing non-negative matrix factorization on the sparse matrix to extract the potential association between the situational features and the charge labels, and obtaining the potential factor matrix specifically includes: Perform a numerical conversion operation on the elements of the sparse matrix through a normalization algorithm, and standardize the matrix data according to the numerical distributions of the situational feature dimension and the charge label dimension; Construct a potential factor set based on the situational features and charge labels of the standardized sparse matrix and configure the initial parameter values; Perform non-negative matrix factorization on the sparse matrix to establish a situational feature matrix and a charge label matrix associated with the potential factor matrix; Where the matrix elements of the situational feature matrix and the charge label matrix are the numerical mapping relationships between the situational features and the potential factors, and the charge labels and the potential factors respectively; Perform matrix element value reconstruction on the potential factor matrix, and iteratively correct the numerical mappings of the potential factor matrix, the situational feature matrix, and the charge label matrix according to the numerical changes of the set loss function; In S4, eliminating the potential factors with low contribution to the charge label features and reconstructing the initial knowledge graph specifically includes: Perform dimensionality reduction on the decomposed sparse matrix, and eliminate the potential factors with feature contribution lower than the set contribution threshold through principal component analysis; Reconstruct the sparse matrix based on the matrix product of the situational feature matrix and the charge label matrix corresponding to the remaining potential factors; Adjust the edges of the initial knowledge graph based on the association weights between the situational features and the charge labels in the reconstructed sparse matrix.

2. The sentence prediction method based on an adaptive sentencing knowledge graph according to claim 1, wherein In S1, extracting the charge labels, situational features, and sentence labels of historical case samples, and numerically transforming the association relationship between the situational features and the charge labels into a sparse matrix specifically includes: Extract the charge labels, situational features, and sentence labels from the historical sentencing case sample dataset, and construct the corresponding case feature set; Convert the situational features and charge labels in the case feature set into vector forms, and use the word embedding algorithm to generate numerically represented feature vectors; Calculate the association weights based on the co-occurrence frequencies of the situational features and charge labels in the case feature set, and generate an association weight matrix; Convert the calculated association weight matrix into a sparse matrix structure, with rows representing situational features, columns representing charge labels, and matrix elements representing the association weights between the situational features and the labels.

3. A sentence prediction method based on an adaptive sentencing knowledge graph according to claim 1, characterized in that, In S2, constructing the initial knowledge graph based on the correlation relationship between the crime labels and the situational features of the sparse matrix specifically includes: Extracting the set of situational features and crime label elements with non-zero correlation weights in the sparse matrix, and representing the element correlation relationship in the form of node pairs; Connecting the nodes according to the element correlation relationship of the node pairs, and combining the correlation weights to establish the initial numerical expression of the edges to generate the initial knowledge graph; Obtaining the mapping relationship between a single crime label and the sentence label, and embedding the sentence label corresponding to the single crime label into the initial knowledge graph.

4. The term prediction method based on an adaptive sentencing knowledge graph according to claim 1, characterized in that In S5, extracting the crime labels and sentence labels of the historical sentencing case samples containing multiple crime labels, and training the sentence prediction model for multiple crime labels based on the key situational feature set extracted from the reconstructed knowledge graph specifically includes: Extracting the set of case features of the historical sentencing case samples containing multiple crime labels, and taking each individual crime label as the starting node to search for the set of situational feature nodes connected to the starting node in the reconstructed knowledge graph; Obtaining the situational features in the set of case features containing multiple crime labels, and marking the intersection of the corresponding situational features and the search results of the connected situational feature nodes in the knowledge graph as the key situational feature set; Jointly forming the sentence prediction training feature set with the set of multiple crime labels, the key situational feature set, and the sentence labels; Training the sentence prediction model for multiple crime labels based on the sentence prediction training feature set.

5. The sentence prediction method based on an adaptive sentencing knowledge graph according to claim 4, characterized in that The training of the sentence prediction model for multiple crime labels based on the sentence prediction training feature set specifically includes: Establishing a supervised learning structure, initializing the model weight parameters, and setting the type of loss function; Dividing the sentence prediction training feature set into several subsets by using the batch training method, and calculating the model output results through forward propagation; Performing the preset loss function calculation according to the numerical deviation between the model output results and the target sentence labels to generate an error signal sequence; Inputting the error signal sequence into the optimizer structure, performing the weight update operation, and iteratively training until the loss converges to the preset index requirements.

6. The sentence prediction method based on an adaptive sentencing knowledge graph according to claim 1, characterized in that, In S6, inputting the actual case situational features into the sentence prediction model based on the reconstructed knowledge graph and multiple crime labels, and outputting the corresponding predicted sentence results specifically includes: Extracting the situational features of the actual case through semantic recognition, inputting the situational features into the reconstructed knowledge graph to retrieve the corresponding crime labels, and judging whether the crime labels are single crime labels; If so, outputting the sentence label corresponding to the crime label node of this label in the knowledge graph as the sentence prediction result; If not, inputting the combination of multiple crime labels and situational features into the sentence prediction model, and taking the sentence label output by the sentence prediction model as the sentence prediction result.

Citation Information

Patent Citations

  • Recommended sentencing criminal period determination method and system based on regression model and machine learning

    CN117911204A