Sentencing prediction method and device

By vectorizing case-related information and criminal fact description text, and introducing topological structures, first predicting crimes and laws, and then conducting sentence prediction, the problem of inaccurate sentence prediction in the existing technology is solved, and the comprehensiveness of sentencing prediction is improved and accuracy.

CN114860900BActive Publication Date: 2024-11-01HISENSE GRP HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210365513.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-07
Publication Date
2024-11-01
Estimated Expiration
2042-04-07

AI Technical Summary

Technical Problem

The existing technology lacks external information in the prison term prediction and only relies on the description of criminal facts, resulting in incomplete and insufficient accuracy of the judgment results, and the association between the crime, laws and sentences is not considered.

Method used

By obtaining case-related information and criminal fact description text, vectorized processing and feature extraction are carried out, topological structure is introduced, first predicting the crime and laws, and then conducting sentence prediction based on it, enhancing the accuracy of sentence prediction.

Benefits of technology

The comprehensiveness and accuracy of sentencing predictions are improved, and the effectiveness of sentence prediction is enhanced by combining case-related information and criminal fact description text, and the error problem of judgment results in the existing technology is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860900B_ABST
    Figure CN114860900B_ABST
Patent Text Reader

Abstract

The present application discloses a sentencing prediction method and device to solve the problem of incomplete and inaccurate judgment results in the prior art. The method proposed in the present application includes: obtaining case-related information and a text describing the crime facts; vectorizing the word segments included in multiple chapters of the text describing the crime facts to obtain the first word vector corresponding to each word segment, and vectorizing the word segments included in the case-related information to obtain the second word vector corresponding to each word segment; feature extracting the first word vectors included in multiple chapters to obtain the first feature vector of each chapter in the multiple chapters, and determining the prediction category of each chapter based on the first feature vector of each chapter; feature extracting the second word vector included in the case-related information to obtain the second feature vector of the case-related information; and predicting the law, crime and sentence based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vectors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a sentencing prediction method and device. Background Art

[0002] At present, legal judgment prediction mainly involves three subtasks: the prediction of charges, laws and sentences. The sentence prediction process is very complicated. It not only takes into account the defendant's basic status and the process of committing the crime, but also whether the defendant actively pleads guilty, surrenders, and other related factors. First, the existing technical solutions lack external information and only focus on the description of the criminal facts of the case. The description of the criminal facts does play an irreplaceable role in the prediction of charges and laws, but in the process of sentence prediction, it is not realistic to rely solely on the information in the description of the criminal facts. Secondly, in the existing technical solutions, the relevant information corresponding to the three subtasks is extracted from the description of the criminal facts, and the prediction is made based on the information corresponding to a single subtask. The correlation between the subtasks is not considered, which leads to certain errors in the comprehensiveness and accuracy of the judgment results. Summary of the invention

[0003] The embodiments of the present application provide a sentencing prediction method and device to solve the problems of incomplete and inaccurate judgment results in the prior art.

[0004] In a first aspect, an embodiment of the present application provides a sentencing prediction method, comprising:

[0005] Obtaining case-related information and a text describing the crime facts, wherein the case-related information includes at least one of witnesses, physical evidence, defendant information, testimony, suspect confessions, and transcripts; the text describing the crime facts includes multiple chapters, each of the multiple chapters includes multiple sentences, and each of the multiple sentences includes multiple participles;

[0006] Performing vectorization processing on the segmented words included in the multiple chapters to obtain a first word vector corresponding to each segmented word, and performing vectorization processing on the segmented words included in the case-related information to obtain a second word vector corresponding to each segmented word; performing feature extraction on the first word vectors included in the multiple chapters to obtain a first feature vector of each chapter in the multiple chapters, and determining a predicted category of each chapter according to the first feature vector of each chapter, wherein the predicted category is a legal article category, a crime category, or a sentence category;

[0007] Feature extraction is performed on the second word vector included in the case-related information to obtain a second feature vector of the case-related information; and legal provision prediction, crime prediction and sentence prediction are performed based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector.

[0008] Based on the above scheme, case-related information is introduced on the basis of the crime fact description text to jointly predict sentencing, which improves the prediction effect. At the same time, due to the complexity of the sentence, a topological structure is introduced in the multi-task, first predicting the crime, then predicting the law, and finally predicting the sentence based on the crime and the law, which further improves the effect of sentence prediction.

[0009] In a possible implementation, feature extraction is performed on the first word vectors included in the multiple chapters to obtain a first feature vector of each of the multiple chapters, including: filtering the word segments in the first chapter based on the first word vector included in the first chapter to obtain a filtered first chapter, the first word vectors of the multiple sentences included in the filtered first chapter are all related to sentencing prediction, and the first chapter is any chapter in the multiple chapters; combining the multiple sentences included in the filtered first chapter to obtain a plurality of sentence combinations, each of the plurality of sentence combinations including at least two sentences;

[0010] Perform feature extraction on each sentence combination through the first semantic vector encoder to obtain a word-level feature vector for each sentence combination; perform feature concatenation on the word-level feature vectors of multiple sentence combinations to obtain a sentence vector representation of each sentence combination; perform feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain a sentence-level feature vector for each sentence combination; perform feature concatenation on the sentence-level feature vectors of multiple sentence combinations to obtain the first feature vector.

[0011] Based on the above scheme, the context features between multiple word segments and the context features between sentences in each chapter are obtained through feature extraction.

[0012] In a possible implementation, the method further includes: encoding position vectors corresponding to the plurality of first word vectors included in the filtered first chapter, the position vectors corresponding to the first word vectors being used to represent the position of the word segment corresponding to the first word vector in the text corresponding to the first chapter; fusing the first word vectors of the plurality of word segments included in the filtered first chapter with the corresponding position vectors to obtain a fused word vector of the plurality of word segments in the first chapter;

[0013] The method of extracting features from each sentence combination by using a first semantic vector encoder to obtain a word-level feature vector for each sentence combination includes: extracting features from the first sentence combination by using a first semantic vector encoder based on a fused word vector of multiple word segments included in the first sentence combination to obtain a word-level feature vector for the first sentence combination, wherein the first sentence combination is any one of the multiple sentence combinations.

[0014] Based on the above scheme, by fusing the first word vector with the position vector, the relative and absolute position information of each word in the sentence can be obtained in the subsequent encoding process.

[0015] In a possible implementation, the method further includes: encoding position vectors corresponding to the plurality of first sentence vectors included in the filtered first chapter, the position vectors corresponding to the first sentence vectors being used to represent the position of the sentence corresponding to the first sentence vector in the text corresponding to the first chapter; fusing the plurality of first sentence vectors included in the filtered first chapter with the corresponding position vectors to obtain a fused sentence vector of the plurality of sentences in the first chapter;

[0016] The method of extracting features from the sentence vector of each sentence combination by using the second semantic vector encoder to obtain a sentence-level feature vector for each sentence combination includes: extracting features from the first sentence combination by using the second semantic vector encoder according to a fused sentence vector of multiple sentences included in the first sentence combination to obtain a sentence-level feature vector for the first sentence combination, wherein the first sentence combination is any one of the multiple sentence combinations.

[0017] Based on the above solution, by fusing the first sentence vector with the position vector, the relative and absolute position information of each sentence in the sentence combination can be obtained in the subsequent encoding process.

[0018] In a possible implementation, the first semantic vector encoder includes N attention network layers, a first neural network layer, and a first single-head attention layer; each of the N attention network layers includes a first multi-head attention layer and a first additive normalization layer; N is a positive integer;

[0019] The method of extracting features of the first sentence combination using a first semantic vector encoder according to the fused word vector of the multiple words included in the first sentence combination to obtain a word-level feature vector of the first sentence combination includes:

[0020] The first multi-head attention layer in the i-th attention network layer includes a plurality of attention modules that respectively perform attention operations on the fused word vectors of the plurality of word segments included in the first sentence combination to obtain outputs of the plurality of attention modules;

[0021] The first addition normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain a splicing result; the splicing result is linearly transformed according to the output result of the i-1-th attention network layer to obtain the first output result of the first multi-head attention layer of the i-th attention network layer; i is a positive integer less than or equal to N; the first output result of the first multi-head attention layer of the i-th attention network layer is normalized to obtain a second output result, and the second output result is used for the linear transformation of the i+1-th attention network layer;

[0022] Performing feature extraction on the second output result of the Nth attention network layer through the first neural network layer to obtain a feature matrix of the first participle of each sentence combination;

[0023] The feature information in the feature matrix of the first word segmentation is extracted through the first single-head attention layer to obtain a word-level feature vector of the first sentence combination.

[0024] Based on the above scheme, feature extraction is performed on multiple word segmentations included in the first sentence combination through N attention network layers, which can capture the long-distance features between word segmentations in the text, extract rich contextual semantic representation information, and enhance the feature extraction capability.

[0025] In a possible implementation, the second semantic vector encoder includes N attention network layers, a second neural network layer, and a second single-head attention layer; each of the N attention network layers includes a second multi-head attention layer and a second additive normalization layer; N is a positive integer;

[0026] The method of extracting features of the first sentence combination using a second semantic vector encoder according to the fused sentence vector of the plurality of sentences included in the first sentence combination to obtain a sentence-level feature vector of the first sentence combination includes:

[0027] The plurality of attention modules included in the second multi-head attention layer in the i-th attention network layer respectively perform attention calculations on the fused sentence vectors of the plurality of sentences included in the first sentence combination to obtain outputs of the plurality of attention modules;

[0028] The second addition normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain a splicing result; the splicing result is linearly transformed according to the output result of the i-1-th attention network layer to obtain a third output result of the second multi-head attention layer of the i-th attention network layer; i is a positive integer less than or equal to N; the third output result of the second multi-head attention layer of the i-th attention network layer is normalized to obtain a fourth output result, and the fourth output result is used for the linear transformation of the i+1-th attention network layer;

[0029] Performing feature extraction on the fourth output result of the Nth attention network layer through the second neural network layer to obtain a feature matrix of the first sentence of each sentence combination;

[0030] The feature information in the feature matrix of the first sentence is extracted through the second single-head attention layer to obtain a sentence-level feature vector of the first sentence combination.

