Intention recognition method, response method, device, and storage medium

By determining the number of header entities in a user's query statement and the target path in the intent knowledge graph in KBQA, and combining this with a questioning mechanism, the problem of low answer accuracy in existing technologies is solved, achieving higher precision in intent recognition and response.

CN116127025BActive Publication Date: 2025-11-07MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211273796.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-18
Publication Date
2025-11-07
Estimated Expiration
2042-10-18

AI Technical Summary

Technical Problem

In existing KBQA technology, the accuracy of the answers is not high, mainly because it fails to consider the question type and perform semantic judgment on nodes other than the head entity, resulting in inaccurate query paths.

Method used

By determining the number of head entities in a user's query statement, utilizing the target head entities and non-head entities in the intent knowledge graph, determining the target path based on a preset scoring strategy, and combining a question-and-answer mechanism to obtain the initial intent, multi-round question answering is achieved.

Benefits of technology

It improves the accuracy of answers, enables a more precise understanding of user intent, and enhances user experience and processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116127025B_ABST
    Figure CN116127025B_ABST
Patent Text Reader

Abstract

The application provides an intention recognition method, a response method, a device and a storage medium, and relates to the technical field of artificial intelligence. The intention recognition method comprises the following steps: determining the number of head entities corresponding to a user inquiry statement according to the user inquiry statement; determining a first preset number of target head entities in an intention knowledge graph according to the user inquiry statement, the number of head entities and head entities contained in the intention knowledge graph, wherein the first preset number is the same as the number of head entities; determining an initial intention corresponding to the user inquiry statement and a target non-head entity in a candidate path corresponding to the target head entity based on the user inquiry statement; determining a target path in the candidate path based on the target head entity, the initial intention and the target non-head entity; and obtaining a target intention corresponding to the user inquiry statement according to the target path. The application can more accurately understand the target intention corresponding to the user inquiry statement, and thus can obtain response information corresponding to the user inquiry statement with higher accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to an intent recognition method, a response method, a device and a storage medium. BACKGROUND

[0002] Knowledge Base Question Answering (KBQA) utilizes the rich semantic association information of a knowledge graph, can deeply understand a user question and give an answer, and has been applied more and more widely in recent years.

[0003] At present, in the process of applying KBQA, each question-answer training sample in a question-answer training set is usually used to construct a question-predicate sequence dataset based on a knowledge graph, and then a predicate sequence detector is trained. For a question to be answered, the predicate sequence of the question is first identified by the predicate sequence detector. A core path is constructed by using a focus word of the question, the predicate sequence and a label value of an entity. Then, constraint conditions are identified by analyzing the question, and a query path is constructed based on the core path. According to the question, a final answer is selected according to the candidate answer obtained in the core path and the query path. However, the accuracy of the answer obtained by the above-mentioned method is not high. SUMMARY

[0004] The present application provides an intent recognition method, a response method, a device and a storage medium to solve the problem that the accuracy of the answer corresponding to the question obtained by the current method is not high.

[0005] In a first aspect, the present application provides an intent recognition method, comprising:

[0006] According to the user consultation statement, the number of head entities corresponding to the user consultation statement is determined;

[0007] According to the user consultation statement, the number of head entities and the head entities contained in the intent knowledge graph, a first preset number of target head entities in the intent knowledge graph are determined, and the first preset number is the same as the number of head entities;

[0008] Based on the user consultation statement, the initial intent and the target non-head entity corresponding to the user consultation statement are determined in the candidate path corresponding to the target head entity;

[0009] Based on the target head entity, the initial intent and the target non-head entity, the target path in the candidate path is determined;

[0010] According to the target path, the target intent corresponding to the user consultation statement is obtained.

[0011] In a second aspect, the present application provides a response method applied to a robot customer service system, comprising:

[0012] In response to the consultation sentence input by the user, a target intent corresponding to the consultation sentence is obtained, the target intent being obtained based on the intent recognition method as described in the first aspect of the present application;

[0013] The response information corresponding to the target intent is fed back to the user.

[0014] In a third aspect, the present application provides an intent recognition device, comprising:

[0015] A first determination module is configured to determine a number of head entities corresponding to the user consultation sentence according to the user consultation sentence;

[0016] A second determination module is configured to determine a first preset number of target head entities in an intent knowledge graph according to the user consultation sentence, the number of head entities, and the head entities contained in the intent knowledge graph, the first preset number being the same as the number of head entities;

[0017] A third determination module is configured to determine an initial intent and a target non-head entity corresponding to the user consultation sentence in a candidate path corresponding to the target head entity based on the user consultation sentence;

[0018] A fourth determination module is configured to determine a target path in the candidate path based on the target head entity, the initial intent, and the target non-head entity;

[0019] A first acquisition module is configured to obtain a target intent corresponding to the user consultation sentence according to the target path.

[0020] In a fourth aspect, the present application provides a response device applied to a robot customer service system, comprising:

[0021] An acquisition module is configured to obtain a target intent corresponding to a consultation sentence input by a user in response to the consultation sentence, the target intent being obtained based on the intent recognition method as described in the first aspect of the present application;

[0022] A feedback module is configured to feed back response information corresponding to the target intent to the user.

[0023] In a fifth aspect, the present application provides an electronic device, comprising a processor and a memory in communication connection with the processor;

[0024] The memory stores computer execution instructions;

[0025] The processor executes the computer execution instructions stored in the memory to implement the intent recognition method as described in the first aspect of the present application or the response method as described in the second aspect of the present application.

[0026] In a sixth aspect, the present application provides a computer readable storage medium, which stores computer program instructions. When the computer program instructions are executed by a processor, the intent recognition method according to the first aspect of the present application or the response method according to the second aspect of the present application is implemented.

