Automatic reply method, device and storage medium based on tree structure knowledge base
Through the automatic reply method based on the tree structure knowledge base, the problems of inaccurate answers and high resource consumption of interactive response robots are solved, accurate processing of complex and fuzzy user intentions is achieved, and the accuracy and user experience of the dialogue system are improved. .
Patent Information
- Application Number
- CN202411010080.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Existing interactive response robots provide inaccurate answers when dealing with complex or vaguely expressed user questions, resulting in reduced user experience. Large-model dialogue systems also consume high resources and have low accuracy, especially in vertical industries where the accuracy of answers is critical. It is highly demanding and difficult to identify and handle users’ multiple intentions and implicit intentions.
Using an automatic reply method based on a tree-structured knowledge base, it obtains user consultation requests, determines the current node according to the knowledge base category and label, parses the consultation content, matches sub-nodes or knowledge point nodes, generates feedback information, and outputs guidance if it cannot be matched. For words or prompt information, text features are extracted through natural language processing and deep learning models, and the intent distribution is adjusted to improve matching accuracy.
It reduces the computing resource consumption of the dialogue system, improves the accuracy and user experience of the dialogue system, can handle complex and ambiguous user intentions more effectively, and improves the stability and response quality of the dialogue system.
Smart Images

Figure CN118535715B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of knowledge bases, and in particular to an automatic reply method, device and storage medium based on a tree-structured knowledge base. Background Art
[0002] With the continuous advancement of artificial intelligence technology, intelligent dialogue systems have been widely used in many fields, especially multi-round dialogue systems, which have become an important form of human-computer interaction. However, when responding to user questions, existing interactive answering robots usually use a simple question-answer matching method, which often leads to inaccurate answers when dealing with complex or ambiguous expressions, thereby reducing user experience.
[0003] At the same time, although large model technology has promoted the development of multi-round dialogue systems, it still faces many challenges. On the one hand, large models require a lot of computing resources. On the other hand, although large models have achieved remarkable results in processing natural language, there is still room for improvement in ensuring the accuracy of answers, especially in vertical industries, which have extremely high requirements for the accuracy of answers. In addition, existing systems also have certain difficulties in identifying and processing users' multiple intentions and implicit intentions.
[0004] Therefore, how to reduce the computing resource consumption of the dialogue system and improve the accuracy of the dialogue system is an urgent problem that needs to be solved. Summary of the invention
[0005] The present invention provides an automatic reply method, device and storage medium based on a tree structure knowledge base, which are used to solve the problems of high computing resource consumption and low accuracy of a dialogue system.
[0006] In a first aspect, the present invention provides an automatic reply method for a tree structure knowledge base, comprising:
[0007] Acquire a first consultation request of a user, wherein the first consultation request includes a first consultation content, a knowledge base category, and a knowledge base tag under the knowledge base category;
[0008] Determine a current node in the knowledge base according to the knowledge base category and the knowledge base label;
[0009] Parsing the first consulting content under the current node, determining a first child node matching the first consulting content, the first child node being a child node of the current node;
[0010] If the first child node is a first guiding node, the first consulting content is parsed under the first guiding node to determine a knowledge point node matching the first consulting content, the knowledge point node including reply content matching the first consulting content, and the knowledge point node being a child node of the first guiding node;
[0011] If the first subnode is a first knowledge point node, determining that the first knowledge point node is a knowledge point node that matches the first consulting content;
[0012] generating feedback information of the first consultation request according to the reply content in the knowledge point node matching the first consultation content;
[0013] Outputting feedback information of the first consultation request.
[0014] Optionally, the parsing the first consulting content under the first guiding node to determine a knowledge point node matching the first consulting content includes:
[0015] Determining, according to the structure of the knowledge base, whether there are other guiding nodes in the child nodes of the first guiding node;
[0016] If the other guiding nodes exist in the child nodes of the first guiding node, the current node is modified to be the first guiding node, and the first consulting content is parsed under the current node to determine a second child node matching the first consulting content, where the second child node is a child node of the first guiding node;
[0017] If the second sub-node is a knowledge point node, determining the second sub-node as a knowledge point node matching the first consulting content;
[0018] If the second sub-node is a guide node, the current node is modified to be the second sub-node, and a knowledge point node matching the first consulting content is determined in the knowledge point sub-nodes under the second sub-node.
[0019] Optionally, the method further includes:
[0020] If the first consulting content is parsed under the current node and a knowledge point node matching the first consulting content cannot be determined, then a guiding speech corresponding to the current node is output, and the guiding speech is used to guide the user to input a second consulting request, and the second consulting request includes a second consulting content;
[0021] receiving the second consultation request;
[0022] Parsing the second consulting content under the current node to determine a knowledge point node matching the second consulting content, wherein the knowledge point node matching the second consulting content includes a reply content matching the second consulting content;
[0023] generating feedback information of the second consultation request according to the reply content in the knowledge point node matching the second consultation content;
[0024] Output feedback information of the second consultation request.
[0025] Optionally, the method further includes:
[0026] If the second consulting content is parsed under the current node and a knowledge point node matching the second consulting content cannot be determined, modifying the current node to be the root node of the knowledge base;
[0027] Parsing the second consulting content under the root node to determine a knowledge point node matching the second consulting content;
[0028] If the second consulting content is parsed under the root node and a knowledge point node matching the second consulting content cannot be determined, a prompt message is output, where the prompt message is used to prompt the user to re-enter the consulting request.
[0029] Optionally, the analyzing the first consultation content includes:
[0030] Processing the first consultation content through a natural language processing model to obtain a word segmentation result of the first consultation content and a text feature vector corresponding to the word segmentation result;
[0031] According to the text feature vector, deep features of the text feature vector are obtained, wherein the deep features include semantic features, context features, emotional features, and topic features;
[0032] Converting the deep features into a probability distribution of intent distribution through a Softmax function, wherein the probability distribution reflects the possibility that the first consultation content corresponds to each intent category;
[0033] Determining, according to the probability distribution of the intention distribution, an intention classification result corresponding to the first consultation content;
[0034] Acquire the consulting intent of the first consulting content according to the intention classification result;
[0035] According to the consultation intention, a subnode matching the first consultation content or a knowledge point node matching the first consultation content is determined.
[0036] Optionally, obtaining the deep features of the text feature vector according to the text feature vector includes:
[0037] Extracting the semantic feature from the text feature vector through a deep learning model;
[0038] Processing the semantic features through a self-attention mechanism to capture the contextual dependency between the semantic features and the contextual features, and generating the contextual features;
[0039] Inputting the text feature vector into a trained sentiment analysis model to obtain the sentiment feature;
[0040] Processing the text feature vectors using a topic analysis model to generate a potential topic distribution for each text feature vector;
[0041] Determining the topic feature of the first consultation request according to the potential topic distribution;
[0042] The semantic features, the context features, the sentiment features, and the topic features are integrated to generate deep features of the text feature vector.
[0043] Optionally, after converting the deep features into a probability distribution of intent distribution by using a Softmax function, the method further includes:
[0044] According to a preset probability threshold, removing the intent categories in the intent distribution that are lower than or equal to the preset probability threshold, and generating a filtered intent distribution, wherein the preset probability threshold is determined according to the business requirements and / or historical data of the knowledge base;
[0045] Mining the user's historical behavior data to determine the user's behavior pattern, the historical behavior data including the user's historical consultation records, and the behavior pattern including the user's consultation preferences, consultation habits, and types of frequently asked consultation questions;
[0046] Determining weight data of each of the intent categories in the filtered intent distribution according to the user's behavior pattern;
[0047] Performing a fusion calculation based on the weight data and the original probability of each of the intent categories, adjusting the probability distribution of each of the intent categories in the intent distribution, so as to increase the probability of the intent category frequently selected in the historical behavior data;
[0048] The intent distribution is updated according to the adjusted probability of each of the intent categories.
[0049] Optionally, mining the historical behavior data of the user to determine the behavior pattern of the user includes:
[0050] Obtaining the user's historical behavior data and the timestamp of the historical behavior data, wherein the historical behavior data includes historical click data, historical browsing data, and historical consultation data;
[0051] Determine a plurality of historical behavior data time windows according to a preset window length and a timestamp of the historical behavior data, wherein the historical behavior data time window includes one or more sub-historical behavior data;
[0052] Extracting sub-historical behavior features of each of the historical behavior data time windows according to the sub-historical behavior data in each of the historical behavior data time windows, wherein the sub-historical behavior features include click preference features corresponding to the historical click data, browsing preference features corresponding to the historical browsing data, and consulting preference features corresponding to the historical consulting data;
[0053] configuring an attenuation factor of each of the historical behavior data time windows, wherein the attenuation factor is used to adjust the influence of each of the sub-historical behavior data on generating the behavior pattern of the user;
[0054] Determine the historical behavior characteristics of the user according to each of the sub-historical behavior characteristics and the attenuation factor of the historical behavior data time window corresponding to each of the sub-historical behavior characteristics;
[0055] The behavior pattern of the user is determined according to the historical behavior characteristics of the user.
[0056] The extracting of sub-historical behavior features of each of the historical behavior data time windows according to the sub-historical behavior data in each of the historical behavior data time windows includes:
[0057] According to the historical behavior data time window, obtaining the historical behavior network of the user in the historical behavior data time window, and the historical behavior networks of other users, wherein the historical behavior network is generated according to the historical click data, the historical browsing data, and the historical consultation data of the user;
[0058] Based on the historical behavior network of the user and the historical behavior networks of the other users, determine, by correlation analysis, a historical behavior network of a first user whose correlation with the historical behavior network of the user is greater than or equal to a preset correlation threshold;
[0059] According to the historical click data, historical browsing data, and historical consultation data of the first user in the historical behavior network of the first user, the historical click data, the historical browsing data, and the historical consultation data of the user in the historical behavior network of the user are adjusted to generate a target processing result.
[0060] In a second aspect, the present invention provides an electronic device, comprising: a processor, a communication interface and a memory, wherein the processor is communicatively connected to the communication interface and the memory respectively;
[0061] The memory stores computer-executable instructions;
[0062] The communication interface communicates and interacts with external devices;
[0063] The processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of the first aspects.
[0064] In a third aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.
[0065] In a fourth aspect, the present invention provides a computer program product, comprising a computer program, which implements any one of the methods in the first aspect when executed by a processor.
[0066] The automatic reply method, device and storage medium based on the tree-structured knowledge base provided by the present invention obtain the user's first consultation request and determine the current node in the knowledge base according to the knowledge base category and the knowledge base label. The first consultation content is parsed under the current node to determine the first child node matching the first consultation content. If the first child node is the first guide node, the first consultation content is parsed under the first guide node to determine the knowledge point node matching the first consultation content. The knowledge point node includes the reply content matching the first consultation content, and the knowledge point node is a child node of the guide node. If the first child node is the first knowledge point node, the first knowledge point node is determined to be the knowledge point node matching the first consultation content. Feedback information of the first consultation request is generated based on the reply content in the knowledge point node matching the first consultation content and the feedback information is output, thereby reducing the computing power resource consumption of the dialogue system through the preset knowledge base and improving the accuracy of the dialogue system. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0068] Figure 1 A schematic diagram of a process flow of an automatic reply method based on a tree-structured knowledge base provided by an embodiment of the present invention;
[0069] Figure 2 A schematic diagram of a flow chart of another automatic reply method based on a tree-structured knowledge base provided by an embodiment of the present invention;
[0070] Figure 3 A flowchart of another automatic reply method based on a tree-structured knowledge base provided by an embodiment of the present invention;
[0071] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0072] The above drawings have shown clear embodiments of the present invention, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0073] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0074] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below in conjunction with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0075] Figure 1 The following is a flow chart of an automatic reply method based on a tree structure knowledge base provided by an embodiment of the present invention. Figure 1 As shown, the method may include:
[0076] S101. Obtain a user's first consultation request.
[0077] Among them, the first consultation request includes the first consultation content, the knowledge base category, and the knowledge base tag under the knowledge base category. The knowledge base categories and knowledge base tags in the knowledge base can be manually added by the enterprise knowledge base maintenance personnel. For example, for home appliance companies, the knowledge base categories may include "TV", "Refrigerator", etc., and the "TV" knowledge base category has "Pre-sales", "Sales" and "After-sales". Through the classification and label content, users can better and faster retrieve the corresponding answers according to the corresponding classification and tags on the page, and it is conducive to the subsequent use of interactive question-and-answer robots to retrieve the corresponding answers.
[0078] The server is configured with an interface for receiving user consultation requests, which can be an entry point for submitting consultation requests through the Web, mobile APP, mini-program, or other forms of client. When users have consultation needs, they can enter the consultation content through these interfaces and select the relevant knowledge base category and knowledge base tag. The server captures the consultation requests sent by users in real time by monitoring these interfaces.
[0079] S102: Determine a current node in the knowledge base according to the knowledge base category and the knowledge base label.
[0080] The server maintains a tree-structured knowledge base, which is carefully classified according to different categories and tags. When the server receives a consultation request, it will locate the corresponding node in the knowledge base according to the knowledge base category and tag in the request. This node is the basis for subsequent analysis of the consultation content and matching of knowledge points.
[0081] S103: Parse the first consulting content under the current node, and determine a first subnode matching the first consulting content.
[0082] The first child node is a child node of the current node.
[0083] The server will perform an in-depth analysis of the first consultation content at the current node. For example, natural language processing (NLP) technology, such as word segmentation and semantic analysis, can be used to analyze the true intention of the consultation content. By comparing the sub-nodes under the current node, the server will find a sub-node that best matches the consultation content. This sub-node may be a guide node or a knowledge point node.
[0084] S104: If the first sub-node is a first guiding node, the first consulting content is parsed under the first guiding node to determine a knowledge point node matching the first consulting content.
[0085] The knowledge point node includes reply content matching the first consultation content, and the knowledge point node is a child node of the first guide node.
[0086] If the server determines that the first child node is a guide node, it will continue to parse the consultation content under the guide node to find a more specific knowledge point node. The guide node usually contains a series of questions or options to further refine the user's consultation needs. The server will match the user's consultation content with the questions or options under the guide node to find the final knowledge point node.
[0087] S105. If the first sub-node is a first knowledge point node, determine that the first knowledge point node is a knowledge point node that matches the first consulting content.
[0088] If the server directly finds a knowledge point node after parsing the consultation content, and this node is highly matched with the consultation content, then it will determine this knowledge point node as a knowledge point node that matches the consultation content. This means that users can directly obtain the information or answers they want from this node.
[0089] S106: Generate feedback information of the first consultation request according to the reply content in the knowledge point node matching the first consultation content.
[0090] After determining the knowledge point node that matches the consultation content, the server can extract the relevant reply content from this node. These reply contents may be pre-set standard answers, solutions, operation steps, etc. The server will generate feedback information for the user's consultation request based on these reply contents.
[0091] S107: Output feedback information of the first consultation request.
[0092] The server can send the generated feedback information back to the user through the interface through which the user previously submitted the consultation request.
[0093] The method provided by the embodiment of the present invention obtains the user's first consultation request and determines the current node in the knowledge base according to the knowledge base category and the knowledge base label. The first consultation content is parsed under the current node to determine the first child node that matches the first consultation content. If the first child node is the first guide node, the first consultation content is parsed under the first guide node to determine the knowledge point node that matches the first consultation content. The knowledge point node includes the reply content that matches the first consultation content, and the knowledge point node is a child node of the guide node. If the first child node is the first knowledge point node, the first knowledge point node is determined to be the knowledge point node that matches the first consultation content. Feedback information of the first consultation request is generated based on the reply content in the knowledge point node that matches the first consultation content and the feedback information is output, thereby reducing the computing power resource consumption of the dialogue system through the preset knowledge base and improving the accuracy of the dialogue system.
[0094] In a possible implementation, the aforementioned step S104 may be implemented by the following steps:
[0095] S1041. Determine whether there are other guiding nodes in the child nodes of the first guiding node according to the structure of the knowledge base.
[0096] The server loads and parses the structure of the knowledge base, for example, it can read tree structure data stored in a database or a specific file format (such as XML, JSON, etc.). After the structure of the knowledge base is loaded and parsed, the server can traverse the tree structure of the knowledge base, find the specified first leading node, and check the type of its direct child nodes.
[0097] During the inspection process, the server needs to distinguish between guide nodes and knowledge point nodes. Guide nodes are usually used for classification or navigation, while knowledge point nodes contain specific information content. The server will check the metadata or tags of each child node to determine whether it is a guide node or a knowledge point node.
[0098] S1042. If there are other guiding nodes in the child nodes of the first guiding node, modify the current node to the first guiding node, and parse the first consulting content under the current node to determine a second child node matching the first consulting content.
[0099] The second sub-node is a sub-node of the first guiding node.
[0100] If there are other guiding nodes in the child nodes of the first guiding node, it may be necessary to further enter the next layer of guiding nodes of the first guiding node to match the knowledge point nodes. Therefore, the currently processed node can be updated to the first guiding node, and the next layer of matching can be performed in the child nodes of the updated first guiding node.
[0101] Among them, the server can use keyword matching, semantic analysis or natural language processing technology to parse the consultation content and select the most matching one from the child nodes of the current node.
[0102] Optionally, when selecting the second child node, the server may also consider the node weight, historical query records, and other relevant factors to improve the accuracy and efficiency of the matching.
[0103] S1043. If the second sub-node is a guide node, modify the current node to the second sub-node, and determine a knowledge point node matching the first consulting content in the knowledge point sub-nodes under the second sub-node.
[0104] Each layer of nodes in the tree structure of the knowledge base is matched cyclically until a knowledge point node in the tree structure of the knowledge base is matched to obtain feedback information corresponding to the first consultation content.
[0105] For example, the child node of the first guiding node that matches the first consulting content is node A, the node on the same layer of node A is a guiding node, and node A is also a guiding node. Therefore, matching can be further continued in the child nodes of node A until a knowledge point node in at least one layer below node A is matched, and feedback information on the match of the first consulting content is obtained from the knowledge point node.
[0106] S1044: If the second sub-node is a knowledge point node, determine the second sub-node as a knowledge point node that matches the first consulting content.
[0107] In a possible implementation, the method further includes:
[0108] S1045. If the first consulting content is parsed under the current node and a knowledge point node matching the first consulting content cannot be determined, output the guiding words corresponding to the current node.
[0109] The guiding words are used to guide the user to input a second consultation request, and the second consultation request includes a second consultation content.
[0110] When the server cannot determine a matching knowledge point node under the current node, it retrieves the guidance words associated with the node. These guidance words may be stored in the structure of the knowledge base, corresponding to each guidance node. The server selects appropriate guidance words to ensure that it can guide users in the right direction to provide additional information or refine their queries.
[0111] For example, a user asks "I want to buy clothes" in the customer service system of an e-commerce platform, but this inquiry content cannot be directly matched to a specific knowledge point node under the current node "product category". The server will output a guiding phrase: "Excuse me, do you want to buy men's clothing, women's clothing or children's clothing?" Such guiding phrases can help users further clarify their needs, so that the server can provide users with the information they need more accurately.
[0112] S1046: Receive the second consultation request.
[0113] The server receives the second consultation request sent by the user through the network interface. Continuing with the example in step S1034, after receiving the guidance dialogue, the user may enter "I want to buy women's clothing" as the second consultation request. After receiving this request, the server will prepare to further process this consultation under the subnode "women's clothing" of the "product category" node.
[0114] S1047: parse the second consulting content under the current node, and determine a knowledge point node matching the second consulting content.
[0115] Among them, the knowledge point node includes reply content matching the second consultation content.
[0116] The server parses the second consulting content by using a method similar to step S1032 and attempts to find a matching knowledge point node in the child nodes of the current node, which will not be repeated here.
[0117] S1048: Generate feedback information of the second consultation request according to the reply content in the knowledge point node matching the second consultation content.
[0118] If the server determines the matching knowledge point node this time, the server can extract the reply content from the knowledge point node and generate feedback information suitable for sending to the user.
[0119] S1049: Output feedback information of the second consultation request.
[0120] The method provided by the embodiment of the present invention determines whether there are other guiding nodes in the child nodes of the first guiding node according to the structure of the knowledge base. If there are other guiding nodes in the child nodes of the first guiding node, the current node is modified to the first guiding node, and the first consulting content is parsed under the current node to determine the second child node matching the first consulting content. The above steps are executed repeatedly until the current node is the second knowledge point node, and the second knowledge point node is determined to be the knowledge point node matching the first consulting content. If the first consulting content is parsed under the current node and the knowledge point node matching the first consulting content cannot be determined, the guiding speech corresponding to the current node is output, and the second consulting request is received. The second consulting content is parsed under the current node, the knowledge point node matching the second consulting content is determined, and the feedback information of the second consulting request is generated according to the reply content in the knowledge point node matching the second consulting content. This method can quickly obtain the feedback information corresponding to the consulting content by searching the multi-layer matching of the tree structure in the knowledge base, and guide the user to re-describe the consulting content through the guiding speech when the matching fails, so as to improve the success rate of generating feedback information and improve the stability of the dialogue system.
[0121] Optionally, the method may further include:
[0122] If the second consulting content is parsed under the current node and the knowledge point node matching the second consulting content cannot be determined, the current node is modified to the root node of the knowledge base. When the server cannot determine the knowledge point node matching the second consulting content under the current node, it resets the current processing node to the root node of the knowledge base. The root node of the knowledge base is the starting point of the entire knowledge structure and contains all possible knowledge point branches. By returning to the root node, the server can restart the matching process to try to find knowledge points that match the user's consulting content in different knowledge branches. In this process, the server will abandon the previous matching attempt under the current node and reset the matching context. After the reset, the server will be ready to make new matching attempts within a wider range of knowledge, which helps to improve the flexibility and accuracy of matching. For example, suppose a user consults a question about software installation in a technical support system, and the question cannot find a matching knowledge point under the current node "Software Update". At this time, the server will modify the current node to the root node "Technical Support" of the knowledge base. Under the root node, the server can access all possible technical support topics, including "software installation", "troubleshooting", "system requirements", etc., so that there are more opportunities to find knowledge points that match the user's consultation content.
[0123] Parse the second consulting content under the root node, determine the knowledge point node that matches the second consulting content, and the knowledge point node includes the reply content that matches the second consulting content. After modifying the current node to the root node of the knowledge base, the server will try to parse the second consulting content again to determine the matching knowledge point node in a broader knowledge structure. If the corresponding knowledge point node is matched, the server can extract the reply content related to the user's consulting content and prepare to provide feedback to the user. Continuing with the above example, when the server returns to the "Technical Support" root node, it will re-analyze the user's consulting content and try to find matching knowledge points in all technical support topics. If the user's consultation is about software installation, the server may find specific installation steps, FAQs and other knowledge points under the "Software Installation" branch, and integrate this information into reply content.
[0124] If the second consulting content is parsed under the root node and the knowledge point node matching the second consulting content cannot be determined, a prompt message is output, and the prompt message is used to prompt the user to re-enter the consulting request. If the knowledge point node matching the second consulting content still cannot be determined under the root node, the server will determine that it cannot provide a valid response to the user. In this case, the server will output a prompt message to inform the user that the current system cannot recognize or understand their consulting content, and suggest that they re-enter the consulting request. For example, if the user enters a very vague or professional technical consultation, and the consulting content has no corresponding knowledge point in the knowledge base, the server will output a prompt message after multiple failed attempts to match, such as: "I'm sorry, I can't understand your question. Please try to ask the question again using more specific descriptions or keywords." Such prompt messages are intended to guide users to provide clearer and easier-to-understand consulting requests, thereby improving the accuracy and effectiveness of system responses.
[0125] Next, how to parse the first consultation content in the aforementioned steps is described in detail. It should be understood that how to parse the second consultation content can also refer to the method for parsing the first consultation content. Figure 2 A flowchart of another automatic reply method based on a tree structure knowledge base provided by an embodiment of the present invention. Figure 2 As shown, the method may include:
[0126] S201. Process the first consulting content through a natural language processing model to obtain a word segmentation result of the first consulting content and a text feature vector corresponding to the word segmentation result.
[0127] The server can use the natural language processing model to process the first consultation content input by the user. First, the model will segment the first consultation content and divide the continuous text into independent words or phrases, which is helpful for subsequent feature extraction and understanding. During the segmentation process, the model will accurately segment according to the grammatical rules and vocabulary of the language.
[0128] After word segmentation, the model will further generate corresponding text feature vectors for each word or phrase. These feature vectors are mathematical representations of words or phrases, which can capture the semantic information of the text, so that similar words or phrases have similar representations in the vector space. Usually, these feature vectors are pre-trained through word embedding technology (such as Word2Vec, GloVe, etc.), which can map words to a point in high-dimensional space, thereby preserving the semantic relationship between words.
[0129] For example, if the user enters the first query content "I want to check tomorrow's weather conditions", the server first uses the natural language processing model to segment the words, and the result may be "I / want / to / check / tomorrow's / weather / conditions". Then, the model will generate corresponding text feature vectors for these segmented words. For example, the word "weather" may be mapped to a vector representing weather-related concepts, while "query" may be mapped to a vector representing an action or intention.
[0130] S202: Obtain deep features of the text feature vector according to the text feature vector.
[0131] Among them, the deep features include semantic features, contextual features, emotional features, and topic features.
[0132] The server can extract deep features based on the text feature vector obtained in the previous step. These deep features include semantic features (reflecting the meaning and context of the text), context features (reflecting the environment and background of the text), sentiment features (reflecting the sentiment expressed by the text), and topic features (reflecting the central idea and main content of the text). In order to obtain these features, the server can learn the complex patterns and relationships in the text by using deep learning models such as recurrent neural networks (RNN) or convolutional neural networks (CNN).
[0133] Specifically, this step can be implemented through the following sub-steps:
[0134] S2021. Extracting the semantic features from the text feature vector through a deep learning model.
[0135] The server can use deep learning models to extract semantic features from text feature vectors. Deep learning models, such as long short-term memory networks (LSTM) or Transformer models, can understand and capture deep semantic information in text. These models learn the complex relationships between words and phrases through a large amount of training data, so that they can extract semantic features of text.
[0136] In the process of extracting semantic features, the model analyzes the word order, syntactic structure, and word meaning in the text to understand the overall meaning of the text and the relationship between its parts. In this way, the model can capture the core meaning of the text, namely the semantic features, and provide key information for subsequent natural language processing tasks.
[0137] S2022. Process the semantic features through a self-attention mechanism to capture the contextual dependencies between the semantic features and the contextual features, and generate the contextual features.
[0138] The server can process semantic features using the self-attention mechanism to capture the contextual dependencies between semantic features and contextual features, thereby generating contextual features. The self-attention mechanism enables the model to focus on different parts when processing text and understand the relationship between them. In this way, the model can capture the contextual information in the text, that is, how the various parts of the text are related and influence each other.
[0139] S2023. Input the text feature vector into a trained sentiment analysis model to obtain the sentiment feature.
[0140] The server can input the text feature vector into the trained sentiment analysis model to obtain sentiment features. Sentiment analysis models can understand and identify the sentiment tendency in the text, such as positive, negative, or neutral. These sentiment features are very important for understanding the user's attitude and emotions, and can help the server respond to the user's needs more accurately.
[0141] S2024. Process the text feature vectors using a topic analysis model to generate a potential topic distribution for each text feature vector.
[0142] The server may process the text feature vectors using a topic analysis model to generate a latent topic distribution for each text feature vector. The topic analysis model is capable of identifying the main topics or themes in the text and understanding the relationships between them.
[0143] S2025. Determine the topic characteristics of the first consultation request based on the potential topic distribution.
[0144] The latent topic distribution can be a probability vector, in which each element represents the probability that the consultation text belongs to a specific topic. For example, if a first consultation request involves three possible topics: technical issues, service consultation, and product purchase, then the latent topic distribution may be a probability vector similar to [0.6, 0.2, 0.2], indicating that the consultation is most likely to belong to the topic of "technical issues".
[0145] The server analyzes this potential topic distribution and finds the topic with the highest probability. This can be achieved, for example, by comparing the values of each element in the probability vector. In the above example, the topic "Technical Issue" has the highest probability (0.6), so it is considered the topic of the consultation request.
[0146] After determining the most likely topic, the server can further extract features related to the topic. These features may include keywords, phrases, or concepts that are closely related to the topic. For example, for the topic of "technical issues", relevant features may include words such as "failure", "settings", and "update".
[0147] Optionally, in order to more accurately determine the topic features, the server can also use pre-defined topic dictionaries or knowledge bases. These resources contain common words and expressions under various topics, which can help the server more accurately identify and extract features related to a specific topic.
[0148] S2026: Integrate the semantic features, the context features, the sentiment features, and the topic features to generate deep features of the text feature vector.
[0149] The server will fuse semantic features, context features, sentiment features, and topic features to generate deep features of the text feature vector. This deep feature is a rich representation that integrates multiple aspects of the text and can more comprehensively reflect the meaning and connotation of the text. By fusing these features, the server can more accurately understand the user's needs and provide more precise responses.
[0150] For example, the server first normalizes the extracted features to ensure that they are in the same numerical range for effective fusion. Normalization can be performed by methods such as maximum and minimum value scaling and Z-score standardization, which can be selected according to the specific situation of the features and the needs of the model. Secondly, the server can use a specific fusion strategy to combine these features. For example, these features can be combined by the feature concatenation strategy, that is, each feature vector is sequentially concatenated into a longer vector to retain all the information of each feature. Alternatively, the server can also use weighted fusion. According to the importance of each feature to the final task, different weights are assigned to them, and then the weighted feature vectors are added to obtain deep features. The weights can be determined by experimental verification, expert evaluation, or automatically adjusted using machine learning algorithms. Finally, the server uses the fused deep features as a comprehensive representation of the text for subsequent intent classification, knowledge point matching, and other tasks. The deep features integrate information from multiple aspects such as the semantics, context, emotion, and theme of the text, and can more comprehensively reflect the meaning and connotation of the text, thereby improving the accuracy and efficiency of natural language processing tasks.
[0151] S203, converting the deep features into a probability distribution of intent distribution through a Softmax function.
[0152] The probability distribution reflects the possibility that the first consultation content corresponds to each intent category. The Softmax function can map a set of real numbers to a probability distribution so that the sum of all probabilities is 1.
[0153] The server can use the Softmax function to convert the deep features into a probability distribution of intent distribution. In this way, each intent category will get a probability value reflecting the possibility that the first consultation content corresponds to the intent.
[0154] For example, for the sentence "I want to check tomorrow's weather conditions", after being processed by the Softmax function, the following probability distribution may be obtained: the probability of weather query intent is 0.9, and the probability of other intents (such as traffic query, restaurant query, etc.) is relatively low. This means that the model believes that the user's first inquiry content is likely to be about weather query.
[0155] S204. Determine the intent classification result corresponding to the first consultation content according to the probability distribution of the intent distribution.
[0156] One possible implementation method is to select the intent with the highest probability as the classification result. For example, the intent probability of weather query is the highest (0.7), so we will determine weather query as the intent classification result of the first consultation content.
[0157] Another possible implementation method may be to set a probability threshold (such as 0.5), and only when the probability of a certain intent exceeds this threshold, the user is considered to have the intent. In addition, if the probabilities of multiple intents are relatively high (close to or above the threshold), it may be necessary to consider the situation where the user may have multiple intents at the same time.
[0158] S205: Obtain the consulting intent of the first consulting content according to the intention classification result.
[0159] For example, the consulting intent of the first consulting content may be obtained based on the intention classification result and the mapping relationship between the intention classification result and the consulting intent. The mapping relationship may be a predefined mapping table or knowledge base.
[0160] S206. Determine, according to the consultation intention, a subnode matching the first consultation content or a knowledge point node matching the first consultation content.
[0161] The server can determine the subnode or knowledge point node matching the first consulting content according to the consulting intent. The method of determining the subnode or knowledge point node matching the first consulting content can refer to the method of searching the knowledge base for nodes related to the consulting intent in the aforementioned step, which will not be repeated here.
[0162] The method provided by the embodiment of the present invention processes the consulting content through a natural language processing model to obtain the word segmentation result of the consulting content, as well as the text feature vector corresponding to the word segmentation result, and obtains the deep features of the text feature vector based on the text feature vector. The deep features are converted into a probability distribution of intent distribution through a Softmax function, and the intent classification result corresponding to the consulting content is determined based on the probability distribution of the intent distribution, and the consulting intent of the consulting content is obtained. According to the consulting intent, the sub-nodes or knowledge point nodes that match the consulting content are determined, so as to accurately parse the consulting content, improve the data foundation with higher accuracy for subsequent matching in the tree structure of the knowledge base, and promote the matching efficiency and accuracy of the tree structure of the knowledge base.
[0163] Optionally, after converting the deep features into a probability distribution of intent distribution through a Softmax function, the method may further include updating the content of the intent distribution. Figure 3 A flowchart of another automatic reply method based on a tree structure knowledge base provided by an embodiment of the present invention. Figure 3 As shown, the method may also include:
[0164] S301. According to a preset probability threshold, remove the intent categories in the intent distribution that are lower than or equal to the preset probability threshold, and generate a filtered intent distribution.
[0165] The preset probability threshold is determined according to the business requirements and / or historical data of the knowledge base.
[0166] After the server receives the user input and obtains the intent distribution after preliminary analysis, the server can filter the intent distribution according to a preset probability threshold. This probability threshold is determined based on the business needs and historical data of the knowledge base. For example, if in a certain business scenario, the frequency of user consultation for certain intents is very low, then the preset probability thresholds for these intents can be set relatively high to reduce unnecessary calculations and analysis. The server will traverse each intent category in the intent distribution and compare its probability with the preset probability threshold. If the probability of an intent category is lower than or equal to this preset probability threshold, the server will remove it from the intent distribution to generate a filtered intent distribution.
[0167] S302: Mining the historical behavior data of the user to determine the behavior pattern of the user.
[0168] The historical behavior data includes the user's historical consultation records, and the behavior pattern includes the user's consultation preferences, consultation habits, and types of frequently asked consultation questions.
[0169] In order to more accurately understand the needs of users and provide personalized services, the server will dig deep into the user's historical behavior data. This data not only includes the user's past consultation records, but also may cover the user's browsing trajectory, click behavior, search keywords, etc. on the platform. Through comprehensive analysis of these data, the server can depict the user's behavior pattern and predict his future needs and preferences.
[0170] The server uses data mining and machine learning techniques, such as cluster analysis and association rule mining, to identify patterns and trends in user behavior. For example, through cluster analysis, the server can group users' consulting questions by topic or type, thereby discovering users' concerns in different time periods or situations. Association rule mining can help the server discover the correlation between user behaviors, such as after a user consults a certain question, he is likely to consult another related question.
[0171] Optionally, the server can also focus on the temporal characteristics of user behavior. By analyzing the user's behavior sequence over a period of time, the server can infer the user's consulting habits and preferences.
[0172] Specifically, this step can be implemented by the following sub-steps:
[0173] S3021. Obtain the historical behavior data of the user and the timestamp of the historical behavior data.
[0174] The historical behavior data includes historical click data, historical browsing data, and historical consultation data.
[0175] When obtaining the user's historical behavior data and the corresponding timestamp, the server first accesses the database that stores the user data. This database stores all the user's behavior records since registration, including historical click data, historical browsing data, and historical consultation data. The server can retrieve all relevant data for a specific user by executing a specific query statement.
[0176] The historical click data reflects the user's click behavior on the platform content. Each click record contains the identifier of the clicked content and the timestamp of the click. The historical browsing data records the pages or content that the user has browsed on the platform, including the URL of the page, the browsing duration, and the browsing time. The historical consultation data saves the communication records between the user and the platform customer service or intelligent assistant, including the content of the questions, the answers, and the time when the communication occurred.
[0177] S3022. Determine multiple historical behavior data time windows according to a preset window length and the timestamp of the historical behavior data.
[0178] The historical behavior data time window includes one or more sub-historical behavior data.
[0179] When determining the time window of historical behavior data, the server will first set a preset window length, which can be adjusted according to actual needs, such as one week, one month, or one quarter. Next, the server will traverse the user's historical behavior data and classify each piece of data into the corresponding time window according to the timestamp.
[0180] To ensure the accuracy of the time window, the server uses precise time calculation methods, such as converting the timestamp to date and time format, and determining the time window to which the data belongs based on the date and time. At the same time, the server also processes data across time windows to ensure that they are correctly assigned to adjacent time windows.
[0181] After determining multiple time windows of historical behavior data, the server will summarize and count the data in each time window to facilitate subsequent analysis of the user's behavior characteristics in different time periods.
[0182] S3023. Extract sub-historical behavior features of each of the historical behavior data time windows according to the sub-historical behavior data in each of the historical behavior data time windows.
[0183] Among them, the sub-historical behavior characteristics include click preference characteristics corresponding to the historical click data, browsing preference characteristics corresponding to the historical browsing data, and consultation preference characteristics corresponding to the historical consultation data.
[0184] When extracting the sub-historical behavior features of each historical behavior data time window, the server will conduct in-depth analysis and processing of the data in each time window. First, the server will mine the click data to identify the user's click preferences, such as the type of content clicked, the frequency of clicks, and the time distribution of clicks. These click preference features can reflect what content the user is interested in and the user's activity in different time periods. Secondly, the server will process the browsing data and extract the user's browsing preference features. This includes the type of pages browsed by the user, the browsing time, and the depth of browsing. Through the browsing preference features, the server can understand which types of page content the user is more interested in, as well as the user's behavioral habits during the browsing process. Finally, for consultation data, the server will analyze the types of questions asked by the user, the frequency of questions asked, and the time of questions asked, so as to extract consultation preference features. These features can help the server understand in which areas the user has questions or needs, so as to provide more accurate services in the future.
[0185] Specifically, step S3023 can be implemented by the following sub-steps:
[0186] S30231. According to the historical behavior data time window, obtain the historical behavior network of the user in the historical behavior data time window and the historical behavior networks of other users.
[0187] The historical behavior network is generated based on the user's historical click data, historical browsing data, and historical consultation data.
[0188] Based on the historical behavior data time window, the server retrieves the historical behavior data of the specified user and all other users within this time window from the database. These data include historical click data, historical browsing data, and historical consultation data. The server can use graph databases or network analysis techniques to build a user's historical behavior network. In this network, nodes may represent different content items (such as articles, products, services, etc.), and edges represent users' interactive behaviors with these content items (such as clicks, browsing, consultation). For each user, the server creates a unique behavior network that reflects the user's behavior pattern within the selected time window.
[0189] In addition to constructing the historical behavior network of a specified user, the server also creates similar behavior networks for all other users in the same time window. These networks will be used for subsequent correlation analysis and behavior pattern comparison.
[0190] S30232. Based on the historical behavior network of the user and the historical behavior networks of the other users, determine, by correlation analysis, a historical behavior network of a first user whose correlation with the historical behavior network of the user is greater than or equal to a preset correlation threshold.
[0191] The server uses correlation analysis to find other users with similar behavior patterns to the user. For example, this can be achieved by comparing the structural similarities and behavior patterns between different user behavior networks. The server may use algorithms in graph theory, such as subgraph isomorphism, graph edit distance, or similarity metrics based on nodes and edges to perform this comparison. The server determines, based on a preset correlation threshold, that the behavior network of the first user whose correlation with the behavior network of the specified user exceeds the correlation threshold as a similar network of the specified user. The first user's historical behavior network is used for subsequent analysis and processing.
[0192] S30233. According to the historical click data, historical browsing data, and historical consultation data of the first user in the historical behavior network of the first user, adjust the historical click data, historical browsing data, and historical consultation data of the user in the historical behavior network of the user to generate a target processing result.
[0193] After determining the first users with similar behavior patterns to the user, the server can use the historical behavior data of these first users to adjust and optimize the historical behavior network of the original user. This adjustment may include adding or deleting nodes (content items), modifying the weights (interaction strength) of edges, or introducing new edges to represent possible interests or behavior trends.
[0194] The server will synthesize the first user's behavior data, identify common behavior characteristics and trends through algorithms, and then integrate this information into the original user's historical behavior network. This process aims to improve the accuracy and predictive ability of the user behavior model, so as to better reflect the user's real interests and preferences. Ultimately, the server will generate a target processing result, which is an optimized and adjusted user behavior network, which will serve as the basis for subsequent applications such as personalized recommendations, content customization, or user behavior prediction.
[0195] S3024. Configure the attenuation factor of each of the historical behavior data time windows.
[0196] The attenuation factor is used to adjust the influence of each sub-historical behavior data on generating the behavior pattern of the user.
[0197] When configuring the decay factor for each time window of historical behavior data, the server will consider the distance of the time window and the speed of change of the user behavior pattern. The decay factor is set to gradually reduce the impact of data from more distant time windows on the current user behavior pattern to reflect the changes in user behavior over time. The server will set a suitable decay function based on actual needs, such as an exponential decay function or a linear decay function. Through this function, the server can calculate the decay factor corresponding to each time window. Usually, closer time windows are assigned smaller decay factors, while more distant time windows are assigned larger decay factors.
[0198] At the same time, the server will also adjust the decay factor according to the speed of change of the user's behavior pattern. If the user's behavior pattern changes quickly, the server will increase the decay factor to adapt to the changes in user behavior more quickly; conversely, if the user's behavior pattern is relatively stable, the server will reduce the decay factor to maintain continuous consideration of historical behavior.
[0199] S3025. Determine the historical behavior characteristics of the user according to each of the sub-historical behavior characteristics and the attenuation factor of the historical behavior data time window corresponding to each of the sub-historical behavior characteristics.
[0200] When determining the user's historical behavior characteristics, the server comprehensively considers the sub-historical behavior characteristics of each time window and the corresponding attenuation factor. This process aims to merge the behavior characteristics of different time windows to form a comprehensive and accurate description of the user's historical behavior characteristics.
[0201] The server can use weighted average or other fusion algorithms to combine the sub-historical behavior features of each time window with the corresponding attenuation factor. In this way, the influence of the behavior features of the more distant time windows on the current user behavior pattern will be appropriately reduced, while the behavior features of the more recent time windows will be given greater weight.
[0202] During the fusion process, the server considers the correlation and complementarity between behavioral features. For example, click preferences and browsing preferences may have a certain correlation, while consultation preferences may provide additional information to supplement and improve the description of user behavior patterns. Therefore, the server will use appropriate algorithms to comprehensively consider the relationship between these features to ensure the accuracy and comprehensiveness of the fusion results.
[0203] Finally, by comprehensively considering the sub-historical behavior characteristics and attenuation factors of each time window, the server can generate a comprehensive and accurate description of the user's historical behavior characteristics.
[0204] S3026. Determine the behavior pattern of the user according to the historical behavior characteristics of the user.
[0205] The server performs in-depth analysis based on the user's historical behavior features extracted and integrated in the previous steps. These features include but are not limited to click preferences, browsing preferences, and consultation preferences.
[0206] The server clusters or classifies these features to identify common patterns and trends in user behavior. For example, users may frequently browse a certain type of content within a specific time period, or show a sustained interest in clicking on certain types of content. These patterns can be automatically identified using machine learning algorithms such as K-means clustering or decision tree classification. Secondly, the server uses techniques such as association rule learning to mine the associations between user behaviors. For example, after browsing a certain type of page, a user may then click on another type of page. This association can help the server predict the user's next behavior. Finally, combined with the above analysis, the server will combine features from multiple dimensions to construct the user's behavior pattern. This behavior pattern is a multi-dimensional description that reflects the user's overall behavior habits and preferences on the platform. This model not only takes into account the user's historical behavior, but also adapts to changes in user behavior through attenuation factors.
[0207] S303: Determine weight data of each intent category in the filtered intent distribution according to the user's behavior pattern.
[0208] Based on this information, the server can assign a corresponding weight to each intent category in the filtered intent distribution. The weight is determined based on the user's preference for different intent categories, usage frequency, and other relevant factors in the behavior pattern.
[0209] The server can first identify key features in the user's behavior pattern, such as topics that users frequently consult, time preferences, and habits of consultation methods. Then, the server will compare these features with the categories in the filtered intent distribution to find intent categories that highly match the user's behavior pattern. For those intent categories that are closely related to the user's behavior pattern, the server will assign higher weights to indicate the importance and frequency of these categories in user consultations. Conversely, intent categories that are less correlated with the user's behavior pattern will be assigned lower weights.
[0210] S304. Perform a fusion calculation based on the weight data and the original probability of each of the intent categories, and adjust the probability distribution of each of the intent categories in the intent distribution to increase the probability of the intent category frequently selected in the historical behavior data.
[0211] The server can adjust the probability distribution of each intent category in the intent distribution by performing fusion calculation. For example, the server can use the weighted average method, use the weight data as the adjustment factor, and perform weighted calculation with the original probability. In this way, those intent categories with higher weights will be relatively improved in the fused probability distribution, while those with lower weights will be relatively reduced.
[0212] S305: Update the intent distribution according to the adjusted probability of each intent category.
[0213] After completing the fusion calculation, the server updates the intent distribution based on the new probability value. This new intent distribution will more accurately reflect the actual needs of users, thereby improving the pertinence and accuracy of subsequent services.
[0214] The method provided by the embodiment of the present invention removes the intent categories in the intent distribution that are lower than or equal to the preset threshold according to the preset probability threshold, generates a filtered intent distribution, and mines the user's historical behavior data to determine the user's behavior pattern. The weight data of each intent category in the filtered intent distribution is determined according to the user's behavior pattern, and a fusion calculation is performed based on the weight data and the original probability of each intent category, and the probability distribution of each intent category in the intent distribution is adjusted to increase the probability of the intent category frequently selected in the historical behavior data. The intent distribution is updated according to the adjusted probabilities of each intent category, thereby updating the user's intent distribution in real time and improving the accuracy of mining user behavior patterns.
[0215] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. The electronic device is used to execute the automatic reply method based on the tree structure knowledge base mentioned above, for example, it can be the server mentioned above. Figure 4 As shown, the electronic device 400 may include: at least one processor 401 , a memory 402 , and a communication interface 403 .
[0216] The memory 402 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer operation instructions.
[0217] The memory 402 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0218] The processor 401 is used to execute the computer-executable instructions stored in the memory 402 to implement the method described in the above method embodiment. The processor 401 may be a CPU, or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention.
[0219] The processor 401 can communicate and interact with external devices through the communication interface 403, and the external device can be, for example, the user's terminal device mentioned above. In a specific implementation, if the communication interface 403, the memory 402 and the processor 401 are implemented independently, the communication interface 403, the memory 402 and the processor 401 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.
[0220] Optionally, in a specific implementation, if the communication interface 403, the memory 402 and the processor 401 are integrated on a chip, the communication interface 403, the memory 402 and the processor 401 can communicate through an internal interface.
[0221] The present invention also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the method in the above embodiment.
[0222] The present invention also provides a program product, which includes an execution instruction, which is stored in a readable storage medium. At least one processor of a computing device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the computing device implements the above-mentioned automatic reply method based on a tree-structured knowledge base.
[0223] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An automatic reply method based on a tree structure knowledge base, characterized in that: The method comprises: Acquire a first consultation request of a user, wherein the first consultation request includes a first consultation content, a knowledge base category, and a knowledge base tag under the knowledge base category; Determine a current node in the knowledge base according to the knowledge base category and the knowledge base label; Processing the first consultation content by a natural language processing model at the current node to obtain a word segmentation result of the first consultation content and a text feature vector corresponding to the word segmentation result; According to the text feature vector, deep features of the text feature vector are obtained, wherein the deep features include semantic features, context features, emotional features, and topic features; Converting the deep features into a probability distribution of intent distribution through a Softmax function, wherein the probability distribution reflects the possibility that the first consultation content corresponds to each intent category; According to a preset probability threshold, removing the intent categories in the intent distribution that are lower than or equal to the preset probability threshold, and generating a filtered intent distribution, wherein the preset probability threshold is determined according to the business requirements and / or historical data of the knowledge base; Mining the user's historical behavior data to determine the user's behavior pattern, the historical behavior data including the user's historical consultation records, and the behavior pattern including the user's consultation preferences, consultation habits, and types of frequently asked consultation questions; Determining weight data of each of the intent categories in the filtered intent distribution according to the user's behavior pattern; Performing a fusion calculation based on the weight data and the original probability of each of the intent categories, adjusting the probability distribution of each of the intent categories in the intent distribution, so as to increase the probability of the intent category frequently selected in the historical behavior data; updating the intent distribution according to the adjusted probabilities of the intent categories; Determining, according to the probability distribution of the intention distribution, an intention classification result corresponding to the first consultation content; Acquire the consulting intent of the first consulting content according to the intention classification result; Determine, according to the consultation intention, a first child node matching the first consultation content, the first child node being a child node of the current node; If the first child node is a first guiding node, the first consulting content is parsed under the first guiding node to determine a knowledge point node matching the first consulting content, the knowledge point node including reply content matching the first consulting content, and the knowledge point node being a child node of the first guiding node; If the first subnode is a first knowledge point node, determining that the first knowledge point node is a knowledge point node that matches the first consulting content; generating feedback information of the first consultation request according to the reply content in the knowledge point node matching the first consultation content; Output feedback information of the first consultation request.
2. The method according to claim 1, characterized in that The step of parsing the first consulting content under the first guiding node to determine a knowledge point node matching the first consulting content includes: Determining, according to the structure of the knowledge base, whether there are other guiding nodes in the child nodes of the first guiding node; If the other guiding nodes exist in the child nodes of the first guiding node, the current node is modified to be the first guiding node, and the first consulting content is parsed under the current node to determine a second child node matching the first consulting content, where the second child node is a child node of the first guiding node; If the second sub-node is a knowledge point node, determining the second sub-node as a knowledge point node matching the first consulting content; If the second sub-node is a guide node, the current node is modified to be the second sub-node, and a knowledge point node matching the first consulting content is determined in the knowledge point sub-nodes under the second sub-node.
3. The method according to claim 2, characterized in that The method further comprises: If the first consulting content is parsed under the current node and a knowledge point node matching the first consulting content cannot be determined, then a guiding speech corresponding to the current node is output, and the guiding speech is used to guide the user to input a second consulting request, and the second consulting request includes a second consulting content; receiving the second consultation request; Parsing the second consulting content under the current node to determine a knowledge point node matching the second consulting content, wherein the knowledge point node matching the second consulting content includes a reply content matching the second consulting content; generating feedback information of the second consultation request according to the reply content in the knowledge point node matching the second consultation content; Output feedback information of the second consultation request.
4. The method according to claim 3, characterized in that The method further comprises: If the second consulting content is parsed under the current node and a knowledge point node matching the second consulting content cannot be determined, modifying the current node to be the root node of the knowledge base; Parsing the second consulting content under the root node to determine a knowledge point node matching the second consulting content; If the second consulting content is parsed under the root node and a knowledge point node matching the second consulting content cannot be determined, a prompt message is output, where the prompt message is used to prompt the user to re-enter the consulting request.
5. The method according to claim 1, characterized in that The step of obtaining the deep features of the text feature vector according to the text feature vector includes: Extracting the semantic feature from the text feature vector through a deep learning model; Processing the semantic features through a self-attention mechanism to capture the contextual dependency between the semantic features and the contextual features, and generating the contextual features; Inputting the text feature vector into a trained sentiment analysis model to obtain the sentiment feature; Processing the text feature vectors using a topic analysis model to generate a potential topic distribution for each text feature vector; Determining the topic feature of the first consultation request according to the potential topic distribution; The semantic features, the context features, the sentiment features, and the topic features are integrated to generate deep features of the text feature vector.
6. The method according to claim 1, characterized in that The mining of the historical behavior data of the user to determine the behavior pattern of the user includes: Obtaining the user's historical behavior data and the timestamp of the historical behavior data, wherein the historical behavior data includes historical click data, historical browsing data, and historical consultation data; Determine a plurality of historical behavior data time windows according to a preset window length and a timestamp of the historical behavior data, wherein the historical behavior data time window includes one or more sub-historical behavior data; Extracting sub-historical behavior features of each of the historical behavior data time windows according to the sub-historical behavior data in each of the historical behavior data time windows, wherein the sub-historical behavior features include click preference features corresponding to the historical click data, browsing preference features corresponding to the historical browsing data, and consulting preference features corresponding to the historical consulting data; configuring an attenuation factor of each of the historical behavior data time windows, wherein the attenuation factor is used to adjust the influence of each of the sub-historical behavior data on generating the behavior pattern of the user; Determine the historical behavior characteristics of the user according to each of the sub-historical behavior characteristics and the attenuation factor of the historical behavior data time window corresponding to each of the sub-historical behavior characteristics; Determining a behavior pattern of the user according to the historical behavior characteristics of the user; The extracting of sub-historical behavior features of each of the historical behavior data time windows according to the sub-historical behavior data in each of the historical behavior data time windows includes: According to the historical behavior data time window, obtaining the historical behavior network of the user in the historical behavior data time window, and the historical behavior networks of other users, wherein the historical behavior network is generated according to the historical click data, the historical browsing data, and the historical consultation data of the user; Based on the historical behavior network of the user and the historical behavior networks of the other users, determine, by correlation analysis, a historical behavior network of a first user whose correlation with the historical behavior network of the user is greater than or equal to a preset correlation threshold; According to the historical click data, historical browsing data, and historical consultation data of the first user in the historical behavior network of the first user, the historical click data, the historical browsing data, and the historical consultation data of the user in the historical behavior network of the user are adjusted to generate a target processing result.
7. An electronic device, characterized in that: include: A processor, a communication interface and a memory, wherein the processor is communicatively connected to the communication interface and the memory respectively; The memory stores computer-executable instructions; The communication interface communicates and interacts with external devices; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
Citation Information
Patent Citations
Method and apparatus for knowledge point recall
CN109299245A
Intelligent interaction method and device, terminal equipment and storage medium
CN110019727A
