CN112199482A - Dialog generation method, device, equipment and readable storage medium - Google Patents

Dialog generation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN112199482A
CN112199482A CN202011059826.7A CN202011059826A CN112199482A CN 112199482 A CN112199482 A CN 112199482A CN 202011059826 A CN202011059826 A CN 202011059826A CN 112199482 A CN112199482 A CN 112199482A
Authority
CN
China
Prior art keywords
vector
reply
query
question
common sense
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.)
Granted
Application number
CN202011059826.7A
Other languages
Chinese (zh)
Other versions
CN112199482B (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011059826.7A priority Critical patent/CN112199482B/en
Publication of CN112199482A publication Critical patent/CN112199482A/en
Priority to PCT/CN2021/091292 priority patent/WO2022068197A1/en
Application granted granted Critical
Publication of CN112199482B publication Critical patent/CN112199482B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a dialog generation method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: obtaining question information, and converting the question information into a first query vector by using a preset first gate recursion unit GRU model; determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector, and forming a question vector according to the first query vector and the common sense vector; converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors; respectively converting each reply vector into reply words, and combining all the reply words into reply information; the invention can quickly and accurately form the reply information in the remote consultation session, thereby improving the user experience.

Description

Dialog generation method, device, equipment and readable storage medium
Technical Field
The invention relates to the technical field of remote consultation conversations of digital medical treatment, in particular to a conversation generation method, a device, equipment and a readable storage medium.
Background
With the continuous development of artificial intelligence, man-machine conversation is more and more applied to various scenes; for example, in the manual customer service scene, by identifying the question information input by the user, the reply information corresponding to the question information is formed, so that the labor cost is reduced; however, if the conventional open-domain man-machine conversation system lacks understanding of background knowledge and related common sense information of user questions, only starting from the conversation data, the system will generate general answers lacking effective information, and may affect readability of the answer information. In addition, how to quickly and accurately form the reply information according to the user question information becomes a technical problem which needs to be solved urgently by the technical personnel in the field.
Disclosure of Invention
The invention aims to provide a conversation generation method, a device, equipment and a readable storage medium, which can quickly and accurately form reply information in a remote consultation conversation and improve the user experience.
According to an aspect of the present invention, there is provided a dialog generation method, including:
obtaining question information, and converting the question information into a first query vector by using a preset first gate recursion unit GRU model;
determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector, and forming a question vector according to the first query vector and the common sense vector;
converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and respectively converting each reply vector into reply words, and combining all the reply words into reply information.
Optionally, the obtaining the question information and converting the question information into a first query vector by using a preset first gate recursive unit GRU model includes:
performing word segmentation on the question information, and forming a word sequence by a plurality of keywords obtained after the word segmentation;
aiming at a target keyword in the word sequence, calculating a hidden influence factor of the target keyword transmitted to a keyword positioned behind the target keyword in the word sequence by utilizing the first gate recursive unit GRU model according to the hidden influence factor of the target keyword transmitted to the keyword positioned in front of the target keyword in the word sequence;
taking a hidden influence factor calculated according to the last keyword in the word sequence as a first query vector u corresponding to the question information1
Optionally, the determining, according to the first query vector, a common sense vector associated with the first query vector by using a preset first end-to-end memory network MemN2N model, and forming a question vector according to the first query vector and the common sense vector, includes:
in the 1 st cycle of the first end-to-end memory network MemN2N model, the first query vectors u are respectively calculated1With the ith common sense head vector x in the preset common sense head groupiThe correlation value pi;
head vector x according to the ith senseiOf the correlation value piWith the ith common sense tail vector y in the preset common sense tail groupiCalculating the question sub-vector a of the 1 st cycle1
The first query vector u1And the question vector a1Adding to obtain the first query vector u of the 2 nd cycle2
According to the first query vector u of the 2 nd cycle2Recalculating question sub-vector a of 2 nd cycle2And a first query vector u for cycle 33And the rest is done in the same way until the questioning subvector a of the Mth cycle is calculatedM
The question sub-vector a of the Mth cycle is addedMAs described aboveThe question vector.
Optionally, the method further includes:
acquiring a common sense information base; wherein the common sense information base comprises a plurality of common sense information expressed in the form of knowledge triples, and the common sense information comprises: head, tether and tail;
converting the head in each common sense information into a common sense head vector by presetting a first hidden layer matrix, thereby forming a common sense head group;
converting the tail part in each common sense information into a common sense tail vector by presetting a second hidden layer matrix, thereby forming a common sense tail group;
and establishing the corresponding relation between the common sense head vector and the common sense tail vector according to the relation part in each common sense information.
Optionally, the converting, according to the question vector, the question vector into a plurality of second query vectors by using a preset second gate recursive unit GRU model, and sequentially inputting each of the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of response vectors includes:
taking the question vector as a hidden influence factor h of a first layer0And presetting a starting character vector s0Inputting the input vector into the second gate recursive unit GRU model to obtain an output vector s1And a hidden impact factor h passed to the second layer1
The output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1
The output vector s1And hidden influence factor h of the second layer1Re-inputting the second gate recursive unit GRU model to obtain an output vector s2And a hidden impact factor h passed to the third layer2And outputs the output vector s2Re-inputting into the second end-to-end memory network MemN2N model to obtain a reply vector r2And repeating the steps until the output vector of the second gate recursion unit GRU model is presetThe character vector is ended.
Optionally, said outputting said output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1The method comprises the following steps:
in the 1 st cycle of the second end-to-end memory network MemN2N model, calculating the second query vector s respectively1With the i-th reply header vector k in the preset reply header groupiOf the correlation value pi
From the ith reply head vector kiOf the correlation value piWith the ith reply tail vector l in the preset reply tail groupiCalculate the reply subvector o for the 1 st cycle1
The second query vector s1Reply sub-vector o with cycle 11Adding to obtain a second query vector s of the 2 nd cycle2
Second query vector s according to said 2 nd cycle2Recalculating reply subvector o for cycle 22And a second query vector s for cycle 33And so on until the answer subvector o of the Nth cycle is calculatedN
Reply sub-vector o of the Nth cycleNAs a reply vector r1
Optionally, the method further includes:
acquiring a reply information base; wherein the reply information base comprises a plurality of reply information expressed in the form of knowledge triples, and the reply information comprises: head, tether and tail;
converting the head in each reply message into a reply head vector by a preset conversion embedding TransE algorithm, thereby forming a reply head group;
converting the tail in each reply message into a reply tail vector through a preset conversion embedding TransE algorithm, thereby forming a reply tail group;
and establishing the corresponding relation between the reply head vector and the reply tail vector according to the relation part in each reply message.
In order to achieve the above object, the present invention also provides a dialog generating device, including:
the system comprises an acquisition module, a query module and a query module, wherein the acquisition module is used for acquiring question information and converting the question information into a first query vector by utilizing a preset first gate recursion unit GRU model;
the question module is used for determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector and forming a question vector according to the first query vector and the common sense vector;
the answer module is used for converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursive unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and the conversion module is used for respectively converting each reply vector into reply words and combining all the reply words into reply information.
In order to achieve the above object, the present invention further provides a computer device, which specifically includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the dialog generation method introduced above when executing the computer program.
In order to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the dialog generating method described above.
The invention provides a dialog generation method, a device, equipment and a readable storage medium, which combine an end-to-end memory network MemN2N architecture with a GRU network to find out related common sense information according to question information, and comprehensively consider the question information and the common sense information to determine reply information. In the process of encoding the question information into the question vector, the question information is encoded in a form of GRU + MemN2N, a GRU network is used for replacing EmbeddingB in a MemN2N network aiming at the question information input by a user, and the final hidden layer state of the GRU network is input into the MemN2N network as a query vector. In the process of decoding the question vector into the reply information, the reply information is generated in the form of GRU + MemN 2N. The invention can quickly and accurately form the reply information in the remote consultation session, thereby improving the user experience.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is an alternative flowchart of a dialog generation method according to an embodiment;
fig. 2 is a schematic diagram of an alternative structure of the dialog generating device according to the second embodiment;
fig. 3 is a schematic diagram of an alternative hardware architecture of the computer device according to the third embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
An embodiment of the present invention provides a dialog generation method, as shown in fig. 1, the method specifically includes the following steps:
step S101: the method comprises the steps of obtaining question information, and converting the question information into a first query vector by utilizing a preset first GRU (Gate recursive Unit) model.
Specifically, step S101 includes:
step A1: performing word segmentation on the question information, and forming a word sequence by a plurality of keywords obtained after the word segmentation; wherein the word sequence comprises N keywords;
step A2: aiming at a target keyword in the word sequence, calculating a hidden influence factor of the target keyword transmitted to a keyword positioned behind the target keyword in the word sequence by utilizing the first gate recursive unit GRU model according to the hidden influence factor of the target keyword transmitted to the keyword positioned in front of the target keyword in the word sequence;
step A3: taking a hidden influence factor calculated according to the last keyword in the word sequence as a first query vector u corresponding to the question information1
Step S102: according to the first query vector, determining a common sense vector associated with the first query vector by using a preset first MemN2N (End-to-End Memory Networks) model, and forming a question vector according to the first query vector and the common sense vector.
Specifically, step S102 includes:
step B1: calculating the first query vector u in the 1 st loop hop of the first end-to-end memory network MemN2N model1With the ith common sense head vector x in the preset common sense head groupiOf the correlation value pi
Wherein p isi=Softmax((u1)T*xi) And T is a transposition function.
Step B2: head vector x according to the ith senseiOf the correlation value piWith the ith common sense tail vector y in the preset common sense tail groupiCalculating the question sub-vector a of the 1 st cycle1
Wherein, a1=∑ipiyi
Step B3:the first query vector u1And the question vector a1Adding to obtain the first query vector u of the 2 nd cycle2
Step B4: repeating the steps B1 to B3 until the question sub-vector a of the Mth cycle is calculatedM
Step B5: the question sub-vector a of the Mth cycle is addedMAs the question vector.
Further, the method further comprises:
step C1: acquiring a common sense information base; wherein the common sense information base comprises a plurality of common sense information expressed in the form of knowledge triples, and the common sense information comprises: head, tether and tail;
taking "cat is an animal" as an example, the knowledge triplet form represents bits (h: cat, r: belonging, t: animal), where h represents head, t represents tail, and r represents the head-tail relationship.
Step C2: converting the head in each common sense information into a common sense head vector by presetting a first hidden layer matrix EmbeddingA, thereby forming a common sense head group;
step C3: converting the tail in each common sense information into a common sense tail vector by presetting a second hidden layer matrix EmbeddingC, thereby forming a common sense tail group;
step C4: and establishing the corresponding relation between the common sense head vector and the common sense tail vector according to the relation part in each common sense information.
In the encoding Encoder process, that is, in the process of encoding the question information into the question vector, the present embodiment encodes the question information in the form of GRU + MemN2N, and for the question information input by the user, uses the GRU network to replace the EmbeddingB in the MemN2N network, and inputs the final hidden layer state of the GRU network as the query vector into the MemN2N network. The whole MemN2N network is superposed by a plurality of hops, and in each hop, the correlation degree of the query vector and each common sense information in the Memory is calculated respectively. In this embodiment, Encoder is implemented by using GRU + MemN2N, and common knowledge information with high relevance to the whole question information can be continuously added on the premise that the GRU is used to extract complete question information, so that information deviation caused by searching for a single entity word is avoided. In addition, the common knowledge information of the Memory is calculated in a weighted sum mode, and the fact that a single knowledge triple is selected as compensation information is avoided, so that the obtained common knowledge information is more comprehensive.
Step S103: converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors.
Specifically, step S103 includes:
step D1: taking the question vector as a hidden influence factor h of a first layer0And presetting a starting character vector s0Inputting the input vector into the second gate recursive unit GRU model to obtain an output vector s1And a hidden impact factor h passed to the second layer1
Wherein(s)1,h1)=GRU(s0,h0)。
Step D2: the output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1
Further, step D2 includes:
step D21: calculating the second query vectors s respectively in the 1 st loop hop of the second end-to-end memory network MemN2N model1With the i-th reply header vector k in the preset reply header groupiOf the correlation value pi
Wherein p isi=Softmax((s1)Tki) T is a transposition function;
step D22: from the ith reply head vector kiOf the correlation value piWith the ith reply tail vector l in the preset reply tail groupiCalculate the reply subvector o for the 1 st cycle1
Wherein o is1=∑ipili
Step D23: the second query vector s1Reply sub-vector o with cycle 11Adding to obtain a second query vector s of the 2 nd cyclic hop2
Step D24: repeating the steps D21 to D23 until the question sub-vector o of the Nth loop hop is calculatedN
Step D25: the question sub-vector o of the Nth cycle is addedNAs a reply vector r1
Still further, the method further comprises:
step E1: acquiring a reply information base; wherein the reply information base comprises a plurality of reply information expressed in the form of knowledge triples, and the reply information comprises: head, tether and tail;
step E2: converting the head in each reply message into a reply head vector by a preset conversion embedding TransE algorithm, thereby forming a reply head group;
step E3: converting the tail in each reply message into a reply tail vector through a preset conversion embedding TransE algorithm, thereby forming a reply tail group;
wherein k is (h, r, t) MLP (TransE (h, r, t));
ki=h;li=t。
step E4: and establishing the corresponding relation between the reply head vector and the reply tail vector according to the relation part in each reply message.
Step D3: the output vector s1And hidden influence factor h of the second layer1Re-inputting the second gate recursive unit GRU model to obtain an output vector s2And a hidden impact factor h passed to the third layer2And outputs the output vector s2Re-inputting into the second end-to-end memory network MemN2N model to obtain a reply vector r2And repeating the steps until the output vector of the second gate recursion unit GRU model is a preset ending character vector.
Step S104: and respectively converting each reply vector into reply words, and combining all the reply words into reply information.
Specifically, step S104 includes:
the answer vector r is obtained according to the following formulaiCorresponding reply word wi
P(ri=wi)=softmax(Wri);
Wherein W is a preset matrix containing a plurality of answer words, and the calculated word with the maximum P value in the matrix W is taken as RiCorresponding reply word wi
In the Decoder process, namely the process of decoding the questioning vector into the reply information, the generation of the reply information is realized by adopting the form of GRU + MemN 2N; the initial hidden layer state of the GRU network is the output of the Encoder part. Aiming at Memory, different from an Encoder part, a TransE algorithm is used for completing the coding of the knowledge triples, and Embedding A and Embedding C in a Memory N2N model are replaced. Further, unlike the Encoder which takes the output of the last moment of the GRU network as the input of the MemN2N, the Decoder section takes each hidden state of the GRU as the query vector query of the MemN 2N.
In this embodiment, the Decoder portion is implemented to avoid distinguishing the entity words from the common words when generating the reply, so that all reply words can be obtained from the vocabulary. In addition, the method distinguishes a similarity calculation part of the Memory and the query from a weighting and output part by means of the thought of the Kay Value Memory Network, so that the query is closer to a head entity in a knowledge triple, the output is closer to a tail entity in the knowledge triple, and the repetition rate of model generation reply and question is reduced.
Example two
An embodiment of the present invention provides a dialog generating device, as shown in fig. 2, the dialog generating device specifically includes the following components:
an obtaining module 201, configured to obtain question information, and convert the question information into a first query vector by using a preset first gate recursive unit GRU model;
the question module 202 is configured to determine, according to the first query vector, a common sense vector associated with the first query vector by using a preset first end-to-end memory network MemN2N model, and form a question vector according to the first query vector and the common sense vector;
the reply module 203 is configured to convert the question vector into a plurality of second query vectors according to the question vector by using a preset second gate recursive unit GRU model, and sequentially input each second query vector into a preset second end-to-end memory network MemN2N model to obtain a plurality of reply vectors;
the conversion module 204 is configured to convert each reply vector into a reply word, and combine all reply words into reply information.
Specifically, the obtaining module 201 is configured to:
performing word segmentation on the question information, and forming a word sequence by a plurality of keywords obtained after the word segmentation; aiming at a target keyword in the word sequence, calculating a hidden influence factor of the target keyword transmitted to a keyword positioned behind the target keyword in the word sequence by utilizing the first gate recursive unit GRU model according to the hidden influence factor of the target keyword transmitted to the keyword positioned in front of the target keyword in the word sequence; taking a hidden influence factor calculated according to the last keyword in the word sequence as a first query vector u corresponding to the question information1
Further, question module 202 is specifically configured to:
in the 1 st cycle of the first end-to-end memory network MemN2N model, the first query vectors u are respectively calculated1With the ith common sense head vector x in the preset common sense head groupiOf the correlation value pi(ii) a Head vector x according to the ith senseiOf the correlation value piWith the ith common sense tail vector y in the preset common sense tail groupiCalculating the question sub-vector a of the 1 st cycle1(ii) a The first query vector u1And the question vector a1Adding to obtain the first query vector u of the 2 nd cycle2(ii) a According to the first query vector u of the 2 nd cycle2Recalculating question sub-vector a of 2 nd cycle2And a first query vector u for cycle 33And the rest is done in the same way until the questioning subvector a of the Mth cycle is calculatedM(ii) a The question sub-vector a of the Mth cycle is addedMAs the question vector.
Further, the apparatus further comprises:
the processing module is used for acquiring a common sense information base; wherein the common sense information base comprises a plurality of common sense information expressed in the form of knowledge triples, and the common sense information comprises: head, tether and tail; converting the head in each common sense information into a common sense head vector by presetting a first hidden layer matrix, thereby forming a common sense head group; converting the tail part in each common sense information into a common sense tail vector by presetting a second hidden layer matrix, thereby forming a common sense tail group; and establishing the corresponding relation between the common sense head vector and the common sense tail vector according to the relation part in each common sense information.
Further, the reply module 203 is specifically configured to:
taking the question vector as a hidden influence factor h of a first layer0And presetting a starting character vector s0Inputting the input vector into the second gate recursive unit GRU model to obtain an output vector s1And a hidden impact factor h passed to the second layer1(ii) a The output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1(ii) a The output vector s1And hidden influence factor h of the second layer1Re-inputting the second gate recursive unit GRU model to obtain an output vector s2And a hidden impact factor h passed to the third layer2And outputs the output vector s2Re-inputting into the second end-to-end memory network MemN2N model to obtain a reply vector r2And so on until the second gate recursion unit GRUThe output vector of the model is a preset ending character vector.
Further, the reply module 203 is implementing the output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1The method specifically comprises the following steps:
in the 1 st cycle of the second end-to-end memory network MemN2N model, calculating the second query vector s respectively1With the i-th reply header vector k in the preset reply header groupiOf the correlation value pi(ii) a From the ith reply head vector kiOf the correlation value piWith the ith reply tail vector l in the preset reply tail groupiCalculate the reply subvector o for the 1 st cycle1(ii) a The second query vector s1Reply sub-vector o with cycle 11Adding to obtain a second query vector s of the 2 nd cycle2(ii) a Second query vector s according to said 2 nd cycle2Recalculating reply subvector o for cycle 22And a second query vector s for cycle 33And so on until the answer subvector o of the Nth cycle is calculatedN(ii) a Reply sub-vector o of the Nth cycleNAs a reply vector r1
Further, the processing module is further configured to:
acquiring a reply information base; wherein the reply information base comprises a plurality of reply information expressed in the form of knowledge triples, and the reply information comprises: head, tether and tail; converting the head in each reply message into a reply head vector by a preset conversion embedding TransE algorithm, thereby forming a reply head group; converting the tail in each reply message into a reply tail vector through a preset conversion embedding TransE algorithm, thereby forming a reply tail group; and establishing the corresponding relation between the reply head vector and the reply tail vector according to the relation part in each reply message.
EXAMPLE III
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. As shown in fig. 3, the computer device 30 of the present embodiment includes at least but is not limited to: a memory 301, a processor 302 communicatively coupled to each other via a system bus. It is noted that FIG. 3 only shows the computer device 30 having components 301 and 302, but it is understood that not all of the shown components are required and that more or fewer components may be implemented instead.
In this embodiment, the memory 301 (i.e., the readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 301 may be an internal storage unit of the computer device 30, such as a hard disk or a memory of the computer device 30. In other embodiments, the memory 301 may also be an external storage device of the computer device 30, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 30. Of course, the memory 301 may also include both internal and external storage devices for the computer device 30. In the present embodiment, the memory 301 is generally used for storing an operating system and various types of application software installed in the computer device 30. In addition, the memory 301 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 302 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 302 generally serves to control the overall operation of the computer device 30.
Specifically, in this embodiment, the processor 302 is configured to execute a program of a dialog generating method stored in the processor 302, and when the program of the dialog generating method is executed, the following steps are implemented:
obtaining question information, and converting the question information into a first query vector by using a preset first gate recursion unit GRU model;
determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector, and forming a question vector according to the first query vector and the common sense vector;
converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and respectively converting each reply vector into reply words, and combining all the reply words into reply information.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
Example four
The present embodiments also provide a computer readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App application mall, etc., having stored thereon a computer program that when executed by a processor implements the method steps of:
obtaining question information, and converting the question information into a first query vector by using a preset first gate recursion unit GRU model;
determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector, and forming a question vector according to the first query vector and the common sense vector;
converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and respectively converting each reply vector into reply words, and combining all the reply words into reply information.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A dialog generation method, characterized in that the method comprises:
obtaining question information, and converting the question information into a first query vector by using a preset first gate recursion unit GRU model;
determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector, and forming a question vector according to the first query vector and the common sense vector;
converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursion unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and respectively converting each reply vector into reply words, and combining all the reply words into reply information.
2. The dialog generation method according to claim 1, wherein the obtaining the question information and converting the question information into a first query vector using a preset first gate recursion unit GRU model includes:
performing word segmentation on the question information, and forming a word sequence by a plurality of keywords obtained after the word segmentation;
aiming at a target keyword in the word sequence, calculating a hidden influence factor of the target keyword transmitted to a keyword positioned behind the target keyword in the word sequence by utilizing the first gate recursive unit GRU model according to the hidden influence factor of the target keyword transmitted to the keyword positioned in front of the target keyword in the word sequence;
taking a hidden influence factor calculated according to the last keyword in the word sequence as a first query vector u corresponding to the question information1
3. The dialog generation method according to claim 2, wherein the determining, based on the first query vector and using a preset first end-to-end memory network MemN2N model, a common sense vector associated with the first query vector and forming a question vector based on the first query vector and the common sense vector comprises:
in the 1 st cycle of the first end-to-end memory network MemN2N model, the first query vectors u are respectively calculated1With the ith common sense head vector x in the preset common sense head groupiOf the correlation value pi
Head vector x according to the ith senseiOf the correlation value piWith the ith common sense tail vector y in the preset common sense tail groupiCalculating the question sub-vector a of the 1 st cycle1
The first query vector u1And the question vector a1Adding to obtain the first query vector u of the 2 nd cycle2
According to the first query vector u of the 2 nd cycle2Recalculating question sub-vector a of 2 nd cycle2And a first query vector u for cycle 33And the rest is done in the same way until the questioning subvector a of the Mth cycle is calculatedM
The question sub-vector a of the Mth cycle is addedMAs the question vector.
4. The dialog generation method of claim 3, further comprising:
acquiring a common sense information base; wherein the common sense information base comprises a plurality of common sense information expressed in the form of knowledge triples, and the common sense information comprises: head, tether and tail;
converting the head in each common sense information into a common sense head vector by presetting a first hidden layer matrix, thereby forming a common sense head group;
converting the tail part in each common sense information into a common sense tail vector by presetting a second hidden layer matrix, thereby forming a common sense tail group;
and establishing the corresponding relation between the common sense head vector and the common sense tail vector according to the relation part in each common sense information.
5. The dialog generation method according to claim 1, wherein the converting, according to the question vector, the question vector into a plurality of second query vectors by using a predetermined second gate recursion unit GRU model, and sequentially inputting the second query vectors into a predetermined second end-to-end memory network MemN2N model to obtain a plurality of response vectors includes:
taking the question vector as a hidden influence factor h of a first layer0And presetting a starting character vector s0Inputting the input vector into the second gate recursive unit GRU model to obtain an output vector s1And a hidden impact factor h passed to the second layer1
The output vector s1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1
The output vector s1And hidden influence factor h of the second layer1Re-inputting the second gate recursive unit GRU model to obtain an output vector s2And a hidden impact factor h passed to the third layer2And outputs the output vector s2Re-inputting into the second end-to-end memory network MemN2N model to obtain a reply vector r2And repeating the steps until the output vector of the second gate recursion unit GRU model is a preset ending character vector.
6. The dialog generation method of claim 5 wherein the vector s is output1Is input into the second end-to-end memory network MemN2N model as a second query vector to obtain a reply vector r1The method comprises the following steps:
in the 1 st cycle of the second end-to-end memory network MemN2N model, calculating the second query vector s respectively1With the i-th reply header vector k in the preset reply header groupiOf the correlation value pi
From the ith reply head vector kiOf the correlation value piWith the ith reply tail vector l in the preset reply tail groupiCalculate the reply subvector o for the 1 st cycle1
The second query vector s1Reply sub-vector o with cycle 11Adding to obtain a second query vector s of the 2 nd cycle2
Second query vector s according to said 2 nd cycle2Recalculating reply subvector o for cycle 22And a second query vector s for cycle 33And so on until the answer subvector o of the Nth cycle is calculatedN
Reply sub-vector o of the Nth cycleNAs a reply vector r1
7. The dialog generation method of claim 6, further comprising:
acquiring a reply information base; wherein the reply information base comprises a plurality of reply information expressed in the form of knowledge triples, and the reply information comprises: head, tether and tail;
converting the head in each reply message into a reply head vector by a preset conversion embedding TransE algorithm, thereby forming a reply head group;
converting the tail in each reply message into a reply tail vector through a preset conversion embedding TransE algorithm, thereby forming a reply tail group;
and establishing the corresponding relation between the reply head vector and the reply tail vector according to the relation part in each reply message.
8. A dialog generation apparatus, characterized in that the apparatus comprises:
the system comprises an acquisition module, a query module and a query module, wherein the acquisition module is used for acquiring question information and converting the question information into a first query vector by utilizing a preset first gate recursion unit GRU model;
the question module is used for determining a common sense vector associated with the first query vector by utilizing a preset first end-to-end memory network MemN2N model according to the first query vector and forming a question vector according to the first query vector and the common sense vector;
the answer module is used for converting the question vector into a plurality of second query vectors by utilizing a preset second gate recursive unit GRU model according to the question vector, and sequentially inputting the second query vectors into a preset second end-to-end memory network MemN2N model to obtain a plurality of answer vectors;
and the conversion module is used for respectively converting each reply vector into reply words and combining all the reply words into reply information.
9. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202011059826.7A 2020-09-30 2020-09-30 Dialogue generation method, device, equipment and readable storage medium Active CN112199482B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011059826.7A CN112199482B (en) 2020-09-30 2020-09-30 Dialogue generation method, device, equipment and readable storage medium
PCT/CN2021/091292 WO2022068197A1 (en) 2020-09-30 2021-04-30 Conversation generation method and apparatus, device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011059826.7A CN112199482B (en) 2020-09-30 2020-09-30 Dialogue generation method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112199482A true CN112199482A (en) 2021-01-08
CN112199482B CN112199482B (en) 2023-07-21

Family

ID=74007267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011059826.7A Active CN112199482B (en) 2020-09-30 2020-09-30 Dialogue generation method, device, equipment and readable storage medium

Country Status (2)

Country Link
CN (1) CN112199482B (en)
WO (1) WO2022068197A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022068197A1 (en) * 2020-09-30 2022-04-07 平安科技(深圳)有限公司 Conversation generation method and apparatus, device, and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170293919A1 (en) * 2016-04-11 2017-10-12 International Business Machines Corporation Feature learning on customer journey using categorical sequence data
US20180276525A1 (en) * 2015-12-03 2018-09-27 Huawei Technologies Co., Ltd. Method and neural network system for human-computer interaction, and user equipment
CN110704588A (en) * 2019-09-04 2020-01-17 平安科技(深圳)有限公司 Multi-round dialogue semantic analysis method and system based on long-term and short-term memory network
CN111291534A (en) * 2020-02-03 2020-06-16 苏州科技大学 Global coding method for automatic summarization of Chinese long text
CN111400468A (en) * 2020-03-11 2020-07-10 苏州思必驰信息科技有限公司 Conversation state tracking system and method, and man-machine conversation device and method
CN111414460A (en) * 2019-02-03 2020-07-14 北京邮电大学 Multi-round dialogue management method and device combining memory storage and neural network

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10803252B2 (en) * 2018-06-30 2020-10-13 Wipro Limited Method and device for extracting attributes associated with centre of interest from natural language sentences
CN109840255B (en) * 2019-01-09 2023-09-19 平安科技(深圳)有限公司 Reply text generation method, device, equipment and storage medium
CN110377719B (en) * 2019-07-25 2022-02-15 广东工业大学 Medical question and answer method and device
CN111143530B (en) * 2019-12-24 2024-04-05 平安健康保险股份有限公司 Intelligent reply method and device
CN112199482B (en) * 2020-09-30 2023-07-21 平安科技(深圳)有限公司 Dialogue generation method, device, equipment and readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180276525A1 (en) * 2015-12-03 2018-09-27 Huawei Technologies Co., Ltd. Method and neural network system for human-computer interaction, and user equipment
US20170293919A1 (en) * 2016-04-11 2017-10-12 International Business Machines Corporation Feature learning on customer journey using categorical sequence data
CN111414460A (en) * 2019-02-03 2020-07-14 北京邮电大学 Multi-round dialogue management method and device combining memory storage and neural network
CN110704588A (en) * 2019-09-04 2020-01-17 平安科技(深圳)有限公司 Multi-round dialogue semantic analysis method and system based on long-term and short-term memory network
CN111291534A (en) * 2020-02-03 2020-06-16 苏州科技大学 Global coding method for automatic summarization of Chinese long text
CN111400468A (en) * 2020-03-11 2020-07-10 苏州思必驰信息科技有限公司 Conversation state tracking system and method, and man-machine conversation device and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022068197A1 (en) * 2020-09-30 2022-04-07 平安科技(深圳)有限公司 Conversation generation method and apparatus, device, and readable storage medium

Also Published As

Publication number Publication date
CN112199482B (en) 2023-07-21
WO2022068197A1 (en) 2022-04-07

Similar Documents

Publication Publication Date Title
CN112435656B (en) Model training method, voice recognition method, device, equipment and storage medium
CN112131888B (en) Method, device, equipment and storage medium for analyzing semantic emotion
CN108959388B (en) Information generation method and device
CN116737938A (en) Fine granularity emotion detection method and device based on fine tuning large model online data network
CN112084301B (en) Training method and device for text correction model, text correction method and device
CN112560456A (en) Generation type abstract generation method and system based on improved neural network
CN113435210A (en) Social image text recognition method and device, computer equipment and storage medium
CN115908641A (en) Text-to-image generation method, device and medium based on features
CN116069931A (en) Hierarchical label text classification method, system, equipment and storage medium
AU2019270109B2 (en) Chapter-level text translation method and device
CN112199482B (en) Dialogue generation method, device, equipment and readable storage medium
CN112837673B (en) Speech synthesis method, device, computer equipment and medium based on artificial intelligence
CN113342927B (en) Sensitive word recognition method, device, equipment and storage medium
CN112329470B (en) Intelligent address identification method and device based on end-to-end model training
CN112364602B (en) Multi-style text generation method, device, equipment and readable storage medium
WO2023108981A1 (en) Method and apparatus for training text generation model, and storage medium and computer device
JP6633556B2 (en) Acoustic model learning device, speech recognition device, acoustic model learning method, speech recognition method, and program
CN113420869B (en) Translation method based on omnidirectional attention and related equipment thereof
CN112509559B (en) Audio recognition method, model training method, device, equipment and storage medium
CN113434652B (en) Intelligent question-answering method, intelligent question-answering device, equipment and storage medium
CN113704466B (en) Text multi-label classification method and device based on iterative network and electronic equipment
CN115310445A (en) Single-stage joint entity relationship extraction method and system based on enhanced sequence labeling strategy
CN112084782B (en) Answer identification method and system based on energy-enhanced attention network
CN112183057A (en) Article generation method and device, intelligent device and storage medium
CN113283241B (en) Text recognition method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant