Detailed Description
In order to make the technical means, the creation characteristics, the achievement purposes and the effects of the invention easy to understand, the following embodiments specifically describe the intellectual spectrum-based intelligent multi-round interaction system for the traditional Chinese medicine health preservation in combination with the accompanying drawings.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: wherein the context encoder is configured to extract features of entities in two adjacent rounds of interaction.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: the context coder, the input text coder and the candidate text coder all comprise a bidirectional long-short term memory neural network.
The intelligent multi-round interaction system for traditional Chinese medicine health preservation based on the knowledge graph provided by the invention can also have the characteristics that: the knowledge map storage module is used for storing the traditional Chinese medicine health preserving knowledge map, and the traditional Chinese medicine health preserving knowledge map comprises traditional Chinese medicine health preserving body knowledge and a traditional Chinese medicine health preserving custom dictionary.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: wherein, the source data of the traditional Chinese medicine health preserving knowledge map comprises a traditional Chinese medicine hospital case report table, and the content of the traditional Chinese medicine hospital case report table comprises: gender, age, occupation, ethnicity, marital, heart rate, blood pressure, respiration, time to first onset, course of disease, chief complaints, clinical manifestations, other disease history, brief medical history, exam notes, pathology report notes, tongue veins, western medicine diagnosis, traditional Chinese medicine syndrome differentiation, traditional Chinese medicine diagnosis, prescriptions, treatment regimen, maintenance regimen, diet, exercise, lifestyle habits, massage.
The intelligent multi-round interactive system for traditional Chinese medicine health preservation based on the knowledge graph, provided by the invention, can also have the following characteristics: the construction of the traditional Chinese medicine health-preserving knowledge graph comprises the following steps: step S1, performing entity extraction, relationship extraction and attribute extraction on the contents of the medical case report table of the intermediate hospital to obtain an entity extraction result, a relationship extraction result and an attribute extraction result; and step S2, node creation and relation creation are carried out according to the entity extraction result, the relation extraction result and the attribute extraction result, and a traditional Chinese medicine health preserving knowledge graph is obtained.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: and the corpus storage module is used for providing corpus to the session generation module and the result generation module.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: the generating process of the linguistic data stored in the linguistic data storage module comprises the following steps: step A1, analyzing entities and entity relations in the traditional Chinese medicine health preserving knowledge graph to obtain an entity relation graph; step A2, converting the entity relationship graph into a directed graph; step A3, taking each entity of the entity relationship graph as a starting point, traversing the directed graph to obtain a path graph; a4, splitting and combining paths in the path graph to obtain sub-paths; and A5, corresponding the entities and the entity relations in the traditional Chinese medicine health-preserving knowledge graph to each sub-path to obtain the corpus.
The intelligent multi-round interaction system for traditional Chinese medicine health preservation based on the knowledge graph provided by the invention can also have the characteristics that: and the service side communication module is used for receiving the clinical information data sent by the user.
In the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph, the system provided by the invention can also have the following characteristics: the service side communication module comprises an Nginx proxy cluster server, a load balancer and a Web application cluster server.
In this embodiment, an Android mobile phone terminal is taken as an example of a user terminal to explain the intelligent multi-round interaction system for traditional Chinese medicine health preservation based on a knowledge graph, wherein a plurality of user terminals are held by users.
Those skilled in the art can understand that although the Android mobile phone terminal is taken as the user terminal in the embodiment, the user terminal may also be an IOS mobile phone terminal, a PC terminal, or other user terminals.
Fig. 1 is a block diagram of a knowledge graph-based intelligent multi-round interaction system for health preservation in traditional Chinese medicine in an embodiment of the invention.
As shown in fig. 1, the intellectual graph-based intelligent multi-round interaction system 100 for health preservation in chinese medicine may include: the system comprises an entity extraction module 10, an entity linking module 20, an entity query module 30, an extraction sorting module 40, a session generation module 50, a result generation module 60, a knowledge graph storage module 70, a corpus storage module 80 and a service side communication module 90.
The service-side communication module 90 may be configured to accept clinical information data sent by a user.
Fig. 2 is a hardware architecture diagram of the intellectual graph-based intelligent multi-round interaction system for health preservation in traditional Chinese medicine in the embodiment of the present invention. Fig. 3 is a software architecture diagram of the intellectual graph-based intelligent multi-round interactive system for health preservation in traditional Chinese medicine in the embodiment of the present invention.
As shown in fig. 2 and fig. 3, the service-side communication module includes an Nginx proxy cluster server 91, a load balancer 92, and a Web application cluster server 93.
The service side communication module receives a data packet sent by a user through an API (application program interface) of a network layer, a carrier of the user is an Android client, the Android client sends a JSON (Java Server pages) character string to perform data interaction with a system according to the RESTFUL (representational state transfer language) interface requirement, and meanwhile, an interactive UI front-end interface is provided for the user; the Spring Boot is responsible for integrating services such as Nginx and the like into a server; spring MVC is responsible for providing Model, View, Controller interfaces to the server and RESTFUL interface services.
The entity extraction module 10 may be used to extract entities from the clinical information entered by the user in each round of interaction.
The entity linking module 20 may be configured to perform reference resolution and entity disambiguation on the entity to obtain a processed entity.
Fig. 4 is a logic diagram of the operation of the entity link module of the intellectual graph-based intelligent multi-round interactive system for health preservation in traditional Chinese medicine in the embodiment of the present invention.
As shown in FIG. 4,
entity linking module 20 includes a postamble encoder, an input text encoder, a candidate text encoder, an attention mechanism layer, and an output results layer. Wherein, the context coder is responsible for extracting the features of the previous and the following text. The context coder, the input text coder and the candidate text coder all adopt bidirectional LSTM to input text codingCode device as an example, input text { w
1,w
2,...,w
n}(w
nI.e., the nth word in w), i.e., at time f, the positive LSTM yields
Inverse LSTM derivation
Output w at time f
fCan be formed by splicing
And
thus obtaining the compound. The formula is as follows:
and finally, transmitting the candidate vector c, the context vector s and the input text vector w which are calculated by using the attention mechanism into a replay layer to obtain an entity link result. The calculation formula is as follows:
s=Attention(c,w)
c=Attention(s,w)
the embodiment extracts valuable features in multiple rounds of interactive sessions by using the attention mechanism layer, and extracts content features weakened or disappeared in the bidirectional LSTM due to forward transmission over time, so as to filter out invalid features, and finally obtain the valid entity link.
The traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph fuses related information together by using modes of knowledge graph node entity discovery, linkage and the like, so that multi-round interaction is realized. In the conversation process of the health maintenance consultation of the traditional Chinese medicine, the consultation of the user is relevant and continuous, and in order to ensure the accuracy and richness of the reply content of the system, the reply needs to be carried out by combining interactive historical information and a knowledge map related to the interaction.
The modeling of the traditional Chinese medicine health-preserving intelligent multi-round interactive system based on the knowledge graph is completed by adopting a point-to-point generation model, the knowledge graph, the interactive history and the current input of a user are modeled, and then decoding reply is carried out according to modeling information. The interaction history, the knowledge graph and the generated reply are not in a one-to-one mapping relation, so that the correct selection of the knowledge graph and the interaction history and the correct selection of the modeling mode can have a great influence on the effect of generating the reply by the interactive system.
The entity query module 30 may be configured to obtain a plurality of triples related to the processed entity from a pre-stored traditional Chinese medicine health preserving knowledge graph.
The knowledge graph storage module 70 may be configured to store a traditional Chinese medicine health preserving knowledge graph, where the traditional Chinese medicine health preserving knowledge graph includes a traditional Chinese medicine health preserving body knowledge and a traditional Chinese medicine health preserving custom dictionary.
The source data of the traditional Chinese medicine health-preserving knowledge map comprises a traditional Chinese medicine hospital case report table, and the content of the traditional Chinese medicine hospital case report table comprises: gender, age, occupation, ethnicity, marital, heart rate, blood pressure, respiration, time to first onset, course of disease, chief complaints, clinical manifestations, other disease history, brief medical history, exam notes, pathology report notes, tongue veins, western medicine diagnosis, traditional Chinese medicine syndrome differentiation, traditional Chinese medicine diagnosis, prescriptions, treatment regimen, maintenance regimen, diet, exercise, lifestyle habits, massage.
Fig. 5 is a flow chart for constructing a traditional Chinese medicine health preserving knowledge graph of the traditional Chinese medicine health preserving intelligent multi-round interactive system based on the knowledge graph in the embodiment of the invention.
As shown in fig. 5, the construction of the health preserving knowledge graph of traditional Chinese medicine comprises the following steps:
step S1, performing entity extraction, relationship extraction and attribute extraction on the contents of the medical case report table of the hospital to obtain an entity extraction result, a relationship extraction result and an attribute extraction result;
and step S2, performing node creation and relationship creation according to the entity extraction result, the relationship extraction result and the attribute extraction result, and obtaining the traditional Chinese medicine health preserving knowledge graph.
And the extraction and sorting module 40 is configured to screen a plurality of relevant triples of clinical information that needs to be input again by the user, sort the plurality of triples according to a preset priority, obtain a triple priority sequence, and determine a highest priority triple.
In the process of intelligent multi-round interaction, the situations of reference resolution and entity omission occur in the conversation, and the situations cause great troubles to entity linkage, so that the invention aims at entity linkage of the entities identified in the preceding and following texts and proposes to solve the problem of entity omission and reference resolution of statements in the multi-round conversation based on the entity linkage module 20 by combining the text information in the preceding and following texts.
First, the triples related to the entities identified in the context are spliced into candidate texts, then a full connection layer is used for splicing the candidate vectors c output by the candidate text encoder, the context vectors s output by the context encoder and the text vectors w output by the input text encoder, and then linear change is carried out, and finally, the output result replay is calculated through the softmax function, wherein the formula is as follows:
reply=softmax(F·[c;s;w]
f in the formula is the full link layer parameter.
The session generation module 50 may be configured to generate a question according to the triple with the highest priority and a pre-stored traditional Chinese medicine health preserving knowledge graph, so as to perform a next round of questioning on the user.
Fig. 6 is a logic diagram of the operation of the session generation module of the intellectual-graph-based intelligent multi-round interactive system for health preservation in traditional Chinese medicine in the embodiment of the present invention.
As shown in fig. 6, the present embodiment proposes that the text information of a sentence is modeled using one encoder, and the text information before and after the sentence is composed is modeled using another encoder, which generates a model based on the memory ability of the entity linking module 20. The encoder used by the session generation module 50 based on the entity link module 20 is composed of a unidirectional GRU and a bidirectional GRU, the encoder used by the text information before and after the sentence composition is composed of a unidirectional GRU, and the encoder used by the text information of the sentence is a bidirectional GRU.
One preceding or following text is given by { s
1,s
2,...,s
nThe components of the components are replaced by the components,s
nis the nth sentence in the preceding and following text, s
n={w
n1,w
21,...,w
nn},w
nnIs s
nThe Encoder used by Word Encoder is a bidirectional GRU that encodes each sentence { s } in the context
1,s
2,...,s
nEncoding into sentence vector
The Encoder used by the Context Encoder is a one-way GRU that vectors sentences
Coding into a context vector t, and calculating as follows:
t=sn=GRU(sn,sn-1)
the result generating module 60 may be configured to generate a health promotion suggestion result according to the clinical information input by the user for multiple times and a pre-stored traditional Chinese medicine health promotion knowledge graph.
The corpus storage module 80 may be used to provide corpus to the session generation module and the result generation module.
Fig. 7 is a flowchart illustrating the generation of corpora in the corpus storage module of the intellectual-graph-based intelligent multi-round interactive system for health preservation in traditional Chinese medicine according to the embodiment of the present invention.
The corpus generation process stored in the corpus storage module 80 as shown in fig. 7 includes the following steps:
step A1, analyzing entities and entity relations in the traditional Chinese medicine health preserving knowledge graph to obtain an entity relation graph;
step A2, converting the entity relationship graph into a directed graph;
step A3, taking each entity of the entity relationship graph as a starting point, traversing the directed graph to obtain a path graph;
a4, splitting and combining paths in the path graph to obtain sub-paths;
and A5, corresponding the entities and the entity relations in the traditional Chinese medicine health-preserving knowledge graph to each sub-path to obtain the corpus.
Fig. 8 is a logic diagram of the operation of the intelligent multi-round interaction system for health preservation in traditional Chinese medicine based on knowledge graph in the embodiment of the invention.
As shown in fig. 8, after conducting named entity recognition on the current conversation sentence and the historical conversation sentence of the traditional Chinese medicine health problem consulted by the user, the traditional Chinese medicine health preserving intelligent interaction system based on the knowledge graph obtains an entity list related to the user problem, uses a memory sequence-based entity link model to conduct reference resolution and entity disambiguation, extracts triple information related to the entity from the traditional Chinese medicine health preserving knowledge graph, transmits the triple information to the conversation system, and uses a memory sequence modeling-based generation model to generate a reply transmitted to the user.
Effects and effects of the embodiments
According to the traditional Chinese medicine health-preserving intelligent multi-round interaction system based on the knowledge graph, the interaction system has the memory capacity, and the content interacted with the user can be actively associated, so that the essential requirement is met. After a user inputs clinical manifestations into the system, the system actively asks the user for related chief complaint manifestations according to the characteristics of the clinical manifestations input by the user, the user inputs related feedback contents into the system according to questions asked by the system, and the intelligent interactive system uses the mode, and finally gives traditional Chinese medicine health-preserving suggestions with higher accuracy to the user after multi-round interaction with the user. Moreover, the interactive system of the embodiment adopts an interactive form of multi-turn conversation, so that the conclusion accuracy of the end user experience and the Chinese medical health consultation question and answer is higher than that of a common question and answer system with single-turn interaction. In addition, the embodiment carries out entity linking on the entities identified in the preceding and following texts, and proposes an entity linking model based on memory sequences in combination with the text information of the preceding and following texts to solve entity omission and reference resolution of sentences in multiple sessions.
The above embodiments are preferred examples of the present invention, and are not intended to limit the scope of the present invention.