A human-computer interaction method and device, electronic equipment and storage medium
By combining a feature terminology knowledge base and a large language model with a knowledge graph, the problem of mismatched user descriptions was solved, achieving high-precision human-computer interaction and dynamically adjusting the query content to obtain detailed user needs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINESE ACAD OF PREVENTIVE MEDICINE
- Filing Date
- 2025-06-05
- Publication Date
- 2026-04-10
AI Technical Summary
Existing human-computer interaction methods cannot convert user descriptions into words that the model can understand when there are no matching terms in the thesaurus, resulting in low conversation accuracy.
By acquiring user input information, mapping it using a feature terminology knowledge base and a large language model, and dynamically adjusting the query content using a knowledge graph, guided interactive queries are generated to gradually obtain user needs.
It enables accurate understanding of users' natural language expressions, improves the precision of human-computer interaction, and dynamically adjusts the query content to obtain detailed requirements.
Smart Images

Figure CN120596632B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computer technology application, and particularly relates to a human-computer interaction method and device, electronic equipment and storage medium. BACKGROUND
[0002] With the development of artificial intelligence technology, knowledge graphs and large language models are gradually applied to conversation scenarios, enabling more people to enjoy intelligent conversation services. However, existing methods usually use synonym libraries for hard matching, and if the user's description has no matching items in the synonym library, it cannot be converted into words that the model can understand, resulting in the inability to perform conversation work and low human-computer interaction accuracy. SUMMARY
[0003] To solve the above technical problems, the technical scheme adopted by the present application is as follows:
[0004] According to the first aspect of the present application, a human-computer interaction method is provided, which comprises the following steps:
[0005] S100, obtaining initial inquiry content input by a user.
[0006] S200, based on the current received inquiry input information, obtaining k feature terms related to the current received inquiry input information from a preset feature term knowledge base as k associated labels corresponding to the current received inquiry input information; the initial value of the current received inquiry input information is the initial inquiry content; k>1.
[0007] S300, using a large language model to map the current received inquiry input information and the corresponding k associated labels, obtaining a mapping label corresponding to the current received inquiry input information and adding it to the current combination label set; the initial value of the current combination label set is empty.
[0008] S400, based on the current combination label set and the preset knowledge graph, obtaining a label associated with the current combination label set as the current inquiry label.
[0009] S500, if the current inquiry operation meets the preset termination condition, outputting the corresponding inquiry output information based on the current combination label set, otherwise, generating a corresponding inquiry question based on the current inquiry label and outputting the inquiry question; the inquiry question includes at least two features for the user to select.
[0010] S600, obtaining answer information of the user responding to the query question, if the answer information includes a feature description selected by the user, taking the feature description selected by the user as the current received query input information, adding a feature not selected by the user in the query question to the current combination tag set, and taking the received answer information as the current received query input information, performing S200, if the answer information indicates that the user does not select any feature in the query question, adding the feature corresponding to the query question to the current combination tag set, and performing S400.
[0011] According to the second aspect of the present application, a human-computer interaction device is provided, which comprises an operation interface and a processor, the operation interface is used for a user to input query input information, and the processor is used to execute a computer program to realize the following steps:
[0012] S10, obtaining initial query content input by the user.
[0013] S20, obtaining k feature terms related to the current received query input information from a preset feature term knowledge base as k associated tags corresponding to the current received query input information based on the current received query input information; the initial value of the current received query input information is the initial query content; k≥1.
[0014] S30, mapping the current received query input information and the corresponding k associated tags by using a large language model to obtain mapping tags corresponding to the current received query input information and add them to the current combination tag set; the initial value of the current combination tag set is empty.
[0015] S40, obtaining a tag associated with the current combination tag set as a current query tag based on the current combination tag set and a preset knowledge graph.
[0016] S50, if the current query operation satisfies a preset termination condition, outputting corresponding query output information based on the current combination tag set, otherwise, generating a corresponding query question based on the current query tag and outputting the query question; the query question includes at least two features for the user to select.
[0017] S60, obtaining answer information of the user answering the query question, if the answer information includes a feature description selected by the user, taking the feature description selected by the user as the current received query input information, adding a feature not selected by the user in the query question to the current combination tag set, and taking the received answer information as the current received query input information, performing S20, if the answer information indicates that the user does not select any feature in the query question, adding the feature corresponding to the query question to the current combination tag, and performing S40. According to the third aspect of the present application, an electronic device is provided, comprising a processor and a memory; the processor is used to execute the steps of the method of the first aspect of the present application by calling the program or instruction stored in the memory.
[0018] According to the fourth aspect of the present application, a non-transitory computer readable storage medium is provided, which stores a program or instruction, and the program or instruction makes the computer execute the steps of the method of the first aspect of the present application.
[0019] The present application has at least the following beneficial effects:
[0020] The human-computer interaction method provided by the embodiments of the present application firstly obtains k feature terms related to the current received query input information from the preset feature term knowledge base as k associated tags corresponding to the current received query input information based on the current received query input information; then, the current received query input information and the corresponding k associated tags are mapped by using a large language model to obtain a mapping tag corresponding to the current received query input information; then, the mapping tag corresponding to the current received query input information is added to the current combination tag set, and a label associated with the current combination tag set is obtained as a current query label based on the current combination tag set and the preset knowledge graph; if the current query operation satisfies a preset termination condition, a corresponding query output information is output based on the current combination tag set, otherwise, a corresponding query question is generated based on the current query label and the query question is output; when receiving answer information of the user answering the query question, the received answer information is taken as the current received query input information, and the next interaction operation is performed. The human-computer interaction method provided by the present application is a guided interaction query method, which can accurately understand the natural language expression of the user, dynamically adjust the query content, gradually obtain the detailed requirements of the user, and improve the precision of human-computer interaction.
[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced in the following. Obviously, the drawings in the following description only represent some of the embodiments of the present application, and for those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0023] Figure 1 The flowchart of the human-computer interaction method provided by the embodiments of the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described in the following with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without any creative effort belong to the scope of protection of the present application.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0026] It is to be understood that some of the example embodiments are described in terms of a process or method being depicted as a flowchart. Although a flowchart can describe a process as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps can be re-arranged. A process can be terminated when its operations are completed, but could also be terminated in response to other event or condition. Processes might also be
[0027] The embodiments of the present application provide a human-computer interaction method, and one application scenario of the method can be a dialogue scenario. In one specific illustrative embodiment, the scenario can be a traditional Chinese medical diagnosis scenario.
[0028] The method can include the steps as shown in Figure 1
[0029] S100, obtaining initial inquiry content input by a user.
[0030] In the embodiments of the present application, the user can input the initial inquiry content in the text box of the corresponding operation interface. The corresponding operation interface can be the operation interface of the device installed with the computer program capable of executing the human-computer interaction method of the present application. The user can input the content of the required inquiry through text input, voice input or other forms of input, for example, the user can input "I often have headaches recently, and I don't know the reason" in the text box.
[0031] In the embodiments of the present application, the k associated feature terms related to the currently received inquiry input information are obtained from the preset feature term knowledge base based on the currently received inquiry input information as the k associated tags corresponding to the currently received inquiry input information. The initial value of the currently received inquiry input information is the initial inquiry content; k≥1.
[0032] In the embodiments of the present application, k can be set based on actual needs. In a non-limiting illustrative embodiment, 5≤k≤10.
[0033] In an illustrative embodiment of the present application, the feature can be the manifestation of the state of the human body, such as a TCM symptom. The preset feature term knowledge base can be a TCM symptom knowledge base, which can be constructed based on existing TCM symptom term corpus. Any construction method for constructing the preset TCM symptom term knowledge base based on the existing TCM symptom term corpus belongs to the protection scope of the present application. In the embodiments of the present application, the preset feature term knowledge base stores the corresponding vector of each feature term.
[0034] Further, in the embodiments of the present application, the k associated feature terms can be obtained by the following steps:
[0035] S201, obtaining the similarity S between the currently received inquiry input information and the i-th feature term in the preset feature term knowledge base i , obtaining the similarity set S = {S1, S2, …, Sn} of the currently received inquiry input information and the n feature terms in the preset feature term knowledge base. i , …, Sn} n ; the value of i is 1 to n, and n is the number of feature terms in the preset feature term knowledge base.
[0036] As known by those skilled in the art, S i may be the similarity between the vector corresponding to the currently received inquiry input information and the vector corresponding to the i-th feature term in the preset feature term knowledge base. The currently received inquiry input information can be converted into the corresponding vector through the word embedding model.
[0037] In the embodiments of the present application, the similarity can be the cosine similarity. As known by those skilled in the art, any method for obtaining the cosine similarity between two vectors belongs to the protection scope of the present application.
[0038] S202, sort the S in descending order to obtain a sorted similarity set SR.
[0039] S203, take the top k similarities in SR as the k associated feature terms.
[0040] In the embodiments of the present application, the k associated feature terms can be obtained by retrieving an enhanced generation model. The enhanced generation model has the advantages of combining information retrieval and generation model, and can improve the accuracy and relevance of label retrieval. For example, for the user input "I often have headaches recently", the model may retrieve associated labels such as "headache", "dizziness", "abnormal blood pressure", etc.
[0041] S300, mapping the current received inquiry input information and the corresponding k associated labels by using a large language model to obtain the mapping label corresponding to the current received inquiry input information and adding the mapping label corresponding to the current received inquiry input information to the current combination label set. The initial value of the current combination label set is empty.
[0042] In the embodiments of the present application, the large language model can be a trained large language model. In one illustrative embodiment, the large language model can be a YaYi large model. The training method of the large language model can use the existing training method. Specifically, the current received inquiry input information and the corresponding k associated labels can be input into the large language model to obtain the corresponding mapping label.
[0043] In the embodiments of the present application, the inquiry input information and the associated labels are mapped by the large language model, which can more accurately understand the user's description and convert it into a format consistent with the knowledge base label. For example, the user input "I often have headaches recently" will be mapped to the "headache" label.
[0044] S400, obtaining the labels associated with the current combination label set as the current inquiry label based on the current combination label set and the preset knowledge graph.
[0045] In the embodiments of the present application, the knowledge graph can be composed of the first type of nodes to the fourth type of nodes, wherein the first type of nodes are state nodes representing states, the second type of nodes are feature nodes representing features of the states, the third type of nodes are attribute nodes representing attributes of the states, and the fourth type of nodes are region nodes representing regions to which the states belong. There are association relationships between the first type of nodes and the second type of nodes, between the first type of nodes and the third type of nodes, between the first type of nodes and the fourth type of nodes, and between the second type of nodes. The nodes with the association relationships are connected by connection lines. The association relationship between the first type of nodes and the second type of nodes indicates that the state corresponding to the first type of nodes has the feature corresponding to the second type of nodes, the association relationship between the first type of nodes and the third type of nodes indicates that the state corresponding to the first type of nodes can have the attribute corresponding to the third type of nodes, and the association relationship between the first type of nodes and the fourth type of nodes indicates that the state corresponding to the first type of nodes can occur in the region corresponding to the fourth type of nodes. The relationship between the second type of nodes can include mutual exclusion relationship and mutual existence relationship.
[0046] In a specific embodiment of the present application, the knowledge graph can be a traditional Chinese medicine knowledge graph. The first type of nodes can be nodes representing abnormal states of the body such as diseases, the second type of nodes can be nodes representing symptoms, the third type of nodes can be nodes representing pathogenesis, and the fourth type of nodes can be nodes representing disease location. In the embodiments of the present application, the pathogenesis can include deficiency, excess, cold, heat, normal state, etc.
[0047] In the embodiments of the present application, the traditional Chinese medicine symptom knowledge graph can be constructed and updated based on the latest traditional Chinese medicine research results and clinical data.
[0048] In the embodiments of the present application, the edge weight between two nodes with a connection relationship can be initialized, and the bias value of the feature node can be initialized. The edge weight can be determined according to the association degree between the corresponding two nodes. When the knowledge graph is a traditional Chinese medicine knowledge graph, the edge weight can be initialized and set based on clinical data. For example, the initial weight value of the edge weight between a general symptom and a disease can be set to 1, and the weight value of the importance of some symptoms in a specific disease can be set to 5. The edge weight between two feature nodes with mutual exclusion relationship, such as the nodes of “dry mouth” and “not dry mouth”, can be represented by -1, and the edge weight between two feature nodes with mutual existence relationship, such as the nodes of “irritability” and “easily irritable”, can be represented by +1.
[0049] In the embodiments of the present application, the bias value of the feature node can be determined based on the order of the feature appearing in the dialogue scene. For example, in the traditional Chinese medicine diagnosis scene, the bias value of each symptom can be set according to the priority order rule of traditional Chinese medicine inquiry (such as the order in the traditional Chinese medicine inquiry ten questions song). The bias value corresponding to any feature node is bias = log 10(V), V is a value corresponding to a feature node, and the value range is [1, 10]. The logarithm of the value is taken in order to reduce the influence of the bias value and ensure the importance of other factors in the priority calculation.
[0050] In the embodiment of the application, the initial value of the priority of all nodes in the knowledge graph is set to 0.
[0051] Further, S400 can specifically include the following steps:
[0052] S401, obtaining input information input at present.
[0053] In the embodiment of the application, the input information includes feature description or includes feature description and attribute description, that is, can only include feature description or simultaneously includes feature description and attribute description. Wherein, the attribute description includes the attribute selected by the user. For example, the attribute description is cold nature, which indicates that the attribute selected by the user is cold nature.
[0054] The feature description is determined based on the current combination of the label set, and the feature description includes the first feature description or includes the first feature description and the second feature description, that is, the feature description can only include the first feature description or simultaneously includes the first feature description and the second feature description, wherein the first feature description is the feature selected by the user, and the second feature description is the feature not selected by the user. For example, if the input feature description is "headache, no panic", the first feature description is "headache", and the second feature description is "panic".
[0055] In the embodiment of the application, when the dialogue scene is a traditional Chinese medicine diagnosis scene, the attribute description can be obtained based on the tongue image information of the user, and the tongue image information of the user can be obtained by a tongue image scanning device or obtained by the user's known medical knowledge.
[0056] S402, based on the input information input at present, setting the identification of the feature node corresponding to the first feature description in the current knowledge graph as the first identification, as the first feature node, setting the identification of the feature node corresponding to the second feature description in the current knowledge graph as the second identification, as the second feature node, and setting the identification of the attribute node corresponding to the attribute description in the current knowledge graph as the first identification.
[0057] In the embodiment of the application, the first identification and the second identification can be different identifications, and the specific identification can be limited based on actual needs, and the application does not make special limitation.
[0058] S403, for any state node i in the current knowledge graph, based on the edge weight between the state node i and the corresponding feature node and the edge weight between the state node i and the corresponding attribute node, obtaining the priority PS of the state node i corresponding to the state node i i .
[0059] Further, in the embodiments of the present application, the PS i satisfies the following condition:
[0060] PS i = (∑ f1(i) j1=1 w ds ij1 -∑ f2(i) j2=1 w ds ij2 ) / ∑ h(i) j=1 w ds ij ×λ1+(∑ z(i) r=1 w dn ir ) / (∑ g(i) s=1 w dn is
[0061] ×λ2.
[0062] wherein i takes values from 1 to m, m is the number of state nodes in the knowledge graph, w ds ij1 is the edge weight between the state node i and the j1th first feature node connected to the state node i, j1 takes values from 1 to f1(i), f1(i) is the number of first feature nodes connected to the state node i, w ds ij2 is the edge weight between the state node i and the j2th second feature node connected to the state node i, j2 takes values from 1 to f2(i), f2(i) is the number of second feature nodes connected to the state node i, w ds ij is the edge weight between the state node i and the jth feature node connected to the state node i, j takes values from 1 to h(i), h(i) is the number of feature nodes connected to the state node i, w dn ir is the edge weight between the state node i and the rth attribute node connected to the state node i and identified as the first identification, r takes values from 1 to z(i), z(i) is the number of attribute nodes connected to the state node i and identified as the first identification, w dn is is the edge weight between the state node i and the s-th attribute node connected to the state node i, s is 1 to g(i), g(i) is the number of attribute nodes connected to the state node i, λ1 is a first preset coefficient, and λ2 is a second preset coefficient.
[0063] It is known to those skilled in the art that if the second feature description and the attribute description are not contained in the input information, the number of the second feature nodes is 0, and the number of the attribute nodes with the first identification is 0.
[0064] Further, w ds ij1 satisfies the following condition: if 0≤w ds-init ij1 ≤1, w ds ij1 =1 if w ds-init ij1 >1, w ds ij1 =w ds-init ij1 ; w ds ij2 satisfies the following condition: if 0≤w ds-init ij2 ≤1, w ds ij2 =0 if w ds-init ij2 >1, w ds ij2 =w ds-init ij2 .
[0065] wherein w ds-init ij1 is the initial weight corresponding to w ds ij1 , and w ds-init ij2 is the initial weight corresponding to w ds ij2 . Since the description of the first user can be inaccurate, by increasing the weight of the first feature node with a lower initial weight and decreasing the weight of the second feature node with a lower initial weight, a higher fault tolerance can be allowed.
[0066] In the embodiments of the present application, λ1>λ2, and λ1+λ2=1, which can be empirical values. In one illustrative embodiment, λ1=0.9, and λ2=0.1.
[0067] In the embodiments of the present application, the priority of each state node can be dynamically calculated based on the selected features and the unselected features of the user, so as to more accurately reflect the actual state of the first user. In addition, since the attributes of the state are considered, the obtained information is more comprehensive and accurate.
[0068] S404, for any third feature node u in the current knowledge graph, based on the first preset path length, the second preset path length, the bias value corresponding to the third feature node u, the edge weight between the third feature node u and the corresponding state node, the edge weight between the third feature node u and the corresponding first feature node, and the edge weight between the third feature node u and the corresponding state node, the priority PF of the third feature node u is obtained u , the third feature node is a feature node in the knowledge graph except the first feature node and the second feature node, the value of u is 1 to n, and n is the number of third feature nodes.
[0069] Further, PF u satisfies the following conditions:
[0070] PF u =∑ y1(u) q1=1 ((1-log 10 (path1+1)×w ds-init uq1 ×PS 3 uq1 )+∑ y2(u) q2=1 ((1-log 10 (path2+1)
[0071] ×w ss-init uq2 )+bias u ; path1 is the first preset path length, path2 is the second preset path length, w ds -init uq1 is the initial edge weight between the third feature node u and the q1th state node connected to the state node, q1 is 1 to y1(u), y1(u) is the number of state nodes connected to the third feature node u, PS uq1 is the priority corresponding to the q1th state node, w ss-init uq2 is the initial edge weight between the third feature node u and the q2th first feature node connected to the first feature node, q2 is 1 to y2(u), y2(u) is the number of first feature nodes connected to the third feature node u, bias u is the bias value corresponding to the third feature node u.
[0072] In the embodiment of the present application, the priority of the feature node considers the priority of the state node connected thereto, the weight of the first feature node connected thereto, and the bias value, so that the acquired priority is more accurate.
[0073] In the embodiment of the present application, path1 and path2 can be empirical values ensuring that the calculation result is as accurate as possible. In an illustrative embodiment, path1 = 2 and path2 = 1.
[0074] S405, acquiring a feature node corresponding to max(PF1, PF2, …, PF u , …, PF n ) as the current inquiry label, where max() represents taking the maximum value.
[0075] In the embodiment of the present application, the current inquiry label is acquired based on the combined label set formed after multiple inquiries, so that the priority of the label can be dynamically adjusted, and each inquiry is ensured to be based on the latest correlation analysis result. For example, when the user input information is "headache", the priority of the "abnormal blood pressure" label can be raised in the current calculation through the above steps, that is, the feature node with the highest priority, i.e., the symptom "abnormal blood pressure", can be obtained, and the "abnormal blood pressure" can be taken as the current inquiry label, i.e., the next inquiry question.
[0076] S500, if the current inquiry operation satisfies the preset termination condition, outputting the corresponding inquiry output information based on the current combined label set, otherwise, generating a corresponding inquiry question based on the current inquiry label and outputting the inquiry question.
[0077] In the embodiment of the present application, the preset termination condition can be any one of the following conditions:
[0078] Condition 1: receiving an inquiry termination instruction input by the user.
[0079] Condition 2: the number of labels in the current combined label set reaches a preset value, i.e., the number of inquiry rounds reaches a preset value.
[0080] In the embodiment of the present application, the preset value can be set based on actual needs, for example, it can be set to 15-20.
[0081] Condition 3: the number of labels in the current combined label set is less than the preset value, but the corresponding interaction result can be acquired based on the labels in the current combined label set.
[0082] In the embodiment of the present application, the corresponding interaction result that can be obtained based on the labels in the current combined label set refers to the corresponding state that can be obtained based on the preset knowledge graph based on the labels in the current combined label set. Specifically, in the preset knowledge graph, if the ratio of the number of labels in the current combined label set to the number of feature nodes corresponding to the corresponding state node is greater than the preset ratio, the state corresponding to the first node is taken as the corresponding interaction result. The state node corresponding to the current combined label set is a state node connected to all nodes corresponding to the labels in the current combined label set, and the feature node corresponding to the state node corresponding to the current combined label set is a feature node connected to the state node. In an illustrative embodiment, the interaction result that can be obtained based on the labels in the current combined label set can be "liver yang headache" and the like.
[0083] In the embodiment of the present application, the preset ratio can be set to 0.9.
[0084] In the embodiment of the present application, the inquiry output information can be a detailed answer to the user's question, a suggestion of a solution, or other forms of output, and the present application does not have special limitations thereon, which can be set based on actual needs. For example, the inquiry output information can be "according to your description and the multi-round interaction result, it is suggested that you go to a doctor to check whether there is a liver yang headache problem and consider relevant treatment".
[0085] In the embodiment of the present application, the inquiry question aims to guide the user to further provide specific information, thereby helping the system better understand the user's needs or problems. The inquiry question can be output in text form or language form.
[0086] In the embodiment of the present application, the inquiry question includes at least two features for the user to select. Taking the inquiry question "headache" as an example, the generated inquiry question can be "please ask whether your headache is persistent or paroxysmal", wherein the features can include persistent headache and paroxysmal headache.
[0087] In the embodiment of the present application, any method for generating a corresponding inquiry question based on the current inquiry label belongs to the protection scope of the present application. In an illustrative embodiment, the inquiry question can be automatically generated based on a large language model. In another illustrative embodiment, the inquiry question can be generated based on a preset generation rule. The preset generation rule can be set based on actual needs.
[0088] S600, obtaining answer information of the user answering the query question, if the answer information includes a feature description selected by the user, taking the feature description selected by the user as the current received query input information, adding a feature not selected by the user in the query question into the current combination label set, and performing S200, if the answer information indicates that the user does not select any feature in the query question, adding the feature corresponding to the query question into the current combination label, and performing S400.
[0089] In the embodiment of the application, the query question is "Is your headache persistent or paroxysmal?", if the answer information of the user is "my headache is persistent", the description is taken as new input information, and paroxysmal headache is added into the current combination label set,
[0090] In the embodiment of the application, the answer information of the user will further enrich the understanding of the query system to the question, and provide more information for subsequent analysis. For example, the user answers "I have dizziness when I have a headache".
[0091] The human-computer interaction method provided by the embodiment of the application has at least the following advantages:
[0092] (1) By introducing a large language model, the natural language description of the user can be quickly understood and processed, compared with the traditional artificial query mode, the query time can be shortened, and the query efficiency can be improved.
[0093] (2) Combined with a knowledge graph, the features input by the user can be better matched, so that more accurate interactive content can be provided.
[0094] Based on the same inventive concept, the embodiment of the application provides a human-computer interaction device, the device comprises: an operation interface and a processor, the operation interface is used for inputting query input information by the user; the processor is used for executing a computer program to realize the following steps:
[0095] S10, obtaining initial query content input by the user.
[0096] S20, based on the current received query input information, obtaining k feature terms related to the current received query input information from a preset feature term knowledge base as k associated labels corresponding to the current received query input information; the initial value of the current received query input information is the initial query content; k> =1.
[0097] S30, mapping the current received query input information and the corresponding k associated labels by using a large language model, obtaining a mapping label corresponding to the current received query input information and adding it into the current combination label set; the initial value of the current combination label set is empty.
[0098] S40, obtaining, based on the current combined label set and the preset knowledge graph, a label associated with the current combined label set as a current inquiry label.
[0099] S50, if the current inquiry operation satisfies a preset termination condition, outputting corresponding inquiry output information based on the current combined label set, otherwise, generating a corresponding inquiry question based on the current inquiry label and outputting the inquiry question; the inquiry question includes at least two features for the user to select.
[0100] S60, obtaining answer information of the user answering the inquiry question, if the answer information includes a feature description selected by the user, taking the feature description selected by the user as current received inquiry input information, adding a feature not selected by the user in the inquiry question to the current combined label set, and taking the received answer information as current received inquiry input information, performing S20, if the answer information indicates that the user does not select any feature in the inquiry question, adding the feature corresponding to the inquiry question to the current combined label set, and performing S40.
[0101] Further, the k associated symptom terms are obtained by the following steps:
[0102] S21, obtaining a similarity S between the current received inquiry input information and an i-th feature term in the preset feature term knowledge base i , obtaining a similarity set S = {S1, S2, …, S i , …, S n}; the value of i is 1 to n, and n is the number of feature terms in the preset feature term knowledge base.
[0103] S22, sorting S in descending order to obtain a sorted similarity set SR.
[0104] S23, taking the first k similarity terms in SR as the k associated feature terms.
[0105] The device can be used to execute the method shown in the embodiments shown in the embodiments, therefore, the functions and the like that can be realized by the function modules of the device can refer to the description of the embodiments shown in the embodiments, and will not be described in detail. Figure 1 The device can be used to execute the method shown in the embodiments shown in the embodiments, therefore, the functions and the like that can be realized by the function modules of the device can refer to the description of the embodiments shown in the embodiments, and will not be described in detail. Figure 1
[0106] The embodiments of the application also provide an electronic device, including: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the embodiments of the application.
[0107] The embodiment of the present application further provides a non-transitory computer readable storage medium storing computer executable instructions for executing the method of the embodiment of the present application.
[0108] It should be understood that the steps shown above in various forms of flow can be reordered, added or deleted. For example, the steps described in the present application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, which is not limited herein.
[0109] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent replacement and improvement within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A human-machine interaction method, characterized in that, The method comprises the following steps: S100, obtaining initial inquiry content input by a user; S200, obtaining k feature terms related to the currently received inquiry input information from a preset feature term knowledge base as k associated labels corresponding to the currently received inquiry input information based on the currently received inquiry input information; the initial value of the currently received inquiry input information is the initial inquiry content; k≥1; S300, mapping the currently received inquiry input information and the corresponding k associated labels by using a large language model to obtain a mapping label corresponding to the currently received inquiry input information and adding the mapping label to a current combination label set; the initial value of the current combination label set is empty; S400, obtaining a label associated with the current combination label set as a current inquiry label based on the current combination label set and a preset knowledge graph; S500, if the current inquiry operation satisfies a preset termination condition, outputting corresponding inquiry output information based on the current combination label set, otherwise, generating a corresponding inquiry question based on the current inquiry label and outputting the inquiry question; the inquiry question comprises at least two features for the user to select; S600, obtaining answer information of the user answering the inquiry question, if the answer information comprises a feature description selected by the user, taking the feature description selected by the user as the currently received inquiry input information, adding a feature not selected by the user in the inquiry question to the current combination label set, and taking the received answer information as the currently received inquiry input information, and performing S200, if the answer information indicates that the user does not select any feature in the inquiry question, adding the feature corresponding to the inquiry question to the current combination label set, and performing S400; S400 specifically comprises: S401, obtaining input information input currently; the input information comprises feature description and attribute description; S402, based on the input information input currently, setting the identifier of the feature node corresponding to the first feature description in the current knowledge graph as a first identifier as a first feature node, setting the identifier of the feature node corresponding to the second feature description in the current knowledge graph as a second identifier as a second feature node, and setting the identifier of the attribute node corresponding to the attribute description in the current knowledge graph as the first identifier; S403, for any state node i in the current knowledge graph, based on the edge weight between the state node i and the corresponding feature node and the edge weight between the state node i and the corresponding attribute node, the priority PS corresponding to the state node i is obtained i ; i is valued from 1 to m, and m is the number of state nodes in the knowledge graph; S404, for any third feature node u in the current knowledge graph, based on the first preset path length, the second preset path length, the bias value corresponding to the third feature node u, the edge weight between the third feature node u and the corresponding state node, the edge weight between the third feature node u and the corresponding first feature node, and the edge weight between the third feature node u and the corresponding state node, the priority PF corresponding to the third feature node u is obtained u , the third feature node is a feature node in the knowledge graph except the first feature node and the second feature node, the value of u is 1 to n, and n is the number of third feature nodes; S405, acquire the feature node corresponding to max(PF1, PF2, …, PF u , …, PF n ) as the current inquiry label, max() represents taking the maximum value.
2. The method of claim 1, wherein, The k associated labels are obtained by the following steps: S201, obtaining similarity S between the current received inquiry input information and the i-th feature term in the preset feature term knowledge base i , obtaining a similarity set S={S1, S2, …, S i , …, S n}; i is 1 to n, and n is the number of feature terms in the preset feature term knowledge base S202, sorting S according to the order from large to small to obtain a sorted similarity set SR; S203, taking the feature terms corresponding to the first k similarities in SR as the k associated labels.
3. The method of claim 1, wherein, The k associated labels are obtained by a retrieval enhancement generation model.
4. The method of claim 1, wherein, The preset termination condition is any one of the following conditions: Condition 1: receiving an inquiry termination instruction input by the user; Condition 2: the number of labels in the current combination label set reaches a preset value; Condition 3: the number of labels in the current combination label set is less than a preset value, but the corresponding interaction result can be obtained based on the labels in the current combination label set.
5. The method of claim 4, wherein, The preset knowledge graph is composed of first to fourth types of nodes, wherein the first type of node is a state node representing a state, the second type of node is a feature node representing a feature of the state, the third type of node is an attribute node representing an attribute of the state, and the fourth type of node is a region node representing a region to which the state belongs.
6. The method of claim 1, wherein, The inquiry question is output in a text form or a voice form.
7. A human-machine interaction device, characterized in that, The device comprises an operation interface for a user to input inquiry input information and a processor for executing a computer program to implement the following steps: S10, obtaining initial inquiry content input by the user; S20, obtaining, from a preset feature term knowledge base, k feature terms related to the currently received inquiry input information as k associated labels corresponding to the currently received inquiry input information based on the currently received inquiry input information; the initial value of the currently received inquiry input information is the initial inquiry content; k≥1; S30, mapping the currently received inquiry input information and the corresponding k associated labels by using a large language model to obtain a mapping label corresponding to the currently received inquiry input information and adding the mapping label to a current combination label set; the initial value of the current combination label set is empty; S40, obtaining, based on the current combination label set and the preset knowledge graph, a label associated with the current combination label set as a current inquiry label; S50, if the current inquiry operation satisfies a preset termination condition, outputting corresponding inquiry output information based on the current combination label set, otherwise, generating a corresponding inquiry question based on the current inquiry label and outputting the inquiry question; the inquiry question comprises at least two features for the user to select; S60, obtaining answer information of the user answering the inquiry question, if the answer information comprises a feature description selected by the user, taking the feature description selected by the user as the currently received inquiry input information, adding a feature not selected by the user in the inquiry question to the current combination label set, and taking the received answer information as the currently received inquiry input information, and performing S20, if the answer information indicates that the user does not select any feature in the inquiry question, adding the feature corresponding to the inquiry question to the current combination label set, and performing S40; S40 specifically comprises: S41, obtaining input information input at present; the input information comprises feature description and attribute description; S42, based on the input information input at present, setting an identifier of a feature node corresponding to the first feature description in the current knowledge graph as a first identifier as a first feature node, setting an identifier of a feature node corresponding to the second feature description in the current knowledge graph as a second identifier as a second feature node, and setting an identifier of an attribute node corresponding to the attribute description in the current knowledge graph as the first identifier; S43, for any state node i in the current knowledge graph, based on the edge weight between the state node i and the corresponding feature node and the edge weight between the state node i and the corresponding attribute node, the priority PS corresponding to the state node i is obtained i ; i is valued from 1 to m, and m is the number of state nodes in the knowledge graph; S44, for any third feature node u in the current knowledge graph, based on the first preset path length, the second preset path length, the bias value corresponding to the third feature node u, the edge weight between the third feature node u and the corresponding state node, the edge weight between the third feature node u and the corresponding first feature node, and the edge weight between the third feature node u and the corresponding state node, the priority PF corresponding to the third feature node u is obtained u , the third feature node is a feature node in the knowledge graph other than the first feature node and the second feature node, and the value of u is 1 to n, n is the number of third feature nodes; S45, obtaining the feature node corresponding to max(PF1, PF2, …, PF u , …, PF n ) as the current inquiry label, max() representing taking the maximum value.
8. The apparatus of claim 7, wherein, The k associated labels are obtained by the following steps: S21, obtaining similarity S between the current received inquiry input information and the ith feature term in the preset feature term knowledge base i , obtaining a similarity set S={S1, S2, …, S i , …, S n}; i is 1 to n, and n is the number of feature terms in the preset feature term knowledge base S22, sorting S in descending order to obtain a sorted similarity set SR; S23, taking the feature terms corresponding to the first k similarities in SR as the k associated labels.
9. An electronic device, comprising: The device comprises a processor and a memory; The processor is configured to execute the steps of the method according to any one of claims 1 to 6 by invoking the program or instructions stored in the memory.
10. A non-transitory computer-readable storage medium, comprising: The non-transitory computer readable storage medium is configured to store a program or instructions, which cause a computer to execute the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Online medical question and answer method
CN113764112A
Guided inquiry method and system based on large language model, electronic equipment and storage medium
CN119581065A