Disclosure of Invention
The embodiment of the invention provides a method, a device, terminal equipment and a storage medium for simulating patient inquiry dialogue, which can reduce the training cost and shorten the training period.
In a first aspect, an embodiment of the present invention provides a method for simulating a patient inquiry dialogue, including:
acquiring an inquiry statement input by a user;
searching a first answer sentence corresponding to the inquiry sentence in an inquiry matching template;
if a first answer sentence corresponding to the inquiry sentence exists in the inquiry matching template, outputting the first answer sentence to a user; if not, determining a corresponding second answer sentence according to the semantic attribute category of the inquiry sentence, and outputting the second answer sentence to the user;
the inquiry matching template comprises a matching rule and a response statement corresponding to the matching rule, and the matching rule is used for matching the inquiry statement.
With reference to the first aspect, in a possible implementation manner of the first aspect, the determining, according to the semantic attribute category of the inquiry statement, a corresponding second answer statement includes:
and analyzing the inquiry sentences according to the pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences to obtain second response sentences corresponding to the inquiry sentences.
With reference to the first aspect or one possible implementation manner of the first aspect, in another possible implementation manner of the first aspect, the semantic attribute category includes: at least one of a symptom category, a pain category; analyzing the inquiry statement according to a pathology knowledge base corresponding to the semantic attribute category of the inquiry statement to acquire a second response statement corresponding to the inquiry statement, wherein the method comprises the following steps:
acquiring keywords of the inquiry sentences;
searching keywords of the inquiry sentences in a pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences;
and generating a second response sentence corresponding to the inquiry sentence according to whether the keyword of the inquiry sentence exists in the pathology knowledge base or not.
With reference to the first aspect or any one of the possible implementations of the first aspect, in another possible implementation of the first aspect, the semantic attribute category includes a transition semantic category, and the method further includes:
acquiring keywords of the inquiry sentences;
and determining a second response sentence corresponding to the inquiry sentence according to the keyword of the inquiry sentence.
With reference to the first aspect or any one of the possible implementations of the first aspect, in another possible implementation of the first aspect, the semantic attribute category includes other semantic categories, and the method further includes:
processing the inquiry sentences by using a first machine learning algorithm to obtain second answer sentences corresponding to the inquiry sentences;
the first machine learning algorithm is obtained by training by using an inquiry knowledge base, wherein the inquiry knowledge base comprises inquiry sentences and corresponding response sentences.
With reference to the first aspect or any one of the possible implementation manners of the first aspect, in another possible implementation manner of the first aspect, the processing the inquiry statement by using a first machine learning algorithm to obtain a second answer statement corresponding to the inquiry statement includes:
performing word segmentation on the inquiry knowledge base to obtain a word set;
forming a vector space from the set of words;
determining the vector of the inquiry statement according to the vector space;
matching the vectors of the inquiry sentences in the vector space by adopting a similarity algorithm;
and if the matching is successful, extracting a second response sentence corresponding to the inquiry sentence.
With reference to the first aspect or any one of the possible implementations of the first aspect, in another possible implementation of the first aspect, the method further includes:
classifying the inquiry sentences by using a second machine learning algorithm to determine semantic attribute categories of the inquiry sentences;
the second machine learning algorithm is obtained by training by using an inquiry statement and a semantic attribute class corresponding to the inquiry statement.
With reference to the first aspect or any one of the possible implementation manners of the first aspect, in another possible implementation manner of the first aspect, the acquiring an inquiry statement input by a user includes:
receiving a voice signal input by a user;
and carrying out voice-to-character conversion on the voice signal to obtain the inquiry statement.
With reference to the first aspect or any one of possible implementations of the first aspect, in another possible implementation of the first aspect, the outputting the second answer sentence to the user includes:
and performing character-to-voice conversion on the second answer sentence, and outputting a voice signal of the second answer sentence.
With reference to the first aspect or any one of the possible implementations of the first aspect, in another possible implementation of the first aspect, the method further includes:
receiving a standardized patient simulation instruction, and determining a currently activated disease according to disease information corresponding to the standardized patient simulation instruction;
determining the pathology knowledge base based on the currently activated disease.
In a second aspect, an embodiment of the present invention provides a device for simulating a patient inquiry dialogue, including:
the acquisition module is used for acquiring the inquiry sentences input by the user;
the matching module is used for searching a first answer sentence corresponding to the inquiry sentence in the inquiry matching template;
the output module is used for outputting a first answer sentence to a user if the first answer sentence corresponding to the inquiry sentence exists in the inquiry matching template; if not, determining a corresponding second answer sentence according to the semantic attribute category of the inquiry sentence, and outputting the second answer sentence to the user;
the inquiry matching template comprises a matching rule and a response statement corresponding to the matching rule, and the matching rule is used for matching the inquiry statement.
With reference to the second aspect, in a possible implementation manner of the second aspect, the output module includes a first answer determining module, and the first answer determining module is configured to:
and analyzing the inquiry sentences according to the pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences to obtain second response sentences corresponding to the inquiry sentences.
With reference to the second aspect or one possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the semantic attribute category includes: at least one of a symptom category, a pain category; the first response determination module is specifically configured to:
acquiring keywords of the inquiry sentences;
searching keywords of the inquiry sentences in a pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences;
and generating a second response sentence corresponding to the inquiry sentence according to whether the keyword of the inquiry sentence exists in the pathology knowledge base or not.
With reference to the second aspect or any one of the possible implementations of the second aspect, in another possible implementation of the second aspect, the semantic attribute category includes a transition semantic category, and the output module further includes a second answer determining module, where the second answer determining module is configured to:
acquiring keywords of the inquiry sentences;
and determining a second response sentence corresponding to the inquiry sentence according to the keyword of the inquiry sentence.
With reference to the second aspect or any one of the possible implementations of the second aspect, in another possible implementation of the second aspect, the semantic attribute categories include other semantic categories, and the output module further includes a third answer determining module, where the third answer determining module is configured to:
processing the inquiry sentences by using a first machine learning algorithm to obtain second answer sentences corresponding to the inquiry sentences;
the first machine learning algorithm is obtained by training by using an inquiry knowledge base, wherein the inquiry knowledge base comprises inquiry sentences and corresponding response sentences.
With reference to the second aspect or any possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the third answer determining module is configured to:
performing word segmentation on the inquiry knowledge base to obtain a word set;
forming a vector space from the set of words;
determining the vector of the inquiry statement according to the vector space;
matching the vectors of the inquiry sentences in the vector space by adopting a similarity algorithm;
and if the matching is successful, extracting a second response sentence corresponding to the inquiry sentence.
With reference to the second aspect or any possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the apparatus further includes a category determining module, where the category determining module is configured to:
classifying the inquiry sentences by using a second machine learning algorithm to determine semantic attribute categories of the inquiry sentences;
the second machine learning algorithm is obtained by training by using an inquiry statement and a semantic attribute class corresponding to the inquiry statement.
With reference to the second aspect or any possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the obtaining module is configured to:
receiving a voice signal input by a user;
and carrying out voice-to-character conversion on the voice signal to obtain the inquiry statement.
With reference to the second aspect or any possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the output module is configured to:
and performing character-to-voice conversion on the second answer sentence, and outputting a voice signal of the second answer sentence.
With reference to the second aspect or any possible implementation manner of the second aspect, in another possible implementation manner of the second aspect, the obtaining module is further configured to:
receiving a standardized patient simulation instruction, and determining a currently activated disease according to disease information corresponding to the standardized patient simulation instruction;
determining the pathology knowledge base based on the currently activated disease.
In a third aspect, an embodiment of the present invention provides a computer storage medium, on which a computer program or instructions are stored, which, when executed by a processor or a computer, implement the method according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes: a processor, a memory, a transceiver; the transceiver is coupled to the processor, and the processor controls transceiving action of the transceiver;
wherein the memory is to store computer-executable program code, the program code comprising instructions; the instructions, when executed by the processor, cause the terminal device to perform the method of any of the first aspects.
According to the method, the device, the terminal equipment and the storage medium for simulating the patient inquiry dialogue, the inquiry statement input by the user is obtained, the first answer statement corresponding to the inquiry statement is searched in the inquiry matching template, and if the first answer statement corresponding to the inquiry statement exists in the inquiry matching template, the first answer statement is output to the user; if the answer sentence does not exist, the corresponding second answer sentence is determined according to the semantic attribute category of the inquiry sentence, the second answer sentence is output to the user, automatic inquiry dialogue is achieved with the user, the effect of simulating the inquiry dialogue of the patient is achieved, the answer sentence can be applied to practice and evaluation of clinical medical skills, compared with a mode of training a real person, the training cost can be reduced, and the training period can be shortened.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present 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.
Reference herein to "and/or" describing an associative relationship of associated objects means that there may be three relationships, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone.
Reference herein to a "doctor" is to be taken to mean in particular a intern or a student.
The first machine learning algorithm and the second machine learning algorithm according to the embodiment of the present invention are used to distinguish different machine learning algorithms, where the difference refers to the difference of training data. The first machine learning algorithm and the second machine learning algorithm can be traditional machine learning algorithms, neural network algorithms and the like.
The method for simulating the patient inquiry dialogue according to the embodiment of the present invention may be applied to a Terminal device, which may also be referred to as a Terminal (Terminal), a User Equipment (UE), a Mobile Station (MS), a Mobile Terminal (MT), or the like. The terminal device may be a mobile phone (mobile phone), a tablet computer (Pad), a computer with a wireless transceiving function, a Virtual Reality (VR) terminal, an Augmented Reality (AR) terminal, and so on.
The terminal device acts as a role of a standardized patient in the training and evaluation process of clinical medical skills by executing the method for simulating the patient inquiry dialogue, and a user using the terminal device can act as a role of a doctor to automatically perform inquiry dialogue with the terminal device, so that the effect of simulating the patient inquiry is achieved. The user can use the terminal equipment to practice and evaluate the clinical medical skill, and compared with a method of training a real person, the training cost can be reduced, and the training period can be shortened.
Fig. 1 is a flowchart of a first method for simulating a patient inquiry session according to an embodiment of the present invention, and as shown in fig. 1, the method of this embodiment may include:
step 101, obtaining an inquiry statement input by a user.
Wherein the user may be a user of the above-mentioned terminal device, who plays a role of a doctor, during practice and evaluation of clinical medical skills, and the inquiry sentence may be a sentence inquiring the terminal device, which plays a role of a standardized patient, to determine the disease of the standardized patient according to a response sentence fed back from the terminal device, for example, the inquiry sentence may be "ask for your last name? "," you good, where you are uncomfortable "," do you get a fever ", etc.
Specifically, the specific implementation manner for acquiring the inquiry sentence input by the user may be a plurality of different implementation manners. One specific implementation manner is to receive a voice signal input by a user, perform voice-to-text conversion on the voice signal, and acquire the inquiry sentence. It can be understood that the inquiry statement input by the user may be received, that is, the user inputs the text through the peripheral of the terminal device, so that the terminal device obtains the inquiry statement. Other implementation manners are also possible, and the embodiment of the present invention is not limited thereto.
And 102, searching a first answer sentence corresponding to the inquiry sentence in the inquiry matching template.
The inquiry matching template comprises a matching rule and a response sentence corresponding to the matching rule. The matching rule is used for matching the inquiry statement. The specific implementation manner of matching may be regular matching, keyword matching, and the like, and the embodiment of the present invention is not limited thereto.
Specifically, the inquiry matching template may include one or more matching rules and response sentences corresponding to the matching rules, in this embodiment, after acquiring an inquiry sentence, a matching rule matching the inquiry sentence may be searched in the inquiry matching template, if there is a matching rule matching the inquiry sentence, an response sentence corresponding to the matching rule is acquired, and the response sentence corresponding to the matching rule is the first response sentence, and the following step 103 is executed. If there is no matching rule matching, the following step 104 is performed.
For example, the matching rule is: your family name, the answer sentence corresponding to the matching rule is: i surname king, I have a whole body and generate heat. If the inquiry sentence is "ask for your maiden name? If yes, the inquiry statement matches the matching rule, and the answer statement corresponding to the matching rule is the first answer statement. That is, the first answer sentence corresponding to the inquiry sentence is stored in the inquiry matching template, the following step 103 is executed.
If the inquiry statement is "do you have a fever", the inquiry statement does not match the matching rule, i.e. there is no answer statement corresponding to the inquiry statement in the matching template, then the following step 104 is executed.
Step 103, if a first answer sentence corresponding to the inquiry sentence exists in the inquiry matching template, outputting the first answer sentence to the user.
There are various specific implementations of outputting the first answer sentence to the user, for example, performing text-to-speech conversion on the first answer sentence, and outputting a speech signal of the first answer sentence. It is understood that the text of the first answer sentence may also be directly output, or a voice signal and text may also be output, which is not limited in the embodiment of the present invention.
And 104, if the answer sentence does not exist, determining a corresponding second answer sentence according to the semantic attribute type of the inquiry sentence, and outputting the second answer sentence to the user.
The semantic attribute category of the embodiment of the present invention may include any one or more of a symptom category, a pain category, a transition semantic category, and other semantic categories, and may be flexibly set according to a requirement. When the first answer sentence corresponding to the inquiry sentence does not exist in the inquiry matching template, the semantic attribute category of the inquiry sentence can be determined, and the corresponding second answer sentence is determined according to the semantic attribute category of the inquiry sentence.
There are various specific implementations of outputting the second answer sentence to the user, for example, performing text-to-speech conversion on the second answer sentence, and outputting a speech signal of the second answer sentence. It is understood that the text of the second answer sentence may also be directly output, or a voice signal and text may also be output, which is not limited in the embodiment of the present invention.
A specific implementation manner of the step 104 is as follows: and analyzing the inquiry sentences according to the pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences to obtain second response sentences corresponding to the inquiry sentences.
Wherein the pathology knowledge base is formed from medical records of each standardized patient, which may include various symptoms, various pain sites, and the like. And the second answer sentence obtained according to the pathology knowledge base conforms to the medical record, so that the simulation of the standardized patient is realized.
In this embodiment, by obtaining an inquiry statement input by a user, a first answer statement corresponding to the inquiry statement is searched for in an inquiry matching template, and if the first answer statement corresponding to the inquiry statement exists in the inquiry matching template, the first answer statement is output to the user; if the answer sentence does not exist, the corresponding second answer sentence is determined according to the semantic attribute category of the inquiry sentence, the second answer sentence is output to the user, automatic inquiry dialogue is achieved with the user, the effect of simulating the inquiry dialogue of the patient is achieved, the answer sentence can be applied to practice and evaluation of clinical medical skills, compared with a mode of training a real person, the training cost can be reduced, and the training period can be shortened.
The technical solutions of the above method embodiments are described in detail below using several specific examples.
Fig. 2 is a flowchart of a second embodiment of the method for simulating a patient inquiry session, as shown in fig. 2, the method of this embodiment may include:
step 201, obtaining an inquiry statement input by a user.
Step 202, searching a first answer sentence corresponding to the inquiry sentence in the inquiry matching template.
And 203, if a first answer sentence corresponding to the inquiry sentence exists in the inquiry matching template, outputting the first answer sentence to the user.
For the detailed explanation of the above steps 201 to 203, refer to steps 101 to 103 in the embodiment shown in fig. 1, which are not described herein again.
For example, the inquiry sentence asked by the user is: "you are good, where you are uncomfortable". The matching rule is ". times.discomfort", the answer sentence corresponding to the matching rule is "pain of the whole body of oneself", the matching template includes the matching rule and the answer sentence corresponding to the matching rule, and then the answer sentence of the inquiry sentence can be determined as "pain of the whole body of oneself" through the above steps 201 to 203.
And 204, if the query statement does not exist, determining the semantic attribute type of the query statement.
The determination of the semantic attribute category of the inquiry statement can be determined by using a machine learning algorithm, specifically, the inquiry statement is classified by using a second machine learning algorithm, and the semantic attribute category of the inquiry statement is determined; the second machine learning algorithm is obtained by training by using an inquiry statement and a semantic attribute class corresponding to the inquiry statement.
The semantic attribute category referred to herein may be flexibly divided according to requirements, for example, the semantic attribute category may be divided into four categories, including a symptom category, a pain category, a transition semantic category, and other semantic categories, which are used for example and explanation in the embodiments of the present invention. It is to be understood that the semantic attribute category may also be other specific categories, which is not limited in the embodiment of the present invention.
The inquiry sentences belonging to the symptom category are used for inquiring whether the patient has any symptom, for example, the inquiry sentences are sentences with similar semantics such as "do you have fever", "do you have hemoptysis", and the semantic attribute category of the inquiry sentences is the symptom category.
The inquiry sentences belonging to the pain category are used for inquiring whether the patient has pain, for example, the inquiry sentences are sentences with similar semantics such as "do you have headache", "do you have joint pain", "do you have abdomen pain", and the semantic attribute category of the inquiry sentences is the pain category.
The inquiry sentences belonging to the category of transition sentences are used for inquiring whether the patient has a question, for example, the inquiry sentences are sentences with similar semantics such as "whether you have any question", "what you have to supplement", and the like, and the category of semantic attribute of the inquiry sentences is the category of transition sentences.
Other semantic categories: other classes that do not belong to the above categories, classified as not explicitly intended, cannot locate a category.
When semantic attribute categories of the inquiry statement include: when at least one of the symptom category and the pain category is selected, steps 2051 to 2053 are performed, and when the semantic attribute category of the inquiry sentence includes: if the semantic attribute type is a transition semantic type, step 2061 to step 2062 are executed, and if the semantic attribute type does not belong to any of the above symptom type, pain type and transition semantic type, that is, belongs to another semantic type, step 207 is executed.
And step 2051, acquiring keywords of the inquiry sentence.
The obtaining of the keywords may adopt various existing keyword extraction methods, for example, methods based on multi-pattern matching of a keyword thesaurus, word correlation ordering, and the like, which are not illustrated here.
For example, the inquiry sentence asked by the user is: "do you get fever". Since there is no matching rule in the matching template that matches the inquiry statement, it is determined through the above steps 201 to 202 that there is no first answer statement corresponding to the inquiry statement in the inquiry matching template, the semantic attribute category of the inquiry statement is determined through step 204, the semantic attribute category of the inquiry statement is a symptom category, and the keyword of the inquiry statement is obtained through step 2051, and the keyword is "fever".
And step 2052, searching keywords of the inquiry statement in a pathology knowledge base corresponding to the semantic attribute category of the inquiry statement.
Specifically, the keywords of the inquiry sentence are searched in the pathology knowledge base corresponding to the symptom category and/or the pathology knowledge base corresponding to the pain category. Wherein the pathology knowledge base corresponding to the symptom category may comprise a symptom list, i.e. comprise one or more symptoms, such as fever, cough, etc. The pathology knowledge base corresponding to the pain category may include a list of pain, i.e., one or more pain sites, e.g., joints, left abdomen, throat, etc.
The inquiry sentences asked by the user are as follows: by way of further illustration, by way of example, "do you have fever," the keyword is "fever," and the keyword "fever" is looked up in the pathology knowledge base, via step 2052.
And step 2053, generating a second response sentence corresponding to the inquiry sentence according to whether the keyword of the inquiry sentence exists in the pathology knowledge base.
Specifically, if the keyword of the inquiry sentence exists in the pathology knowledge base, the second answer sentence is generated, and the second answer sentence may be a positive answer, and if the keyword of the inquiry sentence does not exist in the pathology knowledge base, the second answer sentence may be a negative answer.
The inquiry sentences asked by the user are as follows: as a further example, the term "do you have a fever" is searched in the pathological knowledge base corresponding to the semantic attribute category of the inquiry sentence, and a second response sentence is generated through step 2053, specifically, for example, if the term exists, the second response sentence is "i have a fever", or "i have a sustained fever, 37.8 degrees", and the like, and if the term does not exist, the second response sentence is "i do not have a fever".
Step 2061, obtaining the keywords of the inquiry statement.
The obtaining of the keywords may adopt various existing keyword extraction methods, for example, methods based on multi-pattern matching of a keyword thesaurus, word correlation ordering, and the like, which are not illustrated here.
Step 2062, determining a second answer sentence corresponding to the inquiry sentence according to the keyword of the inquiry sentence.
For example, the inquiry sentence is "do you have any question", the keywords "what" and "question" are obtained in step 2061, and whether there is any question can be analyzed according to the keywords, and the second answer sentence can be "doctor, what you think me has got what disease".
And step 207, when the inquiry statement belongs to other semantic categories, processing the inquiry statement by using a first machine learning algorithm to obtain a second answer statement corresponding to the inquiry statement.
The first machine learning algorithm is obtained by training by using an inquiry knowledge base, wherein the inquiry knowledge base comprises inquiry sentences and corresponding response sentences.
Wherein, a specific implementation manner of step 207 is as follows: segmenting words from the inquiry knowledge base to obtain a word set, wherein the word set can also be called as a word bag, and a vector space is formed according to the word set; determining the vector of the inquiry statement according to the vector space; matching the vectors of the inquiry sentences in the vector space by adopting a similarity algorithm; and if the matching is successful, extracting a second response sentence corresponding to the inquiry sentence.
For example, the inquiry sentence asked by the user is: "do you need to take a blood drawing check, do you have a blood fainting". Since there is no matching rule in the matching template that matches the inquiry sentence, it is determined through the above steps 201 to 202 that there is no first answer sentence corresponding to the inquiry sentence in the inquiry matching template, it is determined through the steps 204, 2051 to 2053, 2061 to 2062 that the semantic attribute category of the inquiry sentence does not belong to any one of the symptom category, the pain category and the transition semantic category, the inquiry sentence is processed through the step 207 using the first machine learning algorithm, a second answer sentence corresponding to the inquiry sentence is obtained, for example, the answer "do not have blood halo" is matched to "do not have blood halo me", and the answer "do not have blood halo" is taken as the second answer sentence corresponding to the inquiry sentence.
Specifically, a vector space may be formed according to an algorithm such as term frequency-inverse document frequency (TF-IDF). The similarity calculation method may specifically adopt algorithms such as hamming distance and euclidean distance.
And step 208, outputting the second answer sentence to the user.
For a detailed explanation of step 208, reference may be made to the embodiment shown in fig. 1, which is not described herein again.
In this embodiment, by obtaining an inquiry statement input by a user, a first answer statement corresponding to the inquiry statement is searched for in an inquiry matching template, and if the first answer statement corresponding to the inquiry statement exists in the inquiry matching template, the first answer statement is output to the user; if the answer is not found, the semantic attribute category of the inquiry statement is determined, the corresponding second answer statement is determined according to the semantic attribute category of the inquiry statement, the second answer statement is output to the user, automatic inquiry dialogue is achieved with the user, the effect of simulating the inquiry dialogue of the patient is achieved, the answer is applied to practice and evaluation of clinical medical skills, compared with a method of training real people, the training cost can be reduced, and the training period can be shortened.
Moreover, by determining the semantic attribute types of the inquiry statement and executing corresponding processing operations according to different semantic attribute types, the processing efficiency of the inquiry statement can be improved.
It should be noted that the terminal device applying the method of the embodiment of the present invention may simulate an inquiry session of patients with different diseases, and the terminal device may receive a standardized patient simulation instruction, and determine the currently activated disease according to the disease information corresponding to the standardized patient simulation instruction. Determining the pathology knowledge base based on the currently activated disease.
That is, the pathology knowledge base includes a symptom list and a pain list, and may further include symptoms and diseases corresponding to pain parts, each disease is represented by a plurality of symptoms and a plurality of pain parts, when the terminal device may simulate an inquiry dialogue of patients with different diseases, for example, diseases such as pneumonia, cold, leukemia, etc. the terminal device may determine a currently activated disease according to the simulated disease selected by the user, that is, receive a standardized patient simulation instruction, for example, the currently simulated disease is pneumonia, and then determine the pathology knowledge base in the above embodiment according to the pneumonia, where the pathology knowledge base includes symptoms and pain parts corresponding to pneumonia.
Wherein the standardized patient simulation instruction may be an instruction of a touch operation in which the user clicks the disease selection box. For example, a user graphical interface of the terminal device to which the method of the embodiment of the present invention is applied may display a disease selection box for a user to select, and determine a currently activated disease according to an instruction of a touch operation of clicking the disease selection box by the user.
Fig. 3 is a schematic structural diagram of a first device for simulating a patient inquiry session according to an embodiment of the present invention, and as shown in fig. 3, the device of this embodiment may include: the system comprises anacquisition module 11, amatching module 12 and anoutput module 13, wherein theacquisition module 11 is used for acquiring an inquiry statement input by a user; thematching module 12 is configured to search a first answer sentence corresponding to the inquiry sentence in the inquiry matching template; anoutput module 13, configured to output a first answer sentence corresponding to the inquiry sentence to a user if the inquiry matching template has the first answer sentence; if not, determining a corresponding second answer sentence according to the semantic attribute category of the inquiry sentence, and outputting the second answer sentence to the user; the inquiry matching template comprises a matching rule and a response statement corresponding to the matching rule, and the matching rule is used for matching the inquiry statement.
Optionally, theoutput module 13 is configured to determine, according to the semantic attribute category of the inquiry statement, a corresponding second answer statement, and includes: and analyzing the inquiry sentences according to the pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences to obtain second response sentences corresponding to the inquiry sentences.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 4 is a schematic structural diagram of a second embodiment of the device for simulating a patient inquiry session, as shown in fig. 4, the device of this embodiment is based on the device structure shown in fig. 3, and further, the semantic attribute categories include: at least one of a symptom category, a pain category; theoutput module 13 includes a firstanswer determining module 131, where the firstanswer determining module 131 is specifically configured to: acquiring keywords of the inquiry sentences; searching keywords of the inquiry sentences in a pathological knowledge base corresponding to the semantic attribute categories of the inquiry sentences; and generating a second response sentence corresponding to the inquiry sentence according to whether the keyword of the inquiry sentence exists in the pathology knowledge base or not.
The semantic attribute classes comprise transition semantic classes, theoutput module 13 further comprises a secondanswer determining module 132, the secondanswer determining module 132 is configured to: acquiring keywords of the inquiry sentences; and determining a second response sentence corresponding to the inquiry sentence according to the keyword of the inquiry sentence.
The semantic attribute categories include other semantic categories, theoutput module 13 further includes a thirdanswer determining module 133, and the thirdanswer determining module 133 is configured to: processing the inquiry sentences by using a first machine learning algorithm to obtain second answer sentences corresponding to the inquiry sentences; the first machine learning algorithm is obtained by training by using an inquiry knowledge base, wherein the inquiry knowledge base comprises inquiry sentences and corresponding response sentences.
Optionally, the thirdresponse determining module 133 is configured to: performing word segmentation on the inquiry knowledge base to obtain a word set; forming a vector space from the set of words; determining the vector of the inquiry statement according to the vector space; matching the vectors of the inquiry sentences in the vector space by adopting a similarity algorithm; and if the matching is successful, extracting a second response sentence corresponding to the inquiry sentence.
Optionally, the apparatus further includes acategory determining module 14, where thecategory determining module 14 is configured to: classifying the inquiry sentences by using a second machine learning algorithm to determine semantic attribute categories of the inquiry sentences; the second machine learning algorithm is obtained by training by using an inquiry statement and a semantic attribute class corresponding to the inquiry statement.
Optionally, the obtainingmodule 11 is configured to: receiving a voice signal input by a user; and carrying out voice-to-character conversion on the voice signal to obtain the inquiry statement.
Optionally, theoutput module 13 is further configured to: and performing character-to-voice conversion on the second answer sentence, and outputting a voice signal of the second answer sentence.
Optionally, the obtainingmodule 11 is further configured to: receiving a standardized patient simulation instruction, and determining the currently activated disease according to the disease information corresponding to the standardized patient simulation instruction; determining the pathology knowledge base based on the currently activated disease.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 2, and the implementation principle and the technical effect are similar, which are not described herein again.
Embodiments of the present invention also provide a computer storage medium having a computer program or instructions stored thereon, which when executed by a processor or a computer, implement the method according to any of the above embodiments.
It should be noted that, the above-mentioned device for simulating a patient inquiry dialogue according to the embodiment of the present invention may be a terminal device, or may be a component in the terminal device, such as a chip.
Fig. 5 is a schematic structural diagram of a first terminal device according to an embodiment of the present invention, and as shown in fig. 5, the terminal device according to the embodiment includes: aprocessor 211, amemory 212, atransceiver 213, and abus 214. Wherein theprocessor 211, thememory 212 and thetransceiver 213 are connected to each other through abus 214. Thebus 214 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. Thebus 214 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
In terms of hardware implementation, the functional modules shown in fig. 3 or fig. 4 above may be embedded in theprocessor 211 of the terminal device or may be independent of the processor.
Thetransceiver 213 may include a mixer or the like as necessary for radio frequency communication. Theprocessor 211 may include at least one of a Central Processing Unit (CPU), a Digital Signal Processor (DSP), a Microcontroller (MCU), an Application Specific Integrated Circuit (ASIC), or a Field Programmable Gate Array (FPGA).
Thememory 212 is used for storing program instructions, and theprocessor 211 is used for calling the program instructions in thememory 212 to execute the above scheme.
The program instructions may be embodied in the form of software functional units and may be sold or used as a stand-alone product, and thememory 212 may be any form of computer readable storage medium. Based on such understanding, all or part of the technical solutions of the present application may be embodied in the form of a software product, which includes several instructions to enable a computer device, specifically, theprocessor 211, to execute all or part of the steps of the first terminal in the embodiments of the present application. And the aforementioned computer-readable storage media comprise: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The terminal device described above in this embodiment may be configured to execute the technical solutions in the above method embodiments, and the implementation principles and technical effects are similar, where the functions of each device may refer to corresponding descriptions in the method embodiments, and are not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.