Disclosure of Invention
In view of the above, the present invention has been developed to provide a judicial court trial problem generation method, apparatus and computing device that overcome, or at least partially address, the above-discussed problems.
According to one aspect of the present invention, there is provided a judicial court trial-based problem generation method, including:
encoding the complaint text by using an encoder to generate a first semantic vector aiming at the complaint text;
processing the first semantic vector by using a classifier to obtain a category label representing the case category of the appeal shape text;
splicing the first semantic vector and the category label to obtain a first spliced vector;
and decoding the first splicing vector by using a decoder to generate a first question sentence of the court hearing officer.
Optionally, the judicial court trial-based problem generation method according to the present invention further includes: encoding historical dialogue of the court trial by using the encoder to generate a second semantic vector aiming at the historical dialogue, wherein the historical dialogue comprises question sentences of the court trial officer and original told answer sentences; splicing the second semantic vector with the category label to obtain a second spliced vector; and decoding the second spliced vector by using the decoder to generate a subsequent question sentence of the court trial judge.
Optionally, in the judicial court trial-based problem generation method according to the present invention, the encoding, with the encoder, the historical dialogue of the court trial includes: obtaining a preset number of latest dialogue sentences from the historical dialogue; and encoding the acquired dialogue statement by using the encoder.
Optionally, in the judicial court trial-based problem generation method according to the present invention, the obtaining a predetermined number of latest dialogue sentences from the historical dialogue includes: and when the number of the dialogue sentences in the historical dialogue is less than the preset number, acquiring all the dialogue sentences in the historical dialogue.
Optionally, in the judicial court trial based problem generation method according to the present invention, the encoder and the decoder employ an RNN network, an LSTM network, or a GRU network.
Optionally, in the judicial trial-based problem generation method according to the invention, the classifier adopts a SoftMax classifier
According to an aspect of the present invention, there is provided a judicial court trial-based problem generation apparatus including:
the system comprises an encoder, a processing unit and a processing unit, wherein the encoder is suitable for encoding the complaint text and generating a first semantic vector aiming at the complaint text;
the classifier is suitable for processing the first semantic vector to obtain a category label representing the case category of the appeal shape text;
the splicing unit is suitable for splicing the first semantic vector and the category label to obtain a first splicing vector;
and the decoder is suitable for decoding the first splicing vector to generate a first question sentence of the court trial judge.
Optionally, in the judicial court trial-based question generation apparatus according to the present invention, the encoder is further adapted to perform an encoding process on a historical dialogue of the court trial, which includes a question sentence of the court trial officer and an original posted answer sentence, to generate a second semantic vector for the historical dialogue; the splicing unit is further adapted to splice the second semantic vector with the category label to obtain a second spliced vector; the decoder is further adapted to decode the second stitched vector to generate a subsequent question sentence of the court trial judge.
According to yet another aspect of the invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the above-described method.
According to yet another aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the above-described method.
The neural network language model is applied to the judicial field, case category information is automatically determined based on the complaint text, the first question sentence of the court hearing judge is determined based on the complaint text and the case category information, the next question sentence is automatically generated based on the historical court hearing conversation and the case category information, and the court hearing efficiency can be obviously improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a schematic diagram of a judicial court trial-based questioning system 100, according to one embodiment of the present invention. As shown in fig. 1, the questioning system 100 includes a terminal apparatus 110 and a computing apparatus 200.
The terminal device 110 may specifically be a personal computer such as a desktop computer and a notebook computer, and may also be a mobile phone, a tablet computer, a multimedia device, a smart speaker, a smart wearable device, and the like, but is not limited thereto. Computing device 200 is used to provide services to terminal device 110, which may be implemented as a server, such as an application server, a Web server, or the like; but may also be implemented as a desktop computer, a notebook computer, a processor chip, a tablet computer, etc., but is not limited thereto.
According to one embodiment, the computing device 200 may provide intelligent court trial services, and the terminal device 110 may establish a connection with the computing device 200 via the internet, such that a user may have a human-computer conversation with the computing device 200 via the terminal device 110. Specifically, the computing device 200 may automatically determine case category information based on the complaint text, automatically generate a first question sentence of the court hearing officer based on the complaint text and the case category information, send the question sentence to the terminal device 110, and broadcast the question sentence by the terminal device 110.
The terminal device 110 may also collect voice data of the user, such as voice data that was originally reported to answer a question sentence, and perform voice recognition processing on the voice data to obtain an answer sentence, or the terminal device may also transmit the voice data to the computing device 200, and perform voice recognition processing on the voice data by the computing device 200 to obtain an answer sentence.
Further, the computing device 200 may also automatically generate a next question sentence to send to the terminal device 110 based on the historical court trial dialog (including the automatically generated question sentence and the original tolled answer sentence) and the case category information.
In one embodiment, the judicial court trial-based questioning system 100 further includes a data storage device 120. The data storage 120 may be a relational database such as MySQL, ACCESS, etc., or a non-relational database such as NoSQL, etc.; the data storage device 120 may be a local database residing in the computing device 200, or may be disposed at a plurality of geographic locations as a distributed database, such as HBase, in short, the data storage device 120 is used for storing data, and the present invention is not limited to the specific deployment and configuration of the data storage device 120. The computing device 200 may connect with the data storage 120 and retrieve data stored in the data storage 120. For example, the computing device 200 may directly read the data in the data storage 120 (when the data storage 120 is a local database of the computing device 200), or may access the internet in a wired or wireless manner and obtain the data in the data storage 120 through a data interface.
In an embodiment of the present invention, the data storage 120 is adapted to store a text generation model adapted to generate a question statement for a court hearing judge based on the complaint text and/or the court trial conversation and the case category information. The text generation model is a sequence-to-sequence (seq2seq) model and comprises an encoder and a decoder, wherein the encoder is suitable for encoding the complaint text or the court trial conversation and generating a first semantic vector aiming at the complaint text or a second semantic vector aiming at the court trial conversation; the text generation model further comprises a classifier which is suitable for processing the first semantic vector to obtain a category label of a case category representing the complaint text; the input of the decoder is a first spliced vector of the first semantic vector and the category label or a second spliced vector of the second semantic vector and the category label, the first spliced vector is decoded to generate a first question sentence of the court trial judge, and the second spliced vector is decoded to generate a subsequent question sentence of the court trial judge.
The data storage 120 is further adapted to store historical court trial data, which the computing device 200 may use as a training sample set to train the text generation model described above. Specifically, each training sample in the training sample set comprises a complaint text with labeled case category labels and a court trial record comprising question sentences of court officers in the court trial and answer sentences of the original postings.
The judicial court trial-based problem generation method of embodiments of the present invention may be performed in the computing device 200. FIG. 2 shows a block diagram of a computing device 200, according to one embodiment of the invention. As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (μ P), a microcontroller (μ C), a Digital Signal Processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include an operating system 220, one or more applications 222, and program data 224. The application 222 is actually a plurality of program instructions that direct the processor 204 to perform corresponding operations. In some embodiments, application 222 may be arranged to cause processor 204 to operate with program data 224 on an operating system.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to facilitate communications with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In a computing device 200 according to the present invention, the application 222 comprises a judicial court trial-based problem generation apparatus 400, the apparatus 400 comprising a plurality of program instructions that may direct the processor 104 to perform the judicial court trial-based problem generation method 300.
FIG. 3 illustrates a flow diagram of a judicial court trial-based problem generation method 300, according to one embodiment of the invention. The method 300 is suitable for execution in a computing device, such as the computing device 200 described above.
As shown in fig. 3, the method 300 begins at step S310. In step S310, the encoder encodes the complaint text, and generates a first semantic vector for the complaint text. The appetitive text can be the text corresponding to the appetitive or the text corresponding to the appetitive. If the appealing form is a paper edition, an OCR automatic scanning system can be started, characters in the paper document are converted into image files of black and white dot matrixes in an optical mode, and the characters in the images are converted into text formats through recognition software. If the appeal is an electronic version in a text format, the appeal can be directly processed.
Before the appealing text is input into the encoder, sentence division processing is firstly carried out on the appealing text to obtain a plurality of sentences aiming at the appealing text, then word division processing is carried out on each sentence to obtain a plurality of words aiming at each sentence, and finally each word is converted into a word vector (embedding) to obtain a word vector sequence aiming at the appealing text. And inputting the word vectors in the word vector sequence to an encoder in sequence, and outputting a first semantic vector aiming at the appeal text by the encoder.
The encoder may employ a time series based neural network, such as an RNN network, an LSTM network, or a GRU network.
In one implementation, an attention mechanism (attention) may also be introduced in the encoder. Specifically, when each word vector in the word vector sequence is processed in the encoder, a hidden vector is correspondingly generated, and the attention weight corresponding to each hidden vector is obtained, and the hidden vector sequences corresponding to the word vector sequence are subjected to weighted summation based on the attention weight, so that the first semantic vector with attention can be obtained.
In step S320, the first semantic vector is processed by the classifier to obtain a category tag indicating a case category of the complaint text. The classifier can adopt a SoftMax classifier or other known classifiers, and after the first semantic vector is input into the classifier, the classifier can output a corresponding class label. The classifier can classify the complaint texts at multiple levels, for example, case categories include several major categories such as civil disputes, criminal disputes and administrative disputes, the civil disputes are further divided into several minor categories such as property disputes, divorce disputes, damage compensation disputes, contract disputes and copyright disputes, and each category has a category label (category code).
For example, the input complaint text is: the same loan of 80 ten thousand yuan between the original Levain of the institute of complaints and the original Levain of the east Shangyang people court 2013 of the national institute of famous people number 1881 is already agreed with the settlement of 1881, and the settlement is repeated or false litigation to request the refution of the original appeal of the court. "
Then after being classified by the classifier, the determined case category is as follows: civil dispute-property dispute.
In step S330, the first semantic vector and the category label are spliced to obtain a first spliced vector.
In step S340, the decoder decodes the first mosaic vector to generate a first question sentence of the court trial officer. The decoder may employ a time series based neural network, such as an RNN network, LSTM network, or GRU network. And the decoder decodes the probability of the next word in the whole word list in each step, selects the word with the maximum probability as the next word to be generated, and finally decodes the first question sentence.
For example, the first question sentence generated for the above complaint text is:
"the rules of who advocates and testifies according to the Min complaints" are in accordance with the regulations of the highest Min court about civil litigation ". Is there new evidence provided by the original party? "
After the computing device 200 generates the first question sentence, the question sentence is sent to the terminal device 110, and the terminal device 110 broadcasts the question sentence, so that the original report answers the question sentence. The terminal device 110 may collect voice data of an original reported answer, and the voice data may be subjected to voice Recognition (ASR) through the terminal device 110 or the computing device 200 to obtain an answer sentence (text). ASR speech-to-text is transcribed in real time, and in order to avoid ambiguity problems, noise reduction processing is firstly carried out on court trial utterances. In the transcription process, the minimum unit of the common transcription is the word level, the maximum unit is the sentence level, and then the result of the ASR is subjected to smoothing processing, including sentence break error elimination, repeated spoken language deletion, entity recognition error elimination, legal phrase recognition error elimination and the like.
In step S350, the encoding process is performed on the historical dialogue of the court trial by using the encoder, and a second semantic vector for the historical dialogue is generated.
The historical dialogue is a court trial dialogue from the current time in the court trial process, comprises a question sentence of a court trial judge and an original answered sentence, and can acquire a preset number (for example, 5) of latest dialogue sentences from the historical dialogue.
Before inputting the acquired historical dialogue into an encoder, sentence division processing is firstly carried out on the historical dialogue to obtain a plurality of sentences, then word division processing is carried out on each sentence to obtain a plurality of words aiming at each sentence, and finally each word is converted into a word vector (embedding) to obtain a word vector sequence aiming at the historical dialogue. And inputting the word vectors in the word vector sequence to an encoder in sequence, and outputting a second semantic vector aiming at the historical dialogue by the encoder.
When each word vector in the word vector sequence is processed in the encoder, a hidden vector is correspondingly generated, and a second semantic vector with attention can be obtained by obtaining the attention weight corresponding to each hidden vector and performing weighted summation on the hidden vector sequence corresponding to the word vector sequence based on the attention weight.
In step S360, the second semantic vector is spliced with the category label to obtain a second spliced vector.
In step S370, the decoder decodes the second mosaic vector to generate a subsequent question sentence of the court trial judge.
And repeating the steps S350 to S370 to finish the court trial and form a court trial record.
The following describes a training process of the text generation model in the embodiment of the present invention.
As previously mentioned, the text generation model is a sequence-to-sequence (seq2seq) model that includes an encoder and a decoder, and in embodiments of the present invention, the text generation model further includes a classifier coupled to the encoder and the decoder.
The text generation model described above may be trained using historical court trial data as a training sample set. Specifically, each training sample in the training sample set comprises a complaint text with labeled case category labels and a court trial record comprising question sentences of court officers in the court trial and answer sentences of the original postings. Inputting a training sample into a text generation model to be trained, determining a first loss according to the output of a classifier and a labeled class label, determining a second loss according to the output of a decoder and a question sentence in the training sample, and adjusting a model parameter based on the sum of the first loss and the second loss until the model converges to obtain the trained text generation model.
Fig. 4 illustrates a schematic diagram of a judicial court trial-based problem generation apparatus 400, the apparatus 400 residing in a computing device, according to one embodiment of the invention. Referring to fig. 4, the apparatus 400 includes:
the encoder 410 is suitable for encoding the complaint text and generating a first semantic vector aiming at the complaint text;
a classifier 420 adapted to process the first semantic vector to obtain a category label representing a case category of the complaint text;
the splicing unit 430 is adapted to splice the first semantic vector and the category label to obtain a first spliced vector;
and the decoder 440 is suitable for decoding the first spliced vector to generate the first question sentence of the court hearing officer.
The encoder 410 is further adapted to encode historical dialogue of the court trial to generate a second semantic vector for the historical dialogue, wherein the historical dialogue comprises question sentences and original told answer sentences of the court trial officer;
the splicing unit 430 is further adapted to splice the second semantic vector with the category label to obtain a second spliced vector;
the decoder 440 is further adapted to decode the second stitched vector to generate a subsequent question sentence of the court trial officer.
The specific processing performed by the encoder 410, the classifier 420, the splicing unit 430 and the decoder 440 can refer to the method 300, which is not described herein again.
The application scenario of the above embodiment is an online court trial system designed for a court. Based on a similar principle, the problem generation method of the embodiment of the invention can also be applied to other application scenarios, for example, the problem generation method can also comprise judicial institutions such as public security inquiries and inspection yards. Under a public security interrogation scene, question sentences of public security personnel can be automatically generated; under the examination scene of the examination hall, question sentences of the examination personnel can be automatically generated.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.