Intelligent interaction method and device based on customer service question and answer knowledge base
By deeply semantic analysis and structured representation of the natural language text input by users, and multi-dimensional matching in the customer service Q&A knowledge base, combining context and user preferences, the problems of insufficient semantic intention understanding and poor adaptability of language diversity in the existing technology are solved, achieving more accurate and flexible customer service interactions.
Patent Information
- Application Number
- CN202510236362.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-20
AI Technical Summary
The existing customer service interaction methods are difficult to fully understand the semantic intentions of user statements, resulting in failed matching or inaccurate answers, and it is difficult to adapt to the diversity of user statements.
By performing lexical analysis, syntactic analysis and semantic role annotation on the natural language text input by the user, it is transformed into structured semantic representation, and matching the word level, semantic level and knowledge structure level in the customer service Q&A knowledge base, combining context semantic analysis and user preference characteristics to generate the final answer.
It improves the accuracy of semantic understanding and interaction accuracy, enhances the adaptability to language diversity, and reduces matching failures caused by user expression differences.
Smart Images

Figure CN120179774A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to an intelligent interaction method and device based on a customer service question and answer knowledge base. Background Art
[0002] With the development of digitalization, customer service interaction plays a crucial role in the communication between enterprises and customers.
[0003] The existing customer service interaction methods mainly include the interaction method based on keyword matching and the interaction method based on template matching. The interaction method based on keyword matching extracts keywords from the user input statement and searches for questions and corresponding answers containing the keywords in the question and answer knowledge base. However, keyword matching is difficult to cover all possible expressions, easily misses a lot of valid information, making it impossible to understand the complete semantics and intentions of the user statement, which may lead to matching failures or inaccurate answers, reducing the accuracy of interaction. The interaction method based on template matching presets some question templates in advance, matches the user input statement with the templates, and returns the corresponding answers after finding the matching template. However, the design of templates requires a large amount of manual experience and upfront investment, and it is difficult to enumerate all possible question types and expression forms, so the emergence of new product features or user question forms may cause the existing templates to be inapplicable, and the template library needs to be continuously updated and maintained, reducing the adaptability to the language diversity of interaction. Summary of the Invention
[0004] The present invention provides an intelligent interaction method and device based on a customer service question and answer knowledge base to improve the accuracy of interaction and the adaptability to language diversity.
[0005] In a first aspect, the present invention provides an intelligent interaction method based on a customer service question and answer knowledge base, including:
[0006] Performing lexical analysis, syntactic analysis, and semantic role annotation on the natural language text input by the target user to obtain semantic relationship information of the natural language text;
[0007] Converting the semantic relationship information into a structured semantic representation;
[0008] Performing word-level matching, semantic-level matching, and knowledge structure-level matching on the structured semantic representation with the question and answer pairs in the pre-constructed customer service question and answer knowledge base to obtain a candidate answer set;
[0009] Obtaining context information of the target user during the intelligent interaction process based on context semantic analysis, and screening the candidate answer set according to the context information to obtain a target answer;
[0010] Generate a final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0011] In a second aspect, the present invention further provides an intelligent interaction device based on a customer service Q&A knowledge base, which is applied to the intelligent interaction method based on a customer service Q&A knowledge base as described in the first aspect; the intelligent interaction device based on a customer service Q&A knowledge base includes:
[0012] A text parsing module, configured to perform lexical analysis, syntactic analysis, and semantic role annotation on the natural language text input by the target user to obtain the semantic relationship information of the natural language text;
[0013] A semantic transformation module, configured to transform the semantic relationship information into a structured semantic representation;
[0014] A semantic representation matching module, configured to perform word-level matching, semantic-level matching, and knowledge structure-level matching on the structured semantic representation and the Q&A pairs in the pre-constructed customer service Q&A knowledge base to obtain a candidate answer set;
[0015] An answer screening module, configured to obtain the context information of the target user during the intelligent interaction process based on context semantic analysis, and screen the candidate answer set according to the context information to obtain a target answer;
[0016] An interaction module, configured to generate a final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0017] In a third aspect, the present invention further provides an electronic device, including: a memory, configured to store a computer software program; a processor, configured to read and execute the computer software program, thereby implementing the intelligent interaction method based on a customer service Q&A knowledge base as described in any one of the above.
[0018] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, in which a computer software program is stored, and when the computer software program is executed by a processor, the intelligent interaction method based on a customer service Q&A knowledge base as described in any one of the above is implemented.
[0019] In a fifth aspect, the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the intelligent interaction method based on a customer service Q&A knowledge base as described in any one of the above is implemented.
[0020] The intelligent interaction method based on a customer service Q&A knowledge base provided by an embodiment of the present invention comprehensively semantically analyzes natural language processing through lexical analysis, syntactic analysis, and semantic role labeling technologies, and converts semantic information into a structured form. Therefore, it can deeply mine the semantic connotations of user statements, comprehensively understand user intentions from the semantic level, and is no longer limited to surface keywords or fixed templates, greatly improving the accuracy of semantic understanding, and thus improving the accuracy of interaction. On the other hand, by comprehensively considering the word level, semantic level, and knowledge structure level, question-answer pairs are matched in the customer service Q&A knowledge base. Therefore, it can adapt to the diverse language expressions of different users from multiple dimensions. For various expressions of the same question, whether it is the difference in word order, the use of synonyms, or the change in sentence structure, it can accurately find the matching question-answer pair in the customer service Q&A knowledge base, greatly improving the adaptability to language diversity, reducing the matching failures caused by differences in user expressions, and thus improving the adaptability to the language diversity of interaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a schematic flowchart of the intelligent interaction method based on a customer service Q&A knowledge base provided by an embodiment of the present invention;
[0022] Figure 2 is a schematic structural diagram of the intelligent interaction device based on a customer service Q&A knowledge base provided by an embodiment of the present invention;
[0023] Figure 3 is an embodiment diagram of an electronic device provided by an embodiment of the present invention;
[0024] Figure 4 is an embodiment diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0026] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality of" means two or more, unless otherwise specifically defined. In the description of the present invention, the term "for example" is used to mean "serving as an example, illustration, or explanation". Any embodiment described as "for example" in the present invention is not necessarily construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the present invention. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0027] Referring to Figure 1 , Figure 1 FIG. is a schematic flowchart of an intelligent interaction method based on a customer service question and answer knowledge base provided by the present invention. In an embodiment of the present invention, the execution subject of the intelligent interaction method based on the customer service question and answer knowledge base is an intelligent interaction device. Therefore, the intelligent interaction method based on the customer service question and answer knowledge base includes:
[0028] Step 10, perform lexical analysis, syntactic analysis, and semantic role annotation on the natural language text input by the target user to obtain semantic relationship information of the natural language text.
[0029] Among them, the intelligent interaction device in the embodiment of the present invention provides an intelligent interaction interface. Therefore, when the user conducts intelligent interaction with the intelligent interaction device, the user needs to input corresponding text on the intelligent interaction interface. Therefore, the intelligent interaction device receives the natural language text input by the target user and performs semantic parsing on the natural language text. Among them, semantic parsing includes lexical analysis, syntactic analysis, and semantic role annotation. Therefore, it can be understood that the intelligent interaction device performs lexical analysis, syntactic analysis, and semantic role annotation on the natural language text, extracts words, phrases, and sentence structures in the natural language text, and forms semantic relationship information of the natural language text according to the words, phrases, and sentence structures, as specifically described in Steps 101 to 105.
[0030] Step 20, convert the semantic relationship information into a structured semantic representation.
[0031] Further, the intelligent interaction device converts the parsed semantic relation information into a structured semantic representation, where the structured semantic representation includes a semantic graph or a semantic vector. The semantic graph represents entities and concepts with nodes and semantic relations between entities with edges, and the semantic vector encodes semantic information through a vector space model, as specifically described in Steps 201 to 206.
[0032] In an embodiment, the natural language text is "I want to query the flight information from Beijing to Shanghai tomorrow", and the finally obtained semantic relation information can be "I" (the executor of the query action), "flight information" (the object of the query), "tomorrow" (the query time), "Beijing" (the departure place), and "Shanghai" (the destination). For the semantic graph, it can be represented as {nodes: "I", "flight information", "Beijing", "Shanghai", "tomorrow"; edges: "query" (connecting "I" and "flight information"), "departure place" (connecting "Beijing" and "flight information"), "destination" (connecting "Shanghai" and "flight information"), "time" (connecting "tomorrow" and "flight information")}. For the semantic vector, in the vector space model, dimensions 1-6 respectively correspond to concepts such as the executor, action, object, departure place, destination, and time, so it can be represented as [1 (corresponding to me), 2 (corresponding to query), 3 (corresponding to flight information), 4 (corresponding to Beijing), 5 (corresponding to Shanghai), 6 (corresponding to tomorrow)].
[0033] Step 30: Perform word-level matching, semantic-level matching, and knowledge structure-level matching on the structured semantic representation and the question-and-answer pairs in the pre-constructed customer service Q&A knowledge base to obtain a candidate answer set.
[0034] Among them, in the embodiment of the present invention, it is necessary to pre - construct a customer service Q&A knowledge base in the intelligent interaction device, specifically: collect a large amount of customer service Q&A data, which can come from multiple channels such as historical customer service records, product manuals, frequently asked questions (FAQ) documents, etc. Organize the customer service Q&A data into the form of Q&A pairs and store them in the knowledge base. At the same time, domain knowledge related to the Q&A, such as product specifications, industry term explanations, business processes, etc., and semantic information, such as synonym tables, near - synonym relationships, etc., are also stored. Further, pre - process the customer service Q&A data in the knowledge base. Data cleaning removes noise data, such as duplicate Q&A pairs, records containing error characters or garbled codes, etc. Among them, the deduplication operation ensures that each Q&A pair is unique in the knowledge base; classification classifies the Q&A pairs according to different topics, product types, or business domains for convenient and quick retrieval; annotation marks the key information in the Q&A pairs, such as the core concepts in the questions and the important knowledge points in the answers. Further, based on knowledge graph technology, expand and optimize the knowledge base, specifically: extract entities (such as product names, function names, question types, etc.) and relationships (such as the ownership relationship between products and functions, the corresponding relationship between questions and answers, etc.) from the customer service Q&A data in the knowledge base to construct a preliminary knowledge graph. Gradually integrate external knowledge sources. For example, obtain the standard specification knowledge of products from industry standard documents, and mine the actual usage problems and experience sharing of users from professional forum data. Incorporate the entities and relationships in the external knowledge into the constructed knowledge graph. Solve entity conflicts and redundancy problems through knowledge fusion, and use inference algorithms (such as rule - based reasoning, deep - learning - based reasoning, etc.) to mine the implicit relationships between entities. For example, infer the applicable scenarios of a product based on its functions, so as to enrich the semantic connotation and knowledge coverage of the knowledge graph and obtain the customer service Q&A knowledge base.
[0035] Optionally, the intelligent interaction device performs semantic matching between the structured semantic representation and the Q&A pairs in the customer service Q&A knowledge base to obtain a candidate answer set in the customer service Q&A knowledge base. Among them, semantic matching includes word - level matching, semantic - level matching, and knowledge - structure - level matching. Therefore, it can be understood that the intelligent interaction device performs word - level matching, semantic - level matching, and knowledge - structure - level matching between the structured semantic representation and the Q&A pairs in the customer service Q&A knowledge base to obtain a candidate answer set, as specifically described in steps 301 to 304. Among them, word - level matching is realized by calculating the word - level similarity based on the edit distance. The edit distance is a measure of the number of addition, deletion, and modification operations of words in two semantics; semantic - level matching is realized by calculating the semantic - level similarity through the cosine similarity of semantic vectors; knowledge - structure - level matching is realized based on the knowledge - structure - level similarity of finding the entity and relationship paths between semantics in the knowledge graph. For example, compare whether the entity types and relationship types passed through in two paths are the same or similar.
[0036] Step 40: Obtain the context information of the target user during the intelligent interaction based on context semantic analysis, and screen the candidate answer set according to the context information to obtain the target answer.
[0037] Further, the intelligent interaction device obtains the context information of the target user during the intelligent interaction according to the context semantic analysis algorithm. Among them, the context information includes the user question sequence and the customer service answer sequence before this round of interaction.
[0038] Further, the intelligent interaction device screens the candidate answer set according to the user question sequence and the customer service answer sequence in the context information to obtain the target answer that best conforms to the current context, as specifically described in Steps 401 to 404.
[0039] Step 50: Generate the final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user.
[0040] Further, the intelligent interaction device obtains the preference feature information of the target user for the language style. Among them, the preference feature information is obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers. The preference feature information is represented in the form of a vector and includes the style preference feature values of multiple language styles. In an embodiment, the preference feature of the target user for the language style may include a preference for concise expressions, a preference for using technical terms, plain language, a preference for long sentences and short sentences. Quantify the preference features into numerical or vector forms. For example, the conciseness preference degree can be represented by a numerical value between 0 and 1, where 0 indicates an extreme preference for detailed expressions and 1 indicates an extreme preference for concise expressions; the technical term preference degree can also be represented by a numerical value between 0 and 1, where 0 indicates never using technical terms and 1 indicates always using technical terms.
[0041] Further, the intelligent interaction device generates the final answer according to the target answer, the current interaction context information, and the preference feature information of the target user, that is, optimizes and polishes the answer according to the user's question method and context to make its expression more natural, smooth, and meet the user's needs, as specifically described in Steps 501 to 504, and feedbacks the final answer to the target user.
[0042] In an embodiment of the present invention, through lexical analysis, syntactic analysis, and semantic role labeling techniques, comprehensive semantic parsing of natural language processing is performed, and semantic information is transformed into a structured form. Therefore, the semantic connotation of the user's statement can be deeply mined, the user's intention can be comprehensively understood at the semantic level, no longer limited to surface keywords or fixed templates, greatly improving the accuracy of semantic understanding, and thus improving the accuracy of interaction. On the other hand, by comprehensively considering the word level, semantic level, and knowledge structure level, question-answer pairs are matched in the customer service question-answer knowledge base. Therefore, it can adapt to the diverse language expressions of different users from multiple dimensions. For various expressions of the same question, whether it is the difference in word order, the use of synonyms, or the change in sentence structure, the corresponding question-answer pair can be accurately found in the customer service question-answer knowledge base, greatly improving the adaptability to language diversity, reducing the matching failure caused by the differences in user expressions, and thus improving the adaptability to the language diversity of interaction.
[0043] In one embodiment, the descriptions of steps 101 to 105 are as follows:
[0044] Step 101: Input the natural language text into the word segmentation model, and perform word segmentation processing on the natural language text based on the word segmentation model to obtain multiple words and multiple word sequences output by the word segmentation model.
[0045] Among them, the word segmentation model is embedded in the intelligent interaction device of the embodiment of the present invention. The word segmentation model is obtained by training a pre-trained model according to the sample text and its corresponding word segmentation result labels. The pre-trained model can be a feedforward neural network, a convolutional neural network, a recurrent neural network, etc.
[0046] Optionally, the intelligent interaction device inputs the natural language text into the word segmentation model. The word segmentation model performs word segmentation processing on the natural language text according to the string matching word segmentation algorithm according to semantic and syntactic rules, and outputs the word segmentation result of the natural language text. The word segmentation result includes multiple words and multiple word sequences. Therefore, the intelligent interaction device can obtain multiple words and multiple word sequences of the natural language text output by the word segmentation model. In one embodiment, a simple natural language text is "How about the battery life of XX mobile phone", and the obtained word segmentation result is "XX mobile phone", "of", "battery life", "how about".
[0047] Step 102: Perform part-of-speech tagging on each word and each word sequence based on part-of-speech analysis to obtain the part-of-speech information of each word and the part-of-speech information of each word sequence.
[0048] Further, the part-of-speech tagging in the embodiments of the present invention can be performed by referring to a part-of-speech tagging dictionary and looking up the part-of-speech information of words in the dictionary; it can also use statistical machine learning methods, such as the maximum entropy model, conditional random field, etc. The model learns the relationship between the context features of words and their parts of speech on a large-scale tagged corpus to perform part-of-speech tagging on the text; it can also use deep learning models such as recurrent neural networks (RNN) and long short-term memory networks (LSTM) for part-of-speech tagging.
[0049] In the embodiments of the present invention, the intelligent interaction device performs part-of-speech tagging on each word and each word sequence by combining the part-of-speech analysis of the part-of-speech tagging dictionary, obtaining the part-of-speech information of each word and the part-of-speech information of each word sequence. Continuing the above embodiment, after performing part-of-speech tagging on the word segmentation results of "XX mobile phone", "of", "battery life", and "how", the part-of-speech information of each word and the part-of-speech information of each word sequence obtained are: "XX mobile phone (noun)", "of (auxiliary word)", "battery life (noun phrase)", "how (interrogative pronoun)".
[0050] Step 103: Input the part-of-speech information of each word and the part-of-speech information of each word sequence into a syntactic analysis model for syntactic analysis to obtain a syntactic structure tree output by the syntactic analysis model.
[0051] Among them, the syntactic analysis model is embedded in the intelligent interaction device in the embodiments of the present invention. The syntactic analysis model is trained on a pre-trained model according to the structure tree constructed from the word segmentation result tags, the part-of-speech information tags corresponding to the word segmentation result tags, and the word segmentation result tags and part-of-speech information tags.
[0052] Optionally, the intelligent interaction device inputs the part-of-speech information of each word and the part-of-speech information of each word sequence into the syntactic analysis model. The syntactic analysis model performs syntactic analysis on the part-of-speech information of each word and the part-of-speech information of each word sequence according to syntactic analysis algorithms (such as rule-based syntactic analysis, statistical syntactic analysis), organizes the words and word sequences into syntactic units with a hierarchical structure, and outputs a syntactic structure tree. Therefore, the intelligent interaction device can obtain the syntactic structure tree output by the syntactic analysis model. Continuing the above embodiment, for "XX mobile phone (noun)", "of (auxiliary word)", "battery life (noun phrase)", "how (interrogative pronoun)", the syntactic structure tree is: ["XX mobile phone" (subject), ["battery life" (headword)] (modifying component of the subject), "how" (predicate)].
[0053] Step 104: Parse the syntactic structure tree based on a preset semantic role system to identify target words and target word sequences in the natural language text.
[0054] Among them, the preset semantic role system in the embodiments of the present invention is a series of target semantic roles to be extracted, such as the subject, the action object, the location, the time, the attribute feature description, the attribute feature query, etc.
[0055] Therefore, the intelligent interaction device parses the syntactic structure tree according to the preset semantic role system, and identifies the target words and target word sequences in the natural language text. Continuing with the above embodiment, the preset semantic role system is the subject, the attribute feature description, and the attribute feature query. For the natural language text "How about the battery life of the XX mobile phone", the identified target words and target word sequences are: "XX mobile phone", "battery life", and "how". "XX mobile phone" is the object to be described, similar to the "patient" or "subject" in the semantic role. "Battery life" is the attribute feature of the "XX mobile phone", and "how" represents the attribute feature query of the attribute feature.
[0056] Step 105: According to the part-of-speech information of the target words and the part-of-speech information of the target word sequences, label the corresponding semantic roles and semantic relationships for the target words and the target word sequences respectively, so as to obtain the semantic relationship information of the natural language text.
[0057] Furthermore, the intelligent interaction device labels the corresponding semantic roles and semantic relationships for the target words according to the part-of-speech information of the target words, and labels the corresponding semantic roles and semantic relationships for the target word sequences according to the part-of-speech information of the target word sequences, so as to obtain the semantic relationship information of the natural language text. Continuing with the above embodiment, the target words, the target word sequences, and their corresponding part-of-speech information are: "XX mobile phone (subject)", "battery life (head)", and "how (predicate)". Therefore, after the semantic role and semantic relationship are labeled: "XX mobile phone {semantic role: subject; semantic relationship: object to be described}", "battery life {semantic role: attribute feature; semantic relationship: attribute feature of the object to be described}", "how {semantic role: question focus; semantic relationship: attribute feature query of the attribute feature}".
[0058] The embodiments of the present invention perform a comprehensive semantic analysis on natural language processing through lexical analysis, syntactic analysis, and semantic role labeling technologies, and convert the semantic information into a structured form. Therefore, it can deeply explore the semantic connotation of the user's statement, comprehensively understand the user's intention from the semantic level, and is no longer limited to the surface keywords or fixed templates, greatly improving the accuracy of semantic understanding, thereby improving the accuracy of interaction.
[0059] In one embodiment, the structured semantic representation can be a semantic graph. Therefore, the descriptions of steps 201 to 203 are as follows:
[0060] Step 201: Perform entity recognition on the semantic relation information based on a preset entity recognition algorithm to obtain the entities in the semantic relation information.
[0061] Optionally, the preset entity recognition algorithm in the embodiments of the present invention is a rule-statistics combination algorithm. In one embodiment, for the rule-statistics combination algorithm, for a noun phrase, if it satisfies a specific part-of-speech combination pattern (such as adjective + noun) and has a matching item in a specific domain vocabulary, it is determined as an entity. Therefore, the intelligent interaction device performs entity recognition on the semantic relation information according to the rule-statistics combination algorithm to obtain all the entities in the semantic relation information, and the obtained entity set is E = {e1, e2,..., e n}.
[0062] Step 202: Perform entity relation extraction based on the syntactic relation and semantic rules, combining the semantic relation information and the entities in the semantic relation information to obtain the relationships between the entities in the semantic relation information.
[0063] Furthermore, the intelligent interaction device inputs the semantic relation information and the entities in the semantic relation information into a relation extraction function, and performs entity relation extraction on the semantic relation information and the entities in the semantic relation information through the syntactic relation and semantic rules in the relation extraction function to obtain the relationships between the entities in the semantic relation information, and the obtained relation set is R(E) = {r ij |e i , e j ∈E}. Among them, the syntactic relation and semantic rules can be understood as follows: for each pair of entities e i and entity e j , find the shortest dependency path between entity e i and entity e j through the dependency syntax tree, and determine the relationship type between entity e i and entity e j according to the syntactic relation and semantic rules on the path. For example, if there is a "subject-verb-object" structure on the dependency path and the predicate verb has an "operation" semantics, it may be determined as an "execution" relationship.
[0064] Step 203: Construct a structured semantic representation based on the entities in the semantic relation information and the relationships between the entities in the semantic relation information.
[0065] Furthermore, the intelligent interaction device constructs a semantic graph according to the entities in the semantic relation information and the relationships between the entities in the semantic relation information to obtain a structured semantic representation. The process of constructing the semantic graph is as follows:
[0066] The constructed semantic graph can be represented as G = (V, E G ), where V is the node set and E G is the edge set.
[0067] Node addition: For each entity e i ∈ E, add it to the node set V, i.e., V = V ∪ {e i}.
[0068] Edge addition: For each relationship r ij ∈ R(E), add an edge e ij in the semantic graph, connecting the corresponding entity nodes e i and entity node e j , i.e., E G = E G ∪ {e ij}, and at the same time label the edge e ij with the relationship type r ij .
[0069] Furthermore, determine the importance I v (e i ) of nodes and the importance I v (e ij ) of edges in the semantic graph. Among them, the importance I v (e i ) can be expressed as:
[0070]
[0071] Among them, w ij represents the weight determined according to the co-occurrence frequency of entity node e i and entity node e j in the semantic relationship information and the semantic relevance between entity node e i and entity node e j , f(r ij ) represents the importance score of relationship type r ij . The importance score f(r ij ) can be expressed as:
[0072]
[0073] The importance I v (e ij ) can be expressed as:
[0074] I v (e ij ) = I v (e i ) * I v (e j ) * g(r ij );
[0075] Among them, g(r ij)Indicates the relationship type r ij of the connection strength, and the connection strength g(r ij ) can be expressed as:
[0076]
[0077] where d ij represents the distance (in words) between the entity node e i and the entity node e j in the semantic relation information, u d represents the average entity distance, l represents the adjustment parameter, and exp() represents the exponential function.
[0078] The embodiments of the present invention construct a structured semantic representation with node and edge importance annotations, which can more comprehensively reflect the semantic structure of the text. Therefore, it can deeply mine the semantic connotation of the user's statement, comprehensively understand the user's intention from the semantic level, no longer be limited to the surface keywords or fixed templates, greatly improve the accuracy of semantic understanding, and thus improve the accuracy of interaction.
[0079] In one embodiment, the structured semantic representation includes semantic vectors. Therefore, the descriptions of steps 204 to 206 are as follows:
[0080] Step 204: Extract features from the semantic relation information to obtain each feature in the semantic relation information; each feature includes a part-of-speech feature, a syntactic structure feature, and a semantic role distribution feature.
[0081] Optionally, the intelligent interaction device extracts features from the semantic relation information to obtain each feature F = {f1, f2,..., f m}, and each feature includes a part-of-speech feature (such as the proportion of nouns, verbs, and adjectives), a syntactic structure feature (such as the depth and number of branches of the sentence), a semantic role distribution feature (such as the occurrence frequency of roles such as agent, patient, and instrument), and a domain-specific vocabulary feature (such as the presence or absence of specific industry terms).
[0082] Step 205: Convert the part-of-speech feature, the syntactic structure feature, and the semantic role distribution feature into corresponding feature values respectively.
[0083] Further, the intelligent interaction device extracts the feature values corresponding to the part-of-speech feature, the syntactic structure feature, and the semantic role distribution feature respectively through the feature value extraction function , and the feature vector composed of the feature values of each feature can be expressed as
[0084] Step 206: Construct a structured semantic representation based on the feature values of each feature.
[0085] Further, the intelligent interaction device constructs a semantic vector based on the feature values of each feature to obtain a structured semantic representation. The process of constructing the semantic vector is as follows:
[0086] The semantic vector is s = [s1, s2,..., s p , where p is the dimension of the semantic vector.
[0087] Optionally, the feature vector X is mapped to a high-dimensional space to obtain a high-dimensional mapped feature vector ψ(x), where the high-dimensional mapped feature vector ψ(x) can be expressed as: where α i represents a randomly generated mapping parameter used to increase the diversity of the mapped features.
[0088] Further, the final semantic vector is obtained through the compression algorithm of the autoencoder structure. The autoencoder consists of two parts: an encoder and a decoder. The encoder compresses the high-dimensional mapped feature vector ψ(x) into a low-dimensional semantic vector s, and the decoder reconstructs the high-dimensional mapped feature vector ψ(x) from the low-dimensional semantic vector s.
[0089] Among them, the specific formula for the encoder to compress the high-dimensional mapped feature vector ψ(x) into a low-dimensional semantic vector s can be expressed as:
[0090]
[0091] where q is the dimension of the high-dimensional mapped feature vector ψ(x), and δ ij represents the weight matrix of the encoder.
[0092] The process for the decoder to reconstruct the high-dimensional mapped feature vector ψ(x) from the low-dimensional semantic vector s is:
[0093]
[0094] where σ represents an activation function (such as the sigmoid function), λ ij represents the weight matrix of the decoder, and b j represents the bias term of the decoder.
[0095] The training objective of the autoencoder is to minimize the reconstruction error. The reconstruction error function L(x) is:
[0096]
[0097] Embodiments of the present invention generate a structured semantic representation in the form of semantic vectors, which can retain the semantic information of the text. Therefore, it can deeply explore the semantic connotation of the user's statement, comprehensively understand the user's intention from the semantic level, and is no longer limited to the surface keywords or fixed templates, greatly improving the accuracy of semantic understanding, thereby improving the accuracy of interaction. At the same time, it can reduce the dimension, facilitate subsequent semantic calculation and matching, and improve the interaction efficiency of intelligent interaction.
[0098] In one embodiment, the descriptions of steps 301 to 304 are as follows:
[0099] Step 301: Calculate the edit distance between the structured semantic representation and the question semantic representation of each question-answer pair to determine the similarity between the structured semantic representation and each question semantic representation at the word level, and obtain the word-level similarity score between the structured semantic representation and each question semantic representation.
[0100] Optionally, the intelligent interaction device calculates the edit distance between the structured semantic representation and the question semantic representation of each question-answer pair in the customer service question-answer knowledge base to determine the similarity between the structured semantic representation and each question semantic representation at the word level. The edit distance represents the number of operations of adding, deleting, and modifying words in two semantics, and the word-level similarity score between the structured semantic representation and each question semantic representation is obtained.
[0101] In one embodiment, the structured semantic representation is where m represents the number of words in the structured semantic representation, and the question semantic representation of each question-answer pair is where n represents the number of words in the question semantic representation of each question-answer pair. The edit distance is represented by a two-dimensional array D[m + 1][n + 1], where D[i][j] represents the minimum number of operations (operations include inserting, deleting, and replacing words) required to convert the first i words of the structured semantic representation to the first j words of the question semantic representation of each question-answer pair Initialization: D[0][0] = 0. For i = 1 to m, D[i][0] = i, indicating that all the first i words of the structured semantic representation are deleted; for j = 1 to n, D[0][j] = j, indicating that all the first j words of the question semantic representation of each question-answer pair are inserted.
[0102] Therefore, for i = 1 to m, j = 1 to n:
[0103]
[0104] The final edit distance is D[m][n], and the word-level similarity score S between the structured semantic representation and each question semantic representationedii It can be expressed as:
[0105]
[0106] Among them, the word-level similarity score S edit The closer it is to 1, the higher the word-level similarity.
[0107] Step 302: Calculate the cosine similarity of the semantic vectors between the structured semantic representation and the question semantic representation of each Q&A pair to determine the similarity at the semantic level between the structured semantic representation and each question semantic representation, and obtain the semantic-level similarity score between the structured semantic representation and each question semantic representation.
[0108] Furthermore, the intelligent interaction device calculates the cosine similarity of the semantic vectors between the structured semantic representation and the question semantic representation of each Q&A pair to determine the similarity at the semantic level between the structured semantic representation and each question semantic representation, and obtains the semantic-level similarity score S between the structured semantic representation and each question semantic representation cosine , where the semantic-level similarity score S cOsine The calculation formula is as follows:
[0109]
[0110] Among them, represents the modulus length of the structured semantic representation of, represents the modulus length of the question semantic representation of each Q&A pair of, exp() represents the exponential function; λ represents the adjustment parameter, which is used to control the influence degree of the semantic representation element difference on the similarity. When λ is larger, the influence of the semantic representation element difference on the similarity is greater; when λ = 0, it is the ordinary cosine similarity formula.
[0111] Step 303: Based on the semantic path of the natural language text in the knowledge graph and the semantic path of each Q&A pair in the knowledge graph, determine the similarity at the knowledge structure level between the natural language text and each Q&A pair, and obtain the knowledge structure level similarity score between the natural language text and each Q&A pair.
[0112] It should be noted that the knowledge graph is a structured knowledge representation form, which can construct various entities (such as people, things) in the real world and the relationships between entities in the form of a graph. Among them, the nodes represent entities, and the edges represent the relationships between entities. For example, in the knowledge graph of electronic products, "XX mobile phone" is an entity node, "operating device" is another entity node, and there may be a relationship edge of "equipped with" between the two. Therefore, the knowledge representation form is "XX mobile phone - equipped with - operating device".
[0113] Among them, the semantic path of natural language text in the knowledge graph can be understood as an ordered sequence composed of a series of entities extracted from the natural language text and the relationships connecting the entities. For example, if the natural language text is "How to solve the problem that the XX mobile phone takes blurred photos", in the knowledge graph, it may involve entities such as "XX mobile phone", "camera", "photo-taking effect", "blurring problem", and "solution". Therefore, the semantic path of natural language text in the knowledge graph can be represented as a chain formed by entities according to the semantic logic of the problem, such as "XX mobile phone - has - camera - produces - photo-taking effect - appears - blurring problem - requires - solution", which reflects a complete semantic association chain from the product (XX mobile phone) to its functional component (camera), then to the problem that occurs (blurred photos) and the ultimate goal (solution). The semantic path of each question-and-answer pair in the knowledge graph is the same.
[0114] Furthermore, the intelligent interaction device obtains the semantic path of the natural language text in the knowledge graph and the semantic path of each question-and-answer pair in the knowledge graph. Among them, the semantic path of the natural language text in the knowledge graph can be represented as P U ={e u1 ,r u1 ,e u2 ,r u2 ,...,e um ,r um ,e u(m+1)}, where e ui represents the entity in the semantic path, and r ui represents the relationship between adjacent entities. The semantic path of each question-and-answer pair in the knowledge graph can be represented as P K ={e k1 ,r k1 ,e k2 ,r k2 ,...,e kn ,r kn ,e k(n+1)}.
[0115] Furthermore, the intelligent interaction device calculates the path length difference score S length between the natural language text and each question-and-answer pair according to the semantic path of the natural language text in the knowledge graph and the semantic path of each question-and-answer pair in the knowledge graph. The calculation formula of the path length difference score S length is as follows:
[0116]
[0117] Further, the intelligent interaction device calculates the entity type matching score S between the natural language text and each Q&A pair according to the semantic path of the natural language text in the knowledge graph and the semantic path of each Q&A pair in the knowledge graph entity , where the entity type matching score S entity is calculated as follows:
[0118]
[0119] where type() represents the type indication function.
[0120] Further, the intelligent interaction device calculates the relationship type matching score S between the natural language text and each Q&A pair according to the semantic path of the natural language text in the knowledge graph and the semantic path of each Q&A pair in the knowledge graph relation , where the relationship type matching score S relation is calculated as follows:
[0121]
[0122] Further, the intelligent interaction device calculates the knowledge structure level similarity score S between the natural language text and each Q&A pair according to the path length difference score, entity type matching score and relationship type matching score graph , where the knowledge structure level similarity score S graph is calculated as follows:
[0123] S graph = S length *(S entity + S relation ) / 2;
[0124] Step 304: Determine the candidate answer set in the customer service Q&A knowledge base based on the word level similarity score, semantic level similarity score and knowledge structure level similarity score.
[0125] Further, the intelligent interaction device calculates the final semantic similarity score S between the structured semantic representation and each question semantic representation according to the word level similarity score, semantic level similarity score and knowledge structure level similarity score. The specific calculation formula is as follows:
[0126] S = α * S edit + β * S cosine + γ * S graph ;
[0127] where α, β and γ are weight parameters determined according to the actual situation, and α + β + γ = 1.
[0128] Further, the intelligent interaction device sorts the final semantic similarity scores between the structured semantic representation and each question semantic representation in descending order, and determines the question-answer pairs corresponding to the final semantic similarity scores ranked in the top preset positions as the candidate answer set in the customer service question-answer knowledge base, where the top preset positions are set according to the actual situation. In one embodiment, the top preset position is 5, that is, the question-answer pairs with the top 5 final semantic similarity scores are determined as the candidate answer set in the customer service question-answer knowledge base.
[0129] In the embodiment of the present invention, by comprehensively considering the word level, semantic level, and knowledge structure level to match question-answer pairs in the customer service question-answer knowledge base, it can adapt to the diverse language expressions of different users from multiple dimensions. For various expressions of the same question, whether it is the difference in word order, the use of synonyms, or the change in sentence structure, it can accurately find the matching question-answer pairs in the customer service question-answer knowledge base, greatly improving the adaptability to language diversity, reducing the matching failures caused by user expression differences, and thus enhancing the adaptability to the language diversity of the interaction.
[0130] In one embodiment, the descriptions of steps 401 to 404 are as follows:
[0131] Step 401: Based on the semantic vectors of each question-answer pair in the candidate answer set and the semantic vectors of each question text in the user question sequence, determine the first correlation coefficient between each question-answer pair in the candidate answer set and each question text in the user question sequence.
[0132] Step 402: Based on the semantic vectors of each question-answer pair in the candidate answer set and the semantic vectors of each reply text in the customer service answer sequence, determine the second correlation coefficient between each question-answer pair in the candidate answer set and each reply text in the customer service answer sequence.
[0133] The candidate answer set in the embodiment of the present invention includes m question-answer pairs, and the candidate answer set can be expressed as A = {a1, a2,..., a m}, and each question-answer pair a i includes a question text and an answer text The user question sequence includes n question texts, and the user question sequence can be expressed as Q = {q1, q2,..., q n}. The customer service answer sequence includes L reply texts. Therefore, the customer service answer sequence can be expressed as R = {r1, r2,..., r L}.
[0134] Optionally, the intelligent interaction device takes the question text i and the answer text of each question-answer pair a Each question text q in the user question sequence Q j , each response text r in the customer service response sequence R k is converted into a corresponding semantic vector to obtain each question-answer pair a i the question text in semantic vector of each question-answer pair a i the answer text in semantic vector of Each question text q in the user question sequence Q j semantic vector of Each response text r in the customer service response sequence R k semantic vector of
[0135] Furthermore, the intelligent interaction device calculates the similarity based on the semantic vector of the question text i in each question-answer pair a semantic vector of each question-answer pair a i the answer text in semantic vector of Each question text q in the user question sequence j semantic vector of to obtain the first association coefficient between each question-answer pair in the candidate answer set and each question text in the user question sequence. The calculation formula for the first association coefficient is as follows:
[0136]
[0137] where represents the first association coefficient between the i-th question-answer pair in the candidate answer set and the j-th question text in the user question sequence, and η1 and η2 represent preset weight values.
[0138] Similarly, the intelligent interaction device calculates the similarity based on the semantic vector of the question text i in each question-answer pair a semantic vector of each question-answer pair a i the answer text in semantic vector of Each response text r in the customer service response sequence R k semantic vector of to obtain the second association coefficient between the i-th question-answer pair in the candidate answer set and the k-th response text in the customer service response sequence
[0139] Step 403: Determine the first round difference between the natural language text and each question text in the user question sequence, and the second round difference between the natural language text and each response text in the customer service response sequence.
[0140] Further, the intelligent interaction device obtains the current interaction round number low(t) of the natural language text, as well as the interaction round numbers of each question text in the user question sequence and the interaction round numbers of each reply text in the customer service answer sequence wherein, the interaction round numbers are determined according to their sequence in the entire Q&A history
[0141] In one embodiment, the Q&A history is {q1, r1, q2, r2, q3, r3, Text}. Therefore, the interaction round number of the natural language text Text is 0, and the interaction round numbers of q1, r1, q2, r2, q3, r3 are 6, 5, 4, 3, 2, 1 respectively
[0142] The intelligent interaction device determines the first round number difference between the natural language text and each question text in the user question sequence according to the current interaction round number low(t) of the natural language text and the interaction round numbers of each question text in the user question sequence Determine the first round number difference between the natural language text and each question text in the user question sequence According to the current interaction round number low(t) of the natural language text and the interaction round numbers of each reply text in the customer service answer sequence Determine the second round number difference between the natural language text and each reply text in the customer service answer sequence
[0143] Continuing with the above embodiment, the Q&A history is {q1, r1, q2, r2, q3, r3, Text}, the round number difference of the question text q1 The interaction round number of the reply text r1 The round number difference of the question text q2 The interaction round number of the reply text r2 The round number difference of the question text q3 The interaction round number of the reply text r3
[0144] Step 404: Based on the first correlation coefficient and the second correlation coefficient of each Q&A pair in the candidate answer set, as well as the first round number difference and the second round number difference, determine the target answer in the candidate answer set
[0145] Further, the intelligent interaction device calculates the comprehensive score S i (all) of each Q&A pair in the candidate answer set according to the first correlation coefficient and the second correlation coefficient of each Q&A pair in the candidate answer set, as well as the first round number difference and the second round number difference i The calculation formula of the comprehensive score S
[0146]
[0147] Further, the intelligent interaction device traverses the comprehensive score S i (all) of each Q&A pair in the candidate answer set, and determines the answer text in the Q&A pair corresponding to the maximum comprehensive score in the candidate answer set as the target answer.
[0148] In the embodiment of the present invention, the target answer in the candidate answer set is accurately determined through the semantic similarity and the round number difference of the interaction rounds, so that an answer that meets the user's needs can be accurately provided, improving the user's interaction experience with intelligent interaction and increasing the user's stickiness to intelligent interaction.
[0149] In one embodiment, the descriptions of steps 501 to 504 are as follows:
[0150] Step 501, based on the style preference feature values of each language style in the preference feature information, obtain the semantic pattern sets of the target user for each language style.
[0151] Among them, the preference feature information is represented in the form of a vector, and the preference feature information carries the style preference feature values of multiple language styles. Therefore, the intelligent interaction device can obtain the style preference feature values of each language style according to the preference feature information. In one embodiment, the preference feature information can be expressed as P = [p1, p2,..., p n , where n represents the dimension of the preference feature information, and p i represents the style preference feature value of the i-th language style. Further, the intelligent interaction device obtains the semantic pattern sets l i of the target user for each language style according to the style preference feature values of each language style. In one embodiment, if the style preference feature value p i is the conciseness preference degree, the corresponding semantic pattern set l i can be the concise expression pattern set, such as "change... to...", "use... to...", etc.
[0152] Step 502, based on the number of semantic patterns in the current interaction context information that intersect with the semantic pattern sets of each language style, the semantic similarity between the target answer and the semantic pattern sets of each language style, and the number of semantic patterns in the semantic pattern sets of each language style, determine the preference feature adaptation value of each language style in the current context information.
[0153] Further, the intelligent interaction device obtains the number count(l i ∩ C) of semantic patterns in the current interaction context information C that intersect with the semantic pattern sets l i of each language style, and obtains the target answer A t and the semantic pattern sets l iThe semantic similarity sim(A t , l i ), and obtaining the set of semantic patterns l i of each language style, and the length len(l i ), that is, the number of semantic patterns in the set of semantic patterns l i of each language style. Among them, the semantic similarity sim(A t , l i ) can be obtained by calculating the cosine similarity of word vectors.
[0154] Further, the intelligent interaction device determines the preference feature adaptation value f(C, A i ∩ C), semantic similarity sim(A t , l i ) and length len(l i ) of each language style in the current context information C, where the calculation formula of the preference feature adaptation value f(C, A t , i) is as follows: t
[0155]
[0156] Step 503: Based on the style preference feature values of each language style and the preference feature adaptation values of each language style in the current context information, determine the comprehensive influence factor of the language style.
[0157] Further, the intelligent interaction device calculates the comprehensive influence factor μ of the language style according to the style preference feature values of each language style and the preference feature adaptation values of each language style in the current context information. The calculation formula of the comprehensive influence factor μ is as follows:
[0158]
[0159] Among them, ω i represents the preset weight of the i-th language style, which can be determined according to the analysis and experiment of a large amount of user interaction data. In one embodiment, operations such as word replacement and sentence pattern adjustment are performed on the target answer A t according to the magnitude of the comprehensive influence factor μ.
[0160] Step 504: Based on the comprehensive influence factor and the style preference feature values of each language style, adjust the target answer to generate the final answer.
[0161] Further, the intelligent interaction device adjusts the target answer according to the comprehensive influence factor and the style preference feature values of each language style to generate the final answer. In one embodiment, if the comprehensive influence factor μ is large and the simplicity preference degree is high, the intelligent interaction device will use the target answer At Simplify some complex sentence patterns in it, and replace long words with short words; if the comprehensive impact factor μ is relatively large and the preference degree for professional terms is relatively low, the intelligent interaction device will use target answer A t Replace the professional terms in it with popular explanations.
[0162] In a specific embodiment, target answer A t is "In the settings menu of the smartphone, find the display settings option, and then adjust the value of the screen brightness to adapt to the change of ambient light". The interactive context information is that the user previously asked a question about the phone screen being too dark to see clearly outdoors. The preference feature information of the target user language shows a preference for concise expressions (the style preference feature value for concise preference is 0.8) and a preference for popular language (the style preference feature value for professional term preference is 0.2). The weight of the concise preference feature ω 简洁偏好 = 0.6, and the weight of the professional term preference feature ω 专业术语偏好 = 0.4.
[0163] Calculate f(C, A t , concise preference). There are keywords such as "the screen is too dark" in the interactive context information that match "the screen... is dark" in the set of concise expression patterns. If count(l 简洁偏好 ∩C) = 1 at this time, target answer A t The semantic similarity between and the concise expression pattern sim(A t , l 简洁偏好 ) is calculated to be 0.3. The length of the semantic pattern set of the concise preference is len(l 简洁偏好 ) = 5, then f(C, A t , concise preference) = (1 + 0.3) / 5 = 0.26. Similarly, calculate f(C, A t , professional term preference). Since there are professional terms such as "settings menu" and "display settings option" in target answer A t , the intersection with the set of popular language patterns is relatively small. If count(l 专业术语偏好 ∩C) = 0 at this time, target answer A t The semantic similarity between and the professional term expression pattern sim(A t , l 专业术语偏好 ) is calculated to be 0.1. The length of the semantic pattern set of the professional term preference is len(l 专业术语偏好 ) = 3, then f(C, A t, (Preference for technical terms) = (0 + 0.1) / 3 ≈ 0.03. Therefore, the comprehensive influence factor μ = (0.6 * 0.8 * 0.26 + 0.4 * 0.2 * 0.03) / (0.6 + 0.4) ≈ 0.13. Finally, based on the comprehensive influence factor μ = 0.13, the style preference eigenvalue of simplicity preference is 0.8, and the style preference eigenvalue of technical term preference is 0.2 for the target answer A t Modify it. Simplify "In the settings menu of the smartphone, find the display settings option" to "In the phone settings, find the display settings" to obtain the preliminarily modified answer. After checking grammar and semantic coherence, determine the final answer as "In the phone settings, find the display settings, and then adjust the screen brightness value to adapt to outdoor light."
[0164] In the embodiment of the present invention, the target answer is optimized according to the current interaction context information and the user's preference feature information, making the expression of the final answer more natural, smooth and meeting the user's needs, improving the user's interaction experience with intelligent interaction and increasing the user's stickiness to intelligent interaction.
[0165] Furthermore, the intelligent interaction device based on the customer service Q&A knowledge base provided by the present invention is described below. The intelligent interaction device based on the customer service Q&A knowledge base described below can be correspondingly referred to the intelligent interaction method based on the customer service Q&A knowledge base described above.
[0166] Optionally, refer to Figure 2 , Figure 2 is the structural schematic diagram of the intelligent interaction device based on the customer service Q&A knowledge base provided by the present invention. The intelligent interaction device based on the customer service Q&A knowledge base includes.
[0167] A text parsing module 211, configured to perform lexical analysis, syntactic analysis and semantic role annotation on the natural language text input by the target user to obtain the semantic relationship information of the natural language text;
[0168] A semantic transformation module 220, configured to transform the semantic relationship information into a structured semantic representation;
[0169] A semantic representation matching module 230, configured to perform word-level matching, semantic-level matching and knowledge structure-level matching on the structured semantic representation and the Q&A pairs in the pre-constructed customer service Q&A knowledge base to obtain a candidate answer set;
[0170] An answer screening module 240, configured to obtain the context information of the target user during the intelligent interaction process based on context semantic analysis, and screen the candidate answer set according to the context information to obtain the target answer;
[0171] An interaction module 250, configured to generate a final answer based on a target answer, current interaction context information, and preference feature information of a target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0172] In the embodiments of the present invention, through lexical analysis, syntactic analysis, and semantic role labeling techniques, a comprehensive semantic analysis of natural language processing is performed, and semantic information is converted into a structured form. Therefore, the semantic connotation of the user's statement can be deeply mined, the user's intention can be comprehensively understood from the semantic level, and it is no longer limited to surface keywords or fixed templates, greatly improving the accuracy of semantic understanding, thereby improving the accuracy of interaction. On the other hand, by comprehensively considering the word level, semantic level, and knowledge structure level, question-and-answer pairs are matched in the customer service question-and-answer knowledge base. Therefore, it can adapt to the diverse language expressions of different users from multiple dimensions. For various expressions of the same question, whether it is the difference in word order, the use of synonyms, or the change in sentence structure, the corresponding question-and-answer pair can be accurately found in the customer service question-and-answer knowledge base, greatly improving the adaptability to language diversity, reducing the matching failure caused by the user's expression differences, and thus improving the adaptability to the language diversity of interaction.
[0173] Please refer to Figure 3 , Figure 3 which is an embodiment diagram of the electronic device provided by the embodiments of the present invention. As Figure 3 shown, the embodiments of the present invention provide an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented:
[0174] Perform lexical analysis, syntactic analysis, and semantic role labeling on the natural language text input by the target user to obtain semantic relationship information of the natural language text;
[0175] Convert the semantic relationship information into a structured semantic representation;
[0176] Perform word-level matching, semantic-level matching, and knowledge structure-level matching on the structured semantic representation and the question-and-answer pairs in the pre-constructed customer service question-and-answer knowledge base to obtain a candidate answer set;
[0177] Obtain the context information of the target user during the intelligent interaction process based on context semantic analysis, and screen the candidate answer set according to the context information to obtain the target answer;
[0178] Generate a final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0179] Please refer to Figure 4 , Figure 4 which is the embodiment diagram of the computer-readable storage medium provided by the embodiment of the present invention. As Figure 4 shown, this embodiment provides a computer-readable storage medium 400, on which a computer program 311 is stored. When the computer program 311 is executed by a processor, the following steps are implemented:
[0180] Perform lexical analysis, syntactic analysis, and semantic role annotation on the natural language text input by the target user to obtain the semantic relationship information of the natural language text;
[0181] Convert the semantic relationship information into a structured semantic representation;
[0182] Match the structured semantic representation with the question-and-answer pairs in the pre-constructed customer service question-and-answer knowledge base at the word level, semantic level, and knowledge structure level to obtain a candidate answer set;
[0183] Obtain the context information of the target user during the intelligent interaction based on the context semantic analysis, and screen the candidate answer set according to the context information to obtain the target answer;
[0184] Generate a final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0185] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the intelligent interaction method based on the customer service question-and-answer knowledge base provided by the above-mentioned various methods. The method includes:
[0186] Perform lexical analysis, syntactic analysis, and semantic role annotation on the natural language text input by the target user to obtain the semantic relationship information of the natural language text;
[0187] Convert the semantic relationship information into a structured semantic representation;
[0188] Match the structured semantic representation with the question-and-answer pairs in the pre-constructed customer service question-and-answer knowledge base at the word level, semantic level, and knowledge structure level to obtain a candidate answer set;
[0189] Obtain the context information of the target user during the intelligent interaction process based on context semantic analysis, and screen the candidate answer set according to the context information to obtain the target answer;
[0190] Generate the final answer based on the target answer, the current interaction context information, and the preference feature information of the target user, and feedback the final answer to the target user; the preference features are obtained based on the language style characteristics of the target user's historical questions and the feedback information on the answers.
[0191] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative work.
[0192] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0193] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An intelligent interaction method based on a customer service question and answer knowledge base, characterized in that: include: Performing lexical analysis, syntactic analysis, and semantic role labeling on the natural language text input by the target user to obtain semantic relationship information of the natural language text; Converting the semantic relationship information into a structured semantic representation; Matching the structured semantic representation with question-answer pairs in a pre-built customer service question-answer knowledge base at the word level, the semantic level, and the knowledge structure level to obtain a candidate answer set; Obtaining context information of the target user in the intelligent interaction process based on context semantic analysis, and screening the candidate answer set according to the context information to obtain a target answer; A final answer is generated based on the target answer, current interaction context information and preference feature information of the target user, and the final answer is fed back to the target user; the preference feature is obtained based on the language style characteristics of the target user's historical questions and feedback information on the answers.
2. The intelligent interaction method based on the customer service question and answer knowledge base according to claim 1 is characterized in that: The step of performing lexical analysis, syntactic analysis, and semantic role labeling on the natural language text input by the target user to obtain semantic relationship information of the natural language text includes: The natural language text is input into a word segmentation model, and the natural language text is segmented based on the word segmentation model to obtain a plurality of words and a plurality of word sequences output by the word segmentation model; the word segmentation model is trained based on sample text and its corresponding word segmentation result labels; Perform part-of-speech tagging on each word and each word sequence based on part-of-speech analysis to obtain part-of-speech information of each word and each word sequence; Inputting the part-of-speech information of each word and the part-of-speech information of each word sequence into a syntactic analysis model for syntactic analysis, and obtaining a syntactic structure tree output by the syntactic analysis model; the syntactic analysis model is trained based on the word segmentation result label and its corresponding part-of-speech information label and the structure tree; Parsing the syntactic structure tree based on a preset semantic role system to identify target words and target word sequences in the natural language text; According to the part-of-speech information of the target word and the part-of-speech information of the target word sequence, the target word and the target word sequence are respectively labeled with corresponding semantic roles and semantic relations to obtain the semantic relation information of the natural language text.
3. The intelligent interaction method based on the customer service question and answer knowledge base according to claim 1 is characterized in that: The structured semantic representation is matched with the question-answer pairs in the pre-built customer service question-answer knowledge base at the word level, the semantic level and the knowledge structure level to obtain a candidate answer set, including: Calculating the edit distance between the structured semantic representation and the question semantic representation of each question-answer pair, determining the similarity between the structured semantic representation and each question semantic representation at the word level, and obtaining a word level similarity score between the structured semantic representation and each question semantic representation; Calculate the semantic vector cosine similarity between the structured semantic representation and the question semantic representation of each question-answer pair, determine the similarity between the structured semantic representation and each question semantic representation at the semantic level, and obtain a semantic level similarity score between the structured semantic representation and each question semantic representation; Based on the semantic path of the natural language text in the knowledge graph and the semantic path of each question-answer pair in the knowledge graph, determine the similarity between the natural language text and each question-answer pair at the knowledge structure level, and obtain a similarity score between the natural language text and each question-answer pair at the knowledge structure level; Based on the word-level similarity score, the semantic-level similarity score, and the knowledge-structure-level similarity score, a candidate answer set in the customer service question-and-answer knowledge base is determined.
4. The intelligent interaction method based on the customer service question and answer knowledge base according to claim 1 is characterized in that: The generating a final answer based on the target answer, current interaction context information and the target user's preference feature information includes: Based on the style preference feature value of each language style in the preference feature information, obtaining a semantic pattern set of each language style for the target user; Determine the preference feature adaptation value of each language style under the current context information based on the number of semantic patterns in the current interaction context information that have an intersection with the semantic pattern set of each language style, the semantic similarity between the target answer and the semantic pattern set of each language style, and the number of semantic patterns in the semantic pattern set of each language style; Determining a comprehensive influencing factor of the language style based on the style preference feature value of each language style and the preference feature adaptation value of each language style under the current context information; The target answer is adjusted based on the comprehensive influencing factor and the style preference characteristic value of each language style to generate the final answer.
5. The intelligent interaction method based on the customer service question and answer knowledge base according to claim 1 is characterized in that: The context information includes the user's question sequence and the customer service's answer sequence before the current round of interaction; The step of screening the candidate answer set according to the context information to obtain a target answer includes: Determine a first correlation coefficient between each question-answer pair in the candidate answer set and each question text in the user question sequence based on the semantic vector of each question-answer pair in the candidate answer set and the semantic vector of each question text in the user question sequence; Determine a second correlation coefficient between each question-answer pair in the candidate answer set and each reply text in the customer service answer sequence based on the semantic vector of each question-answer pair in the candidate answer set and the semantic vector of each reply text in the customer service answer sequence; Determine a first round number difference between the natural language text and each question text in the user question sequence, and a second round number difference between the natural language text and each reply text in the customer service answer sequence; Based on the first correlation coefficient and the second correlation coefficient of each question-answer pair in the candidate answer set, and the first round number difference and the second round number difference, a target answer in the candidate answer set is determined.
6. The intelligent interaction method based on the customer service question and answer knowledge base according to any one of claims 1 to 5, characterized in that: The structured semantic representation includes a semantic graph, and the converting of the semantic relationship information into the structured semantic representation includes: Performing entity recognition on the semantic relationship information based on a preset entity recognition algorithm to obtain entities in the semantic relationship information; Extracting entity relationships based on syntactic relationships and semantic rules in combination with the semantic relationship information and entities in the semantic relationship information to obtain relationships between entities in the semantic relationship information; The structured semantic representation is constructed based on the entities in the semantic relationship information and the relationships between the entities in the semantic relationship information.
7. The intelligent interaction method based on the customer service question and answer knowledge base according to any one of claims 1 to 5, characterized in that: The structured semantic representation includes a semantic vector; and the converting the semantic relationship information into the structured semantic representation includes: Extracting features from the semantic relationship information to obtain various features in the semantic relationship information; the various features include part-of-speech features, syntactic structure features, and semantic role distribution features; Converting the part-of-speech feature, the syntactic structure feature, and the semantic role distribution feature into corresponding feature values respectively; The structured semantic representation is constructed based on the feature values of each feature.
8. An intelligent interactive device based on a customer service question and answer knowledge base, characterized in that: Applied to the intelligent interaction method based on the customer service question and answer knowledge base as claimed in any one of claims 1 to 7; The intelligent interactive device based on the customer service question and answer knowledge base includes: A text parsing module is used to perform lexical analysis, syntactic analysis and semantic role labeling on the natural language text input by the target user to obtain semantic relationship information of the natural language text; A semantic conversion module, used for converting the semantic relationship information into a structured semantic representation; A semantic representation matching module is used to match the structured semantic representation with question-answer pairs in a pre-built customer service question-answer knowledge base at the word level, semantic level and knowledge structure level to obtain a candidate answer set; An answer screening module is used to obtain context information of the target user in the intelligent interaction process based on context semantic analysis, and screen the candidate answer set according to the context information to obtain a target answer; The interactive module is used to generate a final answer based on the target answer, current interactive context information and preference feature information of the target user, and feed the final answer back to the target user; the preference feature is obtained based on the language style characteristics of the target user's historical questions and feedback information on the answers.
9. An electronic device, comprising: Memory for storing computer software programs; A processor, used to read and execute a computer software program, wherein when the computer software program is executed by the processor, an intelligent interaction method based on a customer service question and answer knowledge base as described in any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer software program stored therein, characterized in that: When the computer software program is executed by the processor, the intelligent interaction method based on the customer service question and answer knowledge base as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Apartment agent question and answer method and system based on knowledge base
CN121960803A
Apartment intelligent agent question-answering method and system based on knowledge base
CN121960803B