CN113792120B - Graph network construction method and device, reading and understanding method and device - Google Patents

Graph network construction method and device, reading and understanding method and device Download PDF

Info

Publication number
CN113792120B
CN113792120B CN202111110988.3A CN202111110988A CN113792120B CN 113792120 B CN113792120 B CN 113792120B CN 202111110988 A CN202111110988 A CN 202111110988A CN 113792120 B CN113792120 B CN 113792120B
Authority
CN
China
Prior art keywords
word
feature vector
graph network
initial
sample
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
CN202111110988.3A
Other languages
Chinese (zh)
Other versions
CN113792120A (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 Kingsoft Digital Entertainment Co Ltd
Original Assignee
Beijing Kingsoft Digital Entertainment 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 Kingsoft Digital Entertainment Co Ltd filed Critical Beijing Kingsoft Digital Entertainment Co Ltd
Priority to CN202111110988.3A priority Critical patent/CN113792120B/en
Publication of CN113792120A publication Critical patent/CN113792120A/en
Application granted granted Critical
Publication of CN113792120B publication Critical patent/CN113792120B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a method and a device for constructing a graph network, and a method and a device for reading and understanding, wherein the method for constructing the graph network comprises the following steps: determining a first feature vector in a first feature vector group as an attention value of a first node in an initial first graph network, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network; determining a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network; determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; and determining the attention value between the first node and the second node with the edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain the first graph network, thereby improving the accuracy of reading and understanding the model.

Description

Graph network construction method and device, reading and understanding method and device
Technical Field
The present application relates to the field of natural language processing technologies, and in particular, to a method and apparatus for constructing a graph network, a method and apparatus for reading and understanding, a computing device, and a computer readable storage medium.
Background
Machine-readable understanding is a study that is directed to teaching a machine to read a human language and understand its meaning, and is widely used as a popular direction in the field of natural language processing with the development of natural language processing technology. The machine-readable understanding task is more focused on understanding text and learning related information from the text so that questions related to the text can be answered.
In the prior art, a method for training a machine to understand text mainly comprises the steps of constructing a model to be trained, and training the model to be trained to obtain a reading and understanding model meeting requirements, so that the reading and understanding model can finish reading and understanding tasks as accurately as possible. Specifically, the sample questions and the sample answers can be used as training samples to be input into the model to be trained, the model to be trained can output predicted answers, and the model to be trained is optimized according to the difference between the predicted answers and the sample answers so as to obtain a desired reading understanding model.
However, the above method only considers the association relationship between the questions and the answers, the comparison is single, and some questions can be applied to different texts, and the answers obtained for different texts are different, so the accuracy of executing the reading and understanding task by the reading and understanding model obtained through training in the above method may be low.
Disclosure of Invention
In view of this, the embodiment of the application provides a method for constructing a graph network. The application also relates to a training method of the reading and understanding model, a reading and understanding method, a construction device of the graph network, a training device of the reading and understanding model, a computing device and a computer readable storage medium, which are used for solving the technical defects in the prior art.
According to a first aspect of an embodiment of the present application, there is provided a training method for reading an understanding model, including:
constructing an initial first graph network of sample text fragments and sample answers through a graph construction network layer of a reading and understanding model, and constructing an initial second graph network of sample questions and the sample answers;
inputting the sample text fragments, the sample questions and the sample answers into a text processing layer of the reading understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain a first graph network and a second graph network;
Inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer;
and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached.
According to a second aspect of an embodiment of the present application, there is provided a reading and understanding method, including:
constructing an initial first graph network of a target text and a target answer through a graph construction network layer of a reading and understanding model, and constructing an initial second graph network of a target question and the target answer, wherein the reading and understanding model is trained by the method of the first aspect;
inputting the target text, the target questions and the target answers into a text processing layer of the reading understanding model, and adding attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network;
and inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain an answer to the target question.
According to a third aspect of an embodiment of the present application, there is provided a method for constructing a graph network, including:
Determining a first feature vector in a first feature vector group as an attention value of a first node in an initial first graph network, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network;
determining a third feature vector in a third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
and determining the attention value between the first node and the second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain the first graph network.
According to a fourth aspect of embodiments of the present application, there is provided another reading and understanding method, comprising:
constructing an initial first graph network of a target text and a target answer through a graph construction network layer of a reading and understanding model, and constructing an initial second graph network of a target question and the target answer, wherein the reading and understanding model is trained by the method of the first aspect or the third aspect;
Inputting the target text, the target questions and the target answers into a feature extraction layer of the reading understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group;
determining a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network through the attention layer of the reading understanding model, wherein the first node is a node corresponding to a word unit of a target text in the initial first graph network;
determining a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a target answer in the initial first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; determining an attention value between a first node and a second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain a first graph network;
Adding attention values to nodes and edges of the initial second graph network based on a second feature vector group and the third feature vector group through an attention layer to obtain a second graph network;
and inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain an answer to the target question.
According to a fifth aspect of an embodiment of the present application, there is provided a device for constructing a graph network, including:
the first determining module is configured to determine a first feature vector in a first feature vector group as an attention value of a first node in an initial first graph network, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network;
the second determining module is configured to determine a third feature vector in a third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network;
a third determining module configured to determine, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
And a fourth determining module configured to determine, based on the first feature vector group and the third feature vector group, an attention value between a first node and a second node where an edge exists in the initial first graph network and obtain the first graph network as the attention value of the edge.
According to a sixth aspect of embodiments of the present application, there is provided a reading and understanding apparatus comprising:
a graph network construction module configured to construct an initial first graph network of a target text and a target answer through a graph construction network layer of a reading understanding model, and construct an initial second graph network of a target question and the target answer, wherein the reading understanding model is trained by the method described in the first aspect or the third aspect;
the acquisition module is configured to input the target text, the target questions and the target answers into the feature extraction layer of the reading understanding model to acquire a first feature vector group, a second feature vector group and a third feature vector group respectively;
a fifth determining module, configured to determine, by reading an attention layer of the understanding model, a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, where the first node is a node corresponding to a word unit of a target text in the initial first graph network;
A sixth determining module, configured to determine a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, where the second node is a node corresponding to a word unit of a target answer in the initial first graph network;
a seventh determining module configured to determine, based on the first feature vector set, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; determining an attention value between a first node and a second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain a first graph network;
an eighth determining module configured to add, through the attention layer, attention values to nodes and edges of the initial second graph network based on a second feature vector set and the third feature vector set, to obtain a second graph network;
a ninth determination module configured to input the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to determine an answer to the target question.
According to a seventh aspect of the embodiment of the present application, there is provided a training apparatus for reading an understanding model, including:
a first graph network construction module configured to construct an initial first graph network of sample text fragments and sample answers by reading a graph construction network layer of an understanding model, and to construct an initial second graph network of sample questions and the sample answers;
the first text processing module is configured to input the sample text fragments, the sample questions and the sample answers into a text processing layer of the reading understanding model, and add attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network;
the prediction module is configured to input the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer;
and the training module is configured to train the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached.
According to an eighth aspect of embodiments of the present application, there is provided another reading and understanding apparatus comprising:
A second graph network construction module configured to construct an initial first graph network of the target text and the target answer through a graph construction network layer of a reading understanding model, and construct an initial second graph network of the target question and the target answer;
the second text processing module is configured to input the target text, the target questions and the target answers into the text processing layer of the reading understanding model, and add attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network;
and the determining module is configured to input the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to determine an answer to the target question.
According to a ninth aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the method of the first, second, third or fourth aspects or comprising the apparatus of the fifth, sixth, seventh or eighth aspects.
According to a tenth aspect of embodiments of the present application, there is provided a computer readable storage medium storing computer executable instructions which when executed by a processor implement the steps of the method of the first, second, third or fourth aspects or comprise the apparatus of the fifth, sixth, seventh or eighth aspects.
According to an eleventh aspect of embodiments of the present application, there is provided a chip storing computer instructions which, when executed by the chip, implement the steps of the method of the first, second, third or fourth aspects described above.
In the embodiment of the application, a network layer is constructed through reading and understanding the graph of the model to construct an initial first graph network of sample text fragments and sample answers, and an initial second graph network of sample questions and sample answers is constructed; inputting the sample text fragments, the sample questions and the sample answers into a text processing layer of the reading understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain a first graph network and a second graph network; inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer; and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached. The method can effectively utilize the feature vectors of the sample text fragments, the sample questions and the sample answers, extract the association relation among the sample text fragments, the sample questions and the sample answers, train the reading and understanding model by combining the association relation among the sample text fragments, the sample questions and the sample answers, and improve the accuracy of the reading and understanding model in executing the reading and understanding tasks.
In the embodiment of the application, a first feature vector in a first feature vector group is determined as an attention value of a first node in an initial first graph network, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network; determining a third feature vector in a third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network; determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; and determining the attention value between the first node and the second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain the first graph network. Therefore, by adding the attention value to the nodes and edges of the initial first graph network, the correlation among the sample text fragments, the sample answers and the sample questions can be further learned when the reading and understanding model processes the first graph network, and the accuracy of the reading and understanding model in processing the reading and understanding task can be improved.
Drawings
FIG. 1 is a block diagram of a computing device according to one embodiment of the application;
FIG. 2 is a flow chart of a training method for reading understanding models according to an embodiment of the present application;
FIG. 3 is a flow chart of data between layers of a reading understanding model at model training time according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an initial third graph network according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an initial first graph network according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an initial fourth graph network according to an embodiment of the present application;
FIG. 7 is a schematic diagram of an initial second graph network according to an embodiment of the present application;
FIG. 8 is a process flow diagram of a reading understanding model training method applied to choice questions provided in an embodiment of the present application;
FIG. 9 is a flow chart of a reading and understanding method provided by an embodiment of the application;
FIG. 10 is a flow chart of data between layers of a reading understanding model at the time of application provided by an embodiment of the present application;
FIG. 11 is a schematic diagram of another initial first graph network provided by an embodiment of the present application;
FIG. 12 is a schematic diagram of another initial second graph network provided in accordance with an embodiment of the present application;
FIG. 13 is a flow chart of a process for reading understanding models applied to choice questions provided by an embodiment of the present application;
FIG. 14 is a schematic diagram of a training device for reading and understanding models according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of a reading and understanding device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. The present application may be embodied in many other forms than those herein described, and those skilled in the art will readily appreciate that the present application may be similarly embodied without departing from the spirit or essential characteristics thereof, and therefore the present application is not limited to the specific embodiments disclosed below.
The terminology used in the one or more embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the application. As used in one or more embodiments of the application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of the application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the application. The word "if" as used herein may be interpreted as "responsive to a determination" depending on the context.
First, terms related to one or more embodiments of the present application will be explained.
The Bert model: (Bidirectional Encoder Representations from Transformer) is a dynamic word vector technology, adopts a bidirectional transducer model to train a label-free data set, comprehensively considers the contextual characteristic information, and can better solve the problems of word ambiguity and the like.
GCN model: graph Convolutional Network a graph roll-up network model may be used to extract features of the graph.
Word vector: a representation of a word is one that is intended to be processed by a computer.
Word embedding: refers to the process of embedding a high-dimensional space, which is the number of all words in dimension, into a continuous vector space, which is much lower in dimension, each word or phrase being mapped to a vector on the real number domain.
Word unit: before any actual processing of the input text, it needs to be split into language units such as words, punctuation marks, numbers or letters, which are called word units. For english text, word units may be a word, a punctuation mark, a number, etc.; for chinese text, the smallest word unit may be a word, a punctuation mark, a number, etc.
word2vec: one method for word embedding processing is a high-efficiency word vector training method constructed by Mikolov on the basis of Bengio Neural Network Language Model (NNLM). The word embedding processing can be carried out on the text by using the method, so that word vectors of the text are obtained.
First word unit: in a model training stage of a reading and understanding model, the first word unit refers to a word unit obtained by word segmentation processing of a sample text fragment; and in the reading and understanding task executing stage of the reading and understanding model, the first word unit refers to a word unit obtained after word segmentation processing is carried out on the target text.
First word unit group: a word unit group consisting of a plurality of first word units.
Second word unit: in a model training stage of the reading and understanding model, the second word unit refers to a word unit obtained after word segmentation processing is carried out on the sample problem; and in the reading and understanding task executing stage of the reading and understanding model, the second word unit refers to a word unit obtained after word segmentation processing is carried out on the target problem.
Second word unit group: and a word unit group consisting of a plurality of second word units.
Third word unit: in a model training stage of the reading and understanding model, the second word unit refers to a word unit obtained after word segmentation processing is carried out on the sample answers; and in the reading and understanding task executing stage of the reading and understanding model, the second word unit refers to a word unit obtained after word segmentation processing is carried out on the target answer.
Third word unit group: and a word unit group consisting of a plurality of third word units.
First feature vector: in a model training stage of a reading and understanding model, a first feature vector is a vector obtained after word embedding processing is carried out on a first word unit in a sample text fragment; and in the reading and understanding task executing stage of the reading and understanding model, the first feature vector refers to a vector obtained after word embedding processing is carried out on a first word unit of the target text.
A first set of feature vectors: and a feature vector group consisting of a plurality of first feature vectors.
Second feature vector: in a model training stage of the reading and understanding model, the second feature vector is a vector obtained after word embedding processing is carried out on a second word unit in the sample problem; and in the reading and understanding task executing stage of the reading and understanding model, the first feature vector refers to a vector obtained after word embedding processing is carried out on a second word unit of the target problem.
A second set of feature vectors: and a feature vector group consisting of a plurality of second feature vectors.
Third feature vector: in a model training stage of the reading and understanding model, the third feature vector refers to a vector obtained after word embedding processing is carried out on a third word unit in the sample answer; and in the reading and understanding task executing stage of the reading and understanding model, the third feature vector refers to a vector obtained by carrying out word embedding processing on a third word unit of the target answer.
Third feature vector group: and a feature vector group formed by a plurality of third feature vectors.
Initial first graph network: in a model training stage of reading and understanding the model, the initial first graph network is a graph network for representing the association relationship between the sample text fragments and the sample answers; in the reading and understanding model executing reading and understanding task stage, the initial first graph network is a graph network for representing the association relation between the target text and the target answer.
Initial second graph network: in a model training stage of reading and understanding the model, the initial second graph network is a graph network for representing the association relationship between the sample questions and the sample answers; in the reading and understanding model executing reading and understanding task stage, the initial second graph network is a graph network for representing the association relation between the target question and the target answer.
Initial third graph network: in a model training stage of reading and understanding the model, the initial third graph network is a graph network for representing the dependency relationship among word units in the sample text fragment; in the reading understanding model execution reading understanding task stage, the initial third graph network is a graph network characterizing the dependency relationship between word units in the target text.
Initial fourth graph network: in a model training stage of reading and understanding the model, the initial third graph network is a graph network for representing the dependency relationship among word units in the sample problem; in the reading understanding model execution reading understanding task stage, the initial third graph network is a graph network that characterizes dependencies between word units in the target problem.
First graph network: initial first graph network including attention values of nodes and attention values of edges
Second graph network: initial second graph network including attention values of nodes and attention values of edges
First hidden layer feature vector: and the vector representation of the first graph network is obtained after the first graph network is subjected to convolution processing through the graph convolution network layer.
Second hidden layer feature vector: and the vector representation of the second graph network is obtained after the second graph network is subjected to convolution processing through the graph convolution network layer.
Target hidden layer feature vector: the first hidden layer feature vector and the second hidden layer feature vector are combined to obtain a vector representation.
In the present application, a training method of a reading understanding model is provided, and the present application relates to a training apparatus of a reading understanding model, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
FIG. 1 illustrates a block diagram of a computing device 100, according to an embodiment of the application. The components of the computing device 100 include, but are not limited to, a memory 110 and a processor 120. Processor 120 is coupled to memory 110 via bus 130 and database 150 is used to store data.
Computing device 100 also includes access device 140, access device 140 enabling computing device 100 to communicate via one or more networks 160. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 140 may include one or more of any type of network interface, wired or wireless (e.g., a Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the application, the above-described components of computing device 100, as well as other components not shown in FIG. 1, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device shown in FIG. 1 is for exemplary purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 100 may be any type of stationary or mobile computing device including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 100 may also be a mobile or stationary server.
Wherein the processor 120 may perform the steps of the training method of the reading understanding model shown in fig. 2. Fig. 2 shows a flowchart of a training method for reading understanding models according to an embodiment of the present application, including steps 202 to 210.
Step 202, constructing an initial first graph network of sample text fragments and sample answers by a graph construction network layer of a reading understanding model, and constructing an initial second graph network of sample questions and sample answers.
The reading understanding model is used for executing reading understanding tasks, and correct answers of the questions can be output under the condition of given text, the questions and the answers to be selected. The sample answer is a correct answer to the sample question corresponding to the sample text segment. The sample text segment may be any text segment obtained by segmenting the sample text.
The initial first graph network is used for representing the association relation between the sample text fragments and the sample answers, and the initial second graph network is used for representing the association relation between the sample questions and the sample answers.
In some embodiments, the training data set may be pre-constructed from a plurality of sample text, a plurality of sample questions, and a plurality of sample answers.
As an example, there is a correspondence among a plurality of sample texts, a plurality of sample questions and a plurality of sample answers, since the sample texts are generally text with chapter level, the data size is relatively large, and the model processing is relatively difficult, so that each sample text can be segmented or sentence-processed to obtain a plurality of sample text fragments of each sample text, and then the plurality of sample text fragments of each sample text correspond to the sample questions and sample answers corresponding to the sample text, the plurality of sample text fragments, the plurality of sample questions and the plurality of sample answers can be stored in the training data set, and the sample text fragments, the sample questions and the sample answers with the correspondence are in correspondence, so that one sample text fragment, one sample question and one sample answer with the correspondence can be called a set of training data.
As another example, since the sample text is generally text of chapter level, the data volume is relatively large, and the model processing is relatively difficult, each sample text may be segmented or sentence-processed to obtain a plurality of sample text fragments of each sample text. Taking a reference sample text as an example, a plurality of sample text fragments of the reference sample text may be referred to as reference sample text fragments, a sample question corresponding to the reference sample text may be referred to as a reference sample question, a sample answer corresponding to the reference sample text and the reference sample question may be referred to as a reference sample answer, and then the plurality of sample text fragments may be respectively matched with the reference sample question to determine a plurality of first similarities, and the plurality of sample text fragments may be respectively matched with the reference sample answer to determine a plurality of second similarities, so as to obtain a reference sample text fragment having a first similarity and a second similarity greater than a similarity threshold, and the obtained reference sample text fragment may be considered to have a strong correlation with the reference sample question, and the reference sample text fragment and the reference sample answer may be considered to have a strong correlation, so that the obtained reference sample text fragment, the reference sample question and the reference sample answer may be used as a set of data. And carrying out the processing on each sample text to obtain a plurality of groups of training data, wherein the relevance between the sample text fragments in each group of training data and the corresponding sample questions and sample answers is higher.
In both exemplary ways, a training data set may be created that includes multiple sets of training data, from which multiple sets of training data may be obtained and input into the graph construction network layer of the reading understanding model.
Illustratively, referring to fig. 3, a graph construction network layer of a sample text segment, a sample question, and a sample answer may be input to a reading understanding model, an initial first graph network is derived based on the sample text segment and the sample answer, and an initial second graph network is derived based on the sample question and the sample answer.
In an implementation, constructing an initial first graph network of sample text fragments and sample answers by a graph construction network layer of a reading understanding model, and constructing an initial second graph network of sample questions and sample answers may include: an initial third graph network is constructed based on the dependencies between word units in the sample text segment, and an initial fourth graph network is constructed based on the dependencies between word units in the sample question. Constructing the initial first graph network based on the association relationship between the initial third graph network and the sample answer, and constructing the initial second graph network based on the association relationship between the initial fourth graph network and the sample answer.
Wherein the initial third graph network is used to characterize dependencies between word units in the sample text segment. The initial fourth graph network is used to characterize the dependencies between word units in the sample question.
That is, an initial third graph network reflecting the dependency relationship between word units in the sample text segment can be constructed, and then the first graph network is constructed according to the association relationship between the sample answer and the sample text segment on the basis of the initial third graph network. And firstly constructing an initial fourth graph network reflecting the dependency relationship between word units in the sample questions, and then constructing a second graph network according to the association relationship between the sample answers and the sample questions on the basis of the initial fourth graph network.
Thus, the association relationship between the word units of the sample text fragments and the word units of the sample answers can be clearly described through the first graph network, the association relationship between the word units of the sample questions and the word units of the sample answers can be clearly described through the second graph network, and the association relationship between the word units of the sample questions and the word units of the sample answers can be preliminarily obtained, so that preparation is provided for further use.
In some embodiments, constructing an initial third graph network based on dependencies between word units in the sample text segment may include: taking word units in the sample text fragments as nodes to obtain a plurality of nodes; and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample text fragment to obtain the initial third graph network.
That is, with word units in the sample text segment as nodes and dependencies between word units as edges, an initial third graph network can be constructed that characterizes the dependencies between word units in the sample text segment. Therefore, the association relation between the word units in the sample text segment can be preliminarily determined, and the learning of the relation between the word units in the sample text segment by the model can be enhanced.
As one example, a sample text segment may be subject to dependency analysis by a Stanford Core NLP (Natural Language Processing ) algorithm, and dependencies between word units in the sample text segment may be obtained.
Illustratively, the dependency analysis is performed on the sample text segment "i love my ancestor" by Stanford Core NLP algorithm, i can get "i" as the subject, "i" as the predicate, "my ancestor" as the object, and we can get the dependency relationship between "i", "ancestor" and "country". For example, in the sample text segment, one "me" has a dependency relationship with "love", one "me" has a dependency relationship with "ancestor" and "ancestor" has a dependency relationship with "ancestor", and the initial third graph network shown in fig. 4 can be obtained based on the dependency relationship.
In some embodiments, the constructing the initial first graph network based on the association relationship between the initial third graph network and the sample answer may include: and based on the association relation between the word units in the sample answers and the word units in the sample text fragments, connecting the target node with the nodes in the initial third graph network by taking the word units in the sample answers as target nodes, and obtaining the initial first graph network.
That is, the word units in the sample answers can be used as target nodes, and the target nodes are connected with the nodes corresponding to the word units of the sample text fragments in the initial third graph network, so that an initial first graph network representing the association relationship between the word units of the sample text fragments and the word units of the sample answers can be obtained, and the model can learn the association relationship between the sample text fragments and the sample answers preliminarily.
As an example, a target node corresponding to a word unit in a sample answer may be connected to a node corresponding to each word unit in a sample text segment. Alternatively, as another example, the target node corresponding to the word unit in the sample answer may be connected to a node in the initial third graph network having an association relationship with the target node.
Illustratively, taking a sample text segment as "my love my country" and a sample answer as "country", the "ancestor" in the sample answer may be respectively connected to each node in the initial third graph network, and the "country" in the sample answer may be respectively connected to each node in the initial third graph network, so as to obtain a first graph network shown in fig. 5, where the bolded node in fig. 5 is the target node.
In some embodiments, the constructing the initial fourth graph network based on the dependencies between word units in the sample question may include: taking word units in the sample problem as nodes to obtain a plurality of nodes; and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample problem to obtain the initial fourth graph network.
That is, with the word units in the sample question as nodes and the dependencies between the word units as edges, an initial fourth graph network can be constructed that characterizes the dependencies between the word units in the sample question. Therefore, the association relation between the word units in the sample problem can be preliminarily determined, and the learning of the relation between the word units in the sample problem by the model can be enhanced.
As one example, a sample question may be subject to dependency analysis by a Stanford Core NLP algorithm, which may result in dependencies among multiple word units in the sample question.
As an example, by performing a dependency analysis on the sample question "i love" by Stanford Core NLP algorithm, "i am the subject," love "is the predicate," who "is the object, and" i am "," love "," who "dependency relationship with each other can be obtained. For example, in the sample question, there is a dependency relationship between "me" and "love", there is a dependency relationship between "love" and "who", and based on the dependency relationship described above, referring to fig. 6, an initial fourth graph network shown in fig. 6 can be obtained.
In some embodiments, the constructing the initial first graph network based on the association relationship between the initial third graph network and the sample answer may include: and based on the association relation between the word units in the sample answers and the word units in the sample text fragments, connecting the target node with the nodes in the initial third graph network by taking the word units in the sample answers as target nodes, and obtaining the initial first graph network.
In some embodiments, the constructing the initial second graph network based on the association relationship between the initial fourth graph network and the sample answer may include: and based on the association relation between the word units in the sample answers and the word units in the sample questions, connecting the target node with the nodes in the initial fourth graph network by taking the word units in the sample answers as target nodes, and obtaining the initial second graph network.
That is, the word units in the sample answers are used as target nodes, and the target nodes are connected with nodes corresponding to the word units of the sample questions in the initial fourth graph network, so that an initial second graph network representing the association relationship between the word units of the sample questions and the word units of the sample answers can be obtained, and the model can learn the association relationship between the sample questions and the sample answers preliminarily.
As an example, a target node corresponding to a word unit in a sample answer may be connected to a node corresponding to each word unit in a sample question. Alternatively, as another example, the target node corresponding to the word unit in the sample answer may be connected to a node in the initial fourth graph network having an association relationship with the target node.
Taking the sample question as "i love" and the sample answer as "country", the "ancestor" in the sample answer may be respectively connected to each node in the initial fourth graph network, and the "country" in the sample answer may be respectively connected to each node in the initial fourth graph network, so as to obtain an initial second graph network shown in fig. 7, where the bolded node in fig. 7 is the target node.
According to the embodiment of the application, the reading and understanding model can be trained by fully utilizing the association relation between the sample text fragments and the sample answers and the association relation between the sample text fragments and the sample questions, and the accuracy of the reading and understanding model in executing the reading and understanding task can be improved.
And 204, inputting the sample text segment, the sample questions and the sample answers into a feature extraction layer of the reading and understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group.
As one example, a feature extraction layer may be used to extract features of the entered text. The first feature vector group is a feature vector group obtained after the sample text fragment passes through the feature extraction layer, the second feature vector group is a feature vector group obtained after the sample question sample text fragment passes through the feature extraction layer, and the third feature vector group is a feature vector group obtained after the sample answer sample text fragment passes through the feature extraction layer. And the first feature vector group comprises a plurality of first feature vectors, each first feature vector corresponds to one word unit in the sample text segment, the second feature vector group comprises a plurality of second feature vectors, each second feature vector corresponds to one word unit in the sample question, the third feature vector group comprises a plurality of third feature vectors, and each third feature vector corresponds to one word unit in the sample answer.
Illustratively, referring to fig. 3, a sample text segment, a sample question, and a sample answer may be input into a feature extraction layer of a reading understanding model to determine a first feature vector set, a second feature vector set, and a third feature vector set, respectively.
In implementation, the specific implementation of this step may include: performing word segmentation processing on the sample text fragment, the sample question and the sample answer to obtain a first word unit group, a second word unit group and a third word unit group respectively; word embedding processing is carried out on the first word unit group, the second word unit group and the third word unit group to respectively obtain a first word vector group, a second word vector group and a third word vector group; and encoding the first word vector group, the second word vector group and the third word vector group to respectively obtain the first feature vector group, the second feature vector group and the third feature vector group.
In an embodiment of the present application, the feature extraction layer may include a word embedding processing function and an encoding function. As one example, the feature extraction layer may include a word embedding processing module and an encoding module.
Illustratively, the feature extraction layer may employ the structure of the Bert model. Because the feature vector obtained by the Bert model is the feature vector combined with the full text semantic information, the feature vector of the word units in the sample text segment, the sample question and the sample answer can be more fully utilized, and the accuracy of reading and understanding the model can be improved.
Taking a sample text segment as an example, if the sample text segment is a chinese text, a word may be divided into a word unit, and a punctuation mark may be divided into a word unit; if the sample text segment is a foreign text, a word can be divided into a word unit, and a phrase can be divided into a word unit; if there are numbers in the sample text segment, the numbers can be divided into word units individually.
By way of example, assuming that the sample text fragment is "white of plum" called poetry ", seven first word units of" plum "," white "," quilt "," called "," poetry "," immortal "can be obtained.
As an example, a word embedding process may be performed on each first word unit in the first word unit group by using a one-hot (one-hot) encoding method, so as to obtain a word vector of each first word unit, a word embedding process may be performed on each second word unit in the second word unit group, so as to obtain a word vector of each second word unit, and a word embedding process may be performed on each word unit in the third word unit group, so as to obtain a word vector of each third word unit.
As another example, word embedding processing may be performed on each first word unit in the first word unit group by using a word2vec coding manner to obtain a word vector of each first word unit, word embedding processing may be performed on each second word unit in the second word unit group to obtain a word vector of each second word unit, and word embedding processing may be performed on each word unit in the third word unit group to obtain a word vector of each third word unit.
As an example, the encoding process is performed on each first word vector, each second word vector, and each third word vector, so that a vector representation after the text segment full text semantic information of the fused sample corresponding to each first word unit, that is, a first feature vector, a vector representation after the text segment full text semantic information of the fused sample corresponding to each second word unit, that is, a second feature vector, and a vector representation after the text segment full text semantic information of the fused sample corresponding to each third word unit, that is, a third feature vector, may be obtained, and then a first feature vector group, a second feature vector group, and a third feature vector group may be obtained.
Illustratively, taking a sample answer as "white plum", inputting the "white plum" into the feature extraction layer, segmenting the "white plum" to obtain word units "white plum" and "white plum", respectively performing word embedding processing on the "white plum" and the "white plum" to obtain word vectors of the "white plum" and the "white plum", encoding the word vectors of the "white plum" and the "word vectors of the" white plum "to obtain a third feature vector obtained after the" white plum "is combined with the word vectors of the" white plum ", and obtaining a third feature vector obtained after the" white "is combined with the word vectors of the" white plum ", wherein the third feature vector set may be xy assuming that the third feature vector corresponding to the" white plum "is x and the third feature vector corresponding to the" white "is y. Similarly, the sample text segment Li Baibei is called a poetry input feature extraction layer, so that a first feature vector of each word in the sample text segment can be output, the sample question "who the poetry is" is input to the feature extraction layer, and a second feature vector of each word in the sample question can be output.
Through the feature extraction, the first feature vector which can accurately reflect the semantics of each word unit in the sample text fragment can be obtained, the second feature vector which can accurately reflect the semantics of each word unit in the sample question can be obtained, and the third feature vector which can accurately reflect the semantics of each word unit in the sample answer can be obtained, namely, the reading understanding model is trained by using the more accurate feature vector, and the accuracy of the model obtained through training can be improved.
It should be noted that, in the embodiment of the present application, the feature extraction layer may use a structure of the BERT model after preprocessing and fine adjustment of reading and understanding tasks, so that the obtained first feature vector set, second feature vector set and third feature vector set may reflect the semantic features of the sample text segment, the semantic features of the sample question and the semantic features of the sample answer more accurately, and may improve the training rate and the use accuracy of the model.
And 206, inputting the first feature vector group, the second feature vector group and the third feature vector group into the attention layer of the reading understanding model, and adding attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network.
Wherein the first graph network is an initial first graph network comprising attention values of nodes and attention values of edges. The second graph network is an initial second graph network including the attention values of the nodes and the attention values of the edges.
As an example, the attention layer may employ the structure of the attention layer of the BERT model. Alternatively, the attention layer may take any other structure including a model of an attention mechanism, which is not limited by the embodiment of the present application.
As an example, in this step, a first feature vector set, a second feature vector set, a third feature vector set, an initial first graph network, and an initial second graph network may be input into an attention layer of a reading understanding model, attention values may be added to nodes and edges of the initial first graph network based on the first feature vector set and the second feature vector set, the first graph network may be obtained, and attention values may be added to nodes and edges of the initial second graph network based on the second feature vector set and the third feature vector set, and the second graph network may be obtained. Illustratively, referring to fig. 3, a first feature vector group, a second feature vector group, a third feature vector group, an initial first graph network, and an initial second graph network may be input into an attention layer of a reading understanding model, and attention values are added to nodes and edges included in the initial first graph network based on the first feature vector group and the second feature vector group to obtain a first graph network; and adding attention values for nodes and edges included in the initial second graph network based on the second characteristic vector group and the third characteristic vector group to obtain the second graph network.
Or, as another example, in this step, the first feature vector set, the second feature vector set, and the third feature vector set may be input into an attention layer of the reading understanding model, attention values of nodes and edges included in the initial first graph network are obtained based on the first feature vector set and the second feature vector set, and the attention values are added to the initial first graph network to obtain the first graph network; and obtaining attention values of nodes and edges included in the initial second graph network based on the second feature vector group and the third feature vector group, and adding the attention values to the initial second graph network to obtain the second graph network.
In implementation, the specific implementation of this step may include: adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set; and adding attention values to nodes and edges of the initial second graph network based on the second feature vector group and the third feature vector group through the attention layer.
As an example, the initial first graph network characterizes the association between the sample text snippet and the sample answer, the first set of feature vectors is a feature representation of the sample text snippet, and the third set of feature vectors is a feature representation of the sample answer, so that attention values may be added to nodes and edges of the initial first graph network according to the first and third sets of feature vectors. Similarly, the initial second graph network characterizes the association between the sample question and the sample answer, the second feature vector set is a feature representation of the sample question, and the third feature vector set is a feature representation of the sample answer, so that attention values can be added to nodes and edges of the initial second graph network according to the second feature vector set and the third feature vector set.
The nodes in the initial first graph network are word units of sample text fragments and sample answers, so that attention values can be added to the nodes and edges of the initial first graph network at the attention layer according to the first feature vector group and the third feature vector group, and the association relationship between the sample text fragments and the sample answers can be further captured. Similarly, the nodes in the initial second graph network are word units of sample questions and sample answers, so that attention values can be added to the nodes and edges of the initial second graph network at the attention layer according to the second characteristic vector group and the third characteristic vector group, and the association relation between the sample questions and the sample answers can be further captured. Therefore, the reading and understanding model can learn the association relation among the sample text fragments, the sample answers and the sample questions, and the accuracy of the reading and understanding model in processing the reading and understanding tasks is improved.
In some embodiments, adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set may include: taking a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, wherein the first node is a node corresponding to a word unit of the sample text fragment in the initial first graph network; taking a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of the sample answer in the initial first graph network; determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; an attention value between a first node and a second node of an edge present in the initial first graph network is determined and used as the attention value of the edge based on the first feature vector set and the third feature vector set.
That is, the first feature vector in the first feature vector group may be used as the attention value of the node corresponding to the word unit of the sample text fragment in the initial first graph network, and the third feature vector in the third feature vector group may be used as the attention value of the node corresponding to the word unit of the sample answer in the initial first graph network. And determining an attention value of an edge between word units of the sample text snippet in the initial first graph network from the first set of feature vectors, and determining an attention value of an edge between word units of the sample text snippet and word units of the sample answer in the initial first graph network from the first set of feature vectors and the third set of feature vectors. Therefore, the association relation between word units in the sample text fragments and the association relation between the sample text fragments and sample answers can be further learned, and the accuracy of the reading and understanding model obtained through training can be improved conveniently.
As an example, for two first nodes where an edge exists, attention calculation may be performed on the first feature vectors of word units corresponding to the two first nodes, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the two first feature vectors by multiplying the two first feature vectors and normalizing the result to obtain an attention value. Referring to fig. 5, there is an edge between "me" and "love" in fig. 5, and "me" and "love" are word units in a sample text fragment, a first feature vector of the word unit "me" may be obtained from the first feature vector group, a first feature vector of "love" may be obtained from the first feature vector group, the first feature vector of "me" and the first feature vector of "love" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "me" and "love".
As an example, for a first node and a second node where an edge exists, attention calculation may be performed on a first feature vector of a word unit corresponding to the first node and a third feature vector of a word unit corresponding to the second node, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the first feature vector and the third feature vector by multiplying the first feature vector and the third feature vector and normalizing the result to obtain an attention value. Illustratively, referring to fig. 5, there is an edge between "me" and "ancestor" in fig. 5, and "me" is a word unit in a sample text fragment, and "ancestor" is a word unit in a sample answer, a first feature vector of the word unit "me" may be obtained from the first feature vector group, and a third feature vector of "ancestor" may be obtained from the third feature vector group, the first feature vector of "me" and the third feature vector of "ancestor" may be multiplied, and the products may be normalized to obtain an attention value of the edge between "me" and "ancestor".
In the above manner, the attention value of each edge and the attention value of each node in fig. 5 can be determined, and the attention values of the nodes and the edges are added to the initial first graph network, so that the first graph network can be obtained.
In some embodiments, adding, by the attention layer, attention values to nodes and edges of the initial second graph network based on the second set of feature vectors and the third set of feature vectors may include: taking a second feature vector in the second feature vector group as an attention value of a third node in the initial second graph network, wherein the third node is a node corresponding to a word unit of the sample problem in the initial second graph network; taking a third feature vector in the third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the sample answer in the initial second graph network; determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge; and determining an attention value between a third node and a fourth node of an edge existing in the initial second graph network based on the second feature vector group and the third feature vector group, and taking the attention value as the attention value of the edge.
That is, the second feature vector in the second feature vector set may be used as the attention value of the node corresponding to the word unit of the sample question in the initial second graph network, and the third feature vector in the third feature vector set may be used as the attention value of the node corresponding to the word unit of the sample answer in the initial second graph network. And determining an attention value of an edge between word units of the sample question in the initial second graph network from the second set of feature vectors, and determining an attention value of an edge between word units of the sample question and word units of the sample answer in the initial second graph network from the second set of feature vectors and the third set of feature vectors. Therefore, the association relation between word units in the sample questions and the association relation between the sample questions and the sample answers can be further learned, and the accuracy of the reading and understanding model obtained through training can be improved conveniently.
As an example, for two third nodes where an edge exists, attention computation may be performed on the second feature vectors of word units corresponding to the two third nodes, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the two second feature vectors by multiplying the two second feature vectors and normalizing the result to obtain an attention value. Illustratively, referring to fig. 7, an edge exists between "me" and "who" in fig. 7, and "me" and "who" are word units in the sample problem, a second feature vector of the word unit "me" may be obtained from the second feature vector group, and a second feature vector of "who" may be obtained from the second feature vector group, the second feature vector of "me" and the second feature vector of "who" may be multiplied, and the products may be normalized to obtain an attention value of the edge between "me" and "who".
As an example, for the third node and the fourth node where an edge exists, attention calculation may be performed on the second feature vector of the word unit corresponding to the third node and the third feature vector of the word unit corresponding to the fourth node, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the second feature vector and the third feature vector by multiplying the second feature vector and the third feature vector and normalizing the result to obtain the attention value. For example, referring to fig. 7, an edge exists between "who" and "country" in fig. 7, and "who" is a word unit in a sample question, "country" is a word unit in a sample answer, a second feature vector of "who" of the word unit may be obtained from the second feature vector group, and a third feature vector of "country" may be obtained from the third feature vector group, the second feature vector of "who" and the third feature vector of "country" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "who" and "country".
In the above manner, the attention value of each edge and the attention value of each node in fig. 7 can be determined, and the attention values of the nodes and the edges are added to the initial second graph network, so that the second graph network can be obtained.
It should be noted that, in the embodiment of the present application, attention calculation may be performed on two feature vectors by the following formula (1).
Wherein in formula (1), attention represents the attention value, softmax (·) is a normalization function, Q and K represent two eigenvectors, d, respectively k Is a constant and T is a matrix transpose.
For example, referring to fig. 7, where "who" and "country" in fig. 7 are edges, and "who" is a word unit in a sample question, "country" is a word unit in a sample answer, a second feature vector of "who" of the word unit may be obtained as Q from the second feature vector group, and a third feature vector of "country" may be obtained as K from the third feature vector group, and the attention value of the edge between "who" and "country" may be determined by the above formula (1).
In the embodiment of the application, the incidence relation among the sample text fragment, the sample question and the sample answer can be further captured through the attention layer, and the incidence relation is converted into the attention value and is endowed to the initial first graph network and the initial second graph network, so that the first graph network and the second graph network are obtained, the model can further learn the incidence relation among the sample text fragment, the sample question and the sample answer, and the accuracy of the reading understanding model obtained through training can be improved.
It should be noted that, step 204-step 206 is a specific implementation of "inputting the sample text segment, the sample question, and the sample answer into the text processing layer of the reading understanding model, and adding attention values to nodes and edges included in the initial first graph network and the initial second graph network, respectively, to obtain a first graph network and a second graph network".
And step 208, inputting the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to obtain a prediction answer.
As one example, the graph roll network layer may be a GCN model.
Illustratively, referring to FIG. 3, the first graph network and the second graph network may be input into a graph roll-up network layer of a reading understanding model to obtain a predicted answer.
In an implementation, inputting the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model, a specific implementation of obtaining the predicted answer may include: determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph roll layer; carrying out weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector; and determining the prediction answer based on the target hidden layer feature vector.
As an example, the first hidden layer feature vector is a vector representation of the first graph network obtained by convolving the first graph network with the graph convolution network layer, and may be considered as a graph feature vector of the first graph network. The second hidden layer feature vector is a vector representation of the second graph network obtained by convolving the second graph network with the graph convolution network layer, and can be regarded as the graph feature vector of the second graph network. The target hidden layer feature vector is a vector representation obtained by combining vector representations of the first graph network and the second graph network.
In some embodiments, the graph network may be convolved at the graph roll network layer by the following equation (2).
Wherein in formula (2), i represents an i-th node in the graph network, j represents a j-th node in the graph network,the feature vector representing the ith node input of the 1+1th convolution layer, σ (·) represents a nonlinear conversion function, which may be a ReLU activation function, N i Representing node i and all nodes connected to node i,/->Representing the j-th node input the feature vector of the l convolution layer, C ij Attention value representing the edge between the i-th node and the j-th node,/for the node >Indicating the weight of the jth node at the ith convolutional layer, +.>Representing the intercept of the jth node at the ith convolutional layer.
As an example, a plurality of convolution layers may be included in the graph-convolution network layer, each convolution layer includes a preset weight parameter matrix, the weight of each node at each convolution layer may be an initial weight in the weight parameter matrix, and similarly, each convolution layer may include a preset intercept parameter matrix, and the intercept of each node at each convolution layer may be an initial intercept in the intercept parameter matrix. In the subsequent training process, the weight parameter matrix and the intercept parameter matrix of each convolution layer can be adjusted according to the training condition.
Taking the first graph network as an example, assuming that the graph rolling network layer includes two convolution layers, in the first convolution layer, a feature vector of each node in the first graph network may be taken as an input, and a weight parameter matrix and an intercept parameter matrix of the first convolution layer may be taken as preset parameters, and by using the above formula (2), it may be determined that each node in the first graph network inputs a feature vector of the second convolution layer, that is, a feature vector obtained after performing a convolution processing on each node in the first graph network. And then in the second convolution layer, the obtained feature vector of each node input into the second convolution layer can be used as input, the weight parameter matrix and the intercept parameter matrix of the second convolution layer are used as preset parameters, and the feature vector of each node input into the third convolution layer in the first graph network can be determined through the formula (2), namely the feature vector obtained after two times of convolution processing are carried out on each node in the first graph network. And splicing the feature vectors obtained after the two convolution processes are carried out on the plurality of nodes in the first graph network, so that the first hidden layer feature vector of the first graph network can be obtained.
As an example, when the first hidden layer feature vector and the second hidden layer feature vector are weighted and summed, the weight of the first hidden layer feature vector and the weight of the second hidden layer feature vector may be the same, may be different, may be set by a user according to actual needs, may be set by a computing device by default, and the embodiment of the present application is not limited to this.
By the method, the potential association relation between the nodes in the first graph network and the potential association relation between the nodes in the second graph network can be obtained, so that the model can be read and understood conveniently, the potential association relation between the sample text segment, the sample question and the sample answer can be learned, and the accuracy of the model is improved.
In some embodiments, determining the specific implementation of the predicted answer based on the target hidden layer feature vector may include: converting the value of each dimension of the target hidden layer feature vector into at least one prediction probability through a sequence labeling function, wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and the at least one prediction probability corresponding to each dimension represents the probability that the prediction label of the word unit corresponding to each dimension is at least one label; determining a predictive label of a word unit corresponding to each dimension based on at least one predictive probability corresponding to each dimension; and determining the prediction answer based on the prediction labels of the word units corresponding to each dimension.
As an example, a sequence labeling function is a function used when sequence labeling is performed, and an input vector may be mapped into probabilities of at least one dimension, i.e., at least one probability may be obtained for each vector. The Sequence labeling can be called Sequence Tagging, and after the probability corresponding to the vector in each dimension is determined through the Sequence labeling function, a preset label can be labeled for each word unit according to the probability.
As an example, the tag may be B, I, O. Wherein B can be called Begin, and represents the beginning word of the answer, namely the first word of the answer; i may be referred to as an instruction, representing the intermediate ending word of the answer, i.e., the second word to the last word of the answer; o may be referred to as outlide, representing a non-answer word, i.e., a word that is not an answer.
It should be noted that, the length of the target hidden layer feature vector is the same as the length of the sample text segment, that is, the dimension of the target hidden layer feature vector is the same as the number of word units of the sample text segment.
Illustratively, assuming that the sample text segment is "my love my ancestor," the target hidden layer feature vector is a 6-dimensional vector, and the 6 dimensions correspond to word units i, q, and q, respectively, each of the dimensions in the target hidden layer feature vector is converted to 3 prediction probabilities, each of which corresponds to a likelihood of occurrence of the tag "BIO. For example, for the word unit "me", assuming that the calculated prediction probabilities are 0.2,0.3,0.5, it is possible to determine that the probability of the prediction label being "O" is the largest, the prediction label corresponding to "me" is "O". Similarly, the predictive labels corresponding to the 6 word units may be determined to be "O", "B", and "I", respectively. Since the label "B" represents the answer start word and the label "I" represents the answer intermediate end word, it can be considered that "ancestor" and "country" are predicted answers.
The prediction label of each word unit can be determined through a sequence labeling mode, the prediction answer can be determined according to the prediction label, and when model parameters are adjusted, the prediction label of the correct prediction answer can be enabled to be more close to the correct label, so that training efficiency and accuracy of reading and understanding models can be improved.
As an example, the at least one tag includes an answer start word, an answer middle end word, and a non-answer word, and determining the specific implementation of the predicted answer based on the predicted tag of the word unit corresponding to each dimension may include: and taking word units corresponding to the beginning words of the answers and word units corresponding to the intermediate ending words of the answers as the predicted answers.
That is, the answer starting word and the answer intermediate ending word can be spliced to obtain the predicted answer.
Continuing with the above example, where the label of the word unit "ancestor" is B, the label of the word unit "country" is I, the label "B" represents the answer starting word, the label "I" represents the answer ending word in the middle, the "ancestor" can be determined to be the predicted answer.
And step 210, training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached.
In some embodiments, the difference between the predictive function and the sample answer may be determined by a loss function and the reading understanding model trained based on the difference.
As one example, training the reading understanding model based on differences is primarily based on differences adjusting parameters of the graph roll network layer so that the predicted answer and the sample answer can be more closely related in subsequent training. For example, assuming that the answer is "country", if the probability of the "O" label corresponding to "country" is highest during training, the parameters need to be adjusted in model training so that the probability of the "I" label corresponding to "country" is highest.
Illustratively, referring to FIG. 3, a difference value may be determined based on the predicted answer and the sample answer, and parameters of the graph roll-up network layer may be adjusted based on the difference value.
In some embodiments, the training the reading understanding model based on the difference between the predicted answer and the sample answer until the training stop condition is reached may include: if the difference value is smaller than a preset threshold value, stopping training the reading and understanding model; and if the difference value is greater than or equal to the preset threshold value, continuing training the reading and understanding model.
It should be noted that, the preset threshold may be set by the user according to the actual requirement, or may be set by default by the computing device, which is not limited in the embodiment of the present application.
That is, the reading understanding model may be trained based on the difference between the predicted answer and the sample answer, and if the loss value is less than the preset threshold, the current model parameter may be considered to substantially satisfy the requirement, and the reading understanding model may be considered to be trained, so that the training of the reading understanding model may be stopped. If the loss value is greater than or equal to the preset threshold, the difference between the predicted answer and the sample answer of the model can be considered to be large, and the current model parameters cannot meet the requirements, so that the reading and understanding model needs to be continuously trained.
Whether the reading and understanding model is continuously trained is determined through the relation between the difference value and the preset threshold value, so that the training degree of the reading and understanding model can be mastered more accurately, and the training efficiency of the model and the accuracy of the model in processing reading and understanding tasks are improved.
In other embodiments, the reaching the training stop condition may include: recording and carrying out iterative training once every time a predicted answer is obtained; and counting the training times of iterative training, and determining that the training stopping condition is reached if the training times are greater than a time threshold.
It should be noted that, the frequency threshold may be set by the user according to the actual requirement, or may be set by default by the computing device, which is not limited in the embodiment of the present application.
As an example, each time a predicted answer is obtained, it is indicated that an iterative training is performed, the number of iterative training times may be increased by one, and the number of training times is counted after each time of iterative training is performed, if the number of training times is greater than the number threshold, it is indicated that training of the reading and understanding model is sufficient, that is, a training stop condition is reached, and further training may not reach a better effect, so that training may be stopped. If the training frequency is less than or equal to the frequency threshold, the training frequency of the reading and understanding model is too low, and the reading and understanding model may not be trained until the actual requirement is met, so that training can be continued based on the difference value between the predicted answer and the sample answer.
And determining whether to continue training the reading understanding model or not according to the corresponding relation between the number of iterative training and the number threshold, so that unnecessary iterative training can be reduced, the calculation resource consumption caused by the iterative training is reduced, and the training efficiency of the model is improved.
In the embodiment of the application, a network layer is constructed through reading and understanding the graph of the model to construct an initial first graph network of sample text fragments and sample answers, and an initial second graph network of sample questions and sample answers is constructed; inputting the sample text fragments, the sample questions and the sample answers into a text processing layer of the reading understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain a first graph network and a second graph network; inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer; and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached. The method can effectively utilize the feature vectors of the sample text fragments, the sample questions and the sample answers, extract the association relation among the sample text fragments, the sample questions and the sample answers, train the reading and understanding model by combining the association relation among the sample text fragments, the sample questions and the sample answers, and improve the accuracy of the reading and understanding model in executing the reading and understanding tasks.
The following describes the training method of the reading understanding model by taking the application of the training method of the reading understanding model provided by the application in the task of reading understanding as an example with reference to fig. 8. Fig. 8 is a process flow diagram of a training method applied to a reading understanding model of a choice question according to an embodiment of the present application, which specifically includes the following steps:
step 802, a sample text segment, a sample question, and a sample answer are obtained.
For example, assuming that the sample text snippet is "i love my ancestor", the sample question is a choice question, and assuming that the sample question is "i love who", the choices include "ancestor", "father", "mother", "family", the sample answer is "ancestor".
Step 804, inputting the sample text segment, the sample questions and the sample answers into a graph construction network layer of the reading understanding model, and constructing an initial third graph network based on the dependency relationship among word units in the sample text segment.
In implementation, the words in the sample text segment may be used as nodes to obtain a plurality of nodes, and the nodes with the dependency relationship are connected based on the dependency relationship between word units in the sample text segment to obtain the initial third graph network.
For example, referring to FIG. 4, the nodes of the initial third graph network include the word units "I", "love", "I", "ancestor" and "country" in the sample text segment, and from the dependencies between the six word units, it can be determined that an edge exists between "I" and "love", an edge exists between "I" and "ancestor", an edge exists between "love" and "ancestor", and an edge exists between "ancestor" and "country".
Step 806, based on the association relationship between the word units in the sample answer and the word units in the sample text segment, connecting the target node with the node in the initial third graph network by using the word units in the sample answer as the target node, so as to obtain an initial first graph network.
For example, referring to fig. 5, an initial first graph network may be obtained by determining "ancestor" as a target node, determining "country" as a target node, connecting the target node "ancestor" to each node in the initial third graph network, and connecting the target node "country" to each node in the initial third graph network.
Step 808, inputting the sample text fragments, the sample questions and the sample answers into a graph construction network layer of the reading understanding model, and constructing an initial fourth graph network based on the dependency relationship among word units in the sample questions.
In implementation, the words in the sample problem can be used as nodes to obtain a plurality of nodes; and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample problem to obtain the initial fourth graph network.
For example, referring to FIG. 6, the nodes of the initial fourth graph network include word units "I", "love", "who" in the sample question, and from the dependencies between these three word units, it can be determined that "I" has an edge with "love", "who", and "love" has an edge with "who", respectively.
And step 810, based on the association relationship between the word units in the sample answers and the word units in the sample questions, connecting the target node with the nodes in the initial fourth graph network by taking the word units in the sample answers as target nodes, and obtaining the initial second graph network.
For example, referring to fig. 7, an initial second graph network may be obtained by determining "ancestor" as a target node, determining "country" as a target node, connecting the target node "ancestor" to each node in the initial fourth graph network, and connecting the target node "country" to each node in the initial fourth graph network.
It should be noted that, steps 802 to 810 are described below in step 202, the implementation process is the same as that of step 202, and specific implementation can be referred to the related description of step 202, which is not repeated here.
Step 812, performing word segmentation on the sample text segment to obtain a first word unit group, performing word segmentation on the sample question to obtain a second word unit group, and performing word segmentation on the sample answer to obtain a third word unit group.
Continuing with the above example, after the sample text segment is segmented, a first word unit group may be obtained, which is "me", "love", "me", "ancestor", "country", respectively. Similarly, the second word unit group can be obtained by word segmentation of the sample problem, namely "I", "love", "who" respectively. The third word unit group can be obtained by word segmentation of the sample answers, namely 'ancestor' and 'state'.
Step 814, performing word embedding processing on the first word unit group, the second word unit group, and the third word unit group to obtain a first word vector group, a second word vector group, and a third word vector group, respectively.
Taking the sample answer as a 'country' as an example, the feature extraction layer can obtain a vector representation of each word in the text of the 'country', and the third word vector corresponding to the 'country' is assumed to be x, and the third word vector corresponding to the 'country' is assumed to be y. Similarly, word embedding processing is performed on the sample text fragment 'i love my ancestor', so that a first word vector of each word in the sample text fragment can be output, word embedding processing is performed on the sample question 'i love' and a second word vector of each word in the sample question can be output.
Step 816, encoding the first word vector set, the second word vector set, and the third word vector set to obtain the first feature vector set, the second feature vector set, and the third feature vector set, respectively.
Continuing with the above example, the "ancestor" and "country" in the sample answer are encoded to obtain a third feature vector of "ancestor" and a third feature vector of "country", respectively. Similarly, coding the 'I', 'love' and 'who' in the sample problem can obtain a first feature vector of 'I', 'love' and a first feature vector of 'who' respectively. Coding the 'I', 'love', 'I', 'ancestor' and 'country' in the sample text fragment to obtain 'I' second eigenvector ',' love ',' I 'second eigenvector', 'ancestor' second eigenvector and 'country' second eigenvector respectively.
It should be noted that, the steps 812-816 are the following descriptions of the step 204, the implementation process is the same as the process of the step 204, and the specific implementation may refer to the related descriptions of the step 204, which are not repeated here.
And step 818, adding attention values to nodes and edges of the initial first graph network based on the first feature vector group and the third feature vector group through the attention layer to obtain a first graph network.
As an example, a first feature vector in the first feature vector group may be used as an attention value of a first node in the initial first graph network, where the first node is a node corresponding to a word unit of the sample text segment in the first graph network; taking a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of the sample answer in the first graph network; determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; an attention value between a first node and a second node of an edge present in the initial first graph network is determined and used as the attention value of the edge based on the first feature vector set and the third feature vector set.
Illustratively, referring to fig. 5, for two first nodes where an edge exists, an edge exists between "me" and "love" in fig. 5, and "me" and "love" are word units in a sample text segment, a first feature vector of the word unit "me" may be obtained from a first feature vector group, and a first feature vector of "love" may be obtained from the first feature vector group, the first feature vector of "me" and the first feature vector of "love" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "me" and "love". For the first node and the second node where the edge exists, an edge exists between "me" and "ancestor" in fig. 5, and "me" is a word unit in a sample text fragment, and "ancestor" is a word unit in a sample answer, a first feature vector of the word unit "me" can be obtained from the first feature vector group, a third feature vector of the "ancestor" can be obtained from the third feature vector group, the first feature vector of "me" and the third feature vector of "ancestor" can be multiplied, and the product is normalized, so that the attention value of the edge between "me" and "ancestor" can be obtained.
In the above manner, the attention value of each edge and the attention value of each node in fig. 5 can be determined, and the attention values of the nodes and the edges are added to the initial first graph network, so that the first graph network can be obtained.
And step 820, adding attention values to nodes and edges of the initial second graph network based on the second feature vector group and the third feature vector group through the attention layer to obtain a second graph network.
As an example, taking the second feature vector in the second feature vector set as an attention value of a third node in the initial second graph network, where the third node is a node corresponding to a word unit of the sample problem in the initial second graph network; taking a third feature vector in the third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the sample answer in the initial second graph network; determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge; and determining an attention value between a third node and a fourth node of an edge existing in the initial second graph network based on the second feature vector group and the third feature vector group, and taking the attention value as the attention value of the edge.
Illustratively, referring to fig. 7, for the two third nodes where an edge exists, an edge exists between "me" and "who" in fig. 7, and "me" and "who" are word units in the sample problem, a second feature vector of the word unit "me" may be obtained from the second feature vector group, and a second feature vector of "who" may be obtained from the second feature vector group, the second feature vector of "me" and the second feature vector of "who" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "me" and "who". For the third node and the fourth node where the edge exists, the edge exists between "who" and "country" in fig. 7, and "who" is a word unit in the sample question, and "country" is a word unit in the sample answer, the second feature vector of "who" of the word unit can be obtained from the second feature vector group, and the third feature vector of "country" can be obtained from the third feature vector group, the second feature vector of "who" and the third feature vector of "country" can be multiplied, and the product is normalized, so that the attention value of the edge between "who" and "country" can be obtained.
In the above manner, the attention value of each edge and the attention value of each node in fig. 7 can be determined, and the attention values of the nodes and the edges are added to the initial second graph network, so that the second graph network can be obtained.
It should be noted that, the steps 812-820 are the following descriptions of the step 206, the implementation process is the same as the process of the step 206, and the specific implementation can be referred to the related descriptions of the step 206, which is not repeated here.
And step 822, inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model, and determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph rolling network layer.
Step 824, performing weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector.
Step 826, converting the value of each dimension of the target hidden layer feature vector into at least one predictive probability by a sequence labeling function.
Wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and at least one prediction probability corresponding to each dimension characterizes a probability that a prediction label of the word unit corresponding to each dimension is at least one label. And, the length of the target hidden layer feature vector is the same as the length of the sample text segment, i.e. the dimension of the target hidden layer feature vector can be considered to be the same as the number of word units of the sample text segment.
Illustratively, assuming that the target hidden layer feature vector is a 6-dimensional vector and that the 6 dimensions correspond to the word units i, q, and q, respectively, each dimension in the target hidden layer feature vector is converted to 3 predictive probabilities, each probability corresponding to a likelihood of the occurrence of the tag "BIO". For example, for the word unit "me", assume that the calculated predicted probabilities are 0.2,0.3,0.5, respectively.
Step 828, determining a predictive label for the word unit corresponding to each dimension based on the at least one predictive probability corresponding to each dimension.
Continuing with the above example, since 0.5 is maximum, it may be determined that the prediction tag corresponding to "I" is "O".
And step 830, using word units corresponding to the beginning words of the answers and word units corresponding to the intermediate ending words of the answers as the predicted answers.
Continuing with the above example, assume that the predictive labels corresponding to the 6 word units are determined to be "O", "B", and "I", respectively. Since the label "B" represents the answer start word and the label "I" represents the answer intermediate end word, it can be considered that "ancestor" and "country" are predicted answers.
It should be noted that, steps 822-830 are described below for step 208, the implementation process is the same as that of step 208, and the specific implementation may refer to the related description of step 208, which is not repeated here.
And step 832, training the reading and understanding model based on the difference between the predicted answer and the sample answer.
And 834, if the loss value is smaller than a preset threshold, stopping training the reading understanding model.
And step 836, if the loss value is greater than or equal to the preset threshold, continuing to train the reading understanding model.
It should be noted that, in the steps 832-836, the following description of the step 210 is provided, the implementation process is the same as that of the step 210, and the specific implementation may be referred to the related description of the step 210, which is not repeated here.
In the embodiment of the application, a network layer is constructed through reading and understanding the graph of the model to construct an initial first graph network of sample text fragments and sample answers, and an initial second graph network of sample questions and sample answers is constructed; inputting the sample text fragment, the sample questions and the sample answers into a feature extraction layer of the reading understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group; inputting the first feature vector group, the second feature vector group and the third feature vector group into an attention layer of the reading and understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain a first graph network and a second graph network; inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer; and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached. The method can effectively utilize the feature vectors of the sample text fragments, the sample questions and the sample answers, extract the association relation among the sample text fragments, the sample questions and the sample answers, train the reading and understanding model by combining the association relation among the sample text fragments, the sample questions and the sample answers, and improve the accuracy of the reading and understanding model in executing the reading and understanding tasks.
Referring to fig. 9, fig. 9 shows a flowchart of a reading and understanding method according to an embodiment of the present application, including steps 902 to 908.
Step 902, constructing an initial first graph network of target text and target answers by a graph construction network layer of a reading understanding model, and constructing an initial second graph network of target questions and target answers.
As an example, if the target question is a choice question, the target answer may be a text obtained by splicing multiple options; if the target question is a simple answer, the target answer may be a keyword in the target text.
Illustratively, assuming that the target text is "Libai for life written poems and innumerable, called poems", the target question is a choice question, and the target question is "which poems are called poems", the three options are "Libai", "Dufu" and "Su-che", respectively, then the three options can be spliced as target answers, and then the target answer can be "Li Baidu Su".
For example, assuming that the target question is a brief answer question and the target question is "which poetry is called poetry", the target text is "will enter wine" in a luxury language, the spirit of spacious to be free of the action, optimistic confidence and anger stuffy to social reality are the works of shixian liqueur ", keywords can be extracted from the target text to obtain" will enter wine "," spacious to be free of the action "," optimistic confidence "," shixian "and" liqueur ", and" will enter wine to be free of the action "can be taken as the target answer.
As an example, an initial first graph network is used to characterize the association between the target text and the target answer, and an initial second graph network is used to characterize the association between the target question and the target answer.
For example, referring to fig. 10, a graph construction network layer of a target text, a target question, and a target answer may be input into a reading understanding model, an initial first graph network is obtained based on the target text and the target answer, and an initial second graph network is obtained based on the target question and the target answer.
In an implementation, if the text length of the target text is less than the length threshold, the specific implementation of constructing the initial first graph network of the target text and the target answer by reading the graph construction network layer of the understanding model, and constructing the initial second graph network of the target question and the target answer may include: constructing an initial third graph network based on the dependency relationships among word units in the target text, and constructing an initial fourth graph network based on the dependency relationships among word units in the target question. The initial first graph network is constructed based on the association relation between the initial third graph network and the target answer, and the initial second graph network is constructed based on the association relation between the initial fourth graph network and the target answer.
Wherein the initial third graph network is used to characterize dependencies between word units in the target text. The initial fourth graph network is used to characterize dependencies between word units in the target question.
That is, if the text length of the target text is smaller than the length threshold, the reading understanding model may process the target text, and may construct an initial third graph network reflecting the dependency relationship between word units in the target text, and then construct a first graph network based on the initial third graph network according to the association relationship between the target answer and the target text. And firstly constructing an initial fourth graph network reflecting the dependency relationship between word units in the target questions, and then constructing a second graph network according to the association relationship between the target answers and the target questions on the basis of the initial fourth graph network.
It should be noted that, the length threshold may be set by the user according to the actual requirement, or may be set by default by the device, which is not limited in the embodiment of the present application.
In some embodiments, constructing an initial third graph network based on dependencies between word units in the target text may include: taking word units in the target text as nodes to obtain a plurality of nodes; and connecting nodes with dependency relationship based on the dependency relationship among word units in the target text to obtain the initial third graph network.
That is, with word units in the target text as nodes and dependencies between word units as edges, an initial third graph network can be constructed that characterizes the dependencies between word units in the target text.
As one example, the target text may be subject to a dependency analysis by a Stanford Core NLP algorithm, which may result in dependencies between word units in the target text.
Illustratively, taking the example that the target text is "me loving my ancestor", performing dependency analysis on the target text "me loving my ancestor" through Stanford Core NLP algorithm, it is possible to obtain "me" as a subject, "love" as a predicate, "my ancestor" as an object, and it is possible to obtain the dependency relationship between "me", "love", "me", "ancestor" and "country". For example, one of "me" and "love" in the target text has a dependency relationship, one of "me" and "ancestor" has a dependency relationship, and "love" also has a dependency relationship with "ancestor" and "ancestor" has a dependency relationship with "country", based on which the initial third graph network shown in fig. 4 can be obtained.
In some embodiments, the constructing the initial first graph network based on the association relationship between the initial third graph network and the target answer may include: and based on the association relation between the word units in the target answers and the word units in the target text, connecting the target nodes with the nodes in the initial third graph network by taking the word units in the target answers as target nodes, and obtaining the initial first graph network.
That is, the word units in the target answer may be used as target nodes, and the target nodes may be connected to nodes corresponding to the word units of the target text in the initial third graph network, so that an initial first graph network that characterizes the association relationship between the word units of the target text and the word units of the target answer may be obtained.
As an example, a target node corresponding to a word unit in the target answer may be connected to a node corresponding to each word unit in the target text. Alternatively, as another example, the target node corresponding to the word unit in the target answer may be connected to a node in the initial third graph network having an association relationship with the target node.
By way of example, taking a target text as "my love my country", a target question is a choice question as an example, assuming that the choices include "home" and "hometown", then the target answer is "hometown", word units in the target answer may be used as target nodes, the "ancestor" in the target answer may be connected to each node in the initial third graph network, the "country" in the target answer may be connected to each node in the initial third graph network, the "home" in the target answer may be connected to each node in the initial third graph network, the "hometown" in the target answer may be connected to each node in the initial third graph network, and the first graph network shown in fig. 11 may be obtained, and the node thickened in fig. 11 may be the target node.
In some embodiments, the constructing the initial fourth graph network based on the dependencies between word units in the target question may include: taking word units in the target problem as nodes to obtain a plurality of nodes; and connecting nodes with dependency relationship based on the dependency relationship among word units in the target problem to obtain the initial fourth graph network.
That is, with word units in the target question as nodes and dependencies between word units as edges, an initial fourth graph network can be constructed that characterizes the dependencies between word units in the target question.
As one example, the target question may be subject to dependency analysis by a Stanford Core NLP algorithm, which may result in dependencies among multiple word units in the target question.
As an example, by performing a dependency analysis on the target problem "who i love" through Stanford Core NLP algorithm, "i am the subject," love "is the predicate," who "is the object, and" i am "," love "," who "dependency relationship with each other can be obtained. For example, there is a dependency relationship between "me" and "love" in the target problem, there is a dependency relationship between "love" and "who", and there is a dependency relationship between "me" and "who", based on the above-described dependency relationship, referring to fig. 6, an initial fourth graph network shown in fig. 6 can be obtained.
In some embodiments, the constructing the initial second graph network based on the association relationship between the initial fourth graph network and the target answer may include: and based on the association relation between the word units in the target answers and the word units in the target questions, connecting the target nodes with the nodes in the initial fourth graph network by taking the word units in the target answers as target nodes, and obtaining the initial second graph network.
That is, the word units in the target answers may be used as target nodes, and the target nodes may be connected to nodes corresponding to the word units of the target questions in the initial fourth graph network, so that an initial second graph network representing the association relationship between the word units of the target questions and the word units of the target answers may be obtained.
As an example, a target node corresponding to a word unit in the target answer may be connected to a node corresponding to each word unit in the target question. Alternatively, as another example, the target node corresponding to the word unit in the target answer may be connected to a node in the initial fourth graph network having an association relationship with the target node.
Taking the target question as "loving me" and the target answer as "hometown" as an example, the word unit in the target answer may be used as a target node, the "ancestor" in the target answer may be connected to each node in the initial fourth graph network, the "country" in the target answer may be connected to each node in the initial fourth graph network, the "home" in the target answer may be connected to each node in the initial fourth graph network, the "country" in the target answer may be connected to each node in the initial fourth graph network, and the initial second graph network shown in fig. 12 may be obtained, where the bolded node in fig. 12 is the target node.
In the embodiment of the application, the association relationship between the target text and the target answer and the association relationship between the target text and the target question can be fully utilized to train the reading and understanding model, and the accuracy of the reading and understanding model in executing the reading and understanding task can be improved.
It should be noted that, the above description is given by taking the text length of the target text being smaller than the length threshold as an example, if the target text is a text of chapter level, that is, the text length of the target text is greater than or equal to the length threshold, the reading and understanding model may not be able to process the target text, so that the target text may be segmented or sentence-processed to obtain multiple target text segments, and then an initial first graph network of each target text segment and the target problem is constructed by the above method. For example, if the target text is divided into 3 target text segments, 3 first graph networks may be constructed.
And step 904, inputting the target text, the target questions and the target answers into a feature extraction layer of the reading and understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group.
Wherein the feature extraction layer may be used to extract features of the entered text.
As an example, the first feature vector group is a feature vector group obtained after the target text passes through the feature extraction layer, the second feature vector group is a feature vector group obtained after the target question target text passes through the feature extraction layer, and the third feature vector group is a feature vector group obtained after the target answer target text passes through the feature extraction layer. And the first feature vector group comprises a plurality of first feature vectors, each first feature vector corresponds to one word unit in the target text, the second feature vector group comprises a plurality of second feature vectors, each second feature vector corresponds to one word unit in the target question, the third feature vector group comprises a plurality of third feature vectors, and each third feature vector corresponds to one word unit in the target answer.
For example, referring to fig. 10, the target text, the target question, and the target answer may be input into a feature extraction layer of a reading understanding model to determine a first feature vector group, a second feature vector group, and a third feature vector group, respectively.
In implementation, if the text length of the target text is less than the length threshold, the implementation of this step may include: word segmentation processing is carried out on the target text, the target question and the target answer to respectively obtain a first word unit group, a second word unit group and a third word unit group; word embedding processing is carried out on the first word unit group, the second word unit group and the third word unit group to respectively obtain a first word vector group, a second word vector group and a third word vector group; and encoding the first word vector group, the second word vector group and the third word vector group to respectively obtain the first feature vector group, the second feature vector group and the third feature vector group.
In an embodiment of the present application, the feature extraction layer may include a word embedding processing function and an encoding function. As one example, the feature extraction layer may include a word embedding processing module and an encoding module.
Illustratively, the feature extraction layer may employ the structure of the Bert model. Because the feature vector obtained by the Bert model is the feature vector combined with the full text semantic information, the feature vector of the word units in the target text, the target question and the target answer can be more fully utilized, and the accuracy of reading and understanding the model can be improved.
As an example, taking the target text as an example, if the target text is a chinese text, a word may be divided into a word unit, and a punctuation mark may be divided into a word unit; if the target text is a foreign text, a word can be divided into a word unit, and a phrase can be divided into a word unit; if there are numbers in the target text, the numbers can be individually divided into word units.
For example, assuming that the target text is "plums for life writing poems, which is called poems", the plurality of first word units of "plums", "white", "one", "life", "writing", "poems", "none", "number", "", "called", "as", "poems", "immortals" can be obtained.
As an example, a word embedding process may be performed on each first word unit in the first word unit group by using a one-hot (one-hot) encoding method, so as to obtain a word vector of each first word unit, a word embedding process may be performed on each second word unit in the second word unit group, so as to obtain a word vector of each second word unit, and a word embedding process may be performed on each word unit in the third word unit group, so as to obtain a word vector of each third word unit.
As another example, word embedding processing may be performed on each first word unit in the first word unit group by using a word2vec coding manner to obtain a word vector of each first word unit, word embedding processing may be performed on each second word unit in the second word unit group to obtain a word vector of each second word unit, and word embedding processing may be performed on each word unit in the third word unit group to obtain a word vector of each third word unit.
As an example, the encoding process is performed on each first word vector, each second word vector, and each third word vector, so that a vector representation after the text full text semantic information of the fusion target corresponding to each first word unit, that is, a first feature vector, a vector representation after the text full text semantic information of the fusion target corresponding to each second word unit, that is, a second feature vector, and a vector representation after the text full text semantic information of the fusion target corresponding to each third word unit, that is, a third feature vector, may be obtained, and further, a first feature vector group, a second feature vector group, and a third feature vector group may be obtained.
By way of example, taking the target problem of "who love me" as an input feature extraction layer, word units "who love me" can be obtained by dividing words, "who love me" into words, "who love me", "love me" and "who" respectively perform word embedding processing, word vectors "love me" and "who" can be obtained, a third feature vector obtained after word vectors of two words "love me" and "who" can be obtained, and a third feature vector obtained after word vectors of two words "love me" and "who" can be obtained. Similarly, the first feature vector of each word in the target text can be output by inputting the target text 'i love my hometown' into the feature extraction layer, and the second feature vector of each word in the target answer can be output by inputting the target answer 'hometown' into the feature extraction layer.
The feature extraction layer in the embodiment of the application can adopt the structure of the BERT model which is preprocessed and subjected to fine adjustment by reading and understanding tasks, so that the obtained first feature vector group, second feature vector group and third feature vector group can respectively reflect the semantics of the target text, the semantics of the target problem and the semantics of the target answer more accurately, and the training rate and the using accuracy of the model can be improved.
It should be noted that, the above description is given by taking the case that the text length of the target text is smaller than the length threshold, and when the text length of the target text is smaller than the length threshold, the reading understanding model can process the target text, so that word segmentation processing can be directly performed on the target text. In other embodiments, if the target text is a chapter-level text, that is, the text length of the target text is greater than or equal to the length threshold, the reading and understanding model may not be able to process the target text, so that the target text may be segmented or sentence-processed first to obtain a plurality of target text segments, and then the first feature vector set of each target text segment is extracted by the feature extraction layer. For example, if the target text is divided into 3 target text segments, 3 first feature vector groups may be extracted, the 3 first feature vector groups being used to represent semantics of the 3 target text segments, respectively. The method for extracting the first feature vector set of the target text segment is the same as the method for extracting the first feature vector set of the target text, and the embodiment is not repeated here.
Step 906, inputting the first feature vector set, the second feature vector set and the third feature vector set into the attention layer of the reading understanding model, and adding attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network.
Wherein the first graph network is an initial first graph network comprising attention values of nodes and attention values of edges. The second graph network is an initial second graph network including the attention values of the nodes and the attention values of the edges.
As an example, the attention layer may employ the structure of the attention layer of the BERT model. Alternatively, the attention layer may take any other structure including a model of an attention mechanism, which is not limited by the embodiment of the present application.
As an example, in this step, a first feature vector set, a second feature vector set, a third feature vector set, an initial first graph network, and an initial second graph network may be input into an attention layer of a reading understanding model, attention values may be added to nodes and edges of the initial first graph network based on the first feature vector set and the second feature vector set, the first graph network may be obtained, and attention values may be added to nodes and edges of the initial second graph network based on the second feature vector set and the third feature vector set, and the second graph network may be obtained. For example, referring to fig. 10, a first feature vector group, a second feature vector group, a third feature vector group, an initial first graph network, and an initial second graph network may be input into an attention layer of a reading understanding model, and attention values are added to nodes and edges included in the initial first graph network based on the first feature vector group and the second feature vector group, so as to obtain a first graph network; and adding attention values for nodes and edges included in the initial second graph network based on the second characteristic vector group and the third characteristic vector group to obtain the second graph network.
Or, as another example, in this step, the first feature vector set, the second feature vector set, and the third feature vector set may be input into an attention layer of the reading understanding model, attention values of nodes and edges included in the initial first graph network are obtained based on the first feature vector set and the second feature vector set, and the attention values are added to the initial first graph network to obtain the first graph network; and obtaining attention values of nodes and edges included in the initial second graph network based on the second feature vector group and the third feature vector group, and adding the attention values to the initial second graph network to obtain the second graph network.
In an implementation, if the text length of the target text is smaller than the length threshold, the specific implementation of this step may include: adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set; and adding attention values to nodes and edges of the initial second graph network based on the second feature vector group and the third feature vector group through the attention layer.
As an example, the initial first graph network characterizes the association between the target text and the target answer, the first feature vector set is a feature representation of the target text, and the third feature vector set is a feature representation of the target answer, so that attention values may be added to nodes and edges of the initial first graph network according to the first feature vector set and the third feature vector set. Similarly, the initial second graph network characterizes the association relationship between the target question and the target answer, the second feature vector group is the feature representation of the target question, and the third feature vector group is the feature representation of the target answer, so that attention values can be added to nodes and edges of the initial second graph network according to the second feature vector group and the third feature vector group.
In some embodiments, adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set may include: taking a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, wherein the first node is a node corresponding to a word unit of the target text in the initial first graph network; taking a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of the target answer in the initial first graph network; determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; an attention value between a first node and a second node of an edge present in the initial first graph network is determined and used as the attention value of the edge based on the first feature vector set and the third feature vector set.
That is, the first feature vector in the first feature vector group may be used as the attention value of the node corresponding to the word unit of the target text in the initial first graph network, and the third feature vector in the third feature vector group may be used as the attention value of the node corresponding to the word unit of the target answer in the initial first graph network. And determining an attention value of an edge between the word units of the target text in the initial first graph network from the first set of feature vectors, and determining an attention value of an edge between the word units of the target text and the word units of the target answer in the initial first graph network from the first set of feature vectors and the third set of feature vectors.
As an example, for two first nodes where an edge exists, attention calculation may be performed on the first feature vectors of word units corresponding to the two first nodes, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the two first feature vectors by multiplying the two first feature vectors and normalizing the result to obtain an attention value. Illustratively, referring to fig. 11, an edge exists between "me" and "love" in fig. 11, and "me" and "love" are word units in the target text, a first feature vector of the word unit "me" may be obtained from the first feature vector group, a first feature vector of "love" may be obtained from the first feature vector group, the first feature vector of "me" and the first feature vector of "love" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "me" and "love".
As an example, for a first node and a second node where an edge exists, attention calculation may be performed on a first feature vector of a word unit corresponding to the first node and a third feature vector of a word unit corresponding to the second node, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the first feature vector and the third feature vector by multiplying the first feature vector and the third feature vector and normalizing the result to obtain an attention value. Illustratively, referring to fig. 11, there is an edge between "me" and "home" in fig. 11, and "me" is a word unit in the target text, and "home" is a word unit in the target answer, a first feature vector of the word unit "me" may be obtained from the first feature vector group, and a third feature vector of "home" may be obtained from the third feature vector group, the first feature vector of "me" and the third feature vector of "home" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "me" and "home".
In the above manner, the attention value of each edge and the attention value of each node in fig. 11 can be determined, and the attention values of the nodes and edges are added to the initial first graph network, so that the first graph network can be obtained.
In some embodiments, adding, by the attention layer, attention values to nodes and edges of the initial second graph network based on the second set of feature vectors and the third set of feature vectors may include: taking a second feature vector in the second feature vector group as an attention value of a third node in the initial second graph network, wherein the third node is a node corresponding to a word unit of the target problem in the initial second graph network; taking a third feature vector in the third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the target answer in the initial second graph network; determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge; and determining an attention value between a third node and a fourth node of an edge existing in the initial second graph network based on the second feature vector group and the third feature vector group, and taking the attention value as the attention value of the edge.
That is, the second feature vector in the second feature vector set may be used as the attention value of the node corresponding to the word unit of the target question in the initial second graph network, and the third feature vector in the third feature vector set may be used as the attention value of the node corresponding to the word unit of the target answer in the initial second graph network. And determining an attention value of an edge between the word units of the target question in the initial second graph network from the second set of feature vectors, and determining an attention value of an edge between the word units of the target question and the word units of the target answer in the initial second graph network from the second set of feature vectors and the third set of feature vectors.
As an example, for two third nodes where an edge exists, attention computation may be performed on the second feature vectors of word units corresponding to the two third nodes, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the two second feature vectors by multiplying the two second feature vectors and normalizing the result to obtain an attention value. Illustratively, referring to fig. 12, an edge exists between "me" and "who" in fig. 12, and "me" and "who" are word units in the target problem, a second feature vector of the word unit "me" may be obtained from the second feature vector group, and a second feature vector of "who" may be obtained from the second feature vector group, the second feature vector of "me" and the second feature vector of "who" may be multiplied, and the products may be normalized to obtain an attention value of the edge between "me" and "who".
As an example, for the third node and the fourth node where an edge exists, attention calculation may be performed on the second feature vector of the word unit corresponding to the third node and the third feature vector of the word unit corresponding to the fourth node, and an attention value of the edge may be obtained. Specifically, the attention calculation is performed on the second feature vector and the third feature vector by multiplying the second feature vector and the third feature vector and normalizing the result to obtain the attention value. Illustratively, referring to fig. 12, an edge exists between "who" and "home" in fig. 12, and "who" is a word unit in a target question, "home" is a word unit in a target answer, a second feature vector of "who" of the word unit may be obtained from the second feature vector group, and a third feature vector of "home" may be obtained from the third feature vector group, the second feature vector of "who" and the third feature vector of "home" may be multiplied, and the product may be normalized to obtain an attention value of the edge between "who" and "home".
In the above manner, the attention value of each edge and the attention value of each node in fig. 12 can be determined, and the attention values of the nodes and edges are added to the initial second graph network, so that the second graph network can be obtained.
In the embodiment of the present application, the attention calculation may be performed on the two feature vectors by the above formula (1), and the specific implementation may refer to the description related to step 206, which is not repeated herein.
It should be noted that, the foregoing describes, as an example, that the text length of the target text is smaller than the length threshold, that is, the first feature vector group corresponds to the target text, to determine the first graph network. In other embodiments, for one target text, if the target text is split into multiple target text segments, the first feature vector set is a feature vector set of the target text segment, and then the attention value may be added to the node and the edge of the initial first graph network corresponding to the target text segment based on the first feature vector set of each target text segment and the third feature vector set of the target answer.
For example, if the target text is divided into 3 target text segments, 3 first feature vector sets may be extracted, generating 3 initial first graph networks. For the reference initial first graph network, the reference initial first graph network is generated based on the reference target text segment and the target answer, and then attention values can be added to nodes and edges of the reference initial first graph network according to the first feature vector group of the reference target text segment and the third feature vector group of the target answer to obtain the reference first graph network. Wherein the reference target text segment is any one of a plurality of text segments and the reference initial first graph network corresponds to the reference target text segment and the reference first graph network corresponds to the reference target text segment. Similarly, 3 first graph networks can be obtained in the above manner. In addition, the implementation process of adding the attention value to the node and the edge of the initial first graph network corresponding to the target text segment is the same as the implementation process of adding the attention value to the node and the edge of the initial first graph network, and specific reference may be made to the related description of the foregoing embodiment of the step, which is not repeated herein.
It should be noted that, steps 904-906 are specific implementations of "inputting the target text, the target question, and the target answer into the text processing layer of the reading understanding model, and adding attention values to nodes and edges included in the initial first graph network and the initial second graph network, respectively, to obtain a first graph network and a second graph network".
Step 908, inputting the first graph network and the second graph network into the graph roll network layer of the reading understanding model to obtain an answer to the target question.
As one example, the graph roll-up network layer may be a GCN (Graph Convolutional Network, graph roll-up network) model.
Illustratively, referring to FIG. 10, the first graph network and the second graph network may be input into a graph roll-up network layer of a reading understanding model to obtain an answer.
In an implementation, if the text length of the target text is smaller than a length threshold, the first graph network is a graph network reflecting an association relationship between the target text and the target answer, and the inputting the first graph network and the second graph network into the graph roll network layer of the reading understanding model, to obtain the specific implementation of the answer may include: determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph roll layer; carrying out weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector; and determining the answer based on the target hidden layer feature vector.
The first hidden layer feature vector is a vector representation of the first graph network, which is obtained by performing convolution processing on the first graph network through a graph convolution network layer. The second hidden layer feature vector is a vector representation of the second graph network obtained by convolving the second graph network with the graph convolution network layer.
As an example, a first graph network may be input into a graph convolutional network layer for convolutional processing, a first hidden layer feature vector may be obtained, and a second graph network may be input into a graph convolutional network layer for convolutional processing, a second hidden layer feature vector may be obtained.
It should be noted that, in the graph convolution network layer, the convolution processing may be performed on the graph network through the above formula (2), and the specific implementation may refer to the related description of step 208, which is not repeated herein in the embodiment of the present application.
As an example, when the first hidden layer feature vector and the second hidden layer feature vector are weighted and summed, the weight of the first hidden layer feature vector and the weight of the second hidden layer feature vector may be the same, may be different, may be set by a user according to actual needs, may be set by a computing device by default, and the embodiment of the present application is not limited to this.
In some embodiments, determining a specific implementation of the answer based on the target hidden layer feature vector may include: converting the value of each dimension of the target hidden layer feature vector into at least one probability through a sequence labeling function, wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and the at least one probability corresponding to each dimension represents the probability that the label of the word unit corresponding to each dimension is at least one label; determining a label of a word unit corresponding to each dimension based on at least one probability corresponding to each dimension; and determining the answer based on the labels of the word units corresponding to each dimension.
As an example, a sequence labeling function is a function used when sequence labeling is performed, and an input vector may be mapped into probabilities of at least one dimension, i.e., at least one probability may be obtained for each vector.
For example, the target hidden layer feature vector can be used as the input of a sequence labeling function, and the probability corresponding to each dimension of the target hidden layer feature vector can be obtained through calculation of the sequence labeling function.
As an example, the tag may be B, I, O. Wherein B represents the beginning word of the answer, namely the first word of the answer; i represents intermediate ending words of the answer, namely the second word to the last word of the answer; o represents a non-answer word, i.e., a word that is not an answer.
It should be noted that, the length of the target hidden layer feature vector is the same as the length of the target text.
Illustratively, taking the example that the target text is "my love my ancestor" then the target hidden layer feature vector is a 6-dimensional vector, and the 6 dimensions correspond to word units i, love, me, ancestor, and state, respectively, each dimension in the target hidden layer feature vector is converted to 3 probabilities, each probability corresponding to a likelihood of occurrence of the tag "BIO". For example, for the word unit "love", assuming that the calculated probabilities are 0.2,0.3,0.5, respectively, it can be determined that the probability of the tag being "O" is the greatest, and the tag corresponding to "love" is "O". Similarly, it is assumed that the labels corresponding to the 6 word units are determined to be "O", "B", "I", respectively. Since the label "B" represents the answer start word and the label "I" represents the answer intermediate end word, it can be considered that "ancestor" and "country" are answers.
As an example, the at least one tag includes an answer start word, an answer middle end word, and a non-answer word, and determining the specific implementation of the answer based on the tag of the word unit corresponding to each dimension may include: and taking the word units corresponding to the beginning words of the answers and the word units corresponding to the intermediate ending words of the answers as the answers.
That is, the answer may be obtained by concatenating the answer start word and the answer intermediate end word.
Continuing with the above example, a "country" may be determined as an answer.
It should be noted that, the foregoing is described by taking the example that the text length of the target text is smaller than the length threshold, that is, the first graph network corresponds to the entire target text. In other embodiments, for a target text, if the target text is split into multiple target text segments, the first graph network corresponds to the target text segment, and the answer obtained by inputting the first graph network and the second graph network into the graph winding network layer corresponds to the target text segment, but the answer is not necessarily the correct answer of the target question. Thus, in this case, one answer can be obtained for each target text segment, a plurality of answers can be obtained, and then a correct answer for the target question can be determined from the plurality of answers.
As an example, a target answer having the highest frequency of occurrence among the plurality of answers may be taken as an answer to the target question. For example, assuming that the target text is divided into 10 target text segments, each of the first graph network and the second graph network is input into the graph convolution network layer to be processed, 10 answers can be obtained, the 10 answers include target answers, and the target answer with the largest occurrence number among the 10 answers can be used as the answer of the target question.
The method can effectively utilize the feature vectors of the target text, the target questions and the target answers, extract the association relation among the three, and determine the answers of the target questions through the reading and understanding model by combining the association relation among the sample text, the target questions and the target answers, so that the accuracy of the reading and understanding model in executing the reading and understanding tasks can be improved.
The following describes the training method of the reading and understanding model by taking the application of the reading and understanding method provided by the application in the reading and understanding task as an example with reference to fig. 13. Fig. 13 is a process flow chart of a reading and understanding method applied to a choice question according to an embodiment of the present application, which specifically includes the following steps:
step 1302: and acquiring the target text, the target question and the target answer.
In the embodiment of the application, the form of the target question and the text length of the target text are not limited, and the reading and understanding method is described only by taking the target question as a selection question and taking the text length of the target text as less than the length threshold value as an example.
For example, the target text is "my love my home", the target question is "who me love", and the target answer is two options, namely "home".
Step 1304: and inputting the target text, the target questions and the target answers into a graph construction network layer of the reading understanding model, and constructing an initial third graph network based on the dependency relationship among word units in the target text.
For example, taking the example that the target text is "my love my ancestor", the target text is subjected to dependency analysis by Stanford Core NLP algorithm, so that "me" is the subject, "love" is the predicate, "my ancestor" is the object, and the dependency relationship between "me", "love", "me", "ancestor" and "country" can be obtained. For example, one of "me" and "love" in the target text has a dependency relationship, one of "me" and "ancestor" has a dependency relationship, and "love" also has a dependency relationship with "ancestor" and "ancestor" has a dependency relationship with "country", based on which the initial third graph network shown in fig. 4 can be obtained.
Step 1306: and based on the association relation between the word units in the target answers and the word units in the target text, connecting the target nodes with the nodes in the initial third graph network by taking the word units in the target answers as target nodes, and obtaining the initial first graph network.
Continuing with the above example, the word units in the target answers may be used as target nodes, the "ancestors" in the target answers may be respectively connected to each node in the initial third graph network, the "countries" in the target answers may be respectively connected to each node in the initial third graph network, the "home" in the target answers may be respectively connected to each node in the initial third graph network, the "hometown" in the target answers may be respectively connected to each node in the initial third graph network, and the first graph network shown in fig. 11 may be obtained, where the bolded nodes in fig. 11 are the target nodes.
Step 1308: and inputting the target text, the target questions and the target answers into a graph construction network layer of the reading understanding model, and constructing an initial fourth graph network based on the dependency relationship among word units in the target questions.
Continuing with the above example, by performing a dependency analysis on the target problem "I love" by Stanford Core NLP algorithm, "I" as the subject, "love" as the predicate, "who" as the object, and "I", "love", "who" as the dependency relationship with each other can be obtained. For example, there is a dependency relationship between "me" and "love" in the target problem, there is a dependency relationship between "love" and "who", and there is a dependency relationship between "me" and "who", based on the above-described dependency relationship, referring to fig. 6, an initial fourth graph network shown in fig. 6 can be obtained.
Step 1310: and based on the association relation between the word units in the target answers and the word units in the target questions, connecting the target nodes with the nodes in the initial fourth graph network by taking the word units in the target answers as target nodes, and obtaining the initial second graph network.
Continuing with the above example, the word units in the target answers may be used as target nodes, the "ancestors" in the target answers may be respectively connected to each node in the initial fourth graph network, the "countries" in the target answers may be respectively connected to each node in the initial fourth graph network, the "home" in the target answers may be respectively connected to each node in the initial fourth graph network, the "hometown" in the target answers may be respectively connected to each node in the initial fourth graph network, and the initial second graph network shown in fig. 12 may be obtained, where the bolded nodes in fig. 12 are the target nodes.
Step 1312: inputting the target text, the target questions and the target answers into a feature extraction layer of a reading understanding model, performing word segmentation on the target text to obtain a first word unit group, performing word segmentation on the target questions to obtain a second word unit group, and performing word segmentation on the target answers to obtain a third word unit group.
Continuing with the above example, after the target text is segmented, a first word unit group may be obtained, which is "me", "love", "me", "ancestor", "country", respectively. Similarly, the target problem is segmented to obtain a second word unit group, namely 'I', 'love', 'who' respectively. The third word unit group can be obtained by word segmentation of the target answer, namely 'ancestor', 'national', 'home' and 'rural'.
In step 1314, word embedding processing is performed on the first word unit group, the second word unit group and the third word unit group, so as to obtain a first word vector group, a second word vector group and a third word vector group, respectively.
Continuing with the above example, word embedding processing is performed on each first word unit in the first word unit group, so that a first word vector of "me", a first word vector of "love", a first word vector of "me", a first word vector of "ancestor", and a first word vector of "country" can be obtained respectively. Similarly, word embedding processing is performed on each second word unit in the second word unit group, and the second word unit group can be respectively a second word vector of 'I', a second word vector of 'love', and a second word vector of 'who'. And carrying out word embedding processing on each third word unit in the third word unit group to respectively obtain a third word vector of 'ancestor', a third word vector of 'country', a third word vector of 'home', and a third word vector of 'county'.
Step 1316, encoding the first word vector set, the second word vector set, and the third word vector set to obtain a first feature vector set, a second feature vector set, and a third feature vector set, respectively.
Continuing with the above example, the word vector of "me", the word vector of "love" and the word vector of "who" are encoded, the third feature vector obtained after "me" combines the word vectors of "love", "who" and the word vectors of "love" and the third feature vector obtained after "love" combines the word vectors of "me", "who" and the word vectors of "who" and the third feature vector obtained after "who" combines the word vectors of "me", "love" and the word vectors of "love" can be obtained. Similarly, a second feature vector of each word unit in the target question and a third feature vector of each word unit in the target answer can be obtained.
Step 1318, adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first set of feature vectors and the third set of feature vectors, resulting in the first graph network.
Continuing with the above example, the feature vector for each node in FIG. 11 may be taken as the attention value for each node. There is an edge between "me" and "love" in fig. 11, and "me" and "love" are word units in the target text, a first feature vector of the word unit "me" can be obtained from the first feature vector group, a first feature vector of "love" can be obtained from the first feature vector group, the first feature vector of "me" and the first feature vector of "love" can be multiplied, and the products are normalized, so that the attention value of the edge between "me" and "love" can be obtained. There is an edge between "me" and "home", and "me" is a word unit in the target text, and "home" is a word unit in the target answer, and the first feature vector of the word unit "me" can be obtained from the first feature vector group, and the third feature vector of "home" can be obtained from the third feature vector group, and the first feature vector of "me" and the third feature vector of "home" can be multiplied, and the product is normalized, so that the attention value of the edge between "me" and "home" can be obtained.
In the above manner, the attention value of each edge and the attention value of each node in fig. 11 can be determined, and the attention values of the nodes and edges are added to the initial first graph network, so that the first graph network can be obtained.
Step 1320, adding, by the attention layer, attention values to nodes and edges of the initial second graph network based on the second set of feature vectors and the third set of feature vectors, resulting in a second graph network.
Continuing with the above example, the feature vector for each node in FIG. 11 may be taken as the attention value for each node. There is an edge between "me" and "who" in fig. 12, and "me" and "who" are word units in the target problem, the second feature vector of the word unit "me" may be obtained from the second feature vector group, and the second feature vector of "who" may be obtained from the second feature vector group, the second feature vector of "me" and the second feature vector of "who" may be multiplied, and the products may be normalized, so that the attention value of the edge between "me" and "who" may be obtained. An edge exists between 'who' and 'home', and 'who' is a word unit in a target question, wherein 'home' is a word unit in a target answer, a second feature vector of 'who' of the word unit can be obtained from a second feature vector group, a third feature vector of 'home' can be obtained from a third feature vector group, the second feature vector of 'who' and the third feature vector of 'home' can be multiplied, and the product is normalized, so that an attention value of the edge between 'who' and 'home' can be obtained.
In the above manner, the attention value of each edge and the attention value of each node in fig. 12 can be determined, and the attention values of the nodes and edges are added to the initial second graph network, so that the second graph network can be obtained.
Step 1322, inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model, and determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph rolling network layer.
As an example, a first graph network may be input into a graph convolutional network layer for convolutional processing, a first hidden layer feature vector may be obtained, and a second graph network may be input into a graph convolutional network layer for convolutional processing, a second hidden layer feature vector may be obtained.
Step 1324, performing weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain the target hidden layer feature vector.
At step 1326, values for each dimension of the target hidden layer feature vector are converted to at least one predictive probability by a sequence labeling function.
As an example, a sequence labeling function is a function used when sequence labeling is performed, and an input vector may be mapped into probabilities of at least one dimension, i.e., at least one probability may be obtained for each vector.
For example, the target hidden layer feature vector can be used as the input of a sequence labeling function, and the probability corresponding to each dimension of the target hidden layer feature vector can be obtained through calculation of the sequence labeling function.
Continuing the above example, the target text is "my love my ancestor" comprising 6 word units, then the target hidden layer feature vector is a 6-dimensional vector, and the 6 dimensions correspond to word units i, i love, i, q, respectively, then each dimension in the target hidden layer feature vector is converted to 3 predictive probabilities, each probability corresponding to a probability of the occurrence of the tag "BIO". For example, assuming that the calculated prediction probabilities are 0.5,0.3,0.2 for the word unit "ancestor", respectively, 0.5 is the probability that the label of the word unit "ancestor" is "B", 0.3 is the probability that the label of the word unit "ancestor" is "I", 0.2 is the probability that the label of the word unit "ancestor" is "O", and for the word unit "country", assuming that the calculated prediction probabilities are 0.3,0.6,0.1, respectively, 0.3 is the probability that the label of the word unit "country" is "B", 0.6 is the probability that the label of the word unit "country" is "I", and 0.1 is the probability that the label of the word unit "country" is "O".
Step 1328, determining a predictive label for the word unit corresponding to each dimension based on the at least one predictive probability corresponding to each dimension.
Continuing with the above example, since 0.5 is the largest of the prediction probabilities corresponding to the word unit "ancestor" and 0.5 is the probability that the label of the word unit "ancestor" is "B", the prediction label corresponding to the "ancestor" can be determined to be "O", 0.6 is the largest of the prediction probabilities corresponding to the word unit "country" and 0.6 is the probability that the label of the word unit "country" is "I", and the prediction label corresponding to the "country" can be determined to be "I".
Step 1330, the word unit corresponding to the beginning word of the answer and the word unit corresponding to the middle ending word of the answer are used as the answer of the target question.
Continuing with the above example, assume that the labels corresponding to the 6 word units of "I, love, I, ancestor, country" are "O", "B", "I", respectively, are determined. Since the label "B" represents the answer start word and the label "I" represents the answer intermediate end word, it can be determined that the answer to the target question is "country".
The method can effectively utilize the feature vectors of the target text, the target questions and the target answers, extract the association relation among the three, and determine the answers of the target questions through the reading and understanding model by combining the association relation among the target text, the target questions and the target answers, so that the accuracy of the reading and understanding model in executing the reading and understanding task can be improved.
Corresponding to the method embodiment, the application further provides an embodiment of a training device for reading the understanding model, and fig. 14 shows a schematic structural diagram of the training device for reading the understanding model according to an embodiment of the application. As shown in fig. 14, the apparatus may include:
a first graph network construction module 1402 configured to construct an initial first graph network of sample text fragments and sample answers by a graph construction network layer of a reading understanding model, and to construct an initial second graph network of sample questions and the sample answers;
a first text processing module 1404 configured to input the sample text segment, the sample question, and the sample answer into a text processing layer of the reading understanding model, and add attention values for nodes and edges included in the initial first graph network and the initial second graph network, respectively, to obtain a first graph network and a second graph network;
a prediction module 1406 configured to input the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to obtain a predicted answer;
a training module 1408 is configured to train the reading understanding model based on the difference between the predicted answer and the sample answer until a training stop condition is reached.
Optionally, the first text processing module 1404 is configured to:
inputting the sample text fragment, the sample questions and the sample answers into a feature extraction layer of the reading understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group;
and inputting the first feature vector group, the second feature vector group and the third feature vector group into the attention layer of the reading and understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain the first graph network and the second graph network.
Optionally, the first text processing module 1404 is configured to:
performing word segmentation processing on the sample text fragment, the sample question and the sample answer to obtain a first word unit group, a second word unit group and a third word unit group respectively;
word embedding processing is carried out on the first word unit group, the second word unit group and the third word unit group to respectively obtain a first word vector group, a second word vector group and a third word vector group;
and encoding the first word vector group, the second word vector group and the third word vector group to respectively obtain the first feature vector group, the second feature vector group and the third feature vector group.
Optionally, the first graph network construction module 1402 is configured to:
constructing an initial third graph network based on the dependency relationship between word units in the sample text segment, and constructing an initial fourth graph network based on the dependency relationship between word units in the sample question;
constructing the initial first graph network based on the association relationship between the initial third graph network and the sample answer, and constructing the initial second graph network based on the association relationship between the initial fourth graph network and the sample answer.
Optionally, the first graph network construction module 1402 is configured to:
taking word units in the sample text fragments as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample text fragment to obtain the initial third graph network.
Optionally, the first graph network construction module 1402 is configured to:
and based on the association relation between the word units in the sample answers and the word units in the sample text fragments, connecting the target node with the nodes in the initial third graph network by taking the word units in the sample answers as target nodes, and obtaining the initial first graph network.
Optionally, the first graph network construction module 1402 is configured to:
taking word units in the sample problem as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample problem to obtain the initial fourth graph network.
Optionally, the first graph network construction module 1402 is configured to:
and based on the association relation between the word units in the sample answers and the word units in the sample questions, connecting the target node with the nodes in the initial fourth graph network by taking the word units in the sample answers as target nodes, and obtaining the initial second graph network.
Optionally, the first text processing module 1404 is configured to:
adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set;
and adding attention values to nodes and edges of the initial second graph network based on the second feature vector group and the third feature vector group through the attention layer.
Optionally, the first text processing module 1404 is configured to:
Taking a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, wherein the first node is a node corresponding to a word unit of the sample text fragment in the first graph network;
taking a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of the sample answer in the first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
an attention value between a first node and a second node of an edge present in the initial first graph network is determined and used as the attention value of the edge based on the first feature vector set and the third feature vector set.
Optionally, the first text processing module 1404 is configured to:
taking a second feature vector in the second feature vector group as an attention value of a third node in the initial second graph network, wherein the third node is a node corresponding to a word unit of the sample problem in the initial second graph network;
Taking a third feature vector in the third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the sample answer in the initial second graph network;
determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge;
and determining an attention value between a third node and a fourth node of an edge existing in the initial second graph network based on the second feature vector group and the third feature vector group, and taking the attention value as the attention value of the edge.
Optionally, the prediction module 1406 is configured to:
determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph roll layer;
carrying out weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector;
and determining the prediction answer based on the target hidden layer feature vector.
Optionally, the prediction module 1406 is configured to:
converting the value of each dimension of the target hidden layer feature vector into at least one prediction probability through a sequence labeling function, wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and the at least one prediction probability corresponding to each dimension represents the probability that the prediction label of the word unit corresponding to each dimension is at least one label;
Determining a predictive label of a word unit corresponding to each dimension based on at least one predictive probability corresponding to each dimension;
and determining the prediction answer based on the prediction labels of the word units corresponding to each dimension.
Optionally, the prediction module 1406 is configured to:
the at least one label comprises an answer beginning word, an answer middle ending word and a non-answer word, and a word unit corresponding to the answer beginning word and a word unit corresponding to the answer middle ending word are used as the prediction answers.
Optionally, the training module 1408 is configured to:
if the difference value is smaller than a preset threshold value, stopping training the reading and understanding model;
and if the difference value is greater than or equal to the preset threshold value, continuing training the reading and understanding model.
Optionally, the training module 1408 is configured to:
recording and carrying out iterative training once every time a predicted answer is obtained;
and counting the training times of iterative training, and determining that the training stopping condition is reached if the training times are greater than a time threshold.
In the embodiment of the application, a network layer is constructed through reading and understanding the graph of the model to construct an initial first graph network of sample text fragments and sample answers, and an initial second graph network of sample questions and sample answers is constructed; inputting the sample text fragments, the sample questions and the sample answers into a text processing layer of the reading understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain a first graph network and a second graph network; inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer; and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached. The method can effectively utilize the feature vectors of the sample text fragments, the sample questions and the sample answers, extract the association relation among the sample text fragments, the sample questions and the sample answers, train the reading and understanding model by combining the association relation among the sample text fragments, the sample questions and the sample answers, and improve the accuracy of the reading and understanding model in executing the reading and understanding tasks.
The above is a schematic scheme of a training device for reading and understanding a model in this embodiment. It should be noted that, the technical solution of the training device for reading and understanding the model and the technical solution of the training method for reading and understanding the model belong to the same concept, and the details of the technical solution of the training device for reading and understanding the model, which are not described in detail, can be referred to the description of the technical solution of the training method for reading and understanding the model.
Corresponding to the method embodiment, the application further provides an embodiment of a reading and understanding device, and fig. 15 shows a schematic structural diagram of the reading and understanding device according to an embodiment of the application. As shown in fig. 15, the apparatus may include:
a second graph network construction module 1502 configured to construct an initial first graph network of target text and target answers by reading a graph construction network layer of an understanding model, and to construct an initial second graph network of target questions and the target answers;
a second text processing module 1504 configured to input the target text, the target question, and the target answer into a text processing layer of the reading understanding model, and add attention values to nodes and edges included in the initial first graph network and the initial second graph network, respectively, to obtain a first graph network and a second graph network;
A determining module 1506 is configured to input the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to determine an answer to the target question.
Optionally, the second text processing module 1504 is configured to:
inputting the target text, the target questions and the target answers into a feature extraction layer of the reading understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group;
and inputting the first feature vector group, the second feature vector group and the third feature vector group into the attention layer of the reading and understanding model, and respectively adding attention values for nodes and edges included in the initial first graph network and the initial second graph network to obtain the first graph network and the second graph network.
Optionally, the second text processing module 1504 is configured to:
word segmentation processing is carried out on the target text, the target question and the target answer to respectively obtain a first word unit group, a second word unit group and a third word unit group;
word embedding processing is carried out on the first word unit group, the second word unit group and the third word unit group to respectively obtain a first word vector group, a second word vector group and a third word vector group;
And encoding the first word vector group, the second word vector group and the third word vector group to respectively obtain the first feature vector group, the second feature vector group and the third feature vector group.
Optionally, the second graph network construction module 1502 is configured to:
constructing an initial third graph network based on the dependency relationship between word units in the target text, and constructing an initial fourth graph network based on the dependency relationship between word units in the target question;
the initial first graph network is constructed based on the association relation between the initial third graph network and the target answer, and the initial second graph network is constructed based on the association relation between the initial fourth graph network and the target answer.
Optionally, the second graph network construction module 1502 is configured to:
taking word units in the target text as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the target text to obtain the initial third graph network.
Optionally, the second graph network construction module 1502 is configured to:
and based on the association relation between the word units in the target answers and the word units in the target text, connecting the target nodes with the nodes in the initial third graph network by taking the word units in the target answers as target nodes, and obtaining the initial first graph network.
Optionally, the second graph network construction module 1502 is configured to:
taking word units in the target problem as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the target problem to obtain the initial fourth graph network.
Optionally, the second graph network construction module 1502 is configured to:
and based on the association relation between the word units in the target answers and the word units in the target questions, connecting the target nodes with the nodes in the initial fourth graph network by taking the word units in the target answers as target nodes, and obtaining the initial second graph network.
Optionally, the second text processing module 1504 is configured to:
adding, by the attention layer, attention values to nodes and edges of the initial first graph network based on the first feature vector set and the third feature vector set;
and adding attention values to nodes and edges of the initial second graph network based on the second feature vector group and the third feature vector group through the attention layer.
Optionally, the second text processing module 1504 is configured to:
Taking a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, wherein the first node is a node corresponding to a word unit of the target text in the initial first graph network;
taking a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of the target answer in the initial first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
an attention value between a first node and a second node of an edge present in the initial first graph network is determined and used as the attention value of the edge based on the first feature vector set and the third feature vector set.
Optionally, the second text processing module 1504 is configured to:
taking a second feature vector in the second feature vector group as an attention value of a third node in the initial second graph network, wherein the third node is a node corresponding to a word unit of the target problem in the initial second graph network;
Taking a third feature vector in the third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the target answer in the initial second graph network;
determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge;
and determining an attention value between a third node and a fourth node of an edge existing in the initial second graph network based on the second feature vector group and the third feature vector group, and taking the attention value as the attention value of the edge.
Optionally, the determining module 1506 is configured to:
determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph roll layer;
carrying out weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector;
and determining the answer based on the target hidden layer feature vector.
Optionally, the determining module 1506 is configured to:
converting the value of each dimension of the target hidden layer feature vector into at least one probability through a sequence labeling function, wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and the at least one probability corresponding to each dimension represents the probability that the label of the word unit corresponding to each dimension is at least one label;
Determining a label of a word unit corresponding to each dimension based on at least one probability corresponding to each dimension;
and determining the answer based on the labels of the word units corresponding to each dimension.
Optionally, the determining module 1506 is configured to:
the at least one label comprises an answer beginning word, an answer middle ending word and a non-answer word, and a word unit corresponding to the answer beginning word and a word unit corresponding to the answer middle ending word are used as the answers.
In the embodiment of the application, an initial first graph network of a target text and a target answer is constructed through a graph construction network layer of a reading and understanding model, and an initial second graph network of a target question and the target answer is constructed; inputting the target text, the target questions and the target answers into a text processing layer of the reading understanding model, and adding attention values for nodes and edges included in the initial first graph network and the initial second graph network respectively to obtain a first graph network and a second graph network; and inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain an answer to the target question. The method can effectively utilize the feature vectors of the target text, the target questions and the target answers, extract the association relation among the three, and determine the answers of the target questions through the reading and understanding model by combining the association relation among the target text, the target questions and the target answers, so that the accuracy of the reading and understanding model in executing the reading and understanding task can be improved.
The above is a schematic solution of a reading and understanding device of this embodiment. It should be noted that, the technical solution of the reading and understanding device and the technical solution of the reading and understanding method belong to the same concept, and the details of the technical solution of the reading and understanding device, which are not described in detail, can be referred to the description of the technical solution of the reading and understanding method.
It should be noted that, the components in the apparatus claims should be understood as functional modules that are necessary to be established for implementing the steps of the program flow or the steps of the method, and the functional modules are not actually functional divisions or separate limitations. The device claims defined by such a set of functional modules should be understood as a functional module architecture for implementing the solution primarily by means of the computer program described in the specification, and not as a physical device for implementing the solution primarily by means of hardware.
In an embodiment of the present application, a computing device is further provided, including a memory, a processor, and computer instructions stored in the memory and capable of running on the processor, where the processor implements the steps of the training method of the reading understanding model or implements the steps of the reading understanding method described above when executing the instructions.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device and the technical solution of the training method of the reading and understanding model belong to the same concept, and details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the training method of the reading and understanding model. Or, the technical solution of the computing device and the technical solution of the reading and understanding method belong to the same conception, and the details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the reading and understanding method.
An embodiment of the present application also provides a computer readable storage medium storing computer instructions that, when executed by a processor, implement the steps of a training method for reading understanding models as described above, or implement the steps of the reading understanding method described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the training method of the reading and understanding model belong to the same concept, and the details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the training method of the reading and understanding model. Or, the technical solution of the storage medium and the technical solution of the reading and understanding method belong to the same conception, and the details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the reading and understanding method.
The embodiment of the application discloses a chip which stores computer instructions which are executed by a processor to realize the steps of a training method of a reading and understanding model as described above or to realize the steps of the reading and understanding method as described above.
The foregoing describes certain embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, randomAccess Memory), an electrical carrier signal, a telecommunication signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the application disclosed above are intended only to assist in the explanation of the application. Alternative embodiments are not intended to be exhaustive or to limit the application to the precise form disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and the practical application, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and the full scope and equivalents thereof.

Claims (32)

1. A method of constructing a graph network, the method comprising:
determining a first feature vector in a first feature vector group as an attention value of a first node in an initial first graph network through reading an attention layer of an understanding model, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network;
determining a third feature vector in a third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
and determining the attention value between the first node and the second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain the first graph network.
2. The method as recited in claim 1, further comprising:
determining a second feature vector in a second feature vector group as an attention value of a third node in an initial second graph network through the attention layer, wherein the third node is a node corresponding to a word unit of a sample problem in the initial second graph network;
Determining a third feature vector in a third feature vector group as an attention value of a fourth node in the initial second graph network, wherein the fourth node is a node corresponding to a word unit of the sample answer in the initial second graph network;
determining, based on the second set of feature vectors, an attention value between two third nodes in the initial second graph network where an edge exists and as the attention value of the edge;
and determining an attention value between a third node and a fourth node with edges in the initial second graph network based on the second characteristic vector group and the third characteristic vector group, and taking the attention value as the attention value of the edges to obtain a second graph network.
3. The method of claim 2, wherein prior to determining the first feature vector of the first set of feature vectors as the attention value of the first node in the initial first graph network, further comprising:
and inputting the sample text fragment, the sample question and the sample answer into a feature extraction layer of the reading and understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group.
4. A method according to any one of claims 1-3, wherein the reading understanding model further comprises a feature extraction layer, the feature extraction layer adopting the structure of the Bert model.
5. A method according to any one of claims 1-3, wherein the attention layer adopts the structure of an attention layer of a Bert model.
6. The method of claim 3, wherein before inputting the sample text segment, the sample question, and the sample answer to the feature extraction layer of the reading understanding model, further comprising:
constructing the initial first graph network of sample text fragments and sample answers through a graph construction network layer of the reading understanding model, and constructing the initial second graph network of sample questions and sample answers;
determining, based on the second feature vector set and the third feature vector set, an attention value between a third node and a fourth node where an edge exists in the initial second graph network, and using the attention value as the attention value of the edge, and after obtaining a second graph network, further includes:
inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain a prediction answer;
and training the reading and understanding model based on the difference value between the predicted answer and the sample answer until a training stopping condition is reached.
7. The method of claim 6, wherein the graph roll network layer is a GCN model.
8. The method of claim 6 or 7, wherein the graph roll network layer convolves a graph network comprising the first graph network and the second graph network by:
where i represents an ith node in the graph network, j represents a jth node in the graph network,representing the ith node input the eigenvector of the (1+1) th convolution layer, σ (·) represents the nonlinear conversion function, which is the ReLU activation function, N i Representing node i and all nodes connected to node i,/->Representing the j-th node input the feature vector of the l convolution layer, C ij Attention value representing the edge between the i-th node and the j-th node,/for the node>Indicating the weight of the jth node at the ith convolutional layer, +.>Representing the intercept of the jth node at the ith convolutional layer.
9. The method of claim 6 or 7, wherein the graph rolling network layer comprises a plurality of convolution layers, wherein the convolution layers comprise a preset weight parameter matrix, and the weight of each node in each convolution layer is an initial weight in the weight parameter matrix; or the convolution layers comprise preset intercept parameter matrixes, and the intercept of each node in each convolution layer is the initial intercept in each intercept parameter matrix.
10. The method of claim 3, wherein inputting the sample text segment, the sample question, and the sample answer into a feature extraction layer of the reading understanding model obtains a first feature vector set, a second feature vector set, and a third feature vector set, respectively, comprising:
performing word segmentation processing on the sample text fragment, the sample question and the sample answer to obtain a first word unit group, a second word unit group and a third word unit group respectively;
word embedding processing is carried out on the first word unit group, the second word unit group and the third word unit group to respectively obtain a first word vector group, a second word vector group and a third word vector group;
and encoding the first word vector group, the second word vector group and the third word vector group to respectively obtain the first feature vector group, the second feature vector group and the third feature vector group.
11. The method of claim 10, wherein word segmentation is performed on the sample text segment, the sample question, and the sample answer to obtain a first word unit group, a second word unit group, and a third word unit group, respectively, comprising:
If the sample text segment is a Chinese text, dividing a word, a punctuation mark and a number into a word unit respectively and independently, and forming the first word unit group by the word units obtained by dividing the sample text segment; or if the sample text segment is a foreign text, dividing a word or a phrase into a word unit, and forming the first word unit group by the word units obtained by dividing the sample text segment;
if the sample problem is a Chinese text, dividing a word, a punctuation mark and a number into a word unit respectively and independently, and forming a second word unit group by the word units obtained by dividing the sample problem; or if the sample question is a foreign text, dividing a word or a phrase into a word unit, and forming the second word unit group by the word units obtained by dividing the sample question;
if the sample answer is a Chinese text, dividing a word, a punctuation mark and a number into a word unit respectively and independently, and forming a third word unit group by the word units obtained by dividing the sample answer; or if the sample answer is a foreign text, dividing a word or a phrase into a word unit, and forming the third word unit group by the word unit obtained by dividing the sample answer.
12. The method of claim 10, wherein performing word embedding processing on the first word unit group, the second word unit group, and the third word unit group to obtain a first word vector group, a second word vector group, and a third word vector group, respectively, comprises:
word embedding processing is carried out on each first word unit in the first word unit group by adopting a single-heat coding or word2vec coding mode, so that the first word vector group is obtained;
performing word embedding processing on each second word unit in the second word unit group by adopting a single-heat coding or word2vec coding mode to obtain a second word vector group;
and carrying out word embedding processing on each third word unit in the third word unit group by adopting a single-heat coding or word2vec coding mode to obtain the third word vector group.
13. The method of claim 10, wherein encoding the first set of word vectors, the second set of word vectors, and the third set of word vectors to obtain the first set of feature vectors, the second set of feature vectors, and the third set of feature vectors, respectively, comprises:
encoding each first word vector, each second word vector and each third word vector to respectively obtain a first feature vector of each first word unit, a second feature vector of each second word unit and a third feature vector of each third word unit, wherein the first feature vector of each first word unit is a vector representation after the text segment full text semantic information of the fusion sample corresponding to each first word unit, the second feature vector of each second word unit is a vector representation after the text segment full text semantic information of the fusion sample corresponding to each second word unit, and the third feature vector of each third word unit is a vector representation after the text segment full text semantic information of the fusion sample corresponding to each third word unit.
14. The method of claim 6, wherein constructing the initial first graph network of sample text fragments and sample answers and the initial second graph network of sample questions and sample answers by the graph construction network layer of the reading understanding model comprises:
constructing an initial third graph network based on the dependency relationship between word units in the sample text segment, and constructing an initial fourth graph network based on the dependency relationship between word units in the sample question;
constructing the initial first graph network based on the association relationship between the initial third graph network and the sample answer, and constructing the initial second graph network based on the association relationship between the initial fourth graph network and the sample answer.
15. The method of claim 14, wherein constructing an initial third graph network based on dependencies between word units in the sample text segment comprises:
taking word units in the sample text fragments as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample text fragment to obtain the initial third graph network.
16. The method of claim 14 or 15, wherein constructing the initial first graph network based on the association between the initial third graph network and the sample answer comprises:
and based on the association relation between the word units in the sample answers and the word units in the sample text fragments, connecting the target node with the nodes in the initial third graph network by taking the word units in the sample answers as target nodes, and obtaining the initial first graph network.
17. The method of claim 14, wherein constructing an initial fourth graph network based on dependencies between word units in the sample question comprises:
taking word units in the sample problem as nodes to obtain a plurality of nodes;
and connecting nodes with dependency relationship based on the dependency relationship among word units in the sample problem to obtain the initial fourth graph network.
18. The method of claim 14 or 17, wherein constructing the initial second graph network based on the association between the initial fourth graph network and the sample answer comprises:
and based on the association relation between the word units in the sample answers and the word units in the sample questions, connecting the target node with the nodes in the initial fourth graph network by taking the word units in the sample answers as target nodes, and obtaining the initial second graph network.
19. The method of claim 14, 15 or 17, wherein the dependency relationship is calculated by a Stanford Core NLP algorithm.
20. The method of claim 6, wherein inputting the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to obtain a predicted answer comprises:
determining a first hidden layer feature vector of the first graph network and a second hidden layer feature vector of the second graph network through the graph roll layer;
carrying out weighted summation on the first hidden layer feature vector and the second hidden layer feature vector to obtain a target hidden layer feature vector;
and determining the prediction answer based on the target hidden layer feature vector.
21. The method of claim 20, wherein determining the predicted answer based on the target hidden layer feature vector comprises:
converting the value of each dimension of the target hidden layer feature vector into at least one prediction probability through a sequence labeling function, wherein each dimension of the target hidden layer feature vector corresponds to a word unit, and the at least one prediction probability corresponding to each dimension represents the probability that the prediction label of the word unit corresponding to each dimension is at least one label;
Determining a predictive label of a word unit corresponding to each dimension based on at least one predictive probability corresponding to each dimension;
and determining the prediction answer based on the prediction labels of the word units corresponding to each dimension.
22. The method of claim 21, wherein the at least one tag comprises an answer start word, an answer intermediate end word, and a non-answer word; determining the prediction answer based on the prediction labels of the word units corresponding to each dimension comprises the following steps:
and taking word units corresponding to the beginning words of the answers and word units corresponding to the intermediate ending words of the answers as the predicted answers.
23. The method of claim 6, wherein training the reading understanding model based on the difference between the predicted answer and the sample answer until a training stop condition is reached comprises:
if the difference value is smaller than a preset threshold value, stopping training the reading and understanding model;
and if the difference value is greater than or equal to the preset threshold value, continuing training the reading and understanding model.
24. The method of claim 6, wherein reaching a training stop condition comprises:
recording and carrying out iterative training once every time a predicted answer is obtained;
And counting the training times of iterative training, and determining that the training stopping condition is reached if the training times are greater than a time threshold.
25. The method of claim 1, wherein the method of calculating the attention value comprises:
for two first nodes with edges, performing attention calculation on first feature vectors of word units corresponding to the two first nodes to obtain attention values of the edges; or alternatively, the process may be performed,
and for the first node and the second node with the edges, performing attention calculation on the first feature vector of the word unit corresponding to the first node and the third feature vector of the word unit corresponding to the second node to obtain the attention value of the edges.
26. The method of claim 2, wherein the method of calculating the attention value comprises:
for two third nodes with edges, performing attention calculation on second feature vectors of word units corresponding to the two third nodes to obtain attention values of the edges; or alternatively, the process may be performed,
and for the third node and the fourth node with the edges, performing attention calculation on the second feature vector of the word unit corresponding to the third node and the third feature vector of the word unit corresponding to the fourth node to obtain the attention value of the edges.
27. The method of claim 1, 2, 3, 25 or 26, wherein the attention value is calculated as:
wherein, attention represents the attention value, softmax (·) is a normalization function, Q and K represent two eigenvectors, d, respectively k Is a constant and T is a matrix transpose.
28. A reading and understanding method, the method comprising:
constructing an initial first graph network of a target text and a target answer through a graph construction network layer of a reading and understanding model, and constructing an initial second graph network of a target question and the target answer, wherein the reading and understanding model is trained by the method of any one of claims 6 to 27;
inputting the target text, the target questions and the target answers into a feature extraction layer of the reading understanding model to respectively obtain a first feature vector group, a second feature vector group and a third feature vector group;
determining a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network through the attention layer of the reading understanding model, wherein the first node is a node corresponding to a word unit of a target text in the initial first graph network;
Determining a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a target answer in the initial first graph network;
determining, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; determining an attention value between a first node and a second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain a first graph network;
adding attention values to nodes and edges of the initial second graph network based on a second characteristic vector group and the third characteristic vector group through the attention layer to obtain a second graph network;
and inputting the first graph network and the second graph network into a graph rolling network layer of the reading understanding model to obtain an answer to the target question.
29. A graph network construction apparatus, the apparatus comprising:
the first determining module is configured to determine a first feature vector in a first feature vector group as an attention value of a first node in an initial first graph network through reading an attention layer of an understanding model, wherein the first node is a node corresponding to a word unit of a sample text fragment in the initial first graph network;
The second determining module is configured to determine a third feature vector in a third feature vector group as an attention value of a second node in the initial first graph network, wherein the second node is a node corresponding to a word unit of a sample answer in the initial first graph network;
a third determining module configured to determine, based on the first set of feature vectors, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge;
and a fourth determining module configured to determine, based on the first feature vector group and the third feature vector group, an attention value between a first node and a second node where an edge exists in the initial first graph network and obtain the first graph network as the attention value of the edge.
30. A reading and understanding device, the device comprising:
a graph network construction module configured to construct an initial first graph network of target text and target answers by a graph construction network layer of a reading understanding model, and construct an initial second graph network of target questions and the target answers, wherein the reading understanding model is trained by the method of any one of claims 6 to 27;
The acquisition module is configured to input the target text, the target questions and the target answers into the feature extraction layer of the reading understanding model to acquire a first feature vector group, a second feature vector group and a third feature vector group respectively;
a fifth determining module, configured to determine, through the attention layer of the reading understanding model, a first feature vector in the first feature vector group as an attention value of a first node in the initial first graph network, where the first node is a node corresponding to a word unit of a target text in the initial first graph network;
a sixth determining module, configured to determine a third feature vector in the third feature vector group as an attention value of a second node in the initial first graph network, where the second node is a node corresponding to a word unit of a target answer in the initial first graph network;
a seventh determining module configured to determine, based on the first feature vector set, an attention value between two first nodes in the initial first graph network where an edge exists and as the attention value of the edge; determining an attention value between a first node and a second node with edges in the initial first graph network based on the first feature vector group and the third feature vector group, and taking the attention value as the attention value of the edges to obtain a first graph network;
An eighth determining module configured to add, through the attention layer, attention values to nodes and edges of the initial second graph network based on a second feature vector set and the third feature vector set, to obtain a second graph network;
a ninth determination module configured to input the first graph network and the second graph network into a graph roll-up network layer of the reading understanding model to determine an answer to the target question.
31. A computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the instructions, performs the steps of the method of constructing a graph network as claimed in any one of claims 1 to 27, or performs the steps of the method of reading and understanding as claimed in claim 28, or comprises the apparatus of claim 29 or 30.
32. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of constructing a graph network as claimed in any one of claims 1 to 27, or the steps of the reading and understanding method as claimed in claim 28, or comprising the apparatus as claimed in claim 29 or 30.
CN202111110988.3A 2021-04-08 2021-04-08 Graph network construction method and device, reading and understanding method and device Active CN113792120B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111110988.3A CN113792120B (en) 2021-04-08 2021-04-08 Graph network construction method and device, reading and understanding method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111110988.3A CN113792120B (en) 2021-04-08 2021-04-08 Graph network construction method and device, reading and understanding method and device
CN202110375810.5A CN112800186B (en) 2021-04-08 2021-04-08 Reading understanding model training method and device and reading understanding method and device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202110375810.5A Division CN112800186B (en) 2021-04-08 2021-04-08 Reading understanding model training method and device and reading understanding method and device

Publications (2)

Publication Number Publication Date
CN113792120A CN113792120A (en) 2021-12-14
CN113792120B true CN113792120B (en) 2023-09-15

Family

ID=75816480

Family Applications (4)

Application Number Title Priority Date Filing Date
CN202111110989.8A Pending CN113792550A (en) 2021-04-08 2021-04-08 Method and device for determining predicted answer and method and device for reading and understanding
CN202111110988.3A Active CN113792120B (en) 2021-04-08 2021-04-08 Graph network construction method and device, reading and understanding method and device
CN202111111031.0A Active CN113792121B (en) 2021-04-08 2021-04-08 Training method and device of reading and understanding model, reading and understanding method and device
CN202110375810.5A Active CN112800186B (en) 2021-04-08 2021-04-08 Reading understanding model training method and device and reading understanding method and device

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202111110989.8A Pending CN113792550A (en) 2021-04-08 2021-04-08 Method and device for determining predicted answer and method and device for reading and understanding

Family Applications After (2)

Application Number Title Priority Date Filing Date
CN202111111031.0A Active CN113792121B (en) 2021-04-08 2021-04-08 Training method and device of reading and understanding model, reading and understanding method and device
CN202110375810.5A Active CN112800186B (en) 2021-04-08 2021-04-08 Reading understanding model training method and device and reading understanding method and device

Country Status (1)

Country Link
CN (4) CN113792550A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688207B (en) * 2021-08-24 2023-11-17 思必驰科技股份有限公司 Modeling processing method and device based on structural reading understanding of network

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110598573A (en) * 2019-08-21 2019-12-20 中山大学 Visual problem common sense inference model and method based on multi-domain heterogeneous graph guidance
CN111046661A (en) * 2019-12-13 2020-04-21 浙江大学 Reading understanding method based on graph convolution network

Family Cites Families (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6832783B2 (en) * 2017-04-20 2021-02-24 株式会社日立製作所 Data analyzers, data analysis methods, and data analysis programs
US11853903B2 (en) * 2017-09-28 2023-12-26 Siemens Aktiengesellschaft SGCNN: structural graph convolutional neural network
US20190122111A1 (en) * 2017-10-24 2019-04-25 Nec Laboratories America, Inc. Adaptive Convolutional Neural Knowledge Graph Learning System Leveraging Entity Descriptions
CN108959396B (en) * 2018-06-04 2021-08-17 众安信息技术服务有限公司 Machine reading model training method and device and question and answer method and device
CN109002519A (en) * 2018-07-09 2018-12-14 北京慧闻科技发展有限公司 Answer selection method, device and electronic equipment based on convolution loop neural network
WO2020096099A1 (en) * 2018-11-09 2020-05-14 주식회사 루닛 Machine learning method and device
CN111445020B (en) * 2019-01-16 2023-05-23 阿里巴巴集团控股有限公司 Graph-based convolutional network training method, device and system
CN114298310A (en) * 2019-01-29 2022-04-08 北京金山数字娱乐科技有限公司 Length loss determination method and device
US11461619B2 (en) * 2019-02-18 2022-10-04 Nec Corporation Spatio temporal gated recurrent unit
US10861437B2 (en) * 2019-03-28 2020-12-08 Wipro Limited Method and device for extracting factoid associated words from natural language sentences
CN110210021B (en) * 2019-05-22 2021-05-28 北京百度网讯科技有限公司 Reading understanding method and device
CN110309305B (en) * 2019-06-14 2021-05-11 中国电子科技集团公司第二十八研究所 Machine reading understanding method based on multi-task joint training and computer storage medium
CN110309283B (en) * 2019-06-28 2023-03-21 创新先进技术有限公司 Answer determination method and device for intelligent question answering
CN110457450B (en) * 2019-07-05 2023-12-22 平安科技(深圳)有限公司 Answer generation method based on neural network model and related equipment
US11593672B2 (en) * 2019-08-22 2023-02-28 International Business Machines Corporation Conversation history within conversational machine reading comprehension
EP3783531A1 (en) * 2019-08-23 2021-02-24 Tata Consultancy Services Limited Automated conversion of text based privacy policy to video
CN110619123B (en) * 2019-09-19 2021-01-26 电子科技大学 Machine reading understanding method
CN110647629B (en) * 2019-09-20 2021-11-02 北京理工大学 Multi-document machine reading understanding method for multi-granularity answer sorting
CN110750630A (en) * 2019-09-25 2020-02-04 北京捷通华声科技股份有限公司 Generating type machine reading understanding method, device, equipment and storage medium
CN110781663B (en) * 2019-10-28 2023-08-29 北京金山数字娱乐科技有限公司 Training method and device of text analysis model, text analysis method and device
CN111274800B (en) * 2020-01-19 2022-03-18 浙江大学 Inference type reading understanding method based on relational graph convolution network
CN111310848B (en) * 2020-02-28 2022-06-28 支付宝(杭州)信息技术有限公司 Training method and device for multi-task model
CN111460092B (en) * 2020-03-11 2022-11-29 中国电子科技集团公司第二十八研究所 Multi-document-based automatic complex problem solving method
CN111626044B (en) * 2020-05-14 2023-06-30 北京字节跳动网络技术有限公司 Text generation method, text generation device, electronic equipment and computer readable storage medium
CN112380835B (en) * 2020-10-10 2024-02-20 中国科学院信息工程研究所 Question answer extraction method integrating entity and sentence reasoning information and electronic device
CN112434142B (en) * 2020-11-20 2023-04-07 海信电子科技(武汉)有限公司 Method for marking training sample, server, computing equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110598573A (en) * 2019-08-21 2019-12-20 中山大学 Visual problem common sense inference model and method based on multi-domain heterogeneous graph guidance
CN111046661A (en) * 2019-12-13 2020-04-21 浙江大学 Reading understanding method based on graph convolution network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于深度学习的机器中文阅读理解研究;徐鹏飞;李晓戈;;计算机与数字工程(12);全文 *

Also Published As

Publication number Publication date
CN113792121B (en) 2023-09-22
CN112800186B (en) 2021-10-12
CN113792121A (en) 2021-12-14
CN113792120A (en) 2021-12-14
CN113792550A (en) 2021-12-14
CN112800186A (en) 2021-05-14

Similar Documents

Publication Publication Date Title
CN110298037B (en) Convolutional neural network matching text recognition method based on enhanced attention mechanism
CN111783462A (en) Chinese named entity recognition model and method based on dual neural network fusion
CN111522839B (en) Deep learning-based natural language query method
CN112487820B (en) Chinese medical named entity recognition method
CN111985239A (en) Entity identification method and device, electronic equipment and storage medium
CN112257449B (en) Named entity recognition method and device, computer equipment and storage medium
CN110990555B (en) End-to-end retrieval type dialogue method and system and computer equipment
CN113672718B (en) Dialogue intention recognition method and system based on feature matching and field self-adaption
CN110852089B (en) Operation and maintenance project management method based on intelligent word segmentation and deep learning
CN112800768A (en) Training method and device for nested named entity recognition model
CN115393933A (en) Video face emotion recognition method based on frame attention mechanism
CN116341651A (en) Entity recognition model training method and device, electronic equipment and storage medium
CN111145914A (en) Method and device for determining lung cancer clinical disease library text entity
CN113792120B (en) Graph network construction method and device, reading and understanding method and device
CN113486174A (en) Model training, reading understanding method and device, electronic equipment and storage medium
CN117131877A (en) Text detection method and system based on contrast learning
CN116680407A (en) Knowledge graph construction method and device
CN114637852B (en) Entity relation extraction method, device, equipment and storage medium of medical text
CN114842301A (en) Semi-supervised training method of image annotation model
CN115221315A (en) Text processing method and device, and sentence vector model training method and device
CN115358227A (en) Open domain relation joint extraction method and system based on phrase enhancement
CN115617959A (en) Question answering method and device
CN113255342B (en) Method and system for identifying product name of 5G mobile service
KR102610897B1 (en) Method and device for multi-pass human-machine conversation based on time sequence feature screening and encoding module
CN114548325B (en) Zero sample relation extraction method and system based on dual contrast learning

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