[0031] Based on the above scheme, feature extraction is performed on multiple sentences included in the first sentence combination through N attention network layers, which can capture the long-distance features between sentences in the text, extract rich contextual semantic representation information, and enhance the feature extraction capability.

[0032] In a possible implementation, the predicting of legal provisions, crime names and sentences according to the predicted categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vectors includes:

[0033] Performing nonlinear transformation on the second feature vector and the first feature vector whose prediction category is a legal article category among the plurality of first feature vectors corresponding to the plurality of chapters to obtain a legal article prediction vector, and performing legal article prediction according to the legal article prediction vector;

[0034] Performing nonlinear transformation on the second feature vector, the first feature vector with a predicted category of crime among the multiple first feature vectors corresponding to the multiple chapters, and the legal provision prediction vector to obtain a crime prediction vector, and performing crime prediction based on the crime prediction vector;

[0035] A nonlinear transformation is performed on the second eigenvector, the first eigenvector with a predicted category of sentence category among the multiple first eigenvectors corresponding to the multiple chapters, the legal article prediction vector and the crime prediction vector to obtain a sentence prediction vector, and sentence prediction is performed based on the sentence prediction vector.

[0036] Based on the above scheme, a topological structure is used in sentencing prediction. The crime is predicted first, then the legal provisions are predicted, and finally the sentence is predicted based on the crime and the legal provisions, which further improves the effect of sentence prediction.

[0037] In a possible implementation, the case-related information includes first data and second data; wherein the first data includes at least one of testimony, confession of the suspect, and transcript, and the second data includes at least one of witness testimony, physical evidence, and defendant information; vectorizing the word segmentation included in the case-related information to obtain a second word vector corresponding to each word segmentation includes:

[0038] Performing vectorization processing on the word segments included in the first data to obtain a second word vector corresponding to each word segment in the first data;

[0039] Determine the category to which each word segment included in the second data belongs, and determine the category vector corresponding to the category to which each word segment included in the second data belongs from a data vector table; the data vector table includes category vectors corresponding to multiple categories; determine the second word vector corresponding to each word segment by using the category vector corresponding to the category to which each word segment included in the second data belongs.

[0040] Based on the above scheme, case-related information is introduced on the basis of the crime fact description text, and feature extraction is performed on the case-related information. By introducing case-related information on the basis of the crime fact description text, sentencing prediction is performed together, thereby improving the prediction effect.

[0041] In a possible implementation, filtering the word segments in the first chapter based on the first word vector included in the first chapter to obtain a filtered first chapter includes:

[0042] The multiple first word vectors included in the first chapter are filtered through a convolutional neural network to obtain the filtered first chapter.

[0043] In a second aspect, an embodiment of the present application provides a sentencing prediction device, including an acquisition unit and a processing unit;

[0044] The acquisition unit is used to acquire case-related information and a text describing the crime facts, wherein the case-related information includes at least one of witnesses, physical evidence, defendant information, testimony, suspect confession, and transcripts; the text describing the crime facts includes multiple chapters, each of the multiple chapters includes multiple sentences, and each of the multiple sentences includes multiple participles;

[0045] The processing unit is used to perform vectorization processing on the segmented words included in the multiple chapters to obtain a first word vector corresponding to each segmented word, and to perform vectorization processing on the segmented words included in the case-related information to obtain a second word vector corresponding to each segmented word; perform feature extraction on the first word vectors included in the multiple chapters to obtain a first feature vector of each chapter in the multiple chapters, and determine a predicted category of each chapter according to the first feature vector of each chapter, wherein the predicted category is a legal article category, a crime category, or a sentence category;

[0046] The processing unit is further used to perform feature extraction on the second word vector included in the case-related information to obtain a second feature vector of the case-related information; and perform legal provision prediction, crime prediction and sentence prediction based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector.

[0047] In a possible implementation, the processing unit, when performing feature extraction on the first word vectors included in the multiple chapters to obtain the first feature vector of each of the multiple chapters, is specifically configured to:

[0048] Based on the first word vector included in the first chapter, the word segmentation in the first chapter is filtered to obtain a filtered first chapter, wherein the first word vectors in multiple sentences included in the filtered first chapter are all related to sentencing prediction, and the first chapter is any one of the multiple chapters;

[0049] Combining the plurality of sentences included in the filtered first chapter to obtain a plurality of sentence combinations, each of the plurality of sentence combinations including at least two sentences;

[0050] Performing feature extraction on each sentence combination through a first semantic vector encoder to obtain a word-level feature vector for each sentence combination;

[0051] Perform feature concatenation on the word-level feature vectors of multiple clause combinations to obtain a sentence vector representation of each clause combination;

[0052] Performing feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain a sentence-level feature vector of each sentence combination;

[0053] Feature concatenation is performed on the sentence-level feature vectors of the plurality of sentence combinations to obtain the first feature vector.

[0054] In a possible implementation, the processing unit is further used to: encode the position vectors corresponding to the multiple first word vectors included in the filtered first chapter, where the position vector corresponding to the first word vector is used to represent the position of the word segment corresponding to the first word vector in the text corresponding to the first chapter; fuse the first word vectors of the multiple word segments included in the filtered first chapter with the corresponding position vector to obtain the fused word vectors of the multiple word segments in the first chapter;

[0055] The processing unit, when performing feature extraction on each sentence combination through the first semantic vector encoder to obtain a word-level feature vector for each sentence combination, is specifically used to: perform feature extraction on the first sentence combination using the first semantic vector encoder according to a fused word vector of multiple word segments included in the first sentence combination to obtain a word-level feature vector for the first sentence combination, wherein the first sentence combination is any one of the multiple sentence combinations.

[0056] In a possible implementation, the processing unit is further used to: encode the position vectors corresponding to the multiple first sentence vectors included in the filtered first chapter, the position vectors corresponding to the first sentence vectors are used to represent the position of the sentence corresponding to the first sentence vector in the text corresponding to the first chapter; fuse the multiple first sentence vectors included in the filtered first chapter with the corresponding position vectors to obtain the fused sentence vectors of the multiple sentences in the first chapter;

[0057] The processing unit, when performing feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain the sentence-level feature vector of each sentence combination, is specifically used to: perform feature extraction on the first sentence combination using the second semantic vector encoder according to the fused sentence vector of multiple sentences included in the first sentence combination to obtain the sentence-level feature vector of the first sentence combination, where the first sentence combination is any one of the multiple sentence combinations.

[0058] In a possible implementation, the first semantic vector encoder includes N attention network layers, a first neural network layer, and a first single-head attention layer; each of the N attention network layers includes a first multi-head attention layer and a first additive normalization layer; N is a positive integer;

[0059] The processing unit, when using the first semantic vector encoder to extract features from the first sentence combination according to the fused word vectors of the multiple word segments included in the first sentence combination to obtain the word-level feature vector of the first sentence combination, is specifically used to: the multiple attention modules included in the first multi-head attention layer in the i-th attention network layer respectively perform attention operations on the fused word vectors of the multiple word segments included in the first sentence combination to obtain the outputs of the multiple attention modules; the first additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain the splicing result; the first additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules according to the output result of the i-1-th attention network layer The result is linearly transformed to obtain the first output result of the first multi-head attention layer of the ith attention network layer; i is a positive integer less than or equal to N; the first output result of the first multi-head attention layer of the ith attention network layer is normalized to obtain a second output result, and the second output result is used for the linear transformation of the i+1th attention network layer; the second output result of the Nth attention network layer is feature extracted by the first neural network layer to obtain the feature matrix of the first participle of each sentence combination; the feature information in the feature matrix of the first participle is extracted by the first single-head attention layer to obtain the word-level feature vector of the first sentence combination.

[0060] In a possible implementation, the second semantic vector encoder includes N attention network layers, a second neural network layer, and a second single-head attention layer; each of the N attention network layers includes a second multi-head attention layer and a second additive normalization layer; N is a positive integer;

[0061] The processing unit, when using the second semantic vector encoder to extract features from the first sentence combination according to the fused sentence vector of the multiple sentences included in the first sentence combination to obtain the sentence-level feature vector of the first sentence combination, is specifically used to: the multiple attention modules included in the second multi-head attention layer in the i-th attention network layer respectively perform attention calculations on the fused sentence vectors of the multiple sentences included in the first sentence combination to obtain the outputs of the multiple attention modules; the second additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain the splicing result; the second additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules according to the output result of the i-1-th attention network layer The result is linearly transformed to obtain the third output result of the second multi-head attention layer of the ith attention network layer; i is a positive integer less than or equal to N; the third output result of the second multi-head attention layer of the ith attention network layer is normalized to obtain a fourth output result, and the fourth output result is used for the linear transformation of the i+1th attention network layer; the fourth output result of the Nth attention network layer is feature extracted through the second neural network layer to obtain the feature matrix of the first sentence of each sentence combination; the feature information in the feature matrix of the first sentence is extracted through the second single-head attention layer to obtain the sentence-level feature vector of the first sentence combination.

[0062] In a possible implementation, the processing unit, when performing legal article prediction, crime prediction and sentence prediction based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector, is specifically used to: perform nonlinear transformation on the second feature vector and the first feature vector with a prediction category of the legal article category among the multiple first feature vectors corresponding to the multiple chapters to obtain a legal article prediction vector, and perform legal article prediction based on the legal article prediction vector; perform nonlinear transformation on the second feature vector, the first feature vector with a prediction category of the crime category among the multiple first feature vectors corresponding to the multiple chapters, and the legal article prediction vector to obtain a crime prediction vector, and perform crime prediction based on the crime prediction vector; perform nonlinear transformation on the second feature vector, the first feature vector with a prediction category of the sentence category among the multiple first feature vectors corresponding to the multiple chapters, the legal article prediction vector, and the crime prediction vector to obtain a sentence prediction vector, and perform sentence prediction based on the sentence prediction vector.

[0063] In one possible implementation, the case-related information includes first data and second data; wherein the first data includes at least one of testimony, confession of the suspect and transcript, and the second data includes at least one of witness testimony, physical evidence and defendant information; the processing unit, when vectorizing the word segmentations included in the case-related information to obtain the second word vector corresponding to each word segmentation, is specifically used to: vectorize the word segmentations included in the first data to obtain the second word vector corresponding to each word segmentation in the first data; determine the category to which each word segmentation included in the second data belongs, and determine the category vector corresponding to the category to which each word segmentation included in the second data belongs from a data vector table; the data vector table includes category vectors corresponding to multiple categories; determine the second word vector corresponding to each word segmentation using the category vector corresponding to the category to which each word segmentation included in the second data belongs.

[0064] In one possible implementation, the processing unit, when filtering the word segments in the first chapter based on the first word vector included in the first chapter to obtain the filtered first chapter, is specifically used to: filter the multiple first word vectors included in the first chapter through a convolutional neural network to obtain the filtered first chapter.

[0065] In a third aspect, an embodiment of the present application provides a sentencing prediction device, including a memory and a processor;

[0066] The memory is used to store program instructions;

[0067] The processor is used to call the program instructions stored in the memory, and execute the method described in the first aspect and any possible implementation manner included in the first aspect according to the obtained program.

[0068] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any possible implementation method included in the first aspect.

[0069] In addition, the technical effects brought about by any implementation method of the second to fourth aspects can refer to the technical effects brought about by the first aspect and different implementation methods of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0071] Figure 1A A schematic diagram of the system architecture provided for an embodiment of the present application;

[0072] Figure 1B A schematic diagram of the server structure provided in the embodiment of the present application;

[0073] Figure 2 A flowchart of a sentencing prediction method provided in an embodiment of the present application;

[0074] Figure 3 A schematic diagram of a network model for extracting case-related information features provided in an embodiment of the present application;

[0075] Figure 4A A schematic diagram of a network model for extracting features from a text describing a crime fact provided in an embodiment of the present application;

[0076] Figure 4B A flowchart of a feature extraction process for a crime fact description text provided in an embodiment of the present application;

[0077] Figure 5 A schematic diagram of a process for obtaining a word-level feature vector provided in an embodiment of the present application;

[0078] Figure 6 A schematic diagram of an attention network layer provided in an embodiment of the present application;

[0079] Figure 7 A schematic diagram of the structure of a classifier provided in an embodiment of the present application;

[0080] Figure 8 A schematic diagram of the structure of a sentencing prediction model provided in an embodiment of the present application;

[0081] Fig. 9 A schematic diagram of a sentencing prediction device provided in an embodiment of the present application;

[0082] Fig.10 A schematic diagram of another sentencing prediction device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0084] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0085] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0086] In view of the problem that the prior art predicts the sentence based only on the description of the criminal facts of the case, resulting in certain errors in the comprehensiveness and accuracy of the judgment results, the present application provides a sentencing prediction method, which adds case-related information on the basis of the crime fact description text, and realizes sentencing prediction by encoding and extracting features of both the crime fact description text and the case-related information, thereby improving the accuracy of sentencing prediction.

[0087] Figure 1A The system architecture applicable to the embodiments of the present application is exemplarily shown, and the system architecture may include a sentencing prediction device. In some embodiments, the sentencing prediction device may include one or more servers 100, Figure 1AThree servers are taken as an example. Server 100 can be implemented by a physical server or a virtual server. The server can be implemented by a single server or a server cluster composed of multiple servers. A single server or a server cluster implements the sentencing prediction method provided in this application. Optionally, server 100 can be connected to a terminal device to receive a sentencing prediction task sent by the terminal device, or send a sentencing prediction result to the terminal device. For example, the terminal device can be a mobile phone, a tablet computer, a personal computer, etc.

[0088] As an example, see Figure 1B As shown, the server may include a processor 110, a communication interface 120, and a memory 130. Of course, the server 100 may also include other components. Figure 1B Not shown.

[0089] Taking the example of the server 100 being connected to multiple terminal devices, the communication interface 120 is used to communicate with different terminal devices, to receive sentencing prediction tasks sent by the terminal devices, or to send sentencing prediction results to the terminal devices.

[0090] In the embodiment of the present application, the processor 110 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0091] The processor 110 is the control center of the server 100. It connects various parts of the entire server 100 using various interfaces and routes, and executes various functions and processes data of the server 100 by running or executing software programs / or modules stored in the memory 130, and calling data stored in the memory 130. Optionally, the processor 110 may include one or more processing units. The processor 110 may be, for example, a control component such as a processor, a microprocessor, a controller, and may be, for example, a general-purpose central processing unit (CPU), a general-purpose processor, a digital signal processing (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.

[0092] The memory 130 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing by running the software programs and modules stored in the memory 130. The memory 130 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to business processing, etc. The memory 130, as a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 130 may include at least one type of storage medium, for example, a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, and the like. The memory 130 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 130 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0093] It should be noted that the above Figure 1A and Figure 1B The structure shown is only an example and is not limited to this embodiment of the present invention.

[0094] In some scenarios, the sentencing prediction method provided in the embodiments of the present application can be implemented by one or more local terminal devices.

[0095] This application embodiment provides a sentencing prediction method. Figure 2 The process of the sentencing prediction method is exemplarily shown, and the process can be executed by a sentencing prediction device, which can be located at Figure 1B The server 100 shown in the figure may be, for example, a processor 110 or a server 100. The following description will be made by taking the server 100 as an example. For the sake of convenience, the following description of the server 100 will not be illustrated with numbers. The sentencing prediction device may also be located in a local terminal device. The specific process is as follows:

[0096] 201, obtain case-related information and a text describing the crime facts.

[0097] In some embodiments, case-related information refers to other auxiliary information related to the case, such as witnesses, physical evidence, defendant information, testimony, suspect confessions, and transcripts. The crime fact description text may include defendant information and crime information. The defendant information may include the defendant's criminal record information, such as the number of previous convictions, previous fines, previous deprivation of political power, previous sentence, and previous crime. The crime information may include a description of the crime facts, or a description of the crime facts and the amount involved.

[0098] In some embodiments, after obtaining the crime fact description text, the crime fact description text is segmented. The crime fact description text can be segmented based on a segmenter, and this application does not make specific restrictions on this. For example, the segmenter can use a text analysis segmenter Analysis, a Han Language Processing (HanLP) package.

[0099] In some embodiments, after the crime fact description text is segmented, the crime fact description text can be divided into multiple chapters with a fixed number of segmented words or sentences, each chapter includes multiple sentences, and each sentence includes multiple segmented words. The crime fact description text can also be divided into multiple chapters according to paragraphs, which is not specifically limited in the embodiments of the present application.

[0100] In some embodiments, the text describing the crime facts and the case-related information may come from a terminal device connected to the server. In some embodiments, the user may trigger a sentencing prediction task through a terminal device. When sending a sentencing prediction task to the server, the text describing the crime facts and the case-related information may be sent to the server. The sentencing prediction task is used to instruct the server to perform sentencing prediction. After receiving the sentencing prediction task, the server executes the sentencing prediction method flow.

[0101] 202, vectorize the words included in the multiple chapters to obtain a first word vector corresponding to each word, and vectorize the words included in the case-related information to obtain a second word vector corresponding to each word.

[0102] In some embodiments, the crime fact description text is written and official, and is concise and to the point. Therefore, after determining the multiple chapters included in the crime fact description text, the multiple word segments corresponding to the multiple chapters are vectorized to obtain the word vector corresponding to each word segment. For the sake of ease of description, the word vector corresponding to the word segment included in the chapter is called the first word vector. In some scenarios, the crime fact description text is first processed at the word granularity, and the crime fact description text is converted into a numerical form. Specifically, taking the first chapter as an example, each word segment included in the first chapter corresponds to a token, and the first chapter can be expressed as T=(t 1 ,t 2 ,…,t n ). Where T represents the token sequence, t i represents a token of a segmentation, and n is the number of segmentations included in the first chapter. Furthermore, the token sequence included in the first chapter can be mapped to an integer sequence. The integer sequence can be expressed as D(t→d)=(d 1 ,d 2 ,…,d n ), where n is the number of segmentations included in the first chapter. For example, the correspondence between the token corresponding to each segmentation and an integer value can be determined through a dictionary. For example, the dictionary stores the correspondence between the tokens corresponding to all segmentations encountered in the current scene and an integer value. For example, based on statistical feature training and annotation, 5000 segmentations can be obtained, and the dictionary stores the correspondence between the tokens corresponding to 5000 segmentations and the integer values. Different segmentations correspond to different integer values.

[0103] In some embodiments, after converting the crime fact description text into numerical form by converting multiple word segments in the form of text at word granularity, the word segments can be mapped to the vector space to obtain multiple word vectors. The sentencing prediction device stores a word vector sequence, the number of which is the size of the dictionary, and multiple first word vectors are mapped according to the word vector sequence by the numerical values ​​corresponding to the multiple word segments. Specifically, the word vector sequence can be expressed as E=(e 1 ,e 2 ,…,e s ), where s is the number of word segments included in the dictionary, e i is the word vector, the length can be set, e i ∈R k , k is the length of the word vector. For example, if a word vector in the dictionary is "valid", the length of the word vector is 2. Each word segment included in the crime fact description text corresponds to a token, and the value corresponding to each token can be mapped into a vector through E. All the mapped word vectors are combined according to the original order of the tokens, that is, the order of the word segments in the crime fact description text, and the first word vector including the word segment in each chapter of the crime fact description text is obtained. As an example, taking the first chapter including s word segments as an example, after mapping through the word vector sequence E, the first chapter can be expressed as X=(x 1 ,x 2 ,…,x s ), where x i is the first word vector corresponding to the i-th word segmentation, x i ∈R k , k is the length of the first word vector. In some scenarios, the word vector sequence can be generated by the sentencing device model. After receiving the sentencing prediction task sent by the terminal device, the sentencing prediction device can automatically generate a word vector sequence. After the word segmentation of the crime fact description text is converted into a numerical value, the word segmentation can be mapped to the vector space according to the word vector sequence to obtain multiple word vectors.

[0104] In some other embodiments, after obtaining case-related information, the case-related information includes first data and second data. It is understandable that the first data and the second data may also be referred to by other names, for example, the first data may be referred to as continuous data, and the second data may be referred to as discrete data. The first data may include at least one of testimony, confession of the suspect, and transcript, and the second data may include at least one of witness testimony, physical evidence, and defendant information.

[0105] In some scenarios, the word segmentation included in the first data can be vectorized to directly obtain the second word vector corresponding to each word segmentation included in the first data. The method for vectorizing the word segmentation included in the first data is consistent with the method for vectorizing the word segmentation included in the crime fact description text, and will not be repeated here.

[0106] In other scenarios, the multiple word segments included in the first data may belong to different categories. Of course, some word segments in the first data may belong to the same category, that is, each category includes multiple word segments. The vectorized value ranges corresponding to multiple categories may be different, and the range of the vectorized value ranges corresponding to multiple categories is relatively large. Therefore, after the word segments included in the first data are vectorized, the word vectors obtained after the vectorization of the multiple word segments included in the first data can be normalized to obtain the second word vector corresponding to each word segment. Therefore, the second word vector corresponding to the i-th word segment can meet the conditions shown in the following formula (1):

[0107]

[0108] Among them, c′ i Represents the second word vector corresponding to the i-th word in the first data, μ c represents the mean of all values ​​included in the first data, σ c represents the variance, c i Represents the word vector obtained by vectorizing the i-th word segmentation.

[0109] In some scenarios, the first data including the first word vectors of all the categories to which the word segments belong can be represented by a vector sequence, for example, represented as C′=(c′ 1 ,c′ 2 ,c′ 3 ,…,c′ g ). Among them, C′∈R g , g is the number of categories of the first data.

[0110] In some other embodiments, the category to which each word segment included in the second data belongs is determined, and the category vector corresponding to the category of each word segment included in the second data is determined from the data vector table. The number of categories in the second data is less than the number of categories in the first data. The category vector corresponding to the category to which each word segment included in the second data belongs can be used to determine the second word vector corresponding to each word segment by using a pre-constructed data vector table. The data vector table includes category vectors corresponding to multiple categories.

[0111] 203 , extracting features from the first word vectors included in the multiple chapters to obtain a first feature vector for each of the multiple chapters, and determining a predicted category for each chapter according to the first feature vector for each chapter.

[0112] 204 , extract features from the second word vector included in the case-related information to obtain a second feature vector of the case-related information.

[0113] For example, the Concat function may be used to concatenate the second word vectors included in the case-related information to obtain the second feature vector.

[0114] 205. Predicting legal provisions, crimes and sentences according to the prediction categories of the first feature vectors and the second feature vectors corresponding to the multiple chapters.

[0115] In some embodiments, after obtaining the sentencing prediction result, the server may send the sentencing prediction result to a terminal device, and the user may obtain the sentencing prediction result through the terminal device.

[0116] Exemplarily, a sentencing prediction model may be deployed in the sentencing prediction device, and the sentencing prediction device executes steps 202-205 through the sentencing prediction model.

[0117] Through the above scheme, case-related information is introduced on the basis of the crime fact description text to jointly predict sentencing, which improves the prediction effect. At the same time, due to the complexity of the sentence, a topological structure is introduced in the multi-task, first predicting the crime, then predicting the law, and finally predicting the sentence based on the crime and the law, which further improves the effect of sentence prediction.

[0118] In a possible implementation, a feedforward neural network may be used to extract features from the second word vector included in the case related information in step 204, see Figure 3 As shown. For example, the second word vector in the first data is input into the first feedforward neural network to obtain the output vector of the first data. For example, the first feedforward neural network includes a fully connected layer, and the second word vector in the first data is input into the fully connected layer to obtain the output vector of the first data. The output vector of the first data satisfies the condition shown in the following formula (2):

[0119] T c =Relu(C′W c +b c ); (2)

[0120] Among them, T c is the output vector of the first data, T c ∈R p , p is the vector dimension of the output vector of the first data, C′ is the vector sequence of the first data. Relu is the activation function, W c is the transformation matrix, b c is the bias term. Through the above formula, different categories of data that are isolated from each other can be fused together.

[0121] In some embodiments, the second word vector corresponding to the word segmentation included in the second data can be input into the second feedforward neural network to obtain the output vector of the second data, see Figure 3As shown. For example, the second word vector in the second data is input into the second feedforward neural network to obtain the output vector of the second data. For example, the second feedforward neural network includes a fully connected layer, and the second word vector in the second data is input into the fully connected layer to obtain the output vector of each category included in the second data. The second data includes the output vector of the i-th category that satisfies the condition shown in the following formula (3):

[0122] T di =Relu(d′ i W di +b di ); (3)

[0123] Among them, T di represents the output vector corresponding to the i-th category in the second data, Relu represents the activation function, W di represents the transformation matrix, b di represents the bias term. Further, the output vector of the second data can be expressed as T d =(T d1 ,T d2 ,…,T dq );wherein, q is the number of categories included in the second data.

[0124] Further, after obtaining the output vector of the first data and the output vector of the second data, the output vector of the first data and the output vector of the second data are concatenated to obtain a second feature vector of case-related information, such as Figure 3 The second eigenvector satisfies the following condition as shown in formula (4):

[0125] T m =Concat(T c ,T d ); (4)

[0126] Among them, T m represents the second eigenvector, concat represents the concatenation function, T c represents the output vector of the first data, T d An output vector representing the second data.

[0127] In one possible implementation, when obtaining the first feature vector of each chapter in step 203, word-level encoding can be performed by a first semantic vector encoder, and then sentence-level encoding can be performed by a second semantic vector encoder. The first semantic vector encoder can also be called a word encoder, and the second semantic vector encoder can also be called a sentence encoder. In some embodiments, before performing word-level encoding and sentence-level encoding, the word segmentations included in each chapter are first filtered to filter out word segmentations that are not related to sentencing prediction. For example, when performing filtering, a neural network can be used to implement it, such as a convolutional neural network.

[0128] As an example, refer to Figure 4A shown. Taking the use of a convolutional neural network for word segmentation filtering as an example. Taking the first chapter as an example, the word segmentation in the first chapter can be filtered based on the first word vectors included in the first chapter to obtain the filtered first chapter. The first word vectors in the multiple clauses included in the filtered first chapter are all related to sentencing prediction. Specifically, the filtered first chapter can be obtained by filtering the word segmentation included in the first chapter through a convolutional neural network. The advantage of the convolutional neural network over the fully connected neural network is that the convolutional neural network has fewer parameters and faster calculation speed. When the convolutional neural network performs text convolution, the convolutional kernel in the convolutional neural network can be understood as a filter, similar to the high-pass filter in the communication field. By performing convolution on the first word vectors included in the first chapter, meaningful word vectors can pass through (i.e., the first word vectors related to sentencing prediction), while meaningless words (such as "de", "le", etc.) are ignored. Using the convolutional neural network to filter the word segmentation included in the first chapter can make each character have the characteristics of a word when it is a single character, and there will be no overfitting. Through the convolutional operation performed by the convolutional kernel, finally, the feature representation of the token sequence D corresponding to the first chapter can be obtained, which can be represented as C = (c 1 , c 2 , …, c m ), as Figure 4A shown. After convolution, the first word vectors of the multiple word segmentations included in the filtered first chapter have n-gram context features, that is, the word segmentations are no longer isolated from each other. For example, when n = 2, the first word vector in the filtered first chapter has context features with the two adjacent word vectors respectively.

[0129] In some embodiments, the criminal fact description text belongs to the long chapter level, and the long-distance dependence problem will inevitably occur. In order to further obtain the relationship between the word segmentations, the clauses in the text can be recombined. Specifically, the multiple clauses included in the filtered first chapter can be combined to obtain multiple clause combinations, and each clause combination in the multiple clause combinations includes at least two clauses. The filtered first chapter can be represented as C″ = (c 1 ″, c 2 ″, …, c m ″). Exemplarily, when combining the clauses, the order between the clauses is not limited. It can be understood that after the multiple clauses are arranged in different orders, multiple clause combinations can be formed.

[0130] Refer to Figure 4AAs shown, further, the first semantic vector encoder performs feature extraction on each sentence combination to obtain a word-level feature vector for each sentence combination. Then, the word-level feature vectors of multiple sentence combinations are feature concatenated to obtain a sentence vector representation of each sentence combination. Then, the sentence vector of each sentence combination is feature extracted by the second semantic vector encoder to obtain a sentence-level feature vector for each sentence combination; the sentence-level feature vectors of multiple sentence combinations are feature concatenated to obtain a first feature vector.

[0131] As an example, the first semantic vector encoder may adopt a Transformer encoder, which extracts features from each sentence combination through an attention mechanism to obtain a word-level feature vector for each sentence combination.

[0132] In some embodiments, when performing word-level encoding by the first semantic vector encoder, the position of each word segment may be combined. Figure 4B As shown, the first word vectors of the multiple word segments included in the filtered first chapter are fused with the corresponding position vectors to obtain the fused word vectors of the multiple word segments in the first chapter. The fused word vector satisfies the condition shown in the following formula (5):

[0133]

[0134] Among them, C p represents the fused word vector, PE represents the position encoding vector, and C″ represents the first word vector corresponding to the multiple word segments included in the filtered first chapter. Represents the element-by-element addition operation symbol.

[0135] In the above formula, the position encoding vectors are fused by adding corresponding elements instead of concatenating vectors, so that the problem of increasing parameters due to the concatenation of vectors will not occur and overfitting is not likely to occur.

[0136] Exemplarily, the position vector can be obtained by encoding the sine function and the cosine function. Specifically, after encoding the position vectors corresponding to the multiple first word vectors included in the first chapter after the combination, the position vector of the i-th word segment in the chapter satisfies the conditions shown in the following formulas (6) and (7):

[0137]

[0138]

[0139] Among them, pos represents the position of the current word in the sentence, i represents the index of each word vector in the first chapter, and dmodel represents the dimension of the word vector. Therefore, given the position pos of a segmented word, a position vector of dmodel dimension can be generated according to the above formulas (6) and (7). The generated position vector is an absolute position encoding, but because trigonometric functions are used, the absolute position encoding also contains the relative position information between segmented words.

[0140] By encoding the positions of multiple first word vectors and fusing them with multiple first word vectors to obtain fused word vectors, it is possible to avoid the inability to obtain the position information of the word segmentation in the sentence, which affects the final sentencing prediction result. It is understandable that, in general, Transformer does not have a mechanism to capture the relative positions of word segmentations in a sentence, and the output will not be affected when the word segmentations are swapped. When the Transformer encoder is used, the word order information of the word segmentation will be lost, and the relative and absolute position information of each word segmentation in the sentence cannot be obtained. The position of the word segmentation in the sentence or chapter is added to the subsequent feature extraction through the above encoding position.

[0141] In some embodiments, the fused word vectors of the multiple word segments of the first sentence combination may be input into the first semantic encoder and feature extracted to obtain the word-level feature vector of the first sentence combination, such as Figure 4B As shown. The first semantic vector encoder includes N attention network layers, a first neural network layer and a first single-head attention layer; each of the N attention network layers includes a first multi-head attention layer and a first additive normalization layer; N is a positive integer. The first semantic vector encoder extracts features from each sentence combination to obtain a word-level feature vector for each sentence combination. Figure 5 As shown, the following steps are included:

[0142] 501, the first multi-head attention layer in the i-th attention network layer includes multiple attention modules that respectively perform attention operations on the fused word vectors of the multiple word segments included in the first sentence combination to obtain outputs of the multiple attention modules.

[0143] In some embodiments, the first semantic vector encoder includes N layers of first multi-head attention layers, each layer executes a multi-head attention mechanism, and each layer of the first multi-head attention layer includes multiple attention modules. The fused word vectors of the multiple word segments included in the first sentence combination are respectively input into the multiple attention modules through the multi-head attention mechanism to obtain the outputs of the multiple attention modules. For example, the i-th first multi-head attention layer includes h attention modules. The fused word vectors of the multiple word segments are used as the input of the i-th first multi-head attention layer and input into the h attention modules. The h attention modules perform attention operations on the fused word vectors of the input multiple word segments respectively to obtain the outputs of the h attention modules. Each attention module can use the following formulas (8) to (10) to perform attention operations, and the output result of the i-th attention module can be expressed by formula (10).

[0144] Q,K,V=C p ; (8)

[0145] Q′ i =QW i Q , K′ i =KW i K , V′ i =VW i V ; (9)

[0146] Head i =Attention(Q′ i ,K′ i ,V′ i ); (10)

[0147] Among them, C p Represents the fused word vector, W i Q represents the query weight matrix of the i-th attention module in the first multi-head attention layer, Q′ i W represents the query matrix of the i-th attention module in the first multi-head attention layer of the i-th layer. i K represents the key weight matrix of the i-th attention module in the first multi-head attention layer, K′ i W represents the key matrix of the i-th attention module in the i-th multi-head attention layer. i V represents the value weight matrix of the i-th attention module in the first multi-head attention layer of the i-th layer, V′ i Represents the value matrix of the i-th attention module in the i-th multi-head attention layer. irepresents the output matrix of the i-th attention module, and Attention represents the attention operation.

[0148] 502, the first additive normalization layer in the i-th attention network layer concatenates the output results of multiple attention modules in each layer to obtain a concatenated result; linearly transforms the concatenated result according to the output result of the i-1-th attention network layer to obtain the first output result of the first multi-head attention layer of the i-th attention network layer; and normalizes the first output result of the first multi-head attention layer of the i-th attention network layer to obtain a second output result.

[0149] In some embodiments, the data form of the output result of the attention module is a matrix, the data form of the splicing result is also a matrix, and the number of dimensions of the splicing result is equal to the sum of the number of dimensions of the output results of each attention module. The splicing method can be horizontal splicing, and the splicing process can be implemented by calling the concat (splicing) function. It should be understood that the horizontal splicing method is only an exemplary description. Optionally, other splicing methods are used to splice the output results of each attention module. For example, vertical splicing is used to splice the output results of each attention module to obtain a splicing result. The number of rows of the splicing result is equal to the sum of the number of rows of the output results of each attention module. The embodiment of the present application does not specifically limit how to perform splicing.

[0150] In some embodiments, after obtaining the splicing result, the splicing result can be linearly transformed to obtain a first output result. The linear transformation method can be multiplication with a weight matrix, the splicing result is multiplied by the weight matrix, and the product is used as the first output result. Optionally, the linear transformation can also be other methods other than multiplication with the weight matrix, for example, multiplying the splicing result by a constant to linearly transform the splicing result, or adding the splicing result to a constant to linearly transform the splicing result. The embodiment of the present application does not limit the method used for linear transformation.

[0151] As an example, in the embodiment of the present application, when splicing the output results of multiple attention modules in the first multi-head attention layer of the i-th attention network layer, concact splicing can be used to obtain a splicing result. When the splicing result is then linearly transformed, the first output result can be obtained by multiplying the splicing result with a weight matrix. Among them, the weight matrix is ​​the output result of the i-1-th attention network layer. The first output result of the first multi-head attention layer of the i-th attention network layer satisfies the conditions shown in the following formula (11):

[0152]

[0153] Among them, W iO represents the weight matrix of the i-th attention network layer (i.e., the second output result of the i-1-th attention network layer), concat represents the concatenation function, MHA i (Q, K, V) represents the first output result of the i-th attention network layer, h represents the number of attention modules in the first multi-head attention layer in the i-th attention network layer, and h is a positive integer greater than 1; Represents the output of h attention modules in the i-th attention network layer.

[0154] By utilizing the multi-head attention mechanism, it is possible to capture the long-distance features between word segmentations in the text, extract rich contextual semantic representation information, and enhance the ability to extract features. Vectorizing the output results of multiple attention modules can be understood as introducing the original information when calculating the first output result, which can make up for the problem of missing information. In addition, vectorizing the output results of multiple attention modules is equivalent to introducing a network path, so that part of the network can be directly transmitted to the original information without passing through a complex network during back propagation, preventing gradient explosion or gradient disappearance.

[0155] In some embodiments, after obtaining the first output result, the first output result is normalized to obtain the second output result. The normalized mean and variance satisfy the conditions shown in the following formulas (12) and (13):

[0156]

[0157]

[0158] In the above formula, h represents the number of attention modules in the i-th attention network layer, represents the output of the g-th attention module in the i-th attention network layer, μ i represents the mean output of the attention module of the i-th layer, σ i represents the variance of the attention module output of the i-th layer.

[0159] Each layer normalizes the first output of the first multi-head attention layer of the i-th attention network layer by the same mean and variance to obtain the second output of the i-th attention network layer. For example, the second output of the i-th attention network layer can be expressed as M′=(m′ 1 ,m′ 2 ,m′ 3 ,…,m′ n ) represents, then m′ j The following formula (14) is satisfied:

[0160]

[0161] Among them, m′ j represents the jth vector in the second output of the i-th attention network layer, m′ j ∈R m , m represents m′ j The dimension, m j Represents the jth vector in the first output result of the first multi-head attention layer of the i-th attention network layer.

[0162] After the above normalization, the data distribution can be relatively consistent. During the network propagation process, deviations often occur, making reverse propagation difficult. Normalization is performed on each layer. After normalization, the input and output results of each layer conform to the normal distribution. The characteristic of normalization is that it does not depend on the number and length of the input sequence, which has an improvement effect on the effect of the neural network.

[0163] In some embodiments, after obtaining the second output result of the i-th attention network layer, the second output result of the i-th attention network layer can be used for the linear transformation of the i+1-th attention network layer. For example, after the fused word vectors of the multiple word segments included in the first sentence combination are input into the first attention network layer to obtain the second output result of the first attention network layer, the obtained second output result of the first layer can be used as the weight matrix of the linear transformation in the second attention network layer. For example, the second output result of the first layer can be expressed as M′ 1 , we can use M′ 1 As the weight matrix of the linear transformation in the second attention network layer Similarly, the second output result M′ of the i-th attention network layer can be i The weight matrix used in the linear transformation of the i+1th attention layer like Figure 6 The weight matrix satisfies the following conditions:

[0164]

[0165] in, Represents the weight matrix of the second attention network layer, M′ 1 Represents the second output result of the first attention network layer, MHA 2 (Q, K, V) represents the first output result of the second attention network layer, W i O represents the weight matrix of the i-th attention network layer, M′ i-1 Represents the second output result of the i-1th attention network layer, MHA i (Q, K, V) represents the first output result of the i-th attention network layer, represents the weight matrix of the i+1th attention network layer, M′ i shows the second output result of the i-th attention network layer, MHA i+1 (Q, K, V) represents the first output result of the i+1th attention network layer.

[0166] 503, performing feature extraction on the second output result of the Nth attention network layer through the first neural network layer to obtain a feature matrix of the first word of each sentence combination.

[0167] In some embodiments, after obtaining the second output result of the Nth attention network layer, the second output result of the Nth attention network layer can be linearly transformed or nonlinearly transformed by the first neural network to obtain the feature matrix of the first participle of each sentence combination. Linear transformation can include operations of matrix multiplication and bias addition, and nonlinear transformation can be implemented by nonlinear functions. For example, nonlinear transformation can be an operation of finding the maximum value. For example, it can be implemented by the max function. Among them, the max function is only an exemplary implementation method of nonlinear transformation, and other methods can also be used for nonlinear transformation, such as performing operations through activation functions to achieve nonlinear transformation. The embodiments of the present application do not specifically limit how to perform linear or nonlinear transformation. As an example, the first neural network in the embodiments of the present application can be implemented by a feedforward neural network. Specifically, a two-layer fully connected network can be used to extract features from the second output result of the Nth attention network layer, and the feature matrix of the first participle of each sentence combination satisfies the conditions shown in the following formula (15):

[0168] M d =Relu((M′W 1 +b 1 )W 2 +b 2 ); (15)

[0169] Among them, M′ represents the second output result of the Nth attention network layer, M d Represents the feature matrix of the first word, W 1 , W 2 represents the parameter matrix, W 1 , W 2 ∈R m×m , b 1 、b 2 Represents the bias term, and Relu represents the activation function.

[0170] 504, extracting feature information in the feature matrix of the first word segmentation through the first single-head attention layer to obtain a word-level feature vector of the first sentence combination.

[0171] In some embodiments, a trainable attention vector can be used to replace the Q query vector in the existing single-head attention layer to extract feature information in the feature matrix of the first word segmentation to obtain the word-level feature vector of the first sentence combination. The word-level feature vector satisfies the conditions shown in the following formulas (16)-(18):

[0172] a i =u w ·m di ; (16)

[0173]

[0174]

[0175] Among them, a i is the feature matrix after weighting by the attention mechanism, a′ i is the feature matrix after softmax normalization, u w is the initialized attention vector, m di is the i-th column vector in the feature matrix of the first word segmentation, u w ∈R m ,s j Represents the word-level feature vector, s j ∈R m , R m is an m×m matrix.

[0176] In some embodiments, feature concatenation may be performed on word-level feature vectors of multiple sentence combinations to obtain a sentence vector representation of each sentence combination. For example, when the first sentence combination includes n word-level feature vectors, the sentence vector of the first sentence may be represented as S=(s 1 ,s 2 ,s 3 ,…,s n ).

[0177] In some embodiments, the sentence vector of each sentence combination can be feature extracted by the second semantic vector encoder to obtain a sentence-level feature vector of each sentence combination. In some scenarios, before feature extraction is performed on the sentence vector, the position vectors corresponding to the multiple first sentence vectors included in the filtered first chapter can be encoded. The position vector corresponding to the first sentence vector is used to represent the position of the sentence corresponding to the first sentence vector in the text corresponding to the first chapter.

[0178] In some embodiments, after obtaining the position vector corresponding to the first sentence vector, the position vector of the first sentence vector is fused with the first sentence vector to obtain a fused sentence vector. The specific method can refer to the encoding method of the fused word vector mentioned above, which will not be repeated here. Further, the fused sentence vectors corresponding to the multiple sentences can be input into the second semantic vector encoder and feature extraction is performed to obtain the sentence-level feature vector of the first sentence combination, such as Figure 4B shown.

[0179] In some embodiments, the second semantic vector encoder includes N attention network layers, a second neural network layer, and a second single-head attention layer; each of the N attention network layers includes a second multi-head attention layer and a second additive normalization layer. According to the fused sentence vectors of the multiple sentences included in the first sentence combination, the second semantic vector encoder is used to extract features from the first sentence combination to obtain a sentence-level feature vector of the first sentence combination, including the following steps:

[0180] 601, the second multi-head attention layer in the i-th network attention layer includes multiple attention modules that respectively perform attention calculations on the fused sentence vectors of the multiple sentences included in the first sentence combination to obtain outputs of the multiple attention modules.

[0181] 602, the second additive normalization layer in the i-th network attention layer concatenates the output results of multiple attention modules in each layer to obtain a concatenated result; linearly transforms the concatenated result according to the output result of the i-1-th attention network layer to obtain a third output result of the second multi-head attention layer according to the i-1-th attention network layer; i is a positive integer less than or equal to N; normalizes the third output result of the second multi-head attention layer according to the i-th attention network layer to obtain a fourth output result.

[0182] In some embodiments, the fourth output result can be used for linear transformation of the i+1th attention network layer.

[0183] 603. Perform feature extraction on the fourth output result of the Nth attention network layer through the second neural network layer to obtain a feature matrix of the first sentence of each sentence combination.

[0184] 604, extracting feature information in the feature matrix of the first sentence through the second single-head attention layer to obtain a sentence-level feature vector of the first sentence combination.

[0185] The specific methods of the above steps 601-604 are the same as those of steps 501-504, and will not be repeated here.

[0186] In some embodiments, after obtaining the sentence-level feature vectors of the plurality of sentence combinations, feature concatenation may be performed on the sentence-level feature vectors of the plurality of sentence combinations to obtain a first feature vector corresponding to each chapter.

[0187] In some embodiments, after obtaining the first feature vector corresponding to each chapter, the predicted category of each chapter is determined according to the first feature vector. Therefore, multiple chapters can be stripped of information to determine the predicted categories as multiple chapters corresponding to the legal article category, the crime category, and the sentence category.

[0188] After determining the prediction category of each chapter, the second eigenvector, the first eigenvector of each chapter and the prediction category can be combined to perform sentence prediction, legal article prediction and crime prediction. Figure 7 As shown, the sentencing prediction device can obtain a law article prediction vector through nonlinear transformation based on the second eigenvector and multiple first eigenvectors corresponding to multiple chapters whose prediction category is the law article category, and perform law article prediction based on the law article prediction vector. A crime prediction vector is obtained through nonlinear transformation based on the second eigenvector, multiple first eigenvectors corresponding to multiple chapters whose prediction category is the crime category, and the crime prediction vector, and crime prediction is performed based on the crime prediction vector. A sentence prediction vector is obtained through nonlinear transformation based on the second eigenvector, multiple first eigenvectors corresponding to multiple chapters whose prediction category is the sentence category, the law article prediction vector, and the crime prediction vector, and sentence prediction is performed based on the sentence prediction vector.

[0189] In one example, the execution sentence prediction, legal provision prediction, and crime prediction can be implemented by a classifier, which may include a legal provision prediction network, a crime prediction network, and a sentence prediction network. Figure 8 As shown. The law prediction network, crime prediction network and sentence prediction network can use the forward propagation network. Figure 3 , Figure 4B For example, through Figure 4B The corresponding network encoding the crime fact description text obtains the predicted category corresponding to each chapter, and Figure 3 After the corresponding network obtains the second feature vector, it concatenates the second feature vector and the multiple first feature vectors corresponding to the multiple chapters whose prediction category is the legal article category (see formula (19)) to obtain the first concatenated vector, and inputs the first concatenated vector into the classifier (see formulas (20) and (21)) to perform legal article prediction. Generally, the legal articles promulgated by the law include multiple clauses, and different clauses can be set as a clause category. The calculation process of legal article prediction satisfies the conditions shown in the following formulas (19)-(21):

[0190]

[0191]

[0192]

[0193] in, is the first concatenation vector, T m is the second eigenvector, T 1 To predict the first eigenvector corresponding to multiple chapters of the legal category, is the law prediction vector, T l The probability distribution of each clause category in the legal clause prediction, T l ∈R x , x is the number of the first eigenvectors predicted by the law, W l 1 is the weight, is the bias term and Relu is the activation function.

[0194] In some embodiments, the input vector for crime prediction includes T m ,T 2 and the law prediction vector T l 1 . m ,T 2 ,T l 1 The second concatenation vector is obtained by concatenation (see formula (22)), and the second concatenation vector is input into the classifier (see formula (23) and formula (24)) to predict the crime. In general, there may be multiple crimes, and different crimes can be set as a crime category. The calculation process of crime prediction satisfies the conditions shown in the following formulas (22)-(24):

[0195]

[0196]

[0197]

[0198] in, represents the second concatenation vector, T m represents the second eigenvector, T l 1 Denotes the prediction vector, T 2 Represents the first eigenvector corresponding to multiple chapters whose predicted categories are crime categories, represents the crime prediction vector, T ch represents the probability distribution of each crime category in crime prediction, T ch ∈R y , y is the number of the first eigenvector of crime prediction, is the weight, is the bias term and Relu is the activation function.

[0199] In some embodiments, the input vector for sentence prediction includes T m ,T 3 ,T l 1 and the crime prediction vector T m ,T 2 ,T l 1 , The third concatenation vector is obtained by concatenation (see formula (25)), and the third concatenation vector is input into the classifier (see formula (26) and formula (27)) to predict the sentence. In general, the sentence may include a variety of terms, such as 5 years, 10 years, no sentence, death penalty, and life imprisonment. Different sentences can be set as a term category. The calculation process of sentence prediction meets the conditions shown in the following formulas (25)-(27):

[0200]

[0201]

[0202]

[0203] in, represents the second concatenation vector, T m represents the second eigenvector, T l 1 represents the law prediction vector, is the crime prediction vector, T 3 Represents the first eigenvector corresponding to multiple chapters whose predicted categories are prison terms, represents the sentence prediction vector, T p represents the probability distribution of each term category in the sentence prediction, T p ∈R z , z is the number of the first eigenvectors for sentence prediction, is the weight, is the bias term and Relu is the activation function.

[0204] In some embodiments, the sentencing prediction model can be trained by multiple samples in the training set. The samples include judgment documents and case-related information. Among them, the judgment documents include document information, defendant information, description of criminal facts and court judgment information. Among them, the document information is the summary and title in the criminal judgment document, and the court judgment information includes part of the fact finding information and label information. The fact finding includes conclusion information, amount information, circumstance information, consequence information, and confession attitude information. Three categories of labels are extracted: various clause categories in relevant laws, multiple crime categories included in the crime (for example, including not guilty), and sentences (for example, including no sentence, death penalty and life imprisonment). When training the sentencing prediction model, multiple samples can be input into the sentencing prediction model through multiple iterations, and one sample can be input each time. The various network parameters in the sentencing prediction model are adjusted by comparing the legal article prediction results for the sample output by the sentencing prediction model with the legal article prediction results in the sample label. The network parameters in the sentencing prediction model are adjusted by comparing the sentence prediction result of the sample output by the sentencing prediction model with the sentence label in the sample label. The network parameters in the sentencing prediction model are adjusted by comparing the crime prediction result of the sample output by the sentencing prediction model with the crime label in the sample label.

[0205] In a possible example, when adjusting the network parameters, the network parameters can be adjusted by determining the comparison result (i.e., the loss value) obtained by comparison through a loss function. The loss function may be, for example, a cross entropy loss function.

[0206] The loss of each prediction task can be obtained using the cross entropy loss function. The expression of the cross entropy loss function satisfies the conditions shown in the following formula (28):

[0207]

[0208] Among them, y indicates whether the data belongs to the current category. For example, the value of y can be 0 or 1, and l indicates the category, with a value of 1, 2, or 3. Represents the prediction result, which is the probability of belonging to the current category. To predict the loss value of the i-th sample as class l. The value is 1, 2 or 3 to identify the loss value of crime prediction, the loss value of legal article prediction or the loss value of sentence prediction. For example, 1 is used to identify crime prediction, 2 is used to identify legal article prediction, and 3 is used to identify sentence prediction.