[0027] In a seventh aspect, the present application provides a computer program product, which comprises a computer program. When the computer program is executed by a processor, the intent recognition method according to the first aspect of the present application or the response method according to the second aspect of the present application is implemented.

[0028] The intent recognition method, the response method, the device and the storage medium provided by the present application can determine the number of head entities corresponding to the user inquiry statement according to the user inquiry statement, and can determine the problem type according to the number of head entities. The first preset number of target head entities is determined in the intent knowledge graph according to the user inquiry statement, the number of head entities and the head entities contained in the intent knowledge graph. The first preset number is the same as the number of head entities. The head entity information extraction has a large coverage and high scalability, and the target head entity can be obtained more accurately. Based on the user inquiry statement, the initial intent corresponding to the user inquiry statement and the target non-head entity are determined in the candidate path corresponding to the target head entity. Based on the target head entity, the initial intent and the target non-head entity, the target path is determined in the candidate path. Since the initial intent and the target non-head entity outside the target head entity are fully considered when the target path is determined, instead of only determining the target path based on the target head entity, the target path can be determined more accurately. The target intent corresponding to the user inquiry statement is obtained according to the target path. The present application can more accurately understand the target intent corresponding to the user inquiry statement, and can obtain the response information (i.e. the answer) corresponding to the user inquiry statement with higher accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0030] Figure 1 A schematic diagram of a robot customer service application scenario provided by an embodiment of the present application;

[0031] Figure 2 A flowchart of an intent recognition method provided by an embodiment of the present application;

[0032] Figure 3 A flowchart of an intent recognition method provided by another embodiment of the present application;

[0033] Figure 4 An intent knowledge graph based on a corpus set provided by an embodiment of the present application;

[0034] Figure 5 A flowchart of a response method provided by an embodiment of the present application;

[0035] Figure 6 A structural schematic diagram of an intent recognition device provided by an embodiment of the present application;

[0036] Figure 7 A structural schematic diagram of a response device provided by an embodiment of the present application;

[0037] Figure 8 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0039] In the technical solutions of the present application, the collection, storage, use, processing, transmission, provision, and disclosure of information such as financial data or user data comply with relevant laws and regulations and do not violate public order and good customs.

[0040] The main task of KBQA is to map a natural language query (NLQ) to a structured query through different methods and obtain an answer in a knowledge graph. However, a multi-round question for a multi-entity knowledge graph is a difficulty in a knowledge graph question answering task. In related technologies, for a question to be answered, a predicate sequence detector that is pre-trained is used to identify a predicate sequence of the question; a core path is constructed by using a focus word of the question, the predicate sequence, and a label value of an entity; a constraint condition is identified by analyzing the question, and a query path is constructed based on the core path; and a final answer is selected according to the question and the candidate answer and the query path obtained in the core path. However, the related technologies use the predicate sequence detector to mine information of the question to obtain the query path, do not consider the type of the question, cannot return a single or multiple path answers according to different types of questions, and do not perform semantic judgment on nodes other than a head entity, which results in low accuracy of the answer obtained through the above method.

[0041] Based on the above problems, the application provides an intent recognition method, a response method, a device and a storage medium. By determining the number of head entities corresponding to the user consultation statement, determining target head entities in the intent knowledge graph according to a sorting algorithm, the information extraction has a large coverage and high scalability, and the target head entities can be more accurately obtained. Based on the user consultation statement, the initial intent and the target non-head entity corresponding to the user consultation statement are determined by searching in the candidate path corresponding to the target head entity. Based on the target head entity, the initial intent and the target non-head entity, the candidate path corresponding to the target head entity is sorted according to a preset scoring strategy, and the target path is determined. The target path can be more accurately obtained. The target intent corresponding to the user consultation statement is obtained according to the target path. If the initial intent corresponding to the user consultation statement is not determined, the initial intent can be further asked to the user to obtain the initial intent, and the multi-round question and answer based on the intent knowledge graph is realized. Therefore, the application can more accurately obtain the target intent corresponding to the user consultation statement, and then obtain an answer with higher accuracy.

[0042] Hereinafter, the application scenario of the scheme provided by the application is first illustrated.

[0043] Figure 1 The schematic diagram of the robot customer service application scenario provided by an embodiment of the application is shown. As shown in Figure 1 , in the robot customer service application scenario, the terminal device (such as the mobile phone 101 shown in Figure 1 ) receives the consultation question input by the user through the robot agent, and the mobile phone 101 sends the consultation statement to the server 102. The server 102 determines the target intent corresponding to the consultation statement according to the consultation statement, and sends the response information corresponding to the target intent to the mobile phone 101. The mobile phone 101 displays the response information to the user through the robot agent. By identifying the target intent corresponding to the user consultation question in real time during real-time communication, and then feeding back the response information with higher accuracy to the user according to the target intent, the user experience can be improved, and the efficiency of processing user consultation problems can be improved. The specific implementation process of the server 102 for determining the target intent corresponding to the consultation statement can be referred to the schemes of the embodiments described below.

[0044] It should be noted that Figure 1 is only a schematic diagram of an application scenario provided by an embodiment of the application, and the application does not limit the devices included in Figure 1 , nor the positional relationship between the devices in Figure 1 . For example, in the application scenario shown in Figure 1 , a data storage device can also be included, which can be an external storage relative to the server 102, or an internal storage integrated in the server 102.

[0045] The technical solutions of the present application will be described in detail below with specific examples. It should be noted that the following specific examples can be combined with each other, and the same or similar concepts or processes can not be described in detail in some examples.

[0046] Figure 2 The flowchart of the intent recognition method provided by an embodiment of the present application. The method of the embodiment of the present application can be applied in an electronic device, which can be a server or a server cluster, etc. As shown in the figure, the method of the embodiment of the present application includes: Figure 2

[0047] S201, determining the number of head entities corresponding to the user inquiry statement according to the user inquiry statement.

