CN110276068B - Legal case analysis method and device - Google Patents
Legal case analysis method and device Download PDFInfo
- Publication number
- CN110276068B CN110276068B CN201910379141.1A CN201910379141A CN110276068B CN 110276068 B CN110276068 B CN 110276068B CN 201910379141 A CN201910379141 A CN 201910379141A CN 110276068 B CN110276068 B CN 110276068B
- Authority
- CN
- China
- Prior art keywords
- task
- case
- word
- prediction
- vector
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000004458 analytical method Methods 0.000 title claims abstract description 135
- 239000013598 vector Substances 0.000 claims abstract description 309
- 238000013528 artificial neural network Methods 0.000 claims abstract description 95
- 230000000306 recurrent effect Effects 0.000 claims abstract description 61
- 238000000034 method Methods 0.000 claims abstract description 25
- 230000011218 segmentation Effects 0.000 claims abstract description 21
- 238000011176 pooling Methods 0.000 claims abstract description 13
- 239000011159 matrix material Substances 0.000 claims description 33
- 238000012549 training Methods 0.000 claims description 23
- 230000015654 memory Effects 0.000 claims description 19
- 125000004122 cyclic group Chemical group 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 10
- 230000007787 long-term memory Effects 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 10
- 238000003860 storage Methods 0.000 claims description 8
- 208000014674 injury Diseases 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims description 7
- 208000027418 Wounds and injury Diseases 0.000 claims description 6
- 230000006378 damage Effects 0.000 claims description 6
- 238000004519 manufacturing process Methods 0.000 claims description 5
- 210000000056 organ Anatomy 0.000 claims description 5
- 238000012216 screening Methods 0.000 claims description 3
- 238000011161 development Methods 0.000 description 5
- 230000018109 developmental process Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000006403 short-term memory Effects 0.000 description 5
- 230000000740 bleeding effect Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 238000003066 decision tree Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000008034 disappearance Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000004880 explosion Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/211—Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
- G06F40/295—Named entity recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/10—Services
- G06Q50/18—Legal services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Business, Economics & Management (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Biophysics (AREA)
- Evolutionary Computation (AREA)
- Tourism & Hospitality (AREA)
- Computing Systems (AREA)
- Technology Law (AREA)
- Economics (AREA)
- Human Resources & Organizations (AREA)
- Marketing (AREA)
- Primary Health Care (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Machine Translation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a legal case situation analysis method and device. The method comprises the following steps: carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence; acquiring a plurality of word vectors according to words contained in the sentence sequence, encoding each word vector by using a first recurrent neural network, and acquiring task text vectors corresponding to each analysis task; and performing maximum pooling on task text vectors corresponding to all the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and a task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result. The legal case analysis method and the legal case analysis device provided by the embodiment of the invention can improve the analysis accuracy.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a legal case situation analysis method and device.
Background
With the rapid development of artificial intelligence technology, the development of judicial fields assisted by artificial intelligence is a trend inevitable for the times. In recent years, there have been many interdisciplinary studies of artificial intelligence and law. In the last century, many scholars perform case analysis on legal cases by using a mathematical statistics algorithm and a keyword matching algorithm. With the development of machine learning technology, more scholars begin to further automatically analyze cases through a method of manually extracting text features. With the rapid development of deep learning technology, many scholars concentrate on extracting information contained in texts by using a neural network to further improve the quality of case analysis. However, the methods generally cannot solve the problems that the distribution of the number of cases in an actual scene is extremely unbalanced, and the similar criminal names are extremely easy to confuse. In an actual scene, there are many crimes and law rules with low frequency, and the traditional deep learning model cannot accurately give the analysis results of the cases. In other words, the traditional deep learning method can only analyze the case facts of the most frequently appearing partial crime names/cases, and the prior art cannot well distinguish the cases with similar crime names, so that the method has no good practicability.
In summary, the existing technology can only analyze case facts of high-frequency partial crime names and cannot distinguish cases with similar crime names, so that the existing technology has low analysis accuracy and coverage rate on cases.
Disclosure of Invention
The embodiment of the invention provides a legal case analysis method and a legal case analysis device, which are used for solving or at least partially solving the defect of low accuracy of the conventional legal case analysis method.
In a first aspect, an embodiment of the present invention provides a legal case analysis method, including:
carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity;
acquiring a plurality of word vectors according to each word contained in the sentence sequence, the event sequence and the named entity, encoding each word vector by using a first recurrent neural network, and acquiring a task text vector corresponding to each analysis task according to an encoding result, a task hidden vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task;
performing maximum pooling on task text vectors corresponding to the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and the task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed;
the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case prediction model are obtained after training based on a sample legal document.
Preferably, the analysis task further comprises: a related law prediction task and a duration prediction task;
correspondingly, obtaining the overall task text vector of the element judgment task comprises:
encoding the whole task text vector of the element judgment task, the task text vector corresponding to the case prediction task, the task text vector corresponding to the related law bar prediction task and the task text vector corresponding to the duration prediction task by using a second recurrent neural network to obtain first hidden vectors respectively corresponding to the case prediction task, the related law bar prediction task and the duration prediction task;
respectively inputting a first implicit vector corresponding to the case prediction task, a first implicit vector corresponding to the related law prediction task and a first implicit vector corresponding to the duration prediction task into the case prediction model, the related law prediction model and the duration prediction model, and obtaining a case prediction result, a related law prediction result and a duration prediction result of a case description text to be analyzed;
the relevant law enforcement prediction model and the duration prediction model are obtained after training based on the sample legal documents.
Preferably, after the task text vector corresponding to each analysis task is obtained according to the encoding result, the task hidden vector and the correlation matrix, the method further includes:
respectively inputting a task text vector corresponding to each element judgment task into an element judgment model corresponding to the element judgment task to obtain a result of the element judgment task;
and the element judgment model corresponding to each element judgment task is obtained after training based on the sample legal document.
Preferably, the specific steps of performing word segmentation and named entity recognition on the case description text to be analyzed and acquiring a sentence sequence, an event sequence and a named entity include:
performing word segmentation and part-of-speech tagging on the case description text to be analyzed, deleting stop words, and obtaining a plurality of sentences; each sentence comprises a plurality of words and parts of speech corresponding to each word;
screening the sentences according to a pre-constructed trigger word list, reserving sentences describing important facts related to the case, and forming a sentence sequence;
and acquiring a plurality of events and named entities described by the case description text to be analyzed according to preset rules, syntactic dependency relations, words contained in each sentence in the sentence sequence and parts of speech corresponding to the words, and forming the event sequence by the events according to the sequence of the occurrence time of the events.
Preferably, the specific step of obtaining a plurality of word vectors according to each word contained in the sentence sequence, the event sequence and the named entity includes:
splicing all words contained in the sentence sequence according to the sequence of the occurrence time of all events in the event sequence to obtain a word sequence;
mapping the word sequence according to a word vector table obtained by pre-training to obtain an original word vector of each word contained in the sentence sequence;
and for each word contained in the sentence sequence, expanding the original word vector of the word according to the event described by the sentence in which the word is located and whether the word is the named entity, acquiring the word vector corresponding to the word, and acquiring the word vectors.
Preferably, the specific step of obtaining the task text vector corresponding to each analysis task according to the coding result, the task hidden vector and the correlation matrix includes:
and for each analysis task, acquiring the weight corresponding to the coding result according to the coding result, the task hidden vector corresponding to the analysis task and the correlation matrix, and performing weighted summation on the coding result according to the weight corresponding to the coding result to acquire the task text vector corresponding to the analysis task.
Preferably, the first recurrent neural network is a long-term memory neural network; the second cyclic neural network is a long-term memory neural network.
In a second aspect, an embodiment of the present invention provides a legal case situation analyzing apparatus, including:
the data processing module is used for performing word segmentation and named entity recognition on the case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity;
the fact coding module is used for obtaining a plurality of word vectors according to the words contained in the sentence sequence, the event sequence and the named entity, coding each word vector by utilizing a first cyclic neural network, and obtaining task text vectors corresponding to analysis tasks according to a coding result, task hidden vectors and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task;
the task sequence prediction module is used for performing maximum pooling on task text vectors corresponding to the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and the task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed;
the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case prediction model are obtained after training based on a sample legal document.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed, the method implements the steps of the legal case analysis method provided in any one of the various possible implementations of the first aspect.
In a fourth aspect, embodiments of the present invention provide a non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the legal case analysis method as provided by any one of the various possible implementations of the first aspect.
The legal case analysis method and the device provided by the embodiment of the invention analyze the legal cases based on the dependency relationship between legal elements and cases, can distinguish cases with similar criminal names according to the elements, can be suitable for analyzing the case facts of all cases, and is not limited to the case facts of common partial cases, thereby greatly improving the accuracy of case analysis and having higher case coverage rate.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a legal case analysis method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a legal case analysis device according to an embodiment of the present invention;
fig. 3 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to overcome the above problems in the prior art, embodiments of the present invention provide a legal case situation analysis method and apparatus, and the inventive concept is to analyze a plurality of legal elements related to a case judgment through a trained model, and obtain a more accurate case prediction result according to an analysis result of the legal elements and a machine learning model.
Fig. 1 is a schematic flow chart of a legal case analysis method according to an embodiment of the present invention. As shown in fig. 1, the method comprises: step S101, performing word segmentation and named entity recognition on a case description text to be analyzed, and acquiring a sentence sequence, an event sequence and a named entity.
In particular, the case description text to be analyzed describes a piece of case facts.
Each sentence in the sentence sequence is a word sequence. The word sequence is obtained by segmenting a sentence (meaning a sentence separated by a comma, a semicolon or a period) in the case description text to be analyzed.
For the Chinese text, any existing Chinese word segmentation packet can be used for word segmentation, for example, the existing open source Chinese word segmentation packet is hierarchical.
For each sentence in the sentence sequence, if the sentence contains a specific word, the events contained in the sentence can be obtained, so that all the events contained in the sentence sequence can be obtained.
For example, if a sentence in the sentence sequence contains a word "blow," the sentence contains an attack event.
The named entities at least comprise names of persons, places, units and the like. The name of a person, the name of a place, the name of a unit and the like have obvious text characteristics, so that each named entity in the words contained in the sentence sequence can be extracted.
Step S102, obtaining a plurality of word vectors according to each word, event sequence and named entity contained in the sentence sequence, coding each word vector by utilizing a first cyclic neural network, and obtaining a task text vector corresponding to each analysis task according to a coding result, a task implicit vector and a correlation matrix.
The analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task.
Specifically, after the deep learning model reads the serialized words in the form of a word vector sequence, and obtains a sentence sequence, an event sequence and a named entity, for each word contained in the sentence sequence, a word vector sequence can be obtained by using any relevant model for generating a word vector and combining the event sequence and the named entity. The word vector sequence comprises a plurality of word vectors, and each word vector corresponds to a word contained in the sentence sequence.
The correlation model for generating the Word vector may be any one of Word2vec, GloVe, FastText, and the like, which is not particularly limited in this embodiment of the present invention.
After the word vector sequence is obtained, each word vector in the word vector sequence can be encoded by using a first recurrent neural network, semantic information related before and after a sentence is captured, and the encoding result is a second implicit vector sequence or a second implicit vector matrix. The length of the second hidden vector sequence is the same as that of the word vector sequence, namely the number of the second hidden vectors in the second hidden vector sequence is the number of words contained in the sentence sequence.
Any word vector is input into the first recurrent neural network, and the first recurrent neural network outputs a new vector which is called a second implicit vector.
In order to obtain the text vectors related to the analysis tasks, an attention mechanism is adopted to map the second hidden vector sequence to different task text spaces, and task text vectors corresponding to different analysis tasks are obtained.
The analysis task at least comprises a factor judgment task and a case prediction task. The elements are a plurality of legal elements related to the judgment case, so that the number of the element judgment tasks is a plurality, and the elements are respectively used for judging and predicting the values of different legal elements. The number of elements is predetermined, and accordingly the number of elements predicts the task.
For example, for criminal cases, elements may include 10 elements such as profit, business, death, violence, state organs or state workers, public places, illegal occupations, injuries, subjective intent, and during production operations.
The above 10 elements have the following meanings: profit, which means whether the defended person (or the criminal suspect) is paid; buying and selling, which means whether the act of being reported (or criminal suspects) involves buying and selling; death, meaning whether the victim dies; violence, which refers to whether the defendant (or criminal suspect) has committed a violent crime; the state organ or state staff means whether the state organ or state staff is involved in the case; the public place refers to whether a case occurs in the public place; illegal occupation, which means whether the defendant (or criminal suspect) aims at illegal occupation; injury, whether the victim is injured; subjective intentionally, meaning whether the defendant (or criminal suspect) is subjectively intentionally criminal; during a production operation, it refers to whether a case occurs during the production operation.
For different types of administrative cases (such as public security cases, traffic violation cases, industrial and commercial administrative cases and the like), corresponding elements can be adopted to judge case reasons.
It is understood that each element judgment task has a corresponding task text vector.
In order to realize the attention mechanism, a task hidden vector is defined for each analysis task, so that the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task. The task vector serves as a query vector (query).
And the correlation matrix is used for expressing the degree of correlation between the encoding result and each task hidden vector.
And the case law prediction task is used for predicting case laws.
Step S103, performing maximum pooling on the task text vectors corresponding to the element judgment tasks to obtain an overall task text vector of the element judgment tasks, encoding the overall task text vector of the element judgment tasks and the task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task into a case prediction model, and obtaining a case prediction result of a case description text to be analyzed.
Since the number of the task text vectors corresponding to the element judgment tasks is plural, in order to facilitate case prediction, the task text vector corresponding to each element judgment task is defined as a result of maximally pooling the task text vectors corresponding to each element judgment task.
tattr=max_pooling([t1,t2,...,tk])
tattr,i=max(t1,i,t2,i,...,tk,i)
Wherein, tattrThe integral task text vector of the representation element judgment task; t is t1,t2,...,tkRespectively representing task text vectors corresponding to all element judgment tasks; k is a positive integer and represents the number of element judgment tasks; t is tattr,iRepresents tattrThe ith element value of (a); i is more than or equal to 1 and less than or equal to d1,d1A dimension representing a task text vector; t is t1,i,t2,i,...,tk,iAnd respectively representing the ith element value of the task text vector corresponding to each element judgment task.
Capturing the dependency relationship between analysis tasks by using a second recurrent neural network, wherein when the analysis tasks comprise a factor judgment task and a case prediction task, the whole task text vector of the factor judgment task is tattrThe task text vector corresponding to the prediction task is taccuWill tattrAnd taccuForming a task sequence according to the sequence of the element judgment task and the case prediction task, and obtaining a first implicit vector corresponding to the element judgment task through a second recurrent neural networkA first hidden vector corresponding to the pattern prediction taskIs calculated by the formula
Where RNN represents an operation performed by the second recurrent neural network.
Obtaining a first implicit vector corresponding to the case prediction taskThen, willInputting the first implicit vector to the case prediction modelMapping to a label corresponding to a case-by-case prediction taskSpatially, a pattern prediction result is obtained.
For example, for criminal cases, the labels corresponding to the case prediction tasks may include stealing crime, robbery, intentional injury crime, greedy crime, and the like; for traffic violation cases, the labels corresponding to the prediction tasks of the case can include speeding, passing according to traffic signal light regulations, violating traffic prohibition signs, intentionally blocking stained motor vehicle license plates and the like.
The case prediction model can be any kind of trained classifier, such as a support vector machine, an artificial neural network, a decision tree and the like.
For example, using a trained fully-connected neural network as the case prediction model forOutput of the pattern prediction modelWherein, YaccuIf the case is predicted by the prediction model, and the case is predicted by the prediction modelaccuIs composed of
Wherein softmax represents an operation performed by the prediction model; waccuAnd baccuAll represent parameters of the pattern prediction model.
It can be understood that the case is predicted by the prediction. y isaccuIs a vector of yaccuThe value of each dimension represents the probability of the corresponding label. That is, yaccuEach element value of (a) represents the probability of the corresponding case label.
The first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case are obtained by a prediction model after training based on a sample legal document.
It can be understood that training can be performed based on the sample legal documents, parameters are adjusted, and a first recurrent neural network, hidden vectors of each task, a correlation matrix, a second recurrent neural network and a case prediction model are obtained.
A sample legal instrument refers to a legal instrument that determines the final legal outcome. For example, for criminal cases, it may be a court's decision document; for an administrative case, an administrative penalty decision issued by an administrative authority may be made.
The embodiment of the invention analyzes the legal cases based on the dependency relationship between legal elements and cases, can distinguish cases with similar criminal names according to the elements, and can be suitable for analyzing the case facts of all cases, but not limited to the case facts of common partial cases, thereby greatly improving the accuracy of case analysis and having higher case coverage rate.
Based on the content of the foregoing embodiments, the analysis task further includes: a correlation law prediction task and a duration prediction task.
Specifically, in order to further improve the comprehensiveness of case analysis, the relevant law rules and the time duration may be analyzed, and thus the analysis task further includes a relevant law rule prediction task and a time duration prediction task.
And the related law forecast task is used for forecasting related laws.
And the duration prediction task is used for predicting the duration of the penalty. For example, for criminal cases, the duration of the penalty is the period of criminal; for different administrative cases, the penalty duration can be the duration of administrative arrest, the duration of stopping working for a whole period, the duration of temporarily holding the driver's license and the like.
Correspondingly, obtaining the overall task text vector of the element judgment task comprises the following steps: and encoding the whole task text vector of the element judgment task, the task text vector corresponding to the case prediction task, the task text vector corresponding to the related law prediction task and the task text vector corresponding to the duration prediction task by using a second recurrent neural network to obtain first implicit vectors respectively corresponding to the case prediction task, the related law prediction task and the duration prediction task.
Specifically, when the analysis task includes a factor judgment task, a case prediction task, a related law prediction task and a duration prediction task, the factor is to be analyzedJudging integral task text vector t of taskattrTask text vector t corresponding to plan-to-plan prediction taskaccuTask text vector t corresponding to related law prediction tasklawTask text vector t corresponding to duration prediction tasktimeAccording to the sequence of element judgment tasks, case prediction tasks, related law prediction tasks and duration prediction tasks, a task sequence is formed, the dependency relationship among all analysis tasks is captured by using a second recurrent neural network, the task sequence is coded, and a first hidden vector corresponding to the element judgment tasks is obtainedFirst implicit vector corresponding to case-based prediction taskFirst hidden vector corresponding to related normal prediction taskFirst hidden vector corresponding to duration prediction task
For example, when the long-short time memory neural network is adopted as the second recurrent neural network, the calculation formula of the first implicit vector corresponding to each analysis task is as follows
Wherein, the LSTM represents an operation performed by the long-term and short-term memory neural network.
The case prediction task judges the task depending on each element; predicting tasks by related laws, judging tasks and case prediction tasks by depending on all elements; and the duration prediction task is a task judged by depending on each element, a case prediction task and a related law prediction task.
Respectively inputting a first implicit vector corresponding to the case prediction task, a first implicit vector corresponding to the related law prediction task and a first implicit vector corresponding to the duration prediction task into a case prediction model, a related law prediction model and a duration prediction model, and obtaining a case prediction result, a related law prediction result and a duration prediction result of a case description text to be analyzed.
The relevant law and duration prediction models are obtained after training based on the sample legal documents.
Specifically, a first hidden vector corresponding to the case prediction task is obtainedFirst hidden vector corresponding to related normal prediction taskFirst hidden vector corresponding to duration prediction taskThen, willAndrespectively inputting the first hidden vector to a case prediction model, a related law prediction model and a duration prediction model to realize the first hidden vectorAndand mapping the data to label spaces corresponding to the case prediction task, the related law prediction task and the duration prediction task respectively to obtain a case prediction result, a related law prediction result and a duration prediction result.
The specific steps for obtaining the plan prediction result, the related law prediction result and the duration prediction result are similar to the specific steps for obtaining the plan prediction result in the above embodiments, and are not repeated here.
It can be understood that training can be performed based on the sample legal documents, parameters can be adjusted, and relevant law enforcement prediction models and duration prediction models can be obtained.
The analysis tasks comprise a factor judgment task, a case prediction task, a related law prediction task and a duration prediction task
The embodiment of the invention predicts the relevant law based on the dependency relationship between the law elements, case law and the relevant law, predicts the time based on the dependency relationship between the law elements, case law, the relevant law and the time, and can obtain more accurate prediction results of the relevant law and the time prediction results, thereby improving the accuracy and the comprehensiveness of case analysis.
Based on the content of each embodiment, after the task text vector corresponding to each analysis task is obtained according to the encoding result, the task hidden vector and the correlation matrix, the method further includes: and respectively inputting the task text vector corresponding to each element judgment task into the element judgment model corresponding to the element judgment task, and acquiring the result of the element judgment task.
Wherein, the element judgment models corresponding to the element judgment tasks are obtained after training based on the sample legal documents.
Specifically, a task text vector t corresponding to each analysis task is obtained1,t2,...,tkThen, t is added1,t2,...,tkAnd inputting the data into the corresponding element judgment models respectively to obtain the predicted values of the elements as the results of the element judgment task.
The prediction formula of the prediction value of any element is
yi=softmax(Witi+bi)
Wherein, tiA task text corresponding to the ith element judgment task is shown; y isiA predicted value representing the ith element; i is more than or equal to 1 and less than or equal to k; k is a positive integer and represents the number of elements; wiAnd biAll represent the parameter of the ith element judgment model;Yattryes, no.
It can be understood that yiIs a vector of yiThe value of each dimension represents the probability of the corresponding label. E.g. yi=[0.1,0.9]The probability of the ith element being negative is 90%, and the probability of the ith element being positive is 10%.
It can be understood that training can be performed based on the sample legal documents, parameters can be adjusted, and each element judgment model can be obtained.
According to the embodiment of the invention, the predicted value of each element is obtained through the element judgment model and the task text vector corresponding to each element judgment task, so that the key points of cases can be more comprehensively known, and the comprehensiveness and the intelligent level of case analysis can be improved.
Based on the content of each embodiment, the specific steps of performing word segmentation and named entity recognition on the case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity include: performing word segmentation and part-of-speech tagging on a case description text to be analyzed, deleting stop words, and obtaining a plurality of sentences; each sentence includes a plurality of words and parts of speech corresponding to each word.
Specifically, each sentence in the case description text to be analyzed is segmented, each word obtained by segmenting the words is subjected to part-of-speech tagging, stop words are deleted, and the case description text to be analyzed is converted into an original sequence s of the sentences, wherein s is { s ═ s }1,s2,...,sm}. The original sequence comprising a plurality of sentences s1,s2,...,smAnd m represents the number of sentences in the original sequence.
Stop Words refer to Words that are automatically filtered before or after processing natural language data (or text) in order to save memory space and improve processing efficiency in processing natural language data (or text), and are called Stop Words.
For legal case analysis, stop words mainly include functional words contained in human language, which are extremely common and have little actual meaning compared with other words.
Each of the original sequencesSentence sjAs a sequence of words sj={wj1,wj2,...,wjnAnd the part of speech c corresponding to each wordj={cj1,cj2,...,cjn}. Wherein n represents the sentence sjThe number of words contained; w is ajiRepresenting the ith word in the jth sentence; j is more than or equal to 1 and less than or equal to m; i is more than or equal to 1 and less than or equal to n; c. CjiRepresents the part of speech corresponding to the ith word in the jth sentence, namely wjiA corresponding part of speech; c. Cji∈ C, C denotes a part of speech table.
And screening a plurality of sentences according to a pre-constructed trigger word list, reserving the sentences describing important facts related to the case, and forming a sentence sequence.
After obtaining the original sequence, the sentences in the original sequence can be screened according to a pre-constructed trigger word list, facts which are involved in the text and are meaningful for case development are detected, sentences which describe important facts related to the case are reserved, sentences which do not describe important facts related to the case are deleted, and the reserved sentences are formed into a sentence sequence s '{ s'1,s′2,...,s′m′}. m' represents the number of sentences in the sentence sequence.
Sentences containing event trigger words are considered to contain events corresponding to the trigger words. For example, "blow" is a trigger, and if a sentence in the sentence sequence contains a word "blow", the sentence contains an attack event.
According to preset rules, syntax dependency relations, words contained in each sentence in the sentence sequence and parts of speech corresponding to the words, a plurality of events and named entities described by the case description text to be analyzed are obtained, and the event sequence is formed by the events according to the sequence of the occurrence time of the events.
Specifically, according to characteristics such as syntactic dependency, part of speech and the like, each named entity is extracted from words contained in each sentence in the sentence sequence by using a preset rule, and attributes such as occurrence location, event character, occurrence time and the like of a related event can be extracted through the extracted entities such as the name of a person, the name of a place and the like, so that a plurality of described events and the occurrence location, related to the character and the occurrence time, of each event are obtained.
For example, the preset rule is that the verb "blow" object is the victim of the attack event, so that the character related to the attack event can be determined according to the words before and after the verb "blow", the subject being the victim and the object being the victim.
After the events are obtained, real-time event timelines can be combed, and the events are formed into an event sequence according to the sequence of the event occurrence time, but not the sequence of the events appearing in the sentence sequence. For each event in the event sequence, in addition to what event the annotation is, people are involved and the time of occurrence if the location where the event occurred is obtained.
For example, the case description text to be analyzed is 'Li' a certain entrance room steals property, is discovered by an owner in the stealing process, then fight against the owner to hurt the bleeding of the owner, and Li 'a certain horse escapes'; performing chinese participles and part-of-speech (e.g., v denotes verb, p denotes preposition, n denotes noun, np denotes name of person, d denotes adverb, w denotes punctuation, etc.) tagging results in (lie, np) (incoming, v) (theft, v) (property, n) (, w) (theft, v) (process, n) (where, f) (quilt, p) (owner, n) (discovery, v) (, w) (then, d) (and, c) (owner, n) (occurrence, v) (fighting, v) (so, v) (owner, n) (bleeding, v) (injury, v) (, w) (lie, np) (escape, d) (escape, v) (u) (, w)); the result of deleting the chinese stop word is (lie, np) (enter, v) (theft, v) (property, n) (theft, v) (process, n) (owner, n) (discovery, v) (thereupon, d) (and, c) (owner, n) (occurrence, v) (fight, v) (owner, n) (bleeding, v) (injury, v) (lie, np) (horse, d) (escape, v); the result of performing named entity recognition is to obtain a sentence "a Li certain burglary property theft process owner finds that a Li certain horse with the owner suffering fighting and the owner bleeding and being injured escapes", the entities include (Li certain, np) and (owner, n); and detecting to obtain an event sequence as an event 1: theft incident, person: lie, event 2: attack event, person: lie a certain and a master.
The embodiment of the invention screens sentences through the trigger words, can screen useless facts and reduce input noise, thereby reducing data processing amount and improving analysis accuracy.
Based on the content of the above embodiments, the specific step of obtaining a plurality of word vectors according to each word, event sequence and named entity included in the sentence sequence includes: and splicing all words contained in the sentence sequence according to the sequence of the occurrence time of all events in the event sequence to obtain the word sequence.
Specifically, words included in the sentence sequence s' are spliced according to the sequence of the event occurrence time to obtain an input word sequence w ═ { w ═ w1,w2,...,wl}. Where l represents the number of words.
And mapping the word sequence according to a word vector table obtained by pre-training to obtain an original word vector of each word contained in the sentence sequence.
And pre-training the word vectors to obtain a word vector table. The pre-training may be performed by any one of Word2vec, GloVe, FastText, and the like, which is not limited in this embodiment of the present invention.
And mapping the input word sequence through the word vector table to obtain an original word vector of each word.
For each word contained in the sentence sequence, according to the event described by the sentence in which the word is located and whether the word is a named entity, the original word vector of the word is expanded, the word vector corresponding to the word is obtained, and a plurality of word vectors are obtained.
For each word contained in the sentence sequence, according to the event described by the sentence in which the word is located and whether the word is a named entity (including which named entity), the original word vector of the word is expanded, that is, a plurality of elements are added behind the original word vector of the word, and the added elements are used for representing the event described by the sentence in which the word is located and which named entity the word is, so that the original word vector of the word is expanded into the word vector corresponding to the word.
After each word contained in the sentence sequence is expanded, a plurality of word directions are obtainedQuantity, forming a sequence of word vectorsWhere l represents the number of words and d represents the dimension of the word vector.
v={v1,v2,...,vl}
Wherein v is1,v2,...,vlAre respectively the word w1,w2,...,wlThe corresponding word vector.
According to the embodiment of the invention, the original word vector of the word is expanded to obtain the word vector corresponding to the word according to the event described by the sentence in which the word is located and whether the word is a named entity, so that the word vector can better describe the context of the word, and more accurate element judgment results and case analysis results can be obtained according to the word vector.
Based on the content of each embodiment, the specific step of obtaining the task text vector corresponding to each analysis task according to the encoding result, the task hidden vector and the correlation matrix includes: and for each analysis task, acquiring the weight corresponding to the coding result according to the coding result, the task hidden vector corresponding to the analysis task and the correlation matrix, and performing weighted summation on the coding result according to the weight corresponding to the coding result to acquire the task text vector corresponding to the analysis task.
It will be appreciated that the encoding results in a second sequence of hidden vectorsWherein d is1Representing the dimension of the second hidden vector.
h={h1,h2,...,hl}
The second implicit vector sequence h includes 1 second implicit vector, i.e. the length of the second implicit vector sequence is the same as the length of the word sequence w.
Each task hidden vector can form a task vector sequence u ═ { u ═ u1,u2,...,up}; wherein u isiRepresenting a task hidden vector corresponding to the ith analysis task; i is more than or equal to 1 and less than or equal to p; p represents the number of analysis tasks.
For example, if the number of element prediction tasks is 10, and other analysis tasks include a case prediction task, a related law prediction task, and a duration prediction task, p is 13.
For the ith analysis task, according to the task hidden vector u corresponding to the analysis taskiA second implicit vector sequence h and a correlation matrix WaAnd obtaining a task text vector t corresponding to the analysis taski。
The method comprises the following specific steps:
obtaining a weight vector for the analysis taskThe weight vector α is composed of the weight of each second hidden vector in the second hidden vector sequence h;
the weight is calculated by the formula
Wherein, αjRepresenting the weight of the jth second hidden vector in the second hidden vector sequence h; j is more than or equal to 1 and less than or equal to l;
after obtaining the weight vector α for this analysis task, t is obtained by the following formula calculationi,
Through the steps, the task text vector corresponding to each analysis task can be obtained.
According to the embodiment of the invention, based on the correlation degree between the coding result and the task hidden vector, the weight of the coding result to each task hidden vector is obtained, the coding result is subjected to weighted summation according to the weight corresponding to the coding result, the task text vector corresponding to the analysis task is obtained, the characteristics of each analysis task can be represented more accurately, and thus, a more accurate case analysis result is obtained.
Based on the content of the above embodiments, the first recurrent neural network is a long-term memory neural network; the second cyclic neural network is a long-term memory neural network.
In particular, both the first recurrent neural network and the second recurrent neural network may employ gated recurrent neural networks.
The gated cyclic neural network adjusts the structure of the network on the basis of the simple cyclic neural network, and a gating mechanism is added to control the information transmission in the neural network. Gating mechanisms may be used to control how much information in the memory needs to be retained, how much information needs to be discarded, how much new state information needs to be stored in the memory, and so on. This allows the gated cyclic neural network to learn dependencies that span a relatively long time without the problems of gradient disappearance and gradient explosion.
Common gated recurrent neural networks include long-term and short-term memory neural networks and gated recurrent units.
Preferably, the first recurrent neural network and the second recurrent neural network can both adopt long-time and short-time memory neural networks.
The Long Short-term Memory neural network (LSTM) is a time recursion neural network, and is suitable for processing and predicting important events with relatively Long interval and delay in a time sequence. The long-time memory neural network is a special gated cyclic neural network and is also a special cyclic neural network.
In a general recurrent neural network, a memory unit does not have the capacity of measuring the value quantity of information, so that the memory unit looks at the state information of each moment equivalently, which results in that some useless information is stored in the memory unit, and the really useful information is extruded by the useless information. The LSTM is improved from this point, and differs from the recurrent neural network of a general structure in that only one network state is present, and the LSTM divides the network state into an internal state and an external state. The external state of the LSTM is similar to the state in a recurrent neural network of a general structure, i.e., the state is both the output of the hidden layer at the present time and the input of the hidden layer at the next time. The internal states here are then specific to the LSTM.
In LSTM there are three control units called "gates", input gate (input gate), output gate (output gate) and forgetting gate (forget gate), where input gate and forgetting gate are the keys to LSTM being able to remember long-term dependencies. The input gate determines how much information of the state of the network needs to be saved in the internal state at the present time, and the forgetting gate determines how much past state information needs to be discarded. Finally, the output gate determines how much information of the internal state at the current time needs to be output to the external state.
By selectively memorizing and forgetting state information, the LSTM can learn the dependency relationship of longer time interval than the general recurrent neural network.
According to the embodiment of the invention, the long and short term memory neural network is adopted as the first cyclic neural network, semantic information related to the front and the back of the sentence can be better captured, and the long and short term memory neural network is adopted as the second cyclic neural network, so that the dependency relationship between analysis tasks can be better captured, a more accurate analysis result can be obtained, and the analysis accuracy is improved.
Fig. 2 is a schematic structural diagram of a legal case analysis device according to an embodiment of the present invention. Based on the content of the above embodiments, as shown in fig. 2, the apparatus includes a data processing module 201, a fact encoding module 202, and a task sequence prediction module 203, wherein:
the data processing module 201 is configured to perform word segmentation and named entity recognition on a case description text to be analyzed, and acquire a sentence sequence, an event sequence and a named entity;
the fact coding module 202 is configured to obtain a plurality of word vectors according to each word, event sequence and named entity included in the sentence sequence, encode each word vector by using a first recurrent neural network, and obtain a task text vector corresponding to each analysis task according to a coding result, a task implicit vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task;
the task sequence prediction module 203 is configured to perform maximal pooling on task text vectors corresponding to each element judgment task to obtain an overall task text vector of the element judgment task, encode the overall task text vector of the element judgment task and a task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, input the first hidden vector corresponding to the case prediction task to the case prediction model, and obtain a case prediction result of a case description text to be analyzed;
the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case are obtained by a prediction model after training based on a sample legal document.
Specifically, the data processing module 201 performs word segmentation on the case description text to be analyzed, performs named entity recognition on words obtained by word segmentation, and obtains a sentence sequence, an event sequence and a named entity.
After the fact coding module 202 obtains the sentence sequence, the event sequence and the named entity, for each word contained in the sentence sequence, a word vector sequence including a plurality of word vectors can be obtained by using any relevant model for generating the word vectors and combining the event sequence and the named entity; each word vector in the word vector sequence can be encoded by utilizing a first recurrent neural network, semantic information related before and after sentences is captured, and the encoding result is a second implicit vector sequence or a second implicit vector matrix; and mapping the second implicit vector sequence to different task text spaces by adopting an attention mechanism according to the task implicit vectors and the correlation matrix to obtain task text vectors corresponding to different analysis tasks.
The task sequence prediction module 203 performs maximum pooling on task text vectors corresponding to each element judgment task to obtain an overall task text vector of the element judgment task; forming a task sequence by the whole task text vector of the element judgment task and the task text vector corresponding to the case prediction task according to the sequence of the element judgment task and the case prediction task, capturing the dependency relationship among all analysis tasks by using a second recurrent neural network, and encoding the whole task text vector of the element judgment task and the task text vector corresponding to the case prediction task to obtain a first hidden vector corresponding to the case prediction task; and inputting the first implicit vector corresponding to the case prediction task into the case prediction model, so that the first implicit vector corresponding to the case prediction task is mapped to the label space corresponding to the case prediction task, and a case prediction result is obtained.
The specific method and process for implementing the corresponding function by each module included in the legal case analysis device are described in the embodiment of the legal case analysis method, and are not described herein again.
The legal case analysis device is used for the legal case analysis method of each embodiment. Therefore, the descriptions and definitions in the legal case analysis method in the foregoing embodiments can be used for understanding the execution modules in the embodiments of the present invention.
The embodiment of the invention analyzes the legal cases based on the dependency relationship between legal elements and cases, can distinguish cases with similar criminal names according to the elements, and can be suitable for analyzing the case facts of all cases, but not limited to the case facts of common partial cases, thereby greatly improving the accuracy of case analysis and having higher case coverage rate.
Fig. 3 is a block diagram of an electronic device according to an embodiment of the present invention. Based on the content of the above embodiment, as shown in fig. 3, the electronic device may include: a processor (processor)301, a memory (memory)302, and a bus 303; wherein, the processor 301 and the memory 302 complete the communication with each other through the bus 303; the processor 301 is configured to invoke computer program instructions stored in the memory 302 and executable on the processor 301 to perform the legal case analysis methods provided by the above-described method embodiments, including, for example: carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity; acquiring a plurality of word vectors according to each word, an event sequence and a named entity contained in the sentence sequence, encoding each word vector by using a first cyclic neural network, and acquiring a task text vector corresponding to each analysis task according to an encoding result, a task hidden vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task; performing maximum pooling on task text vectors corresponding to all the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and a task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed; the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case are obtained by a prediction model after training based on a sample legal document.
Another embodiment of the present invention discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, which when executed by a computer, the computer is capable of performing the legal case scenario analysis method provided by the above-mentioned method embodiments, for example, comprising: carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity; acquiring a plurality of word vectors according to each word, an event sequence and a named entity contained in the sentence sequence, encoding each word vector by using a first cyclic neural network, and acquiring a task text vector corresponding to each analysis task according to an encoding result, a task hidden vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task; performing maximum pooling on task text vectors corresponding to all the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and a task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed; the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case are obtained by a prediction model after training based on a sample legal document.
Furthermore, the logic instructions in the memory 302 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Another embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions, the computer instructions causing a computer to execute the method for analyzing legal cases provided by the above method embodiments, for example, the method includes: carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity; acquiring a plurality of word vectors according to each word, an event sequence and a named entity contained in the sentence sequence, encoding each word vector by using a first cyclic neural network, and acquiring a task text vector corresponding to each analysis task according to an encoding result, a task hidden vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task; performing maximum pooling on task text vectors corresponding to all the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and a task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed; the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case are obtained by a prediction model after training based on a sample legal document.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. It is understood that the above-described technical solutions may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the above-described embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A legal case analysis method, comprising:
carrying out word segmentation and named entity recognition on a case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity;
acquiring a plurality of word vectors according to each word contained in the sentence sequence, the event sequence and the named entity, encoding each word vector by using a first recurrent neural network, and acquiring a task text vector corresponding to each analysis task according to an encoding result, a task hidden vector and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task; the factors include profit, business, death, violence, state organs or state workers, public places, illegal occupancy, injury, subjective intent and during production operations;
performing maximum pooling on task text vectors corresponding to the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and the task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed;
the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case prediction model are obtained after training based on a sample legal document.
2. The legal case analysis method of claim 1, wherein the analysis task further comprises: a related law prediction task and a duration prediction task;
correspondingly, obtaining the overall task text vector of the element judgment task comprises:
encoding the whole task text vector of the element judgment task, the task text vector corresponding to the case prediction task, the task text vector corresponding to the related law bar prediction task and the task text vector corresponding to the duration prediction task by using a second recurrent neural network to obtain first hidden vectors respectively corresponding to the case prediction task, the related law bar prediction task and the duration prediction task;
respectively inputting a first implicit vector corresponding to the case prediction task, a first implicit vector corresponding to the related law prediction task and a first implicit vector corresponding to the duration prediction task into the case prediction model, the related law prediction model and the duration prediction model, and obtaining a case prediction result, a related law prediction result and a duration prediction result of a case description text to be analyzed;
the relevant law enforcement prediction model and the duration prediction model are obtained after training based on the sample legal documents.
3. The legal case analysis method of claim 1, wherein after obtaining the task text vector corresponding to each analysis task according to the encoding result, the task hidden vector and the correlation matrix, the method further comprises:
respectively inputting a task text vector corresponding to each element judgment task into an element judgment model corresponding to the element judgment task to obtain a result of the element judgment task;
and the element judgment model corresponding to each element judgment task is obtained after training based on the sample legal document.
4. The legal case analysis method of claim 1, wherein the specific steps of performing word segmentation and named entity recognition on the case description text to be analyzed to obtain sentence sequences, event sequences and named entities comprise:
performing word segmentation and part-of-speech tagging on the case description text to be analyzed, deleting stop words, and obtaining a plurality of sentences; each sentence comprises a plurality of words and parts of speech corresponding to each word;
screening the sentences according to a pre-constructed trigger word list, reserving sentences describing important facts related to the case, and forming a sentence sequence;
and acquiring a plurality of events and named entities described by the case description text to be analyzed according to preset rules, syntactic dependency relations, words contained in each sentence in the sentence sequence and parts of speech corresponding to the words, and forming the event sequence by the events according to the sequence of the occurrence time of the events.
5. The legal case analysis method of claim 1, wherein the specific step of obtaining a plurality of word vectors according to each word contained in the sentence sequence, the event sequence and the named entity comprises:
splicing all words contained in the sentence sequence according to the sequence of the occurrence time of all events in the event sequence to obtain a word sequence;
mapping the word sequence according to a word vector table obtained by pre-training to obtain an original word vector of each word contained in the sentence sequence;
and for each word contained in the sentence sequence, expanding the original word vector of the word according to the event described by the sentence in which the word is located and whether the word is the named entity, acquiring the word vector corresponding to the word, and acquiring the word vectors.
6. The legal case analysis method of claim 1, wherein the specific step of obtaining the task text vector corresponding to each analysis task according to the encoding result, the task hidden vector and the correlation matrix comprises:
and for each analysis task, acquiring the weight corresponding to the coding result according to the coding result, the task hidden vector corresponding to the analysis task and the correlation matrix, and performing weighted summation on the coding result according to the weight corresponding to the coding result to acquire the task text vector corresponding to the analysis task.
7. The legal case analysis method of any one of claims 1 to 6, wherein the first recurrent neural network is a long-term memory neural network; the second cyclic neural network is a long-term memory neural network.
8. A legal case scenario analyzing apparatus, comprising:
the data processing module is used for performing word segmentation and named entity recognition on the case description text to be analyzed to obtain a sentence sequence, an event sequence and a named entity;
the fact coding module is used for obtaining a plurality of word vectors according to the words contained in the sentence sequence, the event sequence and the named entity, coding each word vector by utilizing a first cyclic neural network, and obtaining task text vectors corresponding to analysis tasks according to a coding result, task hidden vectors and a correlation matrix; the analysis task comprises a factor judgment task and a case prediction task; the elements are a plurality of legal elements related to the judgment case; the number of the element judgment tasks is the same as that of the elements, and each element judgment task corresponds to one legal element; the number of the task hidden vectors is the same as that of the analysis tasks, and each task hidden vector corresponds to one analysis task; the factors include profit, business, death, violence, state organs or state workers, public places, illegal occupancy, injury, subjective intent and during production operations;
the task sequence prediction module is used for performing maximum pooling on task text vectors corresponding to the element judgment tasks to obtain an integral task text vector of the element judgment tasks, encoding the integral task text vector of the element judgment tasks and the task text vector corresponding to the case prediction task by using a second recurrent neural network to obtain a first hidden vector corresponding to the case prediction task, inputting the first hidden vector corresponding to the case prediction task to a case prediction model, and obtaining a case prediction result of a case description text to be analyzed;
the first recurrent neural network, the task hidden vector, the correlation matrix, the second recurrent neural network and the case prediction model are obtained after training based on a sample legal document.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of legal case analysis according to any one of claims 1 to 7 are implemented by the processor when executing the program.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the legal case analysis method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910379141.1A CN110276068B (en) | 2019-05-08 | 2019-05-08 | Legal case analysis method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910379141.1A CN110276068B (en) | 2019-05-08 | 2019-05-08 | Legal case analysis method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110276068A CN110276068A (en) | 2019-09-24 |
CN110276068B true CN110276068B (en) | 2020-08-28 |
Family
ID=67959767
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910379141.1A Active CN110276068B (en) | 2019-05-08 | 2019-05-08 | Legal case analysis method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110276068B (en) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10726198B2 (en) | 2017-10-17 | 2020-07-28 | Handycontract, LLC | Method, device, and system, for identifying data elements in data structures |
US11475209B2 (en) | 2017-10-17 | 2022-10-18 | Handycontract Llc | Device, system, and method for extracting named entities from sectioned documents |
CN110928987B (en) * | 2019-10-18 | 2023-07-25 | 平安科技(深圳)有限公司 | Legal provision retrieval method and related equipment based on neural network hybrid model |
CN111325387B (en) * | 2020-02-13 | 2023-08-18 | 清华大学 | Interpretable law automatic decision prediction method and device |
CN111382333B (en) * | 2020-03-11 | 2022-06-21 | 昆明理工大学 | Case element extraction method in news text sentence based on case correlation joint learning and graph convolution |
CN111460834B (en) * | 2020-04-09 | 2023-06-06 | 北京北大软件工程股份有限公司 | French semantic annotation method and device based on LSTM network |
CN111552808A (en) * | 2020-04-20 | 2020-08-18 | 北京北大软件工程股份有限公司 | Administrative illegal case law prediction method and tool based on convolutional neural network |
CN111797221B (en) * | 2020-06-16 | 2023-12-08 | 北京北大软件工程股份有限公司 | Similar case recommending method and device |
CN111523313B (en) * | 2020-07-03 | 2020-09-29 | 支付宝(杭州)信息技术有限公司 | Model training and named entity recognition method and device |
CN112100212A (en) * | 2020-09-04 | 2020-12-18 | 中国航天科工集团第二研究院 | Case scenario extraction method based on machine learning and rule matching |
CN113157880B (en) * | 2021-03-25 | 2023-01-17 | 科大讯飞股份有限公司 | Element content obtaining method, device, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107239445A (en) * | 2017-05-27 | 2017-10-10 | 中国矿业大学 | The method and system that a kind of media event based on neutral net is extracted |
CN107818138A (en) * | 2017-09-28 | 2018-03-20 | 银江股份有限公司 | A kind of case legal regulation recommends method and system |
CN108009284A (en) * | 2017-12-22 | 2018-05-08 | 重庆邮电大学 | Using the Law Text sorting technique of semi-supervised convolutional neural networks |
CN108304911A (en) * | 2018-01-09 | 2018-07-20 | 中国科学院自动化研究所 | Knowledge Extraction Method and system based on Memory Neural Networks and equipment |
CN109308355A (en) * | 2018-09-17 | 2019-02-05 | 清华大学 | Legal decision prediction of result method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102127449B1 (en) * | 2017-02-08 | 2020-06-26 | 사회복지법인 삼성생명공익재단 | Apparatus, method, and computer program for generating survival rate prediction model |
-
2019
- 2019-05-08 CN CN201910379141.1A patent/CN110276068B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107239445A (en) * | 2017-05-27 | 2017-10-10 | 中国矿业大学 | The method and system that a kind of media event based on neutral net is extracted |
CN107818138A (en) * | 2017-09-28 | 2018-03-20 | 银江股份有限公司 | A kind of case legal regulation recommends method and system |
CN108009284A (en) * | 2017-12-22 | 2018-05-08 | 重庆邮电大学 | Using the Law Text sorting technique of semi-supervised convolutional neural networks |
CN108304911A (en) * | 2018-01-09 | 2018-07-20 | 中国科学院自动化研究所 | Knowledge Extraction Method and system based on Memory Neural Networks and equipment |
CN109308355A (en) * | 2018-09-17 | 2019-02-05 | 清华大学 | Legal decision prediction of result method and device |
Non-Patent Citations (1)
Title |
---|
《融入罪名关键词的法律判决预测多任务学习模型》;刘宗林 等;《清华大学学报(自然科学版)》;20190410;第59卷(第7期);第498-501页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110276068A (en) | 2019-09-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110276068B (en) | Legal case analysis method and device | |
Holton | Identifying disgruntled employee systems fraud risk through text mining: A simple solution for a multi-billion dollar problem | |
CN109871688B (en) | Vulnerability threat degree evaluation method | |
CN110610005A (en) | Stealing crime auxiliary criminal investigation method based on deep learning | |
CN110197389A (en) | A kind of user identification method and device | |
Marks et al. | Automatic justice? Technology, crime and social control | |
CN112015901A (en) | Text classification method and device and warning situation analysis system | |
CN114091462B (en) | Case fact mixed coding based criminal case risk mutual learning assessment method | |
CN110009224A (en) | Suspect's violation probability prediction technique, device, computer equipment and storage medium | |
CN113888368A (en) | Feature selection method for criminal case detention risk assessment based on image coding | |
CN111985207A (en) | Method and device for acquiring access control policy and electronic equipment | |
CN110826316A (en) | Method for identifying sensitive information applied to referee document | |
CN112765974A (en) | Service assisting method, electronic device and readable storage medium | |
CN110909195A (en) | Picture labeling method and device based on block chain, storage medium and server | |
CN116866054A (en) | Public information safety monitoring system and method thereof | |
CN115204886A (en) | Account identification method and device, electronic equipment and storage medium | |
CN112084240B (en) | Intelligent identification and linkage treatment method and system for group renting | |
CN117349437A (en) | Government information management system and method based on intelligent AI | |
CN117312514A (en) | Consultation reply method, consultation reply device and computer readable storage medium | |
Hull | Dirty data labeled dirt cheap: epistemic injustice in machine learning systems | |
CN110334192B (en) | Text abstract generation method and system, electronic equipment and storage medium | |
CN113918936A (en) | SQL injection attack detection method and device | |
CN111008329A (en) | Page content recommendation method and device based on content classification | |
CN115080709A (en) | Text recognition method and device, nonvolatile storage medium and computer equipment | |
CN117314623A (en) | Loan fraud prediction method, device and storage medium integrating external knowledge |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |