CN110210021B - Reading understanding method and device - Google Patents

Reading understanding method and device Download PDF

Info

Publication number
CN110210021B
CN110210021B CN201910429805.0A CN201910429805A CN110210021B CN 110210021 B CN110210021 B CN 110210021B CN 201910429805 A CN201910429805 A CN 201910429805A CN 110210021 B CN110210021 B CN 110210021B
Authority
CN
China
Prior art keywords
answer
text
sample
question
target
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
Application number
CN201910429805.0A
Other languages
Chinese (zh)
Other versions
CN110210021A (en
Inventor
李弘宇
刘璟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910429805.0A priority Critical patent/CN110210021B/en
Publication of CN110210021A publication Critical patent/CN110210021A/en
Application granted granted Critical
Publication of CN110210021B publication Critical patent/CN110210021B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities

Abstract

The invention provides a reading understanding method and a reading understanding device, wherein the method comprises the following steps: acquiring a preset target problem and a text to be read; performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question; and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient. Therefore, high-quality long answer texts or short answer texts can be well understood from the target questions and the texts to be read based on the preset reading understanding model, the high-quality long answer texts or short answer texts can be well represented under different actual conditions, the existing special model is not limited to have a good understanding effect on answers of one answer type, and the understanding effect on the answers of different answer types is improved compared with the existing general model.

Description

Reading understanding method and device
Technical Field
The invention relates to the field of artificial intelligence, in particular to a reading understanding method and a reading understanding device.
Background
Artificial Intelligence (AI) is a new technical science to study and develop theories, methods, techniques and application systems for simulating, extending and expanding human Intelligence. Artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence, and research in this field includes robotics, language recognition, image recognition, natural language processing, question and answer systems, and expert systems, among others.
At present, the input of questions to be answered and related reading materials into a trained reading understanding model for artificial intelligent reading understanding is becoming more and more widespread. The existing reading understanding models mainly comprise a special model and a general model:
the special model is obtained by training reading materials of the same answer type, but the special model has the limitation that the understanding effect on only one answer type is good. For example, a long answer model obtained by using a mass sample of a long answer type and a short answer model obtained by training a mass sample of a short answer type are used, and the long answer model and the short answer model have different model parameters and training data, so that the long answer model has a good understanding effect on the long answer and a poor understanding effect on the short answer, and the short answer model only has a good understanding effect on the short answer and a poor understanding effect on the long answer.
Although the general model is obtained by adopting sample joint training of different answer types, the structural parameters of the general model are not respectively set for the answers of different answer types, but a set of model parameters are shared, so that the understanding effect of the long answer is not better than that of the long answer model, the understanding effect of the short answer is not better than that of the short answer model, and the reading effect of the model is not good.
Therefore, how to better read and understand becomes a technical problem to be solved urgently.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
To this end, a first object of the invention is to propose a reading and understanding method.
A second object of the invention is to provide a reading and understanding apparatus.
A third object of the invention is to propose a computer device.
A fourth object of the invention is to propose a computer-readable storage medium.
To achieve the above object, an embodiment of a first aspect of the present invention provides a reading understanding method, including:
acquiring a preset target problem and a text to be read;
performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question;
and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient.
In one possible implementation manner, the determining a target answer corresponding to the target question according to the answer text type probability, the answer text, and the corresponding confidence includes:
obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text and a second product of the short answer type probability and the confidence coefficient of the short answer text; judging whether the first product is larger than the second product;
if yes, determining the long answer text as a target answer corresponding to the target question;
if not, determining the short answer text as a target answer corresponding to the target question.
In a possible implementation manner, before the acquiring the preset target question and the text to be read, the method further includes:
obtaining a first sample set, wherein the first sample in the first sample set comprises a training question and a reading material sample, a starting position and an ending position of a correct answer of a long answer type in the reading material sample, and annotation data for representing that the answer type of the first sample is a long answer;
acquiring a second sample set, wherein a second sample in the second sample set comprises a training question, a reading material sample, a starting position and an ending position of a correct answer of a short answer type in the reading material sample, and annotation data for representing that the answer type of the second sample is a short answer;
training an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
In a possible implementation manner, the initial reading understanding model at least includes an encoder, a first prediction layer, a second prediction layer, and a classifier, and the training of the initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model includes:
inputting the first sample in the first sample set and the second sample in the second sample set into the encoder for encoding respectively;
training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set to obtain the preset reading understanding model;
the trained first prediction layer can predict a long answer text and confidence coefficient corresponding to a question needing to be answered, the trained second prediction layer can predict a short answer text and confidence coefficient corresponding to the question needing to be answered, and the trained classifier can judge the answer type probability corresponding to the question needing to be answered.
In a possible implementation manner, after the acquiring the preset target question and the text to be read, the method further includes:
and splicing the target question and the text to be read, wherein in the splicing process, a separator for representing a question is added in front of the target question, and a separator for representing a paragraph is added in front of the paragraph of the text to be read.
According to the reading understanding method provided by the embodiment of the invention, the preset target problem and the text to be read are obtained; performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question; and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient. Therefore, high-quality long answer texts or short answer texts can be well understood from the target questions and the texts to be read based on the preset reading understanding model, the high-quality long answer texts or short answer texts can be well represented under different actual conditions, the existing special model is not limited to have a good understanding effect on answers of one answer type, and the understanding effect on the answers of different answer types is improved compared with the existing general model.
To achieve the above object, a reading and understanding apparatus according to a second embodiment of the present invention includes:
the acquisition module is used for acquiring a preset target problem and a text to be read;
the generating module is used for carrying out understanding analysis on the text to be read according to a preset reading understanding model, and generating answer type probability, answer text and corresponding confidence of the target question;
and the determining module is used for determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient.
In a possible implementation manner, the determining module is specifically configured to:
obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text and a second product of the short answer type probability and the confidence coefficient of the short answer text; judging whether the first product is larger than the second product;
if yes, determining the long answer text as a target answer corresponding to the target question;
if not, determining the short answer text as a target answer corresponding to the target question.
In one possible implementation, the apparatus further includes: a training module;
the obtaining module is further configured to obtain a first sample set, where the first sample in the first sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a long answer type in the reading material sample, and labeling data used for representing that the answer type of the first sample is a long answer;
the obtaining module is further configured to obtain a second sample set, where a second sample in the second sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a short answer type in the reading material sample, and labeling data used for representing that an answer type of the second sample is a short answer;
the training module is configured to train an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
In a possible implementation manner, the initial reading understanding model at least includes an encoder, a first prediction layer, a second prediction layer, and a classifier, and the training module is specifically configured to:
inputting the first sample in the first sample set and the second sample in the second sample set into the encoder for encoding respectively;
training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set to obtain the preset reading understanding model;
the trained first prediction layer can predict a long answer text and confidence coefficient corresponding to a question needing to be answered, the trained second prediction layer can predict a short answer text and confidence coefficient corresponding to the question needing to be answered, and the trained classifier can judge the answer type probability corresponding to the question needing to be answered.
In one possible implementation, the apparatus further includes: a splicing module;
and the splicing is used for splicing the target question and the text to be read after the preset target question and the text to be read are obtained, wherein in the splicing process, a separator for representing the question is added in front of the target question, and a separator for representing the paragraph is added in front of the paragraph of the text to be read.
The reading understanding device provided by the embodiment of the invention obtains the preset target problem and the text to be read; performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question; and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient. Therefore, high-quality long answer texts or short answer texts can be well understood from the target questions and the texts to be read based on the preset reading understanding model, the high-quality long answer texts or short answer texts can be well represented under different actual conditions, the existing special model is not limited to have a good understanding effect on answers of one answer type, and the understanding effect on the answers of different answer types is improved compared with the existing general model.
To achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the processor implements the reading understanding method as described above.
In order to achieve the above object, a fourth aspect of the present invention provides a computer-readable storage medium, wherein when the instructions in the storage medium are executed by a processor, the reading understanding method is implemented as described above.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flow chart of a reading understanding method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another reading understanding method according to an embodiment of the present invention;
FIG. 3 is a model structure diagram of an exemplary prior art reading understanding model;
FIG. 4 is a block diagram of an exemplary pre-defined reading understanding model according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a reading and understanding apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another reading and understanding apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
A reading understanding method and apparatus of the embodiments of the present invention are described below with reference to the accompanying drawings.
Fig. 1 is a flowchart illustrating a reading understanding method according to an embodiment of the present invention. The embodiment provides a reading and understanding method, and the execution main body of the reading and understanding method is a reading and understanding device and is composed of hardware and/or software. The reading and understanding device may specifically be a hardware device, such as a terminal device, a backend server, or the like, or software or an application installed on the hardware device, or the like.
As shown in fig. 1, the reading understanding method includes the following steps:
s101, acquiring a preset target problem and a text to be read.
In practical applications, the answer to the question may be a few words, phrases, etc., or may be a long sentence or paragraph. Answers of this type to several words, phrases are called short answer texts, answers to very long sentences or paragraphs are called long answer texts, and of course, how short answer texts and long answer texts are defined depends on the actual situation.
For example, reading material as "five insurance-one money" refers to a combination of several types of guaranteed treatment given to the worker by the human unit, including endowment insurance, medical insurance, unemployment insurance, industrial injury insurance, and fertility insurance, and housing accumulation money.
Problem 1: "is the guarantee treatment for five risks, the answer text of the question 1 is" yes ", the answer of the question 1 is relatively short, and the answer type of the question 1 is a short answer.
Problem 2: "five insurance-one money includes" and the answer text of the question 2 is "endowment insurance, medical insurance, unemployment insurance, industrial injury insurance, fertility insurance, and housing public accumulation money", the answer of the question 2 is longer, and the answer type of the question 2 is a long answer.
In this embodiment, the preset target question is set according to the actual situation of the text to be read.
For example, the text to be read as "five insurance-one money" refers to a combination of several types of guaranteed treatment given to the worker by the human unit, including endowment insurance, medical insurance, unemployment insurance, industrial injury insurance, fertility insurance, and housing accumulation money. The preset target problems are that the five-risk one-money is the guaranteed treatment, the five-risk one-money comprises the guaranteed treatment, and the like.
For another example, the text to be read is an article that describes the earth, the article relating to the composition of the earth, the species on the earth, and the like, and the preset target question is "what the composition of the earth has", "what the species on the earth have", and the like.
S102, performing understanding analysis on the text to be read according to a preset reading understanding model, and generating answer type probability, answer text and corresponding confidence of the target question.
In this embodiment, a preset reading understanding model is constructed in advance by using a large amount of training data. The preset reading understanding model has good general performance, and can well understand the long answer of the target question based on the target question and the text to be read when the long answer corresponding to the target question is provided; and when the short answer corresponding to the target question is provided, the short answer of the target question can be well understood based on the target question and the text to be read.
Specifically, the preset reading understanding model performs understanding analysis on the problem to be read based on the target problem, and the output understanding result includes: the answer type probability, answer text, and corresponding confidence of the target question, but are not limited thereto.
The answer type probability of the target question comprises a long answer type probability and a short answer type probability.
The answer text of the target question comprises a long answer text and a short answer text.
For example, after the target question and the text to be read are input into a preset reading understanding model, the reading understanding model outputs an understanding result as follows: long answer text AlongAnd its confidence degree SlongShort answer text ashortAnd its confidence degree SshortLong answer type probability PlongShort answer type probability Pshort
Further, in order to enable the model to quickly determine whether a question or a paragraph in a text to be read is input, before a target question and the text to be read are input into a preset reading understanding model to be understood, the target question and the text to be read are spliced, wherein in the splicing process, a separator for representing the question is added in front of the target question, and the separator for representing the question is [ CLS ]; if the reading material sample consists of one or more paragraphs, a separator for characterizing a paragraph is added in front of the paragraph of the text to be read, the separator for characterizing a paragraph is for example [ SEP ].
S103, determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient.
In this embodiment, after obtaining the understanding result of the preset reading understanding model, there may be a plurality of implementation manners to determine the target answer of the target question according to the understanding result. For example, the target answer of the target question may be determined from the long answer text and the short answer text according to the magnitude of the long answer type probability and the short answer type probability, and specifically, the answer text with a large probability may be determined as the target answer of the target question. For example, the target answer of the target question may be determined from the long answer text and the short answer text according to the degree of confidence of the long answer text and the degree of confidence of the short answer text, and specifically, the answer text with high degree of confidence may be determined as the target answer of the target question, but is not limited thereto.
As a possible implementation manner, in order to make a better decision, a target answer of the target question is determined by integrating the answer type probability and the confidence of the answer text, and the specific implementation manner of step S103 is as follows:
and S1031, obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text, and a second product of the short answer type probability and the confidence coefficient of the short answer text. S1032, judging whether the first product is larger than the second product.
S1033, if yes, determining the long answer text as a target answer corresponding to the target question;
s1034, if not, determining the short answer text as a target answer corresponding to the target question.
For convenience of description and understanding, the text A with the understanding result as the long answer is usedlongAnd its confidence degree SlongShort answer text ashortAnd its confidence degree SshortLong answer type probability PlongShort answer type probability PshortFor example.
If Plong*SlongGreater than Pshort*SshortLong answer text AlongDetermining a target answer corresponding to the target question; if Plong*SlongLess than Pshort*SshortShort answer text AshortA target answer corresponding to the target question is determined.
According to the reading understanding method provided by the embodiment of the invention, the preset target problem and the text to be read are obtained; performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question; and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient. Therefore, the high-quality long answer text or short answer text can be well understood from the target question and the text to be read based on the preset reading understanding model, the high-quality long answer text or short answer text can be well displayed on different practical situations, the existing special model is not limited to have a good understanding effect on only one answer type, and the understanding effect on the answers of different answer types is improved compared with the existing general model.
Fig. 2 is a flowchart illustrating another reading understanding method according to an embodiment of the present invention. This embodiment describes a training phase of a preset reading understanding model. With reference to fig. 2, on the basis of the embodiment shown in fig. 1, before step S101, the reading and understanding method further includes the following steps:
and S104, acquiring a first sample set.
Wherein a first sample in the first sample set comprises a training question and a reading material sample, a starting position and an ending position of a correct answer of a long answer type in the reading material sample, and annotation data for representing that the answer type of the first sample is a long answer.
And S105, acquiring a second sample set.
Wherein a second sample in the second sample set comprises a training question and a reading material sample, a starting position and an ending position of a correct answer of a short answer type in the reading material sample, and annotation data for representing that the answer type of the second sample is the short answer.
S106, training an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
As a possible implementation manner, if the initial reading understanding model includes at least an encoder, a first prediction layer, a second prediction layer, and a classifier, the implementation manner of step S106 includes the following steps:
s1061, inputting the first sample in the first sample set and the second sample in the second sample set into the coding layer for coding.
In this embodiment, before encoding the first sample or the second sample, the training question and the reading material sample in the first sample or the second sample are spliced, and during splicing, a separator for characterizing the question is added before the training question, where the separator for characterizing the question is, for example, [ CLS ]; if the sample of reading material consists of one or more paragraphs, a separator characterizing the paragraph is added before each paragraph, for example, [ SEP ]. The encoder can quickly determine whether the input is a problem or reads a paragraph in the material sample by identifying the separator.
S1062, training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set, so as to obtain the preset reading understanding model.
In this embodiment, the trained first prediction layer can predict a long answer text and a confidence thereof corresponding to a question to be answered, the trained second prediction layer can predict a short answer text and a confidence thereof corresponding to a question to be answered, and the trained classifier can judge the answer type probability corresponding to the question to be answered.
Fig. 3 is a model structure diagram of an exemplary existing reading understanding model. Taking the existing reading understanding model as the BERT model as an example, the BERT model comprises an encoder and a prediction layer. After the questions to be answered and the texts to be read are spliced, inputting the spliced questions into an encoder for encoding, and outputting encoding vectors; and the coding vector is predicted by the prediction layer to obtain a corresponding answer.
Fig. 4 is a model structure diagram of an exemplary preset reading understanding model according to an embodiment of the present invention. In fig. 4, an encoder is designed to encode each first sample or each second sample, a first prediction layer (the long answer prediction layer in fig. 4) is designed to predict a long answer and its confidence of a question to be answered, a second prediction layer (the short answer prediction layer in fig. 4) is designed to predict a short answer and its confidence of a question to be answered, and an answer type classifier is designed to determine the answer type probability of the question to be answered. Compared with the existing reading understanding model shown in fig. 3, the preset reading understanding model of the embodiment of the invention has one more prediction layer and one more classifier.
The training phase of the first prediction layer is explained here:
taking the training question and the reading material sample in the coded first sample as input, taking the starting position and the ending position of the correct answer of the long answer type in the coded first sample in the reading material sample as expected output, training a first prediction layer until the first prediction layer converges, wherein the converged first prediction layer can predict a long answer text corresponding to the question to be answered and the confidence coefficient thereof.
It should be noted that the structure of the first prediction layer may be the same as that of the prediction layer in the existing reading understanding model, or may be designed by itself.
The training phase of the second prediction layer is explained here:
and taking the training question and the reading material sample in the coded second sample as input, taking the starting position and the ending position of the correct answer of the short answer type in the coded second sample in the reading material sample as expected output, training a second prediction layer until the second prediction layer converges, wherein the converged second prediction layer can predict the short answer text corresponding to the question to be answered and the confidence coefficient thereof.
It should be noted that the structure of the second prediction layer may be the same as that of the prediction layer in the existing reading understanding model, or may be designed by itself.
The training phase of the classifier is explained here:
taking the training question, the reading material sample and the labeled data for representing that the answer type of the first sample is a long answer in the coded first sample as a training sample, and taking the training question, the reading material sample and the labeled data for representing that the answer type of the second sample is a short answer in the coded second sample as a training sample;
and taking the training questions and the reading material samples in the training samples as output, taking the marking data in the training samples as expected output, training the classifier until the classifier is converged, and judging answer type probability corresponding to the questions to be answered by the converged classifier.
It should be noted that the classifier is, for example, a support vector machine-based classifier, a decision tree-based classifier, but not limited thereto.
Compared with the existing reading understanding model, the reading understanding method provided by the embodiment of the invention has the advantages that the preset reading understanding model not only comprises a first prediction layer capable of predicting long answers and a second prediction layer capable of predicting short answers on the model structure, but also comprises a classifier capable of judging answer types, and as the first prediction layer and the second prediction layer are trained separately and correspond to different model structures and parameters aiming at different answer types, the preset reading understanding model can perform well aiming at reading understanding scenes of different actual situations, and has better flexibility and effect; through the joint training, the model learns better features, the general performance is better, the understanding effect of the existing special model on the answer of one answer type is not limited, the conflict problem between the long answer model and the short answer model is well solved, and the understanding effect of the answers of different answer types is improved compared with the existing general model sharing the model parameters.
Fig. 5 is a schematic structural diagram of a reading and understanding apparatus according to an embodiment of the present invention. The embodiment provides a reading and understanding device which is an execution main body of the reading and understanding method, and the execution main body is composed of hardware and/or software. As shown in fig. 5, the reading and understanding apparatus includes: the device comprises an acquisition module 11, a generation module 12 and a determination module 13.
The acquisition module 11 is used for acquiring a preset target question and a text to be read;
the generating module 12 is configured to perform understanding analysis on the text to be read according to a preset reading understanding model, and generate an answer type probability, an answer text, and a corresponding confidence of the target question;
and the determining module 13 is configured to determine a target answer corresponding to the target question according to the answer type probability, the answer text, and the corresponding confidence.
In a possible implementation manner, the determining module 13 is specifically configured to:
obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text and a second product of the short answer type probability and the confidence coefficient of the short answer text; judging whether the first product is larger than the second product;
if yes, determining the long answer text as a target answer corresponding to the target question;
if not, determining the short answer text as a target answer corresponding to the target question.
In one possible implementation, the apparatus further includes: a splicing module;
and the splicing is used for splicing the target question and the text to be read after the preset target question and the text to be read are obtained, wherein in the splicing process, a separator for representing the question is added in front of the target question, and a separator for representing the paragraph is added in front of the paragraph of the text to be read.
It should be noted that the foregoing explanation on the reading and understanding method embodiment is also applicable to the reading and understanding device of the embodiment, and is not repeated herein.
The reading understanding device provided by the embodiment of the invention obtains the preset target problem and the text to be read; performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question; and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient. Therefore, high-quality long answer texts or short answer texts can be well understood from the target questions and the texts to be read based on the preset reading understanding model, the high-quality long answer texts or short answer texts can be well represented under different actual conditions, the existing special model is not limited to have a good understanding effect on answers of one answer type, and the understanding effect on the answers of different answer types is improved compared with the existing general model.
Fig. 6 is a schematic structural diagram of another reading and understanding apparatus according to an embodiment of the present invention. With reference to fig. 6 in combination, on the basis of the embodiment shown in fig. 5, the apparatus further includes: a training module 14;
the obtaining module 11 is further configured to obtain a first sample set, where the first sample in the first sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a long answer type in the reading material sample, and label data for characterizing that the answer type of the first sample is a long answer;
the obtaining module 11 is further configured to obtain a second sample set, where the second sample in the second sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a short answer type in the reading material sample, and labeling data used for characterizing that the answer type of the second sample is a short answer;
the training module 14 is configured to train an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
In a possible implementation manner, the initial reading understanding model at least includes an encoder, a first prediction layer, a second prediction layer, and a classifier, and the training module 14 is specifically configured to:
inputting the first sample in the first sample set and the second sample in the second sample set into the encoder for encoding respectively;
training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set to obtain the preset reading understanding model;
the trained first prediction layer can predict a long answer text and confidence coefficient corresponding to a question needing to be answered, the trained second prediction layer can predict a short answer text and confidence coefficient corresponding to the question needing to be answered, and the trained classifier can judge the answer type probability corresponding to the question needing to be answered.
It should be noted that the foregoing explanation on the reading and understanding method embodiment is also applicable to the reading and understanding device of the embodiment, and is not repeated herein.
Compared with the existing reading understanding model, the reading understanding device provided by the embodiment of the invention has the advantages that the preset reading understanding model not only comprises the first prediction layer capable of predicting long answers and the second prediction layer capable of predicting short answers on the model structure, but also comprises the classifier capable of judging answer types, as the first prediction layer and the second prediction layer are separately trained and correspond to different model structures and parameters aiming at different answer types, the preset reading understanding model can well perform and has better flexibility and effect aiming at the reading understanding scenes of different practical situations, the model learns better characteristics through joint training, the universality is better, the model is not limited to the existing special model to have good understanding effect only on the answers of one answer type, and the conflict problem between the long answer model and the short answer model is well solved, and compared with the existing general model with common model parameters, the understanding effect of the answers of different answer types is improved.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention. The computer device includes:
memory 1001, processor 1002, and computer programs stored on memory 1001 and executable on processor 1002.
The processor 1002, when executing the program, implements the reading understanding method provided in the above-described embodiment.
Further, the computer device further comprises:
a communication interface 1003 for communicating between the memory 1001 and the processor 1002.
A memory 1001 for storing computer programs that may be run on the processor 1002.
Memory 1001 may include high-speed RAM memory and may also include non-volatile memory (e.g., at least one disk memory).
The processor 1002 is configured to implement the reading understanding method according to the foregoing embodiments when executing the program.
If the memory 1001, the processor 1002, and the communication interface 1003 are implemented independently, the communication interface 1003, the memory 1001, and the processor 1002 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
Optionally, in a specific implementation, if the memory 1001, the processor 1002, and the communication interface 1003 are integrated on one chip, the memory 1001, the processor 1002, and the communication interface 1003 may complete communication with each other through an internal interface.
The processor 1002 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement embodiments of the present invention.
The present embodiment also provides a computer-readable storage medium on which a computer program is stored, wherein the program is characterized by implementing the reading understanding method as described above when executed by a processor.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (12)

1. A reading comprehension method comprising:
acquiring a preset target problem and a text to be read;
performing understanding analysis on the text to be read according to a preset reading understanding model to generate answer type probability, answer text and corresponding confidence of the target question, wherein the answer type probability comprises long answer type probability and short answer type probability;
and determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient.
2. The method of claim 1, wherein the determining a target answer corresponding to the target question according to the answer text type probability, the answer text, and the corresponding confidence level comprises:
obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text and a second product of the short answer type probability and the confidence coefficient of the short answer text;
judging whether the first product is larger than the second product;
if yes, determining the long answer text as a target answer corresponding to the target question;
if not, determining the short answer text as a target answer corresponding to the target question.
3. The method of claim 1, wherein prior to said obtaining the preset target question and the text to be read, further comprising:
obtaining a first sample set, wherein the first sample in the first sample set comprises a training question and a reading material sample, a starting position and an ending position of a correct answer of a long answer type in the reading material sample, and annotation data for representing that the answer type of the first sample is a long answer;
acquiring a second sample set, wherein a second sample in the second sample set comprises a training question, a reading material sample, a starting position and an ending position of a correct answer of a short answer type in the reading material sample, and annotation data for representing that the answer type of the second sample is a short answer;
training an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
4. The method of claim 3, wherein the initial reading understanding model at least comprises an encoder, a first prediction layer, a second prediction layer, and a classifier, and wherein training the initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model comprises:
inputting the first sample in the first sample set and the second sample in the second sample set into the encoder for encoding respectively;
training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set to obtain the preset reading understanding model;
the trained first prediction layer can predict a long answer text and confidence coefficient corresponding to a question needing to be answered, the trained second prediction layer can predict a short answer text and confidence coefficient corresponding to the question needing to be answered, and the trained classifier can judge the answer type probability corresponding to the question needing to be answered.
5. The method according to any one of claims 1 to 4, further comprising, after the obtaining of the preset target question and the text to be read:
and splicing the target question and the text to be read, wherein in the splicing process, a separator for representing a question is added in front of the target question, and a separator for representing a paragraph is added in front of the paragraph of the text to be read.
6. A reading and understanding apparatus, comprising:
the acquisition module is used for acquiring a preset target problem and a text to be read;
the generating module is used for performing understanding analysis on the text to be read according to a preset reading understanding model, and generating answer type probability, answer text and corresponding confidence coefficient of the target question, wherein the answer type probability comprises long answer type probability and short answer type probability;
and the determining module is used for determining a target answer corresponding to the target question according to the answer type probability, the answer text and the corresponding confidence coefficient.
7. The apparatus of claim 6, wherein the determining module is specifically configured to:
obtaining a first product of the long answer type probability and the confidence coefficient of the long answer text and a second product of the short answer type probability and the confidence coefficient of the short answer text; judging whether the first product is larger than the second product;
if yes, determining the long answer text as a target answer corresponding to the target question;
if not, determining the short answer text as a target answer corresponding to the target question.
8. The apparatus of claim 6, further comprising: a training module;
the obtaining module is further configured to obtain a first sample set, where the first sample in the first sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a long answer type in the reading material sample, and labeling data used for representing that the answer type of the first sample is a long answer;
the obtaining module is further configured to obtain a second sample set, where a second sample in the second sample set includes a training question and a reading material sample, a start position and an end position of a correct answer of a short answer type in the reading material sample, and labeling data used for representing that an answer type of the second sample is a short answer;
the training module is configured to train an initial reading understanding model based on the first sample set and the second sample set to obtain the preset reading understanding model.
9. The apparatus of claim 8, wherein the initial reading understanding model comprises at least an encoder, a first prediction layer, a second prediction layer, and a classifier, and wherein the training module is specifically configured to:
inputting the first sample in the first sample set and the second sample in the second sample set into the encoder for encoding respectively;
training the first prediction layer by using each encoded first sample, training the second prediction layer by using each encoded second sample set, and training the classifier by using each encoded first sample set and each encoded second sample set to obtain the preset reading understanding model;
the trained first prediction layer can predict a long answer text and confidence coefficient corresponding to a question needing to be answered, the trained second prediction layer can predict a short answer text and confidence coefficient corresponding to the question needing to be answered, and the trained classifier can judge the answer type probability corresponding to the question needing to be answered.
10. The apparatus of any one of claims 6 to 8, further comprising: a splicing module;
and the splicing is used for splicing the target question and the text to be read after the preset target question and the text to be read are obtained, wherein in the splicing process, a separator for representing the question is added in front of the target question, and a separator for representing the paragraph is added in front of the paragraph of the text to be read.
11. A computer device, comprising:
memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the reading comprehension method according to one of claims 1 to 5 when executing the program.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the reading comprehension method of one of claims 1 to 5.
CN201910429805.0A 2019-05-22 2019-05-22 Reading understanding method and device Active CN110210021B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910429805.0A CN110210021B (en) 2019-05-22 2019-05-22 Reading understanding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910429805.0A CN110210021B (en) 2019-05-22 2019-05-22 Reading understanding method and device

Publications (2)

Publication Number Publication Date
CN110210021A CN110210021A (en) 2019-09-06
CN110210021B true CN110210021B (en) 2021-05-28

Family

ID=67788119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910429805.0A Active CN110210021B (en) 2019-05-22 2019-05-22 Reading understanding method and device

Country Status (1)

Country Link
CN (1) CN110210021B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110955755A (en) * 2019-11-29 2020-04-03 支付宝(杭州)信息技术有限公司 Method and system for determining target standard information
CN113111232A (en) * 2020-02-13 2021-07-13 北京明亿科技有限公司 Regular expression-based alarm receiving and processing text address extraction method and device
CN111428467A (en) * 2020-02-19 2020-07-17 平安科技(深圳)有限公司 Method, device, equipment and storage medium for generating reading comprehension question topic
CN111858878B (en) * 2020-06-18 2023-12-22 达观数据有限公司 Method, system and storage medium for automatically extracting answer from natural language text
CN111814466A (en) * 2020-06-24 2020-10-23 平安科技(深圳)有限公司 Information extraction method based on machine reading understanding and related equipment thereof
CN112215004B (en) * 2020-09-04 2023-05-02 中国电子科技集团公司第二十八研究所 Application method of transfer learning-based text entity extraction in military equipment
CN112509690B (en) * 2020-11-30 2023-08-04 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for controlling quality
CN112800186B (en) * 2021-04-08 2021-10-12 北京金山数字娱乐科技有限公司 Reading understanding model training method and device and reading understanding method and device
CN113657089A (en) * 2021-08-20 2021-11-16 西安电子科技大学 English reading understanding auxiliary question setting method and system
CN114490990B (en) * 2022-01-28 2023-05-23 北京百度网讯科技有限公司 Method, device, equipment and storage medium for determining text to be annotated

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140006012A1 (en) * 2012-07-02 2014-01-02 Microsoft Corporation Learning-Based Processing of Natural Language Questions
US10073831B1 (en) * 2017-03-09 2018-09-11 International Business Machines Corporation Domain-specific method for distinguishing type-denoting domain terms from entity-denoting domain terms
CN108846063B (en) * 2018-06-04 2020-12-22 北京百度网讯科技有限公司 Method, device, equipment and computer readable medium for determining answers to questions
CN109344234A (en) * 2018-09-06 2019-02-15 和美(深圳)信息技术股份有限公司 Machine reads understanding method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110210021A (en) 2019-09-06

Similar Documents

Publication Publication Date Title
CN110210021B (en) Reading understanding method and device
CN110188350B (en) Text consistency calculation method and device
CN110188202B (en) Training method and device of semantic relation recognition model and terminal
US11861307B2 (en) Request paraphrasing system, request paraphrasing model and request determining model training method, and dialogue system
CN109344413B (en) Translation processing method, translation processing device, computer equipment and computer readable storage medium
CN107731228B (en) Text conversion method and device for English voice information
CN108038107B (en) Sentence emotion classification method, device and equipment based on convolutional neural network
JP6677419B2 (en) Voice interaction method and apparatus
JP7457125B2 (en) Translation methods, devices, electronic equipment and computer programs
CN106844340B (en) News abstract generating and displaying method, device and system based on artificial intelligence
CN111401071A (en) Model training method and device, computer equipment and readable storage medium
CN110874536B (en) Corpus quality evaluation model generation method and double-sentence pair inter-translation quality evaluation method
CN112528637A (en) Text processing model training method and device, computer equipment and storage medium
CN112364664B (en) Training of intention recognition model, intention recognition method, device and storage medium
CN112183055A (en) Information acquisition method and device combining RPA and AI, computer equipment and medium
CN110276081B (en) Text generation method, device and storage medium
CN113033200B (en) Data processing method, text recognition model generation method and text recognition method
CN112395880B (en) Error correction method and device for structured triples, computer equipment and storage medium
CN110188327B (en) Method and device for removing spoken language of text
CN112241629A (en) Pinyin annotation text generation method and device combining RPA and AI
CN116306663B (en) Semantic role labeling method, device, equipment and medium
CN108829896B (en) Reply information feedback method and device
CN110852103A (en) Named entity identification method and device
CN115964484A (en) Legal multi-intention identification method and device based on multi-label classification model
CN114707518A (en) Semantic fragment-oriented target emotion analysis method, device, equipment and medium

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