[0048] In the embodiment of the present application, the user inquiry statement can be input by the user to the electronic device executing the embodiment of the method, or sent by other devices to the electronic device executing the embodiment of the method. For example, the user inquiry statement is "X city household registration how to handle". After obtaining the user inquiry statement, the number of head entities corresponding to the user inquiry statement can be determined according to the user inquiry statement.

[0049] Further, optionally, determining the number of head entities corresponding to the user inquiry statement according to the user inquiry statement can include inputting the user inquiry statement into a classification model to determine the number of head entities corresponding to the user inquiry statement.

[0050] For example, a question classification training set can be constructed, and after training the question classification training set by machine learning method, a classification model is obtained. Inputting the user inquiry statement into the classification model can determine the number of head entities corresponding to the user inquiry statement. According to the number of head entities, the user inquiry statement can be divided into single entity question and multi entity question, that is, the type of the question corresponding to the user inquiry statement is determined. In an example, the user inquiry statement is "X city household registration transfer conditions and handling process", and the classification model obtains the head entity as "household registration", that is, the number of head entities is one, which belongs to single entity question. In another example, the user inquiry statement is "X city household registration transfer conditions and Y city ID card handling conditions", and the classification model obtains the head entities as "household registration" and "ID card", that is, the number of head entities is two, which belongs to multi entity question. It can be understood that single entity question and multi entity question are two different types of questions. For single entity question, only the candidate path obtained by querying the intent knowledge graph under the entity needs to be sorted; for multi entity question, multiple candidate paths corresponding to multiple entities need to be sorted based on the intent knowledge graph.

[0051] ​S202, determine a first preset number of target head entities in the intent knowledge graph according to the user consultation statement, the number of head entities, and head entities contained in the intent knowledge graph, the first preset number being the same as the number of head entities.

[0052] In this step, after determining the number of head entities corresponding to the user consultation statement, a first preset number of target head entities can be determined in the intent knowledge graph according to the user consultation statement, the number of head entities, and head entities contained in the intent knowledge graph, that is, the number of head entities obtained in step S201. For example, all head entities contained in the intent knowledge graph can be sorted according to the relevance of each head entity contained in the intent knowledge graph to the user consultation statement, and a first preset number of target head entities can be determined in the intent knowledge graph according to the relevance from high to low. For how to determine a first preset number of target head entities in the intent knowledge graph according to the user consultation statement, the number of head entities, and head entities contained in the intent knowledge graph, reference can be made to subsequent embodiments, which will not be described here.

[0053] S203, determine an initial intent corresponding to the user consultation statement and a target non-head entity in the candidate path corresponding to the target head entity based on the user consultation statement.

[0054] In this step, after determining the first preset number of target head entities, an initial intent corresponding to the user consultation statement and a target non-head entity can be determined in the candidate path corresponding to the target head entity based on the user consultation statement. For example, synonym retrieval can be performed in each word contained in the candidate path corresponding to the target head entity according to each word contained in the user consultation statement, to determine an initial intent corresponding to the user consultation statement and a target non-head entity. For how to determine an initial intent corresponding to the user consultation statement and a target non-head entity in the candidate path corresponding to the target head entity based on the user consultation statement, reference can be made to subsequent embodiments, which will not be described here.

[0055] S204, determine a target path in the candidate path based on the target head entity, the initial intent, and the target non-head entity.

[0056] For example, after determining an initial intent corresponding to the user consultation statement and a target non-head entity, a target path can be determined in the candidate path based on the target head entity, the initial intent, and the target non-head entity. For how to determine a target path in the candidate path based on the target head entity, the initial intent, and the target non-head entity, reference can be made to subsequent embodiments, which will not be described here.

[0057] S205, obtain a target intent corresponding to the user consultation statement according to the target path.

[0058] In this step, after the target path is determined, the target intent corresponding to the user consultation statement can be obtained according to the target path. Further, optionally, according to the target path, the tail node corresponding to the target path in the intent knowledge graph can be determined; based on the attribute information of the tail node, the response information corresponding to the target intent can be obtained. After obtaining the response information corresponding to the target intent, the response information corresponding to the target intent can be fed back to the user, so as to facilitate the user to view the response information.

[0059] The intent recognition method provided in the embodiments of the present application can determine the number of head entities corresponding to the user consultation statement according to the user consultation statement, determine the problem type according to the number of head entities, determine a first preset number of target head entities in the intent knowledge graph according to the user consultation statement, the number of head entities and the head entities contained in the intent knowledge graph, the first preset number is the same as the number of head entities, the coverage of the head entity information extraction is large, the expansibility is high, and the target head entity can be obtained more accurately. Based on the user consultation statement, the initial intent and the target non-head entity corresponding to the user consultation statement are determined in the candidate path corresponding to the target head entity; based on the target head entity, the initial intent and the target non-head entity, the target path is determined in the candidate path. Since the initial intent and the target non-head entity outside the target head entity are fully considered when the target path is determined, instead of only determining the target path based on the target head entity, the target path can be more accurately determined; and the target intent corresponding to the user consultation statement is obtained according to the target path. The present application can more accurately understand the target intent corresponding to the user consultation statement, and then obtain the response information (i.e. the answer) corresponding to the user consultation statement with higher accuracy.

[0060] Figure 3 The flowchart of the intent recognition method provided in another embodiment of the present application. Based on the above-mentioned embodiments, the present embodiment further describes the intent recognition method. As shown in Figure 3 the method of the present embodiment can include:

[0061] S301, determining the number of head entities corresponding to the user consultation statement according to the user consultation statement.

[0062] The specific description of this step can be referred to the related description of S201 in the embodiment shown in Figure 2 herein.

[0063] In the present embodiment, Figure 2 the S202 step can further include the following three steps S302 to S304:

[0064] S302, the user consultation statement is spliced with each head entity contained in the intent knowledge graph to obtain a spliced text pair.