[0209] In some embodiments, the loss values ​​determined by the loss function for crime prediction, the loss values ​​determined by the loss function for legal provisions prediction, and the loss values ​​determined by the loss function for sentence prediction can be accumulated to obtain a total loss value, and then the network parameters of the sentencing prediction model can be adjusted based on the total loss value. In some scenarios, the network parameters can be adjusted by an optimization algorithm, for example, the network parameters of the sentencing prediction model can be adjusted by the Adam optimization algorithm.

[0210] In some possible implementations, different networks in the sentencing prediction model are trained separately. Figure 4B The network for encoding the text describing the facts of the crime is trained separately. Each of the multiple samples in the training set of the network for encoding the text describing the facts of the crime may include a judgment document and a label corresponding to each sentence or paragraph in the judgment document, and the label is used to indicate that the label to which the sentence or paragraph belongs is a crime category, a sentence category, and a legal category. When training the network for encoding the text describing the facts of the crime, multiple samples may be input into the network for encoding the text describing the facts of the crime after multiple iterations, one sample may be input each time, and a comparison result is obtained by comparing the prediction result for the sample output by the network for encoding the text describing the facts of the crime with the category (crime category, sentence category, and legal category) in the sample label, and the various network parameters in the network for encoding the text describing the facts of the crime are adjusted according to the comparison result.

[0211] In a possible example, when adjusting the network parameters, the network parameters can be adjusted by determining the comparison result obtained by comparison through a loss function. The loss function can be, for example, a cross entropy loss function.

[0212] The loss of each prediction task can be obtained using the cross entropy loss function. The expression of the cross entropy loss function satisfies the conditions shown in the following formula (29):

[0213]

[0214] Among them, y indicates whether the data belongs to the current category (crime category, legal category or sentence category). For example, y can be 0 or 1, l indicates the category, and its value is 1, 2 or 3. Represents the prediction result, which is the probability of belonging to the current category. The loss of predicting the i-th sample as class l. The value is 1, 2 or 3 to identify the crime category, legal category or sentence category. For example, 1 is used to identify the crime category, 2 is used to identify the legal category, and 3 is used to identify the sentence category.

[0215] In some embodiments, during the training process, the data of the probability distribution of the predicted category can be represented by a set of numbers consisting of 1 and 0, which refers to the combination of multiple chapters and the predicted classification results. For example, each chapter can be associated with a sequence number. When the probability distribution data is [35273, label1], it means the 35273th chapter, and the predicted category label is the first category. If the predicted result is consistent with the result of manual annotation, it is recorded as 1, otherwise it is recorded as 0.

[0216] Based on the same technical concept, the present application embodiment provides a sentencing prediction device 800, see Fig. 9 As shown. The device 800 can execute each step in the above sentencing prediction method. In order to avoid repetition, it will not be described in detail here. The device 800 includes an acquisition unit 801 and a processing unit 802, including an acquisition unit and a processing unit;

[0217] The acquisition unit 801 is used to acquire case-related information and a text describing the crime facts, wherein the case-related information includes at least one of witnesses, physical evidence, defendant information, testimony, suspect confession, and transcripts; the text describing the crime facts includes multiple chapters, each of the multiple chapters includes multiple sentences, and each of the multiple sentences includes multiple participles;

[0218] The processing unit 802 is used to perform vectorization processing on the segmented words included in the multiple chapters to obtain a first word vector corresponding to each segmented word, and to perform vectorization processing on the segmented words included in the case-related information to obtain a second word vector corresponding to each segmented word; perform feature extraction on the first word vectors included in the multiple chapters to obtain a first feature vector of each chapter in the multiple chapters, and determine a predicted category of each chapter according to the first feature vector of each chapter, wherein the predicted category is a legal article category, a crime category, or a sentence category;

[0219] The processing unit 802 is further used to perform feature extraction on the second word vector included in the case-related information to obtain a second feature vector of the case-related information; and perform legal provision prediction, crime prediction and sentence prediction based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector.

[0220] In some embodiments, the processing unit 802, when performing feature extraction on the first word vectors included in the multiple chapters to obtain the first feature vector of each chapter in the multiple chapters, is specifically used to: filter the word segments in the first chapter based on the first word vector included in the first chapter to obtain a filtered first chapter, the first word vectors of the multiple sentences included in the filtered first chapter are all related to sentencing prediction, and the first chapter is any chapter in the multiple chapters; combine the multiple sentences included in the filtered first chapter to obtain a plurality of sentence combinations, each of the plurality of sentence combinations includes at least two sentences;

[0221] Performing feature extraction on each sentence combination through the first semantic vector encoder to obtain a word-level feature vector of each sentence combination; performing feature concatenation on the word-level feature vectors of multiple sentence combinations to obtain a sentence vector representation of each sentence combination;

[0222] The sentence vector of each sentence combination is subjected to feature extraction by the second semantic vector encoder to obtain a sentence-level feature vector of each sentence combination; and the sentence-level feature vectors of multiple sentence combinations are subjected to feature concatenation to obtain the first feature vector.

[0223] In some embodiments, the processing unit 802 is further used to: encode the position vectors corresponding to the multiple first word vectors included in the filtered first chapter, where the position vector corresponding to the first word vector is used to represent the position of the word segment corresponding to the first word vector in the text corresponding to the first chapter; fuse the first word vectors of the multiple word segments included in the filtered first chapter with the corresponding position vector to obtain the fused word vectors of the multiple word segments in the first chapter;

[0224] The processing unit 802, when performing feature extraction on each sentence combination through the first semantic vector encoder to obtain a word-level feature vector for each sentence combination, is specifically used to: perform feature extraction on the first sentence combination using the first semantic vector encoder according to a fused word vector of multiple word segments included in the first sentence combination to obtain a word-level feature vector for the first sentence combination, wherein the first sentence combination is any one of the multiple sentence combinations.

[0225] In some other embodiments, the processing unit 802 is further used to: encode the position vectors corresponding to the multiple first sentence vectors included in the filtered first chapter, the position vectors corresponding to the first sentence vectors are used to represent the position of the sentence corresponding to the first sentence vector in the text corresponding to the first chapter; fuse the multiple first sentence vectors included in the filtered first chapter with the corresponding position vectors to obtain the fused sentence vectors of the multiple sentences in the first chapter;

[0226] The processing unit 802, when performing feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain the sentence-level feature vector of each sentence combination, is specifically used to: perform feature extraction on the first sentence combination using the second semantic vector encoder according to the fused sentence vector of multiple sentences included in the first sentence combination to obtain the sentence-level feature vector of the first sentence combination, where the first sentence combination is any one of the multiple sentence combinations.

[0227] In some embodiments, the first semantic vector encoder includes N attention network layers, a first neural network layer, and a first single-head attention layer; each of the N attention network layers includes a first multi-head attention layer and a first additive normalization layer; N is a positive integer;

[0228] The processing unit 802, when using the first semantic vector encoder to extract features from the first sentence combination based on the fused word vector of multiple word segments included in the first sentence combination to obtain the word-level feature vector of the first sentence combination, is specifically used for: the multiple attention modules included in the first multi-head attention layer in the i-th attention network layer respectively perform attention operations on the fused word vectors of multiple word segments included in the first sentence combination to obtain the outputs of the multiple attention modules; the first additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain the splicing result; the output results of the i-1-th attention network layer are processed according to the output results of the i-1-th attention network layer. The concatenated result is linearly transformed to obtain the first output result of the first multi-head attention layer of the i-th attention network layer; i is a positive integer less than or equal to N; the first output result of the first multi-head attention layer of the i-th attention network layer is normalized to obtain a second output result, and the second output result is used for the linear transformation of the i+1-th attention network layer; the second output result of the N-th attention network layer is feature extracted by the first neural network layer to obtain the feature matrix of the first participle of each sentence combination; the feature information in the feature matrix of the first participle is extracted by the first single-head attention layer to obtain the word-level feature vector of the first sentence combination.

[0229] In some other embodiments, the second semantic vector encoder includes N attention network layers, a second neural network layer, and a second single-head attention layer; each of the N attention network layers includes a second multi-head attention layer and a second additive normalization layer; N is a positive integer;

[0230] The processing unit 802, when using the second semantic vector encoder to extract features from the first sentence combination according to the fused sentence vector of the multiple sentences included in the first sentence combination to obtain the sentence-level feature vector of the first sentence combination, is specifically used for: the multiple attention modules included in the second multi-head attention layer in the i-th attention network layer respectively perform attention calculations on the fused sentence vectors of the multiple sentences included in the first sentence combination to obtain the outputs of the multiple attention modules; the second additive normalization layer in the i-th attention network layer splices the output results of the multiple attention modules to obtain a splicing result; the output results of the i-1-th attention network layer are calculated according to the output results of the i-1-th attention network layer. The concatenated result is linearly transformed to obtain the third output result of the second multi-head attention layer of the i-th attention network layer; i is a positive integer less than or equal to N; the third output result of the second multi-head attention layer of the i-th attention network layer is normalized to obtain a fourth output result, and the fourth output result is used for the linear transformation of the i+1-th attention network layer; the fourth output result of the N-th attention network layer is feature extracted through the second neural network layer to obtain the feature matrix of the first sentence of each sentence combination; the feature information in the feature matrix of the first sentence is extracted through the second single-head attention layer to obtain the sentence-level feature vector of the first sentence combination.

[0231] In some embodiments, when performing law article prediction, crime prediction and sentence prediction based on the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector, the processing unit 802 is specifically used to: perform nonlinear transformation on the second feature vector and the first feature vector with a prediction category of the law article category among the multiple first feature vectors corresponding to the multiple chapters to obtain a law article prediction vector, and perform law article prediction based on the law article prediction vector; perform nonlinear transformation on the second feature vector, the first feature vector with a prediction category of the crime category among the multiple first feature vectors corresponding to the multiple chapters, and the law article prediction vector to obtain a crime prediction vector, and perform crime prediction based on the crime prediction vector; perform nonlinear transformation on the second feature vector, the first feature vector with a prediction category of the sentence category among the multiple first feature vectors corresponding to the multiple chapters, the law article prediction vector, and the crime prediction vector to obtain a sentence prediction vector, and perform sentence prediction based on the sentence prediction vector.

