A method and electronic device for identifying questions with the same semantics
By performing multiple rounds of correlation processes in user behavior graphs, problems with the same semantics in user logs are identified, which solves the problem of low recognition accuracy in the existing technology and improves the semantic understanding ability of smart devices.
Patent Information
- Application Number
- CN201910927801.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-27
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2039-09-27
AI Technical Summary
It is difficult for the existing technology to accurately identify questions with the same semantics, especially when there are many different ways of asking questions in user logs, resulting in low recognition accuracy and increased labor costs.
By creating a user behavior graph, performing multiple rounds of correlation processes based on seed questions, calculating correlation scores, and determining the K questions with the highest correlation scores, the recognition accuracy of the same semantic questions is improved.
Even if the questions in user logs are highly colloquial and have huge differences in expressions, it can effectively improve the recognition accuracy of questions with the same semantics and improve the semantic understanding of smart devices.
Smart Images

Figure CN112580356B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data mining, and in particular to a method and electronic device for identifying questions with the same semantics. Background Art
[0002] User logs record the behavior data generated by users every time they go online (e.g., visits, browsing, searches, clicks, etc.). By analyzing user logs, we can obtain a lot of information, for example, we can calculate the ranking of questions searched by users, the time users stay on a certain page, the length of time users listen to a certain song, etc. Since questions with the same semantics have the same answers (or results), it is of great significance to analyze user logs to find out which questions in user logs express the same semantics. However, since the same question can be asked in many different ways, users have a variety of expressions for the same or similar things, and some expressions may even contain errors and ambiguities, it is very challenging to accurately find different ways of asking the same question in user logs.
[0003] For example, in smart home devices (e.g., smart speakers, large screens, etc.) and smart assistant systems, user questions contain a large number of questions with the same semantics. Taking a certain brand of smart speakers as an example, the total number of the top 1,000 hot questions accounts for more than 80% of the total number of all questions. However, since these hot questions have many different ways of asking, it is difficult to accurately identify questions with the same semantics. For another example, in an intelligent customer service system, many common questions are stored in the form of frequently asked questions (FAQs). When the user question has a high degree of match with the FAQ, the answer to the FAQ can be returned to the user to solve the user problem. When a user question does not match any FAQ, the operation and maintenance personnel need to determine whether this question is a new question or a different way of asking a FAQ question, resulting in high labor costs. Therefore, it is urgent to solve the problem of low recognition accuracy of questions with the same semantics. Summary of the invention
[0004] The embodiments of the present application provide a method and electronic device for identifying questions with the same semantics, which are used to solve the problem that the recognition accuracy of questions with the same semantics is not high.
[0005] In a first aspect, an embodiment of the present application provides a method for identifying questions with the same semantics, the method comprising: creating a user behavior graph based on at least two user logs; determining a first associated question node set according to the user behavior graph and a seed question, the first associated node set comprising a question node corresponding to the seed question and M associated question nodes, where M is a positive integer; the seed question is a question in the at least two user logs; calculating a relevance score of the question corresponding to each question node in the user behavior graph based on the first associated question node set; using the question corresponding to each associated question node in the first associated question node set as a new seed node to determine M second associated question node sets; updating the relevance score of the question corresponding to each question node in the user behavior graph based on the M second associated question node sets; determining K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph, where K is an integer greater than 1.
[0006] In the embodiment of the present application, mining is performed based on the questions and answers included in the existing user logs, and the K questions with the highest correlation scores are determined through multiple rounds of correlation processes, wherein the K questions with the highest correlation scores have the same or similar semantics. The above method can effectively improve the recognition accuracy of questions with the same semantics even if the questions in the user logs are highly colloquial and the expressions are very different. Furthermore, identifying questions with the same semantics can help improve the semantic understanding ability of smart devices.
[0007] In a possible design, each user log includes at least a user identifier, at least one question and at least one answer corresponding to each question; in the user behavior graph, the i-th user node corresponds to the user identifier in the i-th user log, and the i-th user node is respectively connected to at least one question node; the at least one question node corresponds to at least one question in the i-th user log, and the j-th question node in the at least one question node is respectively connected to at least one answer node; the at least one answer node corresponds to at least one answer corresponding to the j-th question node in the i-th user log; i and j are positive integers, the i-th user log is any one of the at least two user logs, and the j-th question node is any one of the at least one question node.
[0008] With the above design, the user behavior graph accurately describes the association between user identification, questions and answers, which helps to identify questions with the same semantics.
[0009] In a possible design, each user log includes at least one question and at least one answer corresponding to each question; in the user behavior graph, at least one question node in the i-th user log corresponds to at least one question in the i-th user log, and the j-th question node in the at least one question node is respectively connected to at least one answer node; the at least one answer node corresponds to at least one answer corresponding to the j-th question node in the i-th user log; i and j are positive integers, the i-th user log is any one of the at least two user logs, and the j-th question node is any one of the at least one question node.
[0010] With the above design, the user behavior graph accurately describes the association between questions and answers, which helps to identify questions with the same semantics.
[0011] In one possible design, the user behavior graph also includes: the numerical value marked on the edge connecting each question node and the corresponding answer node; the numerical value marked on the edge connecting the j-th question node and the n-th answer node represents: the number of times the question corresponding to the j-th question node is answered using the answer corresponding to the n-th answer node, n is a positive integer, and the n-th answer node is any one of the at least one answer node.
[0012] With the above design, the user behavior graph can reflect the number of times each answer is used to answer the corresponding question, which helps to identify questions with the same semantics.
[0013] In one possible design, a first associated question node set is determined based on the user behavior graph and the seed question, and the first associated node set includes the seed node and M associated question nodes. The following method can be used: a first associated answer node set is determined based on the user behavior graph, and the first associated answer node set includes at least one answer node connected to the question node corresponding to the seed question; question nodes other than the question node corresponding to the seed question connected to the answer node in each of the first associated answer nodes are taken as associated question nodes to determine the M associated question nodes.
[0014] By adopting the above design, it is possible to determine the associated problem nodes related to the seed node and implement the first round of association process.
[0015] In one possible design, the relevance score of the question corresponding to the first question node is calculated based on the following numerical values: the numerical value marked by the edge connecting the question node corresponding to the seed question and each answer node in the first associated answer node set, and the numerical value marked by the edge connecting the first question node and the first associated answer node; in the first associated node question set, the first question node is any associated question node in the first associated question node set, and the first associated answer node is connected to the question node corresponding to the seed question and to the first question node.
[0016] With the above design, the relevance score of each question node is calculated based on the numerical value marked on the edge connecting the question and the answer, which can reflect the degree of relevance between the various questions.
[0017] In one possible design, updating the relevance score of the question corresponding to each question node in the user behavior graph based on the M second associated question node sets may adopt but is not limited to the following method: based on the M second associated question node sets and the relevance score of the question corresponding to each question node in the user behavior graph, updating the relevance score of the question corresponding to each question node in the user behavior graph.
[0018] By adopting the above design, the relevance score of each question can be stabilized as quickly as possible.
[0019] In one possible design, before determining the K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph, it also includes: determining that the difference between the relevance score of each question after the update and the relevance score of each question before the update is less than a preset threshold.
[0020] The above design can improve the accuracy of identifying questions with the same semantics.
[0021] In a second aspect, an embodiment of the present application provides a device, comprising: one or more processors and a memory, wherein the memory stores program instructions, and when the program instructions are executed by the device, the above-mentioned first aspect of the embodiment of the present application and any possible design method involved in the first aspect are implemented.
[0022] In the third aspect, an embodiment of the present application provides a chip, which is coupled to a memory in a device so that the chip calls program instructions stored in the memory during operation to implement the above-mentioned first aspect of the embodiment of the present application and any possible design method involved in the first aspect.
[0023] In a fourth aspect, a computer storage medium of an embodiment of the present application stores program instructions, and when the program instructions are executed on an electronic device, the device executes the above-mentioned first aspect of the embodiment of the present application and any possible design method involved in the first aspect.
[0024] In a fifth aspect, a computer program product of an embodiment of the present application, when the computer program product is run on an electronic device, enables the electronic device to execute a method for implementing the above-mentioned first aspect of the embodiment of the present application and any possible design involved in the first aspect.
[0025] In addition, the technical effects brought about by any possible design method in the second to fifth aspects can be referred to the technical effects brought about by different design methods in the relevant method part, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1(a) is one of the user behavior diagrams in this application;
[0027] Figure 1(b) is the second user behavior diagram in this application;
[0028] Figure 2 A schematic diagram of determining an answer node corresponding to a question node corresponding to a seed question based on FIG. 1( a ) in this application;
[0029] Figure 3 A schematic diagram of determining the first associated problem node based on FIG. 1( a ) in this application;
[0030] Figure 4 One of the flow charts for summarizing the method for identifying questions with the same semantics in this application;
[0031] Figure 5 The second flowchart is a summary of the method for identifying questions with the same semantics in this application;
[0032] Figure 6 This is a schematic diagram of a specific application scenario in this application;
[0033] Figure 7 This is a schematic diagram of the structure of an electronic device in this application. DETAILED DESCRIPTION
[0034] The embodiments of the present application are described below in conjunction with the accompanying drawings.
[0035] The prior art provides a variety of solutions for identifying questions with the same semantics. The following only briefly describes Solution 1 and Solution 2 as examples.
[0036] Solution 1: Method based on keyword matching. This method usually first selects a seed question (or called the initial question), and performs a shallow semantic analysis on the seed question (for example, keyword extraction, word weight calculation, etc.), and then applies a retrieval algorithm (such as BM25, cosine similarity, etc.) to find similar questions to the seed question from the candidate question set. For example, if the matching score of a question in the candidate question set is greater than a threshold, then the question is regarded as a similar question to the seed question. Solution 1 is relatively simple, but the recognition accuracy for questions with the same semantics is low.
[0037] Solution 2: Based on deep learning text matching method. This method also first selects seed questions, converts the text of the seed questions into word vectors through semantic analysis, and then converts the question matching into vector similarity calculation, and determines similar questions from the candidate question set through vector similarity calculation. The accuracy of Solution 2 is higher than that of Solution 1, but because users' questions are highly colloquial and the expressions vary greatly, the recognition accuracy of questions with easily confused semantics is not high.
[0038] For example, three questions (q1, q2 and q3) are as follows:
[0039] Q1: Can it be played?
[0040] Q2: Can you give me a copy of Zhang Zihao's song "Can I?"
[0041] Q3: Can I play a song?
[0042] The semantics of q1 and q2 are both whether to play this song, which are different ways of asking the same question; while the semantics of q3 is to recommend a song, which is different from the semantics of q1 and q2. However, whether the above solution 1 or solution 2 is adopted, the result is that the matching degree of q1 and q3 is much higher than the matching degree of q1 and q2. The reason is that the keywords and word vectors of q1 and q3 are very close, while the keywords and word vectors of q1 and q2 have a large span. The above solutions 1 and 2 cannot recognize that the two questions have the same semantics.
[0043] Based on this, an embodiment of the present application provides a method for identifying questions with the same semantics. The method can be mined based on the questions and answers included in the existing user logs, and the K questions with the highest correlation scores are determined through multiple rounds of association processes, wherein the K questions with the highest correlation scores have the same or similar semantics. Using the above method, even if the questions in the user logs are highly colloquial and the expressions are very different, the recognition accuracy of questions with the same semantics can be effectively improved. Further, identifying questions with the same semantics can help improve the semantic understanding ability of smart devices. For example, if a smart speaker determines that the question asked by the user is one of the above K questions, the smart speaker can determine that the semantics of the question is equivalent to the other (K-1) questions, so the smart device can accurately understand the semantics of the question and then give the answer expected by the user. For another example, a personal laptop computer is installed with a software with an intelligent customer service system. If the intelligent customer service system determines that the question input by the user is one of the above K questions, the intelligent customer service system can accurately understand the semantics of the question, and then determine the standard question corresponding to the question, and push the answer corresponding to the standard question to the user.
[0044] It should be understood that the embodiments of the present application can be applied to a variety of electronic devices with voice control functions, such as smart speakers, large screens, mobile phones, tablet computers, personal laptops, wearable devices, vehicle-mounted devices, etc. Among them, the large screen refers to an electronic device with a relatively large screen. In addition, the embodiments of the present application can also be applied to software with an intelligent customer service system.
[0045] In an embodiment of the present application, each user log includes at least one or more questions and one or more answers corresponding to each question. Optionally, each user log may also include a user ID. It should be understood that the user ID here may be an ID of a real user, or may also be an ID of a virtual user. Among them, all users who ask the same question obtained based on the big data statistical results may be regarded as a virtual user.
[0046] For another example, user log 1 includes: Question 1 is: Can I play it? The answer to question 1 is: Can I play the song? Question 2 is: Can I have a copy of Zhang Zihao's song "Can I play it?" The answer to question 2 is: Can I have a copy of the song? User log 2 includes: Question 1 is: Can I play a song? The answer to question 1 is: Can I play the song? The answer to question 2 is: The song "Good Day".
[0047] For example, user log 1 includes: user identification: user A; question: can I play it?; answer: can I play the song? User log 2 includes: user identification: user B; question: can I play the song "Zhang Zihao"?; answer: can I play the song? User log 3 includes: user identification: user C; question: can I play a song?; answer 1: can I play the song?; answer 2: can I play the song "Good Days".
[0048] It should be understood that each question may have a different answer. For example, if the question is: recommend a good song, the answer to the question may be a different song. Conversely, an answer may also correspond to different questions. For example, if the answer is: the song "Hair Like Snow", the question may be: play a song by Jay Chou, or the question may be: play a Chinese-style song.
[0049] Further, the user behavior graph may be created based on at least two user logs.
[0050] In a possible design, the user behavior graph includes three types of nodes, namely user nodes, question nodes, and answer nodes. Specifically, the user behavior graph can be created in the following ways:
[0051] For each user log, the user ID corresponds to a user node, each question corresponds to a question node, each answer corresponds to an answer node, and the user node is connected to each question node, and each question node is connected to the corresponding answer node. For example, taking the i-th user log as an example, assume that the i-th user log includes a user ID and k questions, wherein the j-th question among the k questions corresponds to s answers, and i, j, k, and s are positive integers. In the user behavior graph, the i-th user node corresponds to the user ID in the i-th user log, k questions correspond to k question nodes, the i-th user node is connected to the k question nodes respectively, the j-th question node among the k question nodes corresponds to the j-th question among the k questions, the s answers corresponding to the j-th question correspond to s answer nodes, and the j-th question node is connected to the s answer nodes respectively.
[0052] In the user behavior graph, the value marked by the edge connecting the user node and the question node indicates the weight of the question in all the questions in the user log to which the question belongs. For example, the value marked by the edge connecting the user node and the question node is 1, indicating that the weight of the question corresponding to the question node in all the questions in the user log to which the question belongs is 1, that is, the user log only includes one question. For another example, the value marked by the edge connecting the user node and the question node is 0.5, indicating that the weight of the question corresponding to the question node in all the questions in the user log to which the question belongs is 0.5, that is, the user log includes two questions. In the user behavior graph, the value marked by the edge connecting the question node and the answer node represents the number of times the user has adopted the answer. It should be understood that when the user identifier is the identifier of a real user, the value marked by the edge connecting the question node and the answer node represents the number of times the real user has adopted the answer; when the user identifier is the identifier of a virtual user, the value marked by the edge connecting the question node and the answer node represents the sum of the number of times all users who asked the question adopted the answer based on the big data statistical results.
[0053] Exemplarily, taking a smart speaker as an example, the smart speaker can determine whether the user adopts the answer based on the following rules:
[0054] 1. Whether the user plays the program indicated by the answer (such as music, etc.) for more than a preset time. If so, it is recorded that the user has adopted the answer, otherwise it is not recorded.
[0055] For example, in the smart speaker scenario, question 1 is: play a song by Jay Chou, and the smart speaker plays a song "Fa Ru Xue" (answer 1). If the song is played to completion, it is recorded once that answer 1 is adopted; or, if the playing time of the song exceeds the preset time (for example, 1 minute or 30 seconds), it is recorded once that answer 1 is adopted.
[0056] 2. Whether the user asks a new question again within a short period of time (for example, within 10 seconds); if so, it is considered that the user has not adopted the answer.
[0057] 3. After the answer is returned, whether the user has a voice request with negative emotions (for example: you are too stupid, you are too dumb, you made a mistake), if so, it is considered that the user did not adopt the answer.
[0058] It should be understood that the above rules for determining whether a user adopts a certain answer are merely examples and are not intended to be limiting of this application.
[0059] As shown in Figure 1(a), Figure 1(a) is a user behavior graph created based on three user logs. Among them, user log 1 records that user u1 asked question q1, and q1 corresponds to two answers a1 and a2 respectively; user log 2 records that user u2 asked question q2, and q2 corresponds to two answers a2 and a3 respectively; user log 3 records that user u3 asked questions q3 and q4, and q3 corresponds to three answers a1, a3 and a4 respectively, and q4 corresponds to one answer a4. Specifically, u1 is connected to q1, and q1 is connected to a1 and a2 respectively. Since user log 1 only includes q1, the edge label value of u1 and q1 is 1, and the edge label value of q1 and a1 is 100, indicating that user u1 has used a1 100 times, and the edge label value of q1 and a2 is 10, indicating that user u1 has used a2 10 times. u2 is connected to q2, and q2 is connected to a2 and a3 respectively. Since user log 2 only includes q2, the edge label value of u2 and q2 is 1, and the edge label value of q2 and a2 is 200, indicating that user u2 has used a2 200 times. The edge label value of q2 and a3 is 50, indicating that user u2 has used a3 to answer q2 50 times. u3 is connected to q3 and q4 respectively. q3 is connected to a1, a3 and a4 respectively, and q4 is connected to a4. Since user log 3 includes q3 and q4, the edge label value of u3 and q3 is 0.5, and the edge label value of u3 and q4 is 0.5. The edge labeling value of the connection between q3 and a1 is 30, which means that user u3 uses a1 30 times. The edge labeling value of the connection between q3 and a3 is 150, which means that user u3 uses a3 150 times. The edge labeling value of the connection between q3 and a4 is 100, which means that user u3 uses a4 100 times. The edge labeling value of the connection between q4 and a4 is 100, which means that user u3 uses a4 100 times.
[0060] In another possible design, the user behavior graph includes two types of nodes, namely question nodes and answer nodes. Specifically, the user behavior graph can be created in the following way:
[0061] For each user log, each question corresponds to a question node, each answer corresponds to an answer node, and each question node is connected to the corresponding answer node. For example, taking the i-th user log as an example, assume that the i-th user log includes a user ID and k questions, wherein the j-th question among the k questions corresponds to s answers, and i, j, k, and s are positive integers. It should be understood that the i-th user log may not include a user ID at this time. In the user behavior graph, k questions correspond to k question nodes, the j-th question node among the k question nodes corresponds to the j-th question among the k questions, the s answers corresponding to the j-th question correspond to s answer nodes, and the j-th question node is connected to the s answer nodes respectively.
[0062] As shown in Figure 1(b), Figure 1(b) is a user behavior graph created based on three user logs. Among them, user log 1 records question q1 and two answers a1 and a2 corresponding to q1; user log 2 records question q2 and two answers a2 and a3 corresponding to q2; user log 3 records questions q3 and q4, as well as three answers a1, a3 and a4 corresponding to q3, and one answer a4 corresponding to q4. Specifically, q1 is connected to a1 and a2 respectively. The edge label value of 100 connecting q1 and a1 indicates that a1 is adopted 100 times by the user who asked the question. The edge label value of 10 connecting q1 and a2 indicates that a2 is adopted 10 times by the user. q2 is connected to a2 and a3 respectively. The edge label value of 200 connecting q2 and a2 indicates that a2 is adopted 200 times by the user. The edge label value of 50 connecting q2 and a3 indicates that a3 is adopted by the user to answer q2 50 times. q3 is connected to a1, a3 and a4 respectively, and q4 is connected to a4. The edge label value of q3 and a1 is 30, which means that a1 is adopted by users 30 times. The edge label value of q3 and a3 is 150, which means that a3 is adopted by users 150 times. The edge label value of q3 and a4 is 100, which means that a4 is adopted by users 100 times. The edge label value of q4 and a4 is 100, which means that a4 is adopted by users 100 times.
[0063] It should be understood that the user behavior diagrams shown in FIG. 1( a ) and FIG. 1( b ) are for illustrative purposes only and are not intended to be limiting of the present application.
[0064] Based on the user behavior graph created in the above manner, the following takes an electronic device as an example to illustrate how to identify questions with the same semantics based on the created user behavior graph and solve the problem of low recognition accuracy of questions with the same semantics. The electronic device can be a terminal device used by an end user or a server device located in the cloud.
[0065] Embodiment 1:
[0066] The present application embodiment provides a method for identifying questions with the same semantics, such as Figure 4 As shown, the method includes:
[0067] S401: The electronic device selects a seed question based on a user log used to create a user behavior graph.
[0068] Exemplarily, the electronic device may select any question included in any user log as a seed question before or after creating the user behavior graph.
[0069] S402: The electronic device determines a first associated problem node set based on the user behavior graph and the problem node corresponding to the seed question, wherein the first associated problem node set includes the problem node corresponding to the seed question and M associated problem nodes, where M is a positive integer. The M associated problem nodes are problem nodes associated with the problem node found in the user behavior graph.
[0070] This is the first round of association process.
[0071] Exemplarily, the M associated problem nodes may be determined using the following method:
[0072] The electronic device determines a first associated answer node set based on the user behavior graph, wherein the first associated answer node set includes at least one answer node connected to the question node corresponding to the seed question. The electronic device uses question nodes other than the question node corresponding to the seed question that are connected to the answer node in each of the first associated answer nodes as associated question nodes, and determines M associated question nodes.
[0073] Specifically, for the first associated answer node set, if an answer node is connected to multiple question nodes, then all the question nodes except the question node corresponding to the seed question are associated question nodes, and the multiple question nodes all belong to the first associated question node set; if an answer node is only connected to the question node corresponding to the seed question, the associated question node cannot be obtained based on the answer node.
[0074] For example, as shown in Figure 1(a), assuming q1 is the seed question, then {a1, a2} is the answer node connected to q1, such as Figure 2 Further, the problem nodes connected to a1 also include q3, and the problem nodes connected to a2 also include q2, then q2 and q3 are associated problem nodes, and the first associated problem node set includes q1, q2 and q3, as shown in Figure 3 shown.
[0075] S403: The electronic device calculates a first relevance score of the question corresponding to each question node in the first relevance question node set as a relevance score of the question corresponding to each question node in the user behavior graph.
[0076] Specifically, in the first associated node question set, the first association score of the seed question is 1, wherein the first question node is any associated question node in the first associated question node set except the question node corresponding to the seed question, and the first associated answer node is connected to the question node corresponding to the seed question and is connected to the first question node. Then the first association score of the first question node can be calculated based on the following numerical values: the numerical value marked by the edge connecting the question node corresponding to the seed question and each answer node in the first associated answer node set, and the numerical value marked by the edge connecting the first question node and the first associated answer node.
[0077] For example, taking Figure 1(a) as an example, assuming that q1 is the seed question, the first associated question node set includes three question nodes: q1, q2, and q3. Among them, the first relevance score of the question corresponding to question node q1 is Score(q1); the first relevance score of the question corresponding to question node q2 is Score(q2); and the first relevance score of the question corresponding to question node q3 is Score(q3).
[0078] Among them, Score(q1)=1; that is, the first relevance score of the seed question is 1.
[0079] Score(q2)=Pr(q2|q1)*Score(q1)=Pr(a2|q1)Pr(q2|a2)*Score(q1)=10 / (100+10)*200 / (200+10)*1=0.087;
[0080] Among them, Pr(q2|q1) represents the correlation between q1 and q2 on the user behavior graph, that is, it represents the proportion of scores transferred from q1 to q2, Pr(a2|q1) represents the proportion of scores transferred from q1 to a2, and Pr(q2|a2) represents the proportion of scores transferred from a2 to q2.
[0081] The values marked on the edge connecting the question node corresponding to at least one seed question and the answer node corresponding to the question node corresponding to the seed question include: the edge marking value connecting q1 and a1 is 100, and the edge marking value connecting q1 and a2 is 10. Assuming q2 is the first question node and a2 is the first answer node, the value marked on the edge connecting the first question node and the first associated answer node is 200, the edge marking value connecting q2 and a2.
[0082] By the same token, we can obtain: Score(q3)=Pr(q3|q1)*Score(q1)=Pr(a1|q1)Pr(q3|a1)*Score(q1)=100 / (100+10)*30 / (100+30)*1=0.210.
[0083] The memory stores the first relevance score of the question corresponding to each question node in the above-mentioned first relevance question node set, that is, the relevance score of the question corresponding to each question node in the user behavior graph, recorded as value1{q1:1.0,q2:0.087,q3:0.210}.
[0084] S404: The electronic device uses the question corresponding to each associated question node in the first associated question node set as a new seed question, and determines a second associated question node set corresponding to each associated question node, that is, M second associated question node sets.
[0085] This is the second round of association process.
[0086] It should be understood that the method of using the question corresponding to each associated question node in the first associated question node set as a new seed question to determine the second associated question node set corresponding to the associated question node can refer to the above S402.
[0087] For example, as shown in Figure 1(a), assuming that q1 is a seed question, through S402, it can be obtained that the first associated question node set includes q1, q2 and q3. Further, the electronic device uses q2 as a new seed question, then {a2, a3} is the answer node connected to q2. The question node connected to a2 also includes q1, and the question node connected to a3 also includes q3, then the second associated question node set corresponding to q2 includes q1, q2 and q3; the electronic device uses q3 as a new seed node, then {a1, a3, a4} is the answer node connected to q3. The question node connected to a1 also includes q1, the question node connected to a3 also includes q2, and the question node connected to a4 also includes q4, then the second associated question node set corresponding to q3 includes q1, q2, q3 and q4.
[0088] S405: The electronic device calculates a second relevance score of the question corresponding to each question node in a second relevance question node set corresponding to each relevance question node based on the first relevance score of the question corresponding to each question node in the first relevance question node set.
[0089] For the specific calculation method, please refer to S403.
[0090] For example, taking FIG. 1(a) as an example, assuming that q2 is a new seed question, the second associated question node set corresponding to q2 includes q1, q2, and q3. The second relevance score of the question corresponding to each question node in the second associated question node set corresponding to q2 is:
[0091] Score(q2)=0.087;
[0092] Score(q1)=Pr(q1|q2)*Score(q2)=Pr(a2|q2)Pr(q1|a2)*Score(q2)=200 / (200+50)*10 / (200+10)*0.087=0.003;
[0093] Score(q3)=Pr(q3|q2)*Score(q2)=Pr(a3|q2)Pr(q3|a3)*Score(q2)=50 / (200+50)*150 / (50+150)*0.087=0.013;
[0094] Assuming q3 is a new seed question, the second associated question node set corresponding to q3 includes q1, q2, q3 and q4. The second relevance score of the question corresponding to each question node in the second associated question node set corresponding to Q3 is:
[0095] Score(q3)=0.210;
[0096] Score(q1)=Pr(q1|q3)*Score(q3)=Pr(a1|q3)Pr(q1|a1)*Score(q3)=30 / (150+100+30)*100 / (100+30)*0.210=0.017;
[0097] Score(q2)=Pr(q2|q3)*Score(q3)=Pr(a3|q3)Pr(q2|a3)*Score(q3)=Pr(a3|q3)Pr(q2|a3)*Score(q3)=150 / (150+100+30)*50 / (150+50)*0.210=0.028;
[0098] Score(q4)=Pr(q4|q3)*Score(q3)=Pr(a4|q3)Pr(q4|a4)*Score(q3)=Pr(a4|q3)Pr(q4|a4)*Score(q3)=100 / (150+100+30)*100 / (100+100)*0.210=0.038;
[0099] S406: The electronic device updates the relevance score of the question corresponding to each question node in the user behavior graph based on the second relevance score of the question corresponding to each question node in the second relevance question node set corresponding to each relevance question node.
[0100] Exemplarily, if a problem node is an associated problem node of multiple seed nodes, the association score of the problem node is the sum of the second association scores of the multiple seed nodes.
[0101] For example, the relevance score of each question node in the updated user behavior graph is:
[0102] Score(q1)=Pr(q1|q3)*Score(q3)+Pr(q1|q2)*Score(q2)=0.017+0.003=0.020;
[0103] Similarly, we can calculate Score(q2)=0.087+0.028=0.115, Score(q3)=0.21+0.013=0.223, Score(q4)=0.038. The correlation score of each question node in the updated user behavior graph is recorded as value2{q1:0.020,q2:0.115,q3:0.223,q4:0.038}.
[0104] S407: The electronic device determines K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph, where K is an integer greater than 1.
[0105] In one example, the electronic device may directly determine K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph.
[0106] In another example, before determining the K questions with the highest relevance scores, the electronic device may also determine whether the relevance score of each question has stabilized based on the change in the relevance score of the question corresponding to each question node after and before the update. Stability here means that no new question nodes are associated, and the difference between the relevance score of each question after the update and the relevance score of each question before the update is less than a preset threshold (e.g., 0.001). If the relevance score of each question is already stable, there is no need to perform the next round of association, and the electronic device determines the K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph. If the relevance score of each question is not stable, the next round of association is performed, that is, the relevance score of the question corresponding to each question node in the user behavior graph is updated based on the above idea, until the electronic device determines that the relevance score of each question is stable, and then determines the K questions with the highest relevance scores.
[0107] For example, value1{q1:1.0,q2:0.087,q3:0.210}, value2{q1:0.020,q2:0.115,q3:0.223,q4:0.038}, it can be seen that the relevance score of each question is not stable, the reason is:
[0108] First, value1 does not contain q4, but value2 contains q4:0.038. Therefore, new nodes are associated in the second round of association.
[0109] Second: Assuming the preset threshold is 0.001, then q1:1.0 in value1 and q1:0.020 in value2, the difference before and after the update is greater than 0.001. Similarly, q2:0.087 in value1 and q2:0.115 in value2, the difference before and after the update is greater than 0.001. Similarly, q3:0.210 in value1 and q3:0.223 in value2, the difference before and after the update is greater than 0.001. Therefore, the correlation scores of q1, q2, and q3 are not stable. In addition, value1 does not contain q4, and q4:0 can also be recorded. Therefore, q4:0 in value1 and q4:0 in value2, the difference before and after the update is greater than 0.001.
[0110] Therefore, based on the above analysis, the electronic device needs to perform a third round of association process, taking each problem node in the second associated problem node set corresponding to each problem node as a seed node, and determining the third associated problem node set corresponding to each problem node. Specifically, since the second associated problem node set corresponding to q2 includes q1, q2, and q3, in the third round of association process, the electronic device takes q1 and q3 as seed nodes respectively to obtain: the third associated problem node set corresponding to q1 includes q1, q2, and q3, and the third associated problem node set corresponding to q3 includes q1, q2, q3, and q4. Similarly, since the second associated problem node set corresponding to q3 includes q1, q2, q3, and q4, in the third round of association process, the electronic device takes q1, q2, and q4 as seed nodes respectively to obtain: the third associated problem node set corresponding to q2 includes q1, q2, and q3, and the third associated problem node set corresponding to q4 includes q3 and q4. Among them, the third associated problem node set corresponding to q1 has been determined and does not need to be determined repeatedly. The electronic device can update the relevance score of the question corresponding to each question node in the user behavior graph based on the above-mentioned S405 and S405 schemes, and then compare it with the relevance score of the question corresponding to each question node in the user behavior graph obtained in the second round of association process to determine whether the relevance score of each question has stabilized, until the relevance score of each question is stable, and the repetitions will not be repeated.
[0111] The above embodiments can effectively improve the recognition accuracy of questions with the same semantics, thereby improving the semantic understanding ability of smart devices.
[0112] It should be understood that when the number of user logs used to create the user behavior graph is small, the structure of the user behavior graph is relatively simple. At this time, the method provided in Example 1 is used, and the electronic device starts the association process based on a seed node. The association score of each question can be stabilized through two or more rounds of association processes. When the number of user logs used to create the user behavior graph is large, the structure of the user behavior graph is relatively complex. At this time, the method provided in Example 1 is used, and the electronic device starts the association process based on a seed node. It may take many rounds of association processes to achieve a stable association score for each question, so it may take a long time and occupy more resources. Based on this, the present application also provides a method for identifying questions with the same semantics. In this method, the electronic device can simultaneously start the association process based on a seed file and at least one candidate question. When the user behavior graph is relatively complex, the above method can quickly achieve a stable association score for each question. For details, please refer to Example 2.
[0113] Embodiment 2:
[0114] The present application embodiment provides a method for identifying questions with the same semantics, such as Figure 5 As shown, the method includes:
[0115] S501: The electronic device selects a seed question and at least one candidate question based on at least two user logs used to create a user behavior graph.
[0116] Exemplarily, the electronic device may adopt the above-mentioned scheme 1 and scheme 2 in the prior art to select candidate questions of the seed question.
[0117] For example, as shown in FIG1( a ), assuming that q1 is a seed problem, based on solution 1 in the prior art, {q3, q4} are obtained as candidate problems.
[0118] It should be understood that the candidate question may also be any question in the at least two user logs except the seed question. Therefore, S501 may also be described as: the electronic device selects a plurality of seed questions based on the at least two user logs used to create the user behavior graph.
[0119] S502: The electronic device determines a first associated question node set corresponding to the seed question and a first associated question node set corresponding to each candidate question based on the user behavior graph, the seed question and at least one candidate question.
[0120] This is the first round of association process.
[0121] It should be understood that the method for determining the first associated question node set corresponding to the seed question and the first associated question node set corresponding to each candidate question is the same, and both can refer to S402.
[0122] Exemplarily, as shown in FIG1(a), {a1, a2} is an answer node connected to q1. Furthermore, the question node connected to a1 also includes q3, and the question node connected to a2 also includes q2, then the first associated question node set corresponding to q1 includes q1, q2, and q3. {a1, a3, a4} is an answer node connected to q3. The question node connected to a1 also includes q1, the question node connected to a3 also includes q2, and the question node connected to a4 also includes q4, then the first associated question node set corresponding to q3 includes q1, q2, q3, and q4. {a4} is an answer node connected to q4. The question node connected to a4 also includes q3, then the first associated question node set corresponding to q4 includes q3 and q4.
[0123] S503: The electronic device calculates the first relevance score of the question corresponding to each question node in the first associated question node set corresponding to the seed question, and the first relevance score of the question corresponding to each question node in the first associated question node set corresponding to each candidate question, to obtain the relevance score of the question corresponding to each question node in the user behavior graph.
[0124] For details, please refer to S403 and S406.
[0125] Exemplarily, the first relevance score of the question corresponding to each question node in the first associated question node set corresponding to the seed question is:
[0126] Score(q1)=1;
[0127] Score(q2)=Pr(q2|q1)*Score(q1)=Pr(a2|q1)Pr(q2|a2)*Score(q1)=10 / (100+10)*200 / (200+10)*1=0.087.
[0128] Score(q3)=Pr(q3|q1)*Score(q1)=Pr(a1|q1)Pr(q3|a1)*Score(q1)=100 / (100+10)*30 / (100+30)*1=0.210.
[0129] The first relevance score of the problem corresponding to each problem node in the first associated problem node set corresponding to q3 is: Score(q3)=1;
[0130] Score(q1)=Pr(q1|q3)*Score(q3)=Pr(a1|q3)Pr(q1|a1)*Score(q3)=30 / (150+100+30)*100 / (100+30)*1=0.081;
[0131] Score(q2)=Pr(q2|q3)*Score(q3)=Pr(a3|q3)Pr(q2|a3)*Score(q3)=Pr(a3|q3)Pr(q2|a3)*Score(q3)=150 / (150+100+30)*50 / (150+50)*1=0.133;
[0132] Score(q4)=Pr(q4|q3)*Score(q3)=Pr(a4|q3)Pr(q4|a4)*Score(q3)=Pr(a4|q3)Pr(q4|a4)*Score(q3)=100 / (150+100+30)*100 / (100+100)*1=0.181;
[0133] The first relevance score of the question corresponding to each question node in the first relevance question node set corresponding to q4 is:
[0134] Score(q4) = 1;
[0135] Score(q3)=Pr(q3|q4)*Score(q4)=Pr(a4|q4)Pr(q3|a4)*Score(q4)=100 / (100)*100 / (100+100)*1=0.5;
[0136] The relevance score of each question node in the user behavior graph is:
[0137] Score(q1)=1+0.081=1.081;
[0138] Score(q2)=0.133+0.087=0.220;
[0139] Score(q3)=1+0.5+0.210=1.710;
[0140] Score(q4)=1+0.181=1.181;
[0141] value1{q1:1.081,q2:0.220,q3:1.710,q4:1.181};
[0142] S504: The electronic device uses the question corresponding to each associated question node in the first associated question node set corresponding to the seed question as a new seed node, determines the second associated question node set corresponding to each associated question node, and uses the question corresponding to each associated question node in the first associated question node set corresponding to the candidate question as a new seed node, determines the second associated question node set corresponding to each associated question node.
[0143] This is the second round of association process. Please refer to S404 for details.
[0144] S505: The electronic device calculates the second relevance score of the question corresponding to each question node in the second associated question node set corresponding to each associated question node based on the relevance score of the question corresponding to each question node in the user behavior graph.
[0145] For details, please refer to S405.
[0146] S506: The electronic device updates the relevance score of the question corresponding to each question node in the user behavior graph based on the second relevance score of the question corresponding to each question node in the second relevance question node set corresponding to each of the above relevance question nodes.
[0147] For details, please refer to S406.
[0148] S507: The electronic device determines K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph, where K is an integer greater than 1.
[0149] It should be understood that the above Figure 5 The embodiment shown and Figure 4 The basic concept of the embodiments shown is the same, wherein Figure 5 In the illustrated embodiment, at least one candidate question is first obtained through a seed question, and further, the seed question and at least one candidate question simultaneously initiate an association process. Therefore, compared with embodiment 1, the speed at which the association score of each question reaches stability can be accelerated.
[0150] like Figure 6As shown, it is a schematic diagram of a specific application scenario of an embodiment of the present application. The electronic device first creates a user behavior graph based on at least two user logs, such as shown in Figure 1(a). The user behavior graph can be used to describe the association between users and questions, and the association between questions and answers. The electronic device can determine multiple questions with the same or similar semantics according to the method for identifying questions with the same semantics provided in the above-mentioned embodiments 1 and 2. For example, the method shown in embodiment 1 or 2 is used to determine the K questions with the highest correlation scores. Among them, the K questions with the highest correlation scores have the same or similar semantics. Furthermore, the above-mentioned recognition results, that is, multiple questions with the same or similar semantics, can be applied to devices or software such as smart speakers, smart assistants, and smart customer service, which can improve the semantic understanding ability of these devices or software, and then provide users with more accurate answers, which can improve the user experience.
[0151] In the embodiments provided by the present application, the method provided by the embodiments of the present application is introduced from the perspective of the electronic device as the execution subject. In order to implement the functions in the methods provided by the embodiments of the present application, the electronic device may include a hardware structure and / or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a function of the above functions is executed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.
[0152] Based on the same concept, Figure 7 The present application provides a device 700 for executing Figure 4 or Figure 5 The method for identifying questions with the same semantics is shown. The device 700 includes at least one processor 710 and a memory 720. The processor 710 is coupled to the memory 720. The coupling in the embodiment of the present application is an indirect coupling or communication connection between devices, units or modules, which can be electrical, mechanical or other forms, and is used for information exchange between devices, units or modules. The connection medium between the above processor 710 and the memory 720 is not limited in the embodiment of the present application. For example, in the embodiment of the present application, Figure 7 The memory 720 and the processor 710 may be connected via a bus, which may be divided into an address bus, a data bus, a control bus, and the like.
[0153] Specifically, the memory 720 is used to store program instructions.
[0154] The processor 710 is used to call the program instructions stored in the memory 720 so that the device 700 executes Figure 4 or Figure 5 The method shown in for identifying questions with the same semantics.
[0155] In the embodiment of the present application, the processor 710 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0156] In the embodiment of the present application, the memory 720 can be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., and can also be a volatile memory (volatile memory), such as a random access memory (RAM). The memory is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this. The memory in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0157] It should be understood that the device 700 can be used to implement the embodiment of the present application. Figure 4 and Figure 5 The related features of the method shown can be referred to above and will not be described again here.
[0158] It is clear to those skilled in the art that the embodiments of the present application can be implemented in hardware, firmware, or a combination thereof. When implemented using software, the above functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any medium that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a computer can access. Taking this as an example but not limited to: a computer-readable medium can include RAM, ROM, electrically erasable programmable read only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer. In addition. Any connection can be appropriately a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, wireless, and microwave are included in the fixation of the medium. As used in the embodiments of the present application, disk and disc include compact disc (CD), laser disc, optical disc, digital video disc (DVD), floppy disk, and Blu-ray disc, where disks usually copy data magnetically and discs use lasers to copy data optically. The above combinations should also be included in the scope of protection of computer-readable media.
[0159] In short, the above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present application shall be included in the protection scope of the present application.
Claims
1. A method to identify questions with the same semantics, It is characterized in that The method includes: Creating a user behavior graph based on at least two user logs: for each user log in the at least two user logs, each question corresponds to a question node, each answer corresponds to an answer node, and each question node is connected to a corresponding answer node; wherein the value marked on the edge connecting each question node and the corresponding answer node represents the number of times the user corresponding to the user behavior graph uses the answer corresponding to the answer node to answer the question corresponding to the question node; Determine a first associated question node set according to the user behavior graph and the seed question, the first associated question node set including a question node corresponding to the seed question and M associated question nodes, where M is a positive integer; the seed question is one of the at least two user logs; wherein determining the first associated question node set according to the user behavior graph and the seed question comprises: determining a first associated answer node set according to the user behavior graph, the first associated answer node set including at least one answer node connected to the question node corresponding to the seed question; determining the M associated question nodes by taking question nodes other than the question node corresponding to the seed question connected to the answer node in each of the first associated answer nodes as associated question nodes; The relevance score of the question corresponding to each question node in the user behavior graph is calculated based on the first set of associated question nodes; the first question node is any associated question node in the first set of associated question nodes, and the relevance score of the question corresponding to the first question node is calculated based on the following numerical values: the numerical value marked by the edge connecting the question node corresponding to the seed question and each answer node in the first set of associated answer nodes, and the numerical value marked by the edge connecting the first question node and the first associated answer node, the first associated answer node is connected to the question node corresponding to the seed question and is connected to the first question node; Using the question corresponding to each associated question node in the first associated question node set as a new seed node, to determine M second associated question node sets; Based on the M second associated question node sets, updating the relevance score of the question corresponding to each question node in the user behavior graph; Based on the relevance score of the question corresponding to each question node in the updated user behavior graph, K questions with the highest relevance scores are determined, where K is an integer greater than 1.
2. The method according to claim 1, It is characterized in that Each user log includes at least a user identification, at least one question, and at least one answer corresponding to each question; In the user behavior graph, the i-th user node corresponds to the user identifier in the i-th user log, and the i-th user node is connected to at least one problem node respectively; The at least one question node corresponds to at least one question in the i-th user log, and the j-th question node in the at least one question node is respectively connected to at least one answer node; The at least one answer node corresponds to at least one answer corresponding to the jth question node in the i-th user log; i and j are positive integers, the i-th user log is any one of the at least two user logs, and the j-th problem node is any one of the at least one problem node.
3. The method according to claim 1, It is characterized in that Each user log includes at least one question and at least one answer corresponding to each question; In the user behavior graph, at least one question node in the i-th user log corresponds to at least one question in the i-th user log, and the j-th question node in the at least one question node is respectively connected to at least one answer node; The at least one answer node corresponds to at least one answer corresponding to the jth question node in the i-th user log; i and j are positive integers, the i-th user log is any one of the at least two user logs, and the j-th problem node is any one of the at least one problem node.
4. The method according to claim 2 or 3, It is characterized in that The user behavior graph also includes: a value marked on the edge connecting each question node and the corresponding answer node; The value marked on the edge connecting the j-th question node and the n-th answer node represents the number of times the question corresponding to the j-th question node is answered using the answer corresponding to the n-th answer node, where n is a positive integer and the n-th answer node is any one of the at least one answer node.
5. The method according to claim 1 or 2, It is characterized in that Updating the relevance score of the question corresponding to each question node in the user behavior graph based on the M second relevance question node sets includes: Based on the M second associated question node sets and the relevance score of the question corresponding to each question node in the user behavior graph, the relevance score of the question corresponding to each question node in the user behavior graph is updated.
6. The method according to claim 1 or 2, It is characterized in that Before determining the K questions with the highest relevance scores based on the relevance scores of the questions corresponding to each question node in the updated user behavior graph, the method further includes: It is determined that the difference between the relevance score of each question after the update and the relevance score of each question before the update is less than a preset threshold.
7. An electronic device, It is characterized in that The device comprises a processor and a memory; The memory stores program instructions; When the program instructions are executed, the electronic device executes the method according to any one of claims 1 to 6.
8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes program instructions, and when the program instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent question answering method, device and intelligent terminal
CN109063152A
Method for answering questions in petrochemical field based on knowledge map
CN109492077A