[0065] Exemplarily, assuming that the user consultation sentence is "X city household registration handling conditions", and the intent knowledge graph contains two head entities such as "household registration" and "ID card", the user consultation sentence is spliced with the two head entities "household registration" and "ID card" respectively to obtain two spliced text pairs such as [CLS] X city household registration handling conditions [SEP] household registration [SEP] and [CLS] X city household registration handling conditions [SEP] ID card [SEP]. Among them, the user consultation sentence and the head entity are separated by [SEP], and [CLS] is used to output the relevance of the user consultation sentence and the head entity. The relevance value is, for example, a value between 0 and 1.

[0066] S303, input each text pair into the relevance model to obtain a relevance score corresponding to each head entity.

[0067] The relevance model is, for example, a model trained by a point-wise method. For how to train the relevance model, reference can be made to subsequent embodiments, which will not be repeated here. In this step, multiple text pairs can be input into the relevance model, that is, the relevance of the user consultation sentence and each head entity contained in the intent knowledge graph is obtained, and a relevance score corresponding to each head entity is obtained.

[0068] S304, according to the relevance score, determining a first preset number of head entities in the intent knowledge graph as target head entities, the first preset number being the same as the number of head entities.

[0069] Among them, the target head entity is a head entity whose relevance score is greater than a first preset threshold.

[0070] In this step, for example, the first preset number of head entities from high to low according to the relevance score can be taken as the target head entity.

[0071] In the embodiments of the present application, Figure 2 The S203 step can further include the following four steps S305 to S308:

[0072] S305, according to the word frequency of the intent corresponding to the target head entity in the candidate path and the word frequency of the non-head entity in the candidate path, the intent in the candidate path and the non-head entity in the candidate path are sorted in descending order to obtain a first word table.

[0073] In this step, after obtaining the first preset number of target head entities, the candidate paths corresponding to each target head entity can be matched. For example, the target head entity is "household registration", and all candidate paths corresponding to the target head entity "household registration" are matched according to the target head entity "household registration", such as: "household registration -> X city -> transfer -> collective -> condition", "household registration -> X city -> move out -> Y city", "household registration -> X city -> move in -> Y city", and "household registration -> X city -> transfer -> individual -> condition". The intents and non-head entities other than the target head entity "household registration" in the above four candidate paths are inverted indexed, that is, all words such as "X city", "transfer", "move out", "move in", "condition", "Y city", and "collective" are sorted in descending order according to the corresponding word frequency (for example, the word frequency of "X city" in the four candidate paths is 4), and TF-IDF vectorization is performed, that is, converted into a word vector, to obtain a first word table. By sorting the intents and non-head entities in the candidate paths, the retrieval efficiency can be improved.

[0074] S306, performing word segmentation processing on the user inquiry sentence to obtain a second word table.

[0075] For example, the user inquiry sentence is subjected to N-Gram word segmentation processing, and TF-IDF vectorization is performed to obtain a second word table. Optionally, the words in the second word table can be preprocessed to remove irrelevant words to improve retrieval efficiency.

[0076] S307, performing synonym retrieval on each word in the second word table in the first word table to determine the target non-head entity corresponding to the user inquiry sentence, and determining whether the initial intent corresponding to the user inquiry sentence is retrieved.

[0077] For example, the cosine similarity between the word vector corresponding to each word in the second word table and the word vector corresponding to each word in the first word table is obtained, and the word vector corresponding to each word in the first word table is sorted (i.e., synonym retrieval) according to the cosine similarity to determine whether the initial intent corresponding to the user inquiry sentence is retrieved.

[0078] If the initial intent corresponding to the user inquiry sentence is retrieved, S308 is performed; if the initial intent corresponding to the user inquiry sentence is not retrieved, S309 is performed.

[0079] S308, determining the initial intent corresponding to the user inquiry sentence.

[0080] Exemplarily, assuming that the user consultation sentence is "household registration is transferred from X city to Y city", it can be determined through retrieval that the initial intent corresponding to the user consultation sentence is "transfer" and the target non-head entities are "X city" and "Y city". Therefore, it is not necessary to feed back the preset counter consultation sentence to the user, that is, it is not necessary to ask back.

[0081] S309, feeding back a preset counter consultation sentence to the user; obtaining a response sentence of the user for the preset counter consultation sentence; taking the response sentence as a new user consultation sentence, and if the initial intent corresponding to the user consultation sentence is not obtained according to the new user consultation sentence, executing the step of feeding back the preset counter consultation sentence to the user until the initial intent corresponding to the user consultation sentence is obtained. After the initial intent is obtained, the step S310 is executed.

[0082] The preset counter consultation sentence is used to confirm the initial intent of the user.

[0083] Exemplarily, assuming that the user consultation sentence is "household registration is transferred from X city to Y city", it can be determined through retrieval that the initial intent corresponding to the user consultation sentence is "transfer" and the target non-head entities are "X city" and "Y city". Therefore, it is not necessary to feed back the preset counter consultation sentence to the user, that is, it is not necessary to ask back.

[0084] In the embodiment of the application, Figure 2 The step S204 can further include two steps S310 and S311 as follows:

[0085] S310, for each candidate path, determining a probability value corresponding to the candidate path according to the target head entity, the initial intent, the number of nodes in the candidate path corresponding to the target non-head entity and the total number of nodes contained in the candidate path.

[0086] The probability value is used to indicate the possibility that the candidate path can represent the target intent.

[0087] S311, determining a second preset number of candidate paths as target paths in the candidate paths according to the probability values.

[0088] The target path is a candidate path in which the probability value is greater than a second preset threshold.