[0232] In some other embodiments, the case-related information includes first data and second data; wherein the first data includes at least one of testimony, confession of the suspect and transcript, and the second data includes at least one of witness testimony, physical evidence and defendant information; the processing unit 802, when vectorizing the word segmentations included in the case-related information to obtain the second word vector corresponding to each word segmentation, is specifically used to: vectorize the word segmentations included in the first data to obtain the second word vector corresponding to each word segmentation in the first data; determine the category to which each word segmentation included in the second data belongs, and determine the category vector corresponding to the category to which each word segmentation included in the second data belongs from the data vector table; the data vector table includes category vectors corresponding to multiple categories; determine the second word vector corresponding to each word segmentation using the category vector corresponding to the category to which each word segmentation included in the second data belongs.

[0233] In some embodiments, the processing unit 802, when filtering the word segments in the first chapter based on the first word vector included in the first chapter to obtain the filtered first chapter, is specifically used to: filter the multiple first word vectors included in the first chapter through a convolutional neural network to obtain the filtered first chapter.

[0234] Based on the same technical concept, the present application embodiment provides a sentencing prediction device 1000, see Fig.10 The device 1000 can execute each step in the above sentencing prediction method, which will not be described in detail here to avoid repetition. The device 1000 includes a memory 1001 and a processor 1002.

[0235] The memory 1001 is used to store program instructions;

[0236] The processor 1002 is used to call the program instructions stored in the memory and execute the above-mentioned sentencing prediction method according to the obtained program.

[0237] An embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any possible implementation method included in the first aspect.

[0238] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0239] The present application is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0240] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0241] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0242] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A sentencing prediction method, characterized in that: include: Obtaining case-related information and a text describing the crime facts, wherein the case-related information includes at least one of witnesses, physical evidence, defendant information, testimony, suspect confessions, and transcripts; the text describing the crime facts includes multiple chapters, each of the multiple chapters includes multiple sentences, and each of the multiple sentences includes multiple participles; Performing vectorization processing on the segmented words included in the multiple chapters to obtain a first word vector corresponding to each segmented word, and performing vectorization processing on the segmented words included in the case-related information to obtain a second word vector corresponding to each segmented word; Performing feature extraction on the first word vectors included in the multiple chapters to obtain a first feature vector of each chapter in the multiple chapters, and determining a predicted category of each chapter according to the first feature vector of each chapter, wherein the predicted category is a legal article category, a crime category, or a sentence category; The first word vectors included in the multiple chapters are subjected to feature extraction to obtain the first feature vector of each chapter in the multiple chapters, including: Based on the first word vector included in the first chapter, the word segmentation in the first chapter is filtered to obtain a filtered first chapter, wherein the first word vectors in multiple sentences included in the filtered first chapter are all related to sentencing prediction, and the first chapter is any one of the multiple chapters; Combining the plurality of sentences included in the filtered first chapter to obtain a plurality of sentence combinations, each of the plurality of sentence combinations including at least two sentences; Performing feature extraction on each sentence combination through a first semantic vector encoder to obtain a word-level feature vector for each sentence combination; Perform feature concatenation on the word-level feature vectors of multiple clause combinations to obtain a sentence vector representation of each clause combination; Performing feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain a sentence-level feature vector of each sentence combination; Performing feature concatenation on the sentence-level feature vectors of the plurality of sentence combinations to obtain the first feature vector; Performing feature extraction on a second word vector included in the case-related information to obtain a second feature vector of the case-related information; Perform legal article prediction, crime prediction and sentence prediction according to the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector; The step of predicting legal provisions, crimes and sentences according to the prediction categories of the first feature vectors corresponding to the multiple chapters and the second feature vectors includes: Performing nonlinear transformation on the second feature vector and the first feature vector whose prediction category is a legal article category among the plurality of first feature vectors corresponding to the plurality of chapters to obtain a legal article prediction vector, and performing legal article prediction according to the legal article prediction vector; Performing nonlinear transformation on the second feature vector, the first feature vector with a predicted category of crime among the multiple first feature vectors corresponding to the multiple chapters, and the legal provision prediction vector to obtain a crime prediction vector, and performing crime prediction based on the crime prediction vector; A nonlinear transformation is performed on the second eigenvector, the first eigenvector with a predicted category of sentence category among the multiple first eigenvectors corresponding to the multiple chapters, the legal article prediction vector and the crime prediction vector to obtain a sentence prediction vector, and sentence prediction is performed based on the sentence prediction vector.

2. The method according to claim 1, characterized in that The method further comprises: Encoding position vectors corresponding to a plurality of first word vectors included in the filtered first chapter, wherein the position vectors corresponding to the first word vectors are used to represent positions of the word segments corresponding to the first word vectors in the text corresponding to the first chapter; The first word vectors of the multiple word segments included in the filtered first chapter are fused with the corresponding position vectors to obtain the fused word vectors of the multiple word segments in the first chapter; The extracting features of each sentence combination by the first semantic vector encoder to obtain a word-level feature vector of each sentence combination includes: A first semantic vector encoder is used to perform feature extraction on the first sentence combination according to the fused word vector of multiple word segments included in the first sentence combination to obtain a word-level feature vector of the first sentence combination, and the first sentence combination is any one of the multiple sentence combinations.

3. The method according to claim 1, characterized in that The method further comprises: Encoding position vectors corresponding to a plurality of first sentence vectors included in the filtered first chapter, wherein the position vectors corresponding to the first sentence vectors are used to represent positions of clauses corresponding to the first sentence vectors in the text corresponding to the first chapter; Fusing the plurality of first sentence vectors included in the filtered first chapter with the corresponding position vectors to obtain fused sentence vectors of the plurality of sentences in the first chapter; The feature extraction of the sentence vector of each sentence combination by the second semantic vector encoder to obtain the sentence-level feature vector of each sentence combination includes: A second semantic vector encoder is used to perform feature extraction on the first sentence combination according to a fused sentence vector of multiple sentences included in the first sentence combination to obtain a sentence-level feature vector of the first sentence combination, where the first sentence combination is any one of the multiple sentence combinations.

4. The method according to any one of claims 1 to 3, characterized in that: The case-related information includes first data and second data; wherein the first data includes at least one of testimony, confession of the suspect and transcript, and the second data includes at least one of witness testimony, physical evidence and defendant information; vectorizing the word segmentation included in the case-related information to obtain a second word vector corresponding to each word segmentation includes: Performing vectorization processing on the word segments included in the first data to obtain a second word vector corresponding to each word segment in the first data; Determine the category to which each word segment included in the second data belongs, and determine the category vector corresponding to the category to which each word segment included in the second data belongs from a data vector table; the data vector table includes category vectors corresponding to multiple categories; determine the second word vector corresponding to each word segment by using the category vector corresponding to the category to which each word segment included in the second data belongs.

5. The method according to any one of claims 1 to 3, characterized in that: The filtering process of the word segmentations in the first chapter based on the first word vector included in the first chapter to obtain the filtered first chapter includes: The plurality of first word vectors included in the first chapter are filtered by a convolutional neural network to obtain the filtered first chapter.

6. A sentencing prediction device, characterized in that: including an acquisition unit and a processing unit; The acquisition unit is used to acquire case-related information and a text describing the crime facts, wherein the case-related information includes at least one of witnesses, physical evidence, defendant information, testimony, suspect confession, and transcripts; the text describing the crime facts includes multiple chapters, each of the multiple chapters includes multiple sentences, and each of the multiple sentences includes multiple participles; The processing unit is used to perform vectorization processing on the segmented words included in the multiple chapters to obtain a first word vector corresponding to each segmented word, and to perform vectorization processing on the segmented words included in the case-related information to obtain a second word vector corresponding to each segmented word; perform feature extraction on the first word vectors included in the multiple chapters to obtain a first feature vector of each chapter in the multiple chapters, and determine a predicted category of each chapter according to the first feature vector of each chapter, wherein the predicted category is a legal article category, a crime category, or a sentence category; Wherein, when the processing unit performs feature extraction on the first word vectors included in the multiple chapters to obtain the first feature vector of each chapter in the multiple chapters, it is specifically used to: Based on the first word vector included in the first chapter, the word segmentation in the first chapter is filtered to obtain a filtered first chapter, wherein the first word vectors in multiple sentences included in the filtered first chapter are all related to sentencing prediction, and the first chapter is any one of the multiple chapters; Combining the plurality of sentences included in the filtered first chapter to obtain a plurality of sentence combinations, each of the plurality of sentence combinations including at least two sentences; Performing feature extraction on each sentence combination through a first semantic vector encoder to obtain a word-level feature vector for each sentence combination; Perform feature concatenation on the word-level feature vectors of multiple clause combinations to obtain a sentence vector representation of each clause combination; Performing feature extraction on the sentence vector of each sentence combination through the second semantic vector encoder to obtain a sentence-level feature vector of each sentence combination; Performing feature concatenation on the sentence-level feature vectors of the plurality of sentence combinations to obtain the first feature vector; The processing unit is further used to extract features from the second word vector included in the case-related information to obtain a second feature vector of the case-related information; and perform legal article prediction, crime prediction, and sentence prediction according to the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector; The processing unit, when performing legal article prediction, crime prediction and sentence prediction according to the prediction categories of the multiple first feature vectors corresponding to the multiple chapters and the second feature vector, is specifically used to: Performing nonlinear transformation on the second feature vector and the first feature vector whose prediction category is a legal article category among the plurality of first feature vectors corresponding to the plurality of chapters to obtain a legal article prediction vector, and performing legal article prediction according to the legal article prediction vector; Performing nonlinear transformation on the second feature vector, the first feature vector with a predicted category of crime among the multiple first feature vectors corresponding to the multiple chapters, and the legal provision prediction vector to obtain a crime prediction vector, and performing crime prediction based on the crime prediction vector; A nonlinear transformation is performed on the second eigenvector, the first eigenvector with a predicted category of sentence category among the multiple first eigenvectors corresponding to the multiple chapters, the legal article prediction vector and the crime prediction vector to obtain a sentence prediction vector, and sentence prediction is performed based on the sentence prediction vector.

7. A sentencing prediction device, characterized in that: including memory and processor; The memory is used to store program instructions; The processor is used to call the program instructions stored in the memory and execute the method according to any one of claims 1 to 5 according to the obtained program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 5.