[0089] Exemplarily, for each candidate path, assuming that the number of nodes corresponding to the target head entity, the initial intention and the target non-head entity in the candidate path is n, and the total number of nodes contained in the candidate path is m, the probability value corresponding to the candidate path can be determined as n / m. Then, the first second preset number of candidate paths from high to low according to the probability value corresponding to each candidate path can be taken as the target path. It can be understood that in the calculation of the probability value corresponding to the candidate path, the target head entity, the initial intention (including the initial intention obtained after the counter-question) and the target non-head entity are comprehensively considered to obtain the probability value corresponding to the candidate path, and through the probability value corresponding to the candidate path, the target path can be more accurately obtained.

[0090] S312, obtaining the target intention corresponding to the user consultation statement according to the target path.

[0091] The specific description of this step can be referred to Figure 2 the related description of S205 in the embodiment shown, which will not be repeated here.

[0092] The intent recognition method provided by the embodiments of the present application comprises the following steps: determining the number of head entities corresponding to a user inquiry sentence according to the user inquiry sentence; splicing the user inquiry sentence and each head entity contained in an intent knowledge graph to obtain a spliced text pair; inputting each text pair into a relevance model to obtain a relevance score corresponding to each head entity; determining a first preset number of head entities as target head entities in the intent knowledge graph according to the relevance score, the first preset number being the same as the number of head entities, the head entity information extraction having a large coverage and high scalability, and the target head entities being able to be obtained more accurately. The intents in the candidate path and the non-head entities in the candidate path are sorted in reverse order according to the word frequency of the intents corresponding to the candidate path in the target head entities and the word frequency of the non-head entities corresponding to the candidate path in the target head entities, to obtain a first word table; performing word segmentation processing on the user inquiry sentence to obtain a second word table; performing synonym retrieval on each word in the second word table in the first word table to determine the target non-head entities corresponding to the user inquiry sentence, and judging whether the initial intent corresponding to the user inquiry sentence is retrieved, so that the user inquiry sentence can be fully utilized for semantic understanding by using the retrieval manner. If the initial intent corresponding to the user inquiry sentence is retrieved, the initial intent corresponding to the user inquiry sentence is determined; if the initial intent corresponding to the user inquiry sentence is not retrieved, a preset counter-inquiry sentence is fed back to the user, and a response sentence of the user to the preset counter-inquiry sentence is obtained; performing word segmentation processing on the response sentence to obtain a third word table; performing synonym retrieval on each word in the third word table in the first word table to determine whether the initial intent is obtained, and if the initial intent is not obtained, the step of feeding back the preset counter-inquiry sentence to the user is performed until the initial intent is obtained. The initial intent corresponding to the user inquiry sentence can be more accurately understood by using the counter-question manner. For each candidate path, the probability value corresponding to the candidate path is determined according to the number of nodes corresponding to the target head entity, the initial intent and the target non-head entity in the candidate path and the total number of nodes contained in the candidate path; the second preset number of candidate paths are determined as target paths in the candidate path according to the probability value; since the initial intent and the target non-head entity other than the target head entity are fully considered when the target path is determined, instead of determining the target path only based on the target head entity, the target path can be more accurately determined. The target intent corresponding to the user inquiry sentence is obtained according to the target path. The present application can more accurately understand the target intent corresponding to the user inquiry sentence, and thus the response information (i.e. the answer) corresponding to the user inquiry sentence with higher accuracy can be obtained.

[0093] On the basis of the above embodiment, the relevance model is obtained by the following manner: a plurality of training sample pairs are obtained, the training sample pairs include positive sample pairs and negative sample pairs, the positive sample pair is obtained by splicing a user inquiry sentence sample and a head entity sample related to the user inquiry sentence sample based on a preset text pair format, the negative sample pair is obtained by splicing a user inquiry sentence sample and a head entity sample unrelated to the user inquiry sentence sample based on the preset text pair format; the plurality of training sample pairs are input into an initial relevance model, a first relevance of the user inquiry sentence sample and the head entity sample in the positive sample pair and a second relevance of the user inquiry sentence sample and the head entity sample in the negative sample pair are obtained; the initial relevance model is iteratively trained based on the first relevance and the second relevance until a loss function value calculated satisfies a preset evaluation condition, and the relevance model is obtained.

[0094] Exemplarily, the initial relevance model is, for example, a Bidirectional Encoder Representations from Transformers (BERT) model. For example, the training sample pair is: [('[CLS]X city household registration handling conditions[SEP] household registration[SEP]', 0), ('[CLS]X city household registration handling conditions[SEP] ID card[SEP]', 1)], wherein, the "household registration" is a head entity sample inquired by the user, therefore, the "household registration" is spliced to the user inquiry sentence sample to construct a positive sample pair, on the contrary, the "ID card" is not a head entity sample inquired by the user, the "ID card" is spliced to the user inquiry sentence sample to construct a negative sample pair; the relevance of the user inquiry sentence sample and the head entity sample is output by [CLS]; 0 in the training sample pair represents the negative sample pair, the negative sample pair can be constructed by random sampling; 1 represents the positive sample pair. All the positive sample pairs and the negative sample pairs in the head entity range are constructed according to the above principle to form the training sample pair. The plurality of training sample pairs are input into the BERT model, the features of the user inquiry sentence sample and the corresponding head entity sample are extracted by using the self-attention mechanism of the BERT model, the first relevance of the user inquiry sentence sample and the head entity sample in the positive sample pair and the second relevance of the user inquiry sentence sample and the head entity sample in the negative sample pair are obtained. The initial relevance model is iteratively trained based on the first relevance and the second relevance until a loss function value calculated satisfies a preset evaluation condition, and the relevance model is obtained. For example, the loss function adopts cross entropy, and for example, the relevance sorting algorithm adopts a point wise method.

[0095] On the basis of the above-mentioned embodiments, the intent knowledge graph is obtained by the following manner: obtaining a corpus set; based on the corpus set, adopting a preset intent extraction method to extract the intent, entity and relationship of the entity corresponding to each corpus in the corpus set, the entity including a head entity; based on the intent, entity and relationship of the entity corresponding to each corpus, obtaining an intent path corresponding to each corpus; and based on the intent path, constructing the intent knowledge graph.

[0096] Exemplarily, the preset intent extraction method is, for example, a method such as clustering, template matching or keyword matching, which is not specifically limited in the present application. By collecting the corpus set, the intent, entity and relationship of the entity corresponding to each corpus in the corpus set are determined in the corpus contained in the corpus set by adopting the preset intent extraction method, wherein the entity includes a head entity, the intent boundary is defined, and the plurality of entities and the relationship of the entity contained under each intent are standardized. In the intent knowledge graph, the node (corresponding to the entity) is the same as that in the traditional knowledge graph, and the edge in the intent knowledge graph is used for the association between entities, indicating the attribute of the entity, the hierarchical ontology relationship between the entity and the concept or the action exerted by a certain entity. In the intent knowledge graph, the "hyperedge" is defined to express a set composed of entities, and the equivalence relationship between intents can be represented between intents. Specifically, the intent knowledge graph can be constructed by the following steps: (1) obtaining the entity, the relationship of the entity and the word group expressing the intent of the question sentence from the original question by information extraction; (2) based on the extracted information, performing entity linking operation on the extracted entity to link to the correct entity object in the knowledge base. Based on the above operation, the intent, entity and relationship of the entity extracted from a single question form an intent path, and based on different intent paths, the intent knowledge graph can be obtained. For example, the corpus is "X city household how to handle", which is converted into "household", "X city" and "handle" three entities as the node information in the intent knowledge graph in the intent knowledge graph, and the connected nodes are taken as the hyperedge "household -> X city -> handle" into the graph, and the intent corresponding to the hyperedge is "household handling".

[0097] Exemplarily, taking the corpus set for household relocation as an example, for the question sentence scenario of household relocation, the corpus set that can be collected at least includes the following corpus: B city household transfer conditions? B city household transfer procedures? B city relocation to C city procedures? B city relocation to A city conditions? A city relocation to B city conditions? B city transfer procedures? B city transfer materials? Figure 4 The schematic diagram for constructing the intent knowledge graph based on the corpus set provided by an embodiment of the present application is shown in Figure 4 As shown, the intent about "B city household" includes "relocation", "relocation", "handling", "transfer", "advantages and disadvantages" and "in-city relocation" in total six kinds, and each intent includes a plurality of intent paths. The intent knowledge graph can be constructed based on the intent path.

[0098] Based on the above obtaining manner of the intent knowledge graph, the intent recognition method provided in the embodiments of the present application can solve the problem that the intent knowledge graph cannot be fused in multi-round question answering of the knowledge graph. For traditional knowledge graph question answering, semantic analysis needs a large number of templates and rules, and after learning by combining a machine learning or deep learning model, a separate pipe line is finally obtained to obtain the analyzed intent. The intent recognition method provided in the embodiments of the present application does not need a large number of templates for semantic extraction. In the data analysis stage of user semantic analysis, according to the dimension of the intent, a plurality of semantic information contained under the intent is collected, converted into a plurality of nodes and placed in the intent knowledge graph. With continuous iteration of data, the intent knowledge graph will be continuously enriched and feed back to the semantic analysis part. The two parts interact deeply and complement each other.

[0099] On the basis of the above embodiments, Figure 5 The flowchart of the response method provided in an embodiment of the present application is applied to a robot customer service system. As shown in Figure 5 The method of the embodiment of the present application comprises:

[0100] S501, obtaining a target intent corresponding to a consultation sentence of a user in response to the consultation sentence input by the user.

[0101] The target intent is obtained based on the intent recognition method in any of the above method embodiments.

[0102] Exemplarily, referring to Figure 1 , after the user inputs the consultation sentence on the mobile phone 101, the mobile phone 101 sends the consultation sentence to the server 102 in response to the consultation sentence input by the user, and the server 102 obtains the target intent corresponding to the consultation sentence based on the intent recognition method in any of the above method embodiments, and sends the response information corresponding to the target intent to the mobile phone 101.

[0103] S502, feeding back the response information corresponding to the target intent to the user.

[0104] Exemplarily, referring to Figure 1 , after obtaining the response information corresponding to the target intent, the mobile phone 101 can feed back the response information corresponding to the target intent to the user, so as to facilitate the user to view the response information.

[0105] The response method provided in the embodiments of the present application obtains a target intent corresponding to a consultation sentence of a user in response to the consultation sentence input by the user; and feeds back the response information corresponding to the target intent to the user. Since the target intent is obtained based on the intent recognition method in any of the above method embodiments, the response information with higher accuracy can be fed back to the user.

[0106] The response method provided by the embodiments of the present application can be applied to the multi-entity and multi-intent scene of user inquiries in the knowledge graph question answering task, and the method can be applied to products in these scenes, such as a robot customer service work order system and a robot customer service dialogue system. Specifically, for the robot customer service work order system, the robot agent receives the consultation question issued by the user dialing the hotline, and in the real-time call process, the robot agent can determine the target intent of the user in real time through the present application, label the user intent for the work order in the work order system, and use it as a reference for subsequent processing of the user consultation question, thereby improving the efficiency of subsequent processing of the user consultation question. For the robot customer service dialogue system, the robot agent receives the consultation question issued by the user dialing the hotline, and in the real-time call process, the robot agent can identify the target intent of the user in real time through the present application, feed back more accurate response information to the user, improve the user experience, and improve the efficiency of processing the user consultation question.

[0107] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, please refer to the method embodiments of the present application.

[0108] Figure 6 The structural schematic diagram of the intent recognition apparatus provided by an embodiment of the present application is shown in FIG. 6, which includes a first determination module 601, a second determination module 602, a third determination module 603, a fourth determination module 604, and a first acquisition module 605. Figure 6

[0109] The first determination module 601 is configured to determine the number of head entities corresponding to the user consultation statement according to the user consultation statement.

[0110] The second determination module 602 is configured to determine a first preset number of target head entities in the intent knowledge graph according to the user consultation statement, the number of head entities, and the head entities contained in the intent knowledge graph, wherein the first preset number is the same as the number of head entities.

[0111] The third determination module 603 is configured to determine the initial intent and the target non-head entity corresponding to the user consultation statement in the candidate path corresponding to the target head entity based on the user consultation statement.

[0112] The fourth determination module 604 is configured to determine the target path in the candidate path based on the target head entity, the initial intent, and the target non-head entity.

[0113] The first acquisition module 605 is configured to obtain the target intent corresponding to the user consultation statement according to the target path.

[0114] ​In some embodiments, the second determining module 602 can be specifically configured to: splice the user consultation statement and each head entity contained in the intent knowledge graph to obtain a spliced text pair; input each text pair into a relevance model to obtain a relevance score corresponding to each head entity; and determine, according to the relevance score, a first preset number of head entities in the intent knowledge graph as target head entities, the target head entities being head entities with a relevance score greater than a first preset threshold.

[0115] Optionally, the intent recognition apparatus 600 further includes a second obtaining module 606 configured to obtain the relevance model by: obtaining a plurality of training sample pairs, the training sample pairs including positive sample pairs and negative sample pairs, the positive sample pairs being sample pairs obtained by splicing, based on a preset text pair format, a user consultation statement sample and a head entity sample related to the user consultation statement sample; the negative sample pairs being sample pairs obtained by splicing, based on the preset text pair format, a user consultation statement sample and a head entity sample unrelated to the user consultation statement sample; inputting the plurality of training sample pairs into an initial relevance model to obtain a first relevance of the user consultation statement sample and the head entity sample in the positive sample pairs and a second relevance of the user consultation statement sample and the head entity sample in the negative sample pairs; and iteratively training the initial relevance model based on the first relevance and the second relevance until a loss function value calculated satisfies a preset evaluation condition to obtain the relevance model.

[0116] In some embodiments, the third determining module 603 can be specifically configured to: according to a word frequency of the intent in the candidate path and a word frequency of the non-head entity in the candidate path, perform reverse order sorting on the intent in the candidate path and the non-head entity in the candidate path to obtain a first word table; perform word segmentation processing on the user consultation statement to obtain a second word table; and perform synonym retrieval on each word in the second word table in the first word table to determine an initial intent corresponding to the user consultation statement and a target non-head entity.

[0117] In some embodiments, the fourth determining module 604 can be specifically configured to: for each candidate path, according to a node number corresponding to the target head entity, the initial intent and the target non-head entity in the candidate path and a total number of nodes contained in the candidate path, determine a probability value corresponding to the candidate path, the probability value being used to indicate a possibility that the candidate path can represent the target intent; and according to the probability value, determine a second preset number of candidate paths in the candidate paths as target paths, the target paths being candidate paths with a probability value greater than a second preset threshold.

[0118] In some embodiments, the first determining module 601 can be specifically configured to: input the user consultation statement into a classification model to determine a number of head entities corresponding to the user consultation statement.

[0119] Optionally, the intent recognition device 600 further includes a third acquisition module 607, used to obtain an intent knowledge graph in the following ways: acquiring a corpus set; based on the corpus set, using a preset intent extraction method to extract the intent, entity, and entity relationship corresponding to each corpus in the corpus set, the entity including the head entity; based on the intent, entity, and entity relationship corresponding to each corpus set, acquiring the intent path corresponding to each corpus set; and based on the intent path, constructing an intent knowledge graph.

[0120] Optionally, the third determining module 603 can also be used to: if the initial intent corresponding to the user's inquiry statement is not obtained, then feed back a preset counter-inquiry statement to the user, the preset counter-inquiry statement being used to confirm the user's initial intent; obtain the user's response statement to the preset counter-inquiry statement; use the response statement as a new user inquiry statement, and if the initial intent corresponding to the user's inquiry statement is not obtained based on the new user inquiry statement, then execute the step of feeding back the preset counter-inquiry statement to the user until the initial intent corresponding to the user's inquiry statement is obtained.

[0121] The apparatus in this application embodiment can be used to perform any of the above method embodiments. Figure 2 or Figure 3 The implementation principle and technical effect of the intent recognition method shown are similar, and will not be described in detail here.

[0122] Figure 7 This is a schematic diagram of the structure of a response device provided in an embodiment of this application, as shown below. Figure 7 As shown, the response device 700 of this application embodiment includes: an acquisition module 701 and a feedback module 702. Wherein:

[0123] The acquisition module 701 is used to obtain the target intent corresponding to the inquiry statement in response to the user input. The target intent is obtained based on the intent recognition method in any of the above method embodiments.

[0124] Feedback module 702 is used to provide the user with the response information corresponding to the target intent.

[0125] The apparatus in this application embodiment can be used to perform any of the above method embodiments. Figure 5 The implementation principle and technical effect of the response method shown are similar, and will not be described in detail here.

[0126] Figure 8 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Exemplarily, the electronic device may be provided as a server or a computer. (Refer to...) Figure 8The electronic device 800 includes a processing component 801, which further includes one or more processors, and a memory resource represented by a memory 802 for storing instructions, such as an application program, executable by the processing component 801. The application program stored in the memory 802 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 801 is configured to execute the instructions to perform any of the above method embodiments.

[0127] The electronic device 800 can further include a power supply component 803 configured to perform power management of the electronic device 800, a wired or wireless network interface 804 configured to connect the electronic device 800 to a network, and an input / output (I / O) interface 805. The electronic device 800 can operate based on an operating system stored in the memory 802, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0128] The present application also provides a computer readable storage medium, in which computer executable instructions are stored, and when the processor executes the computer executable instructions, the scheme of the above intention recognition method and the scheme of the response method are implemented.

[0129] The present application also provides a computer program product, which includes a computer program, and when the processor executes the computer program, the scheme of the above intention recognition method and the scheme of the response method are implemented.

[0130] The above computer readable storage medium, the above readable storage medium can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0131] An exemplary readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium, and can write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the intention recognition device or the response device.

[0132] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes various storage media that can store program codes, such as ROM, RAM, magnetic disk or optical disk.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. An intention recognition method characterized by, The method comprises the following steps: According to the user inquiry statement, the number of head entities corresponding to the user inquiry statement is determined; According to the user inquiry statement, the number of head entities, and the head entities contained in the intent knowledge graph, a first preset number of target head entities in the intent knowledge graph are determined, and the first preset number is the same as the number of head entities; Based on the user inquiry statement, the initial intent and the target non-head entity corresponding to the user inquiry statement are determined in the candidate path corresponding to the target head entity; Based on the target head entity, the initial intent and the target non-head entity, a target path in the candidate path is determined; According to the target path, the target intent corresponding to the user inquiry statement is obtained.

2. The intention recognition method according to claim 1, characterized by, According to the user inquiry statement, the number of head entities corresponding to the user inquiry statement is determined; The user inquiry statement and each head entity contained in the intent knowledge graph are spliced to obtain a spliced text pair; Each text pair is input into a relevance model to obtain a relevance score corresponding to each head entity; According to the relevance score, the first preset number of head entities in the intent knowledge graph are determined as target head entities, and the target head entities are the head entities with a relevance score greater than a first preset threshold.

3. The intention recognition method according to claim 2, characterized by, The relevance model is obtained by the following method: Obtain a plurality of training sample pairs, the training sample pairs include positive sample pairs and negative sample pairs, the positive sample pairs are obtained by splicing a user inquiry statement sample and a head entity sample related to the user inquiry statement sample based on a preset text pair format; The negative sample pairs are obtained by splicing the user inquiry statement sample and a head entity sample unrelated to the user inquiry statement sample based on the preset text pair format; The plurality of training sample pairs are input into an initial relevance model to obtain a first relevance of the user inquiry statement sample and the head entity sample in the positive sample pair, and a second relevance of the user inquiry statement sample and the head entity sample in the negative sample pair; Based on the first relevance and the second relevance, the initial relevance model is iteratively trained until the calculated loss function value meets the preset evaluation condition, and the relevance model is obtained.

4. The intention recognition method according to claim 1, characterized by, Based on the user inquiry statement, the initial intent and the target non-head entity corresponding to the user inquiry statement are determined in the candidate path corresponding to the target head entity, comprising: According to the word frequency of the intent in the candidate path and the word frequency of the non-head entity in the candidate path, the intent in the candidate path and the non-head entity in the candidate path are sorted in reverse order to obtain a first word table; The user inquiry statement is segmented to obtain a second word table; Each word in the second word table is searched for synonyms in the first word table to determine the initial intent and the target non-head entity corresponding to the user inquiry statement.

5. The intention recognition method according to claim 1, wherein Based on the target head entity, the initial intent and the target non-head entity, a target path in the candidate path is determined, comprising: For each of the candidate paths, a probability value corresponding to the candidate path is determined according to the target head entity, the initial intent, and the number of nodes in the candidate path corresponding to the target non-head entity and the total number of nodes contained in the candidate path, the probability value being used to indicate the possibility that the candidate path can represent the target intent; According to the probability value, a second preset number of candidate paths in the candidate paths are determined as the target paths, the target paths being the candidate paths with probability values greater than a second preset threshold in the candidate paths.

6. The intention recognition method according to any one of claims 1 to 5, characterized by, The determining of the number of head entities corresponding to the user consultation statement according to the user consultation statement comprises: inputting the user consultation statement into a classification model to determine the number of head entities corresponding to the user consultation statement.

7. The intention recognition method according to any one of claims 1 to 5, characterized by, The intent knowledge graph is obtained by the following manner: obtaining a corpus set; based on the corpus set, using a preset intent extraction method to extract the intent, entity and relationship of the entity corresponding to each corpus in the corpus set, the entity including a head entity; based on the intent, entity and relationship of the entity corresponding to each corpus, obtaining an intent path corresponding to each corpus; based on the intent path, constructing the intent knowledge graph.

8. The intention recognition method according to any one of claims 1 to 5, characterized by, Further comprising: if the initial intent corresponding to the user consultation statement is not obtained, feeding back a preset counter consultation statement to the user, the preset counter consultation statement being used to confirm the initial intent of the user; obtaining a response statement of the user to the preset counter consultation statement; taking the response statement as a new user consultation statement, if the initial intent corresponding to the user consultation statement is not obtained according to the new user consultation statement, executing the step of feeding back the preset counter consultation statement to the user until the initial intent corresponding to the user consultation statement is obtained.

9. A response method applied to a robot customer service system, characterized in that, Comprise: in response to a user input consultation statement, obtaining a target intent corresponding to the consultation statement, the target intent being obtained based on the intent recognition method in any one of claims 1 to 8; feeding back response information corresponding to the target intent to the user.

10. An electronic device, comprising: Comprise: a processor, and a memory connected in communication with the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to realize the intent recognition method in any one of claims 1 to 8 or the response method in claim 9.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to realize the intent recognition method in any one of claims 1 to 8 or the response method in claim 9.

Citation Information

Patent Citations

  • Automatic question and answer method, device and equipment based on knowledge graph, and storage medium

    CN111949787A

  • Medical intelligent question and answer processing method and system based on knowledge graph reasoning

    CN112650840A