Intelligent response methods and devices, electronic devices and storage media

CN119066167BActive Publication Date: 2026-08-14PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2026-08-14

AI Technical Summary

Benefits of technology

[0040]本申请提出的智能答复方法和装置、电子设备及存储介质,其通过获取问题文本集与答复文本集;对问题文本集进行特征提取得到问题句特征集,对答复文本集进行特征提取得到答复句特征集;对问题句特征集与答复句特征集进行词权重分配,得到加权词权重特征;根据加权词权重特征对问题句特征集进行加权求和,得到问题句权重特征,根据加权词权重特征对答复句特征集进行加权求和,得到答复句权重特征;对问题句权重特征与答复句权重特征进行掩膜拼接操作,得到整句权重特征;根据问题句权重特征、答复句权重特征及整句权重特征从答复文本集中查找出与问题文本集相匹配的目标答复文本,并根据目标答复文本对问题文本集进行答复。本申请通过结合问题文本与答复文本的词权重、问题句权重特征、答复句权重特征及整句权重特征实现问答文本与答复文本的相互匹配,实现了结合语义和字符特征自动对问答文本进行相应的答复,从而提高了答复的效率及准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066167B_ABST
    Figure CN119066167B_ABST
Patent Text Reader

Abstract

This application provides an intelligent response method, device, electronic device, and storage medium, belonging to the field of artificial intelligence technology. The method includes: assigning word weights to an acquired question sentence feature set and response sentence feature set; performing a weighted summation of the question sentence feature set and response sentence feature set based on the weighted word weight features obtained from the word weight assignment; performing a masking and splicing operation on the weighted summation of the question sentence weight features and response sentence weight features to obtain whole sentence weight features; determining the target response text based on the question sentence weight features, response sentence weight features, and whole sentence weight features; and responding to the question text set. This application, by combining word weights, question sentence weight features, response sentence weight features, and whole sentence weight features to match question and answer texts with response texts, achieves automatic response to question and answer texts by combining semantic and character features, thereby improving the efficiency and accuracy of responses.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to an intelligent response method and apparatus, electronic device and storage medium. Background Technology

[0002] Currently, in the service sector, Q&A responses are typically provided by human agents who address user inquiries or questions. For example, in the financial consulting field, a large number of human customer service representatives are needed to answer each user's question or inquiry. However, this method, relying on human agents to answer user questions, can lead to delays and inefficiency when there are too many inquiries. Furthermore, when human agents encounter questions they haven't been trained on, the error rate increases, resulting in lower accuracy. Therefore, improving the efficiency and accuracy of responses has become a pressing issue. Summary of the Invention

[0003] The main objective of this application is to provide an intelligent response method, device, electronic device, and storage medium, which aims to improve the efficiency and accuracy of responses.

[0004] To achieve the above objectives, a first aspect of this application proposes an intelligent response method, the method comprising:

[0005] Retrieve the question text set and the answer text set;

[0006] Feature extraction is performed on the question text set to obtain a question sentence feature set, and feature extraction is performed on the response text set to obtain a response sentence feature set;

[0007] The question sentence feature set and the response sentence feature set are weighted by word weights to obtain weighted word weight features;

[0008] The question sentence feature set is weighted and summed according to the weighted word weight features to obtain the question sentence weight features. The response sentence feature set is weighted and summed according to the weighted word weight features to obtain the response sentence weight features.

[0009] A masking and splicing operation is performed on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the entire sentence.

[0010] Based on the question sentence weight features, the response sentence weight features, and the whole sentence weight features, the target response text that matches the question text set is found from the response text set, and the question text set is responded to based on the target response text.

[0011] In some embodiments, the step of assigning word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features includes:

[0012] The word weight features are obtained by calculating word weights on the question sentence feature set and the response sentence feature set using the trained word weight model.

[0013] Obtain the question word vector set corresponding to the question sentence feature set, and obtain the response word vector set corresponding to the response sentence feature set;

[0014] The question word vector set, the response word vector set, and the word weight features are weighted to obtain the weighted word weight features.

[0015] In some embodiments, the step of performing a weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and performing a weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features, includes:

[0016] Obtain the length of the question sentence in the question sentence feature set and the number of question words contained in the question sentence length; obtain the length of the response sentence in the response sentence feature set and the number of response words contained in the response sentence length.

[0017] The question sentence feature set is averaged and weighted according to the weighted word weight features, the question sentence length, and the number of question words to obtain the question sentence weight features. The response sentence feature set is averaged and weighted according to the weighted word weight features, the response sentence length, and the number of response words to obtain the response sentence weight features.

[0018] In some embodiments, the step of performing a masking concatenation operation on the question sentence weight features and the response sentence weight features to obtain the whole sentence weight features includes:

[0019] Obtain the question boundary identifier and question filling identifier of the question sentence weight feature, and obtain the response boundary identifier and response filling identifier of the response sentence weight feature;

[0020] A masking operation is performed on the question boundary identifier and the question filling identifier to obtain masked question sentence weight features; a masking operation is performed on the response boundary identifier and the response filling identifier to obtain masked response sentence weight features.

[0021] The weight features of the masked question sentence and the weight features of the masked response sentence are concatenated to obtain the weight features of the whole sentence.

[0022] In some embodiments, the step of extracting features from the question text set to obtain a question sentence feature set, and extracting features from the response text set to obtain a response sentence feature set, includes:

[0023] The question text set is encoded to obtain a question word vector set, and the response text set is encoded to obtain a response word vector set;

[0024] The question word vector set is pooled to obtain the question sentence feature set, and the response word vector set is pooled to obtain the response sentence feature set.

[0025] In some embodiments, encoding the question text set to obtain a question word vector set, and encoding the response text set to obtain a response word vector set, includes:

[0026] The question text set is segmented using preset identifiers to obtain a question word set, and the response text set is segmented using preset identifiers to obtain a response word set.

[0027] The question word set is subjected to word embedding operation to obtain the question word vector, and the response word set is subjected to word embedding operation to obtain the response word vector.

[0028] In some embodiments, the step of finding the target response text that matches the question text set from the response text set based on the question sentence weight feature, the response sentence weight feature, and the whole sentence weight feature includes:

[0029] The semantic matching degree between the question sentence feature set and the response sentence feature set is calculated based on the question sentence weight feature, the response sentence weight feature, and the whole sentence weight feature.

[0030] Based on the semantic matching degree, the target response text that matches the question text set is found from the response text set.

[0031] To achieve the above objectives, a second aspect of this application provides an intelligent response device, the device comprising:

[0032] The text acquisition module is used to acquire the question text set and the answer text set;

[0033] The feature extraction module is used to extract features from the question text set to obtain a question sentence feature set, and to extract features from the response text set to obtain a response sentence feature set;

[0034] The weight allocation module is used to allocate word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features;

[0035] The sentence weighting module is used to perform weighted summation on the question sentence feature set according to the weighted word weight features to obtain the question sentence weight features, and to perform weighted summation on the response sentence feature set according to the weighted word weight features to obtain the response sentence weight features;

[0036] The mask stitching module is used to perform a mask stitching operation on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the whole sentence.

[0037] The intelligent response module is used to find the target response text that matches the question text set from the response text set based on the question sentence weight feature, the response sentence weight feature and the whole sentence weight feature, and to respond to the question text set based on the target response text.

[0038] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.

[0039] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.

[0040] The intelligent response method, apparatus, electronic device, and storage medium proposed in this application acquire a question text set and a response text set; extract features from the question text set to obtain a question sentence feature set, and extract features from the response text set to obtain a response sentence feature set; assign word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features; perform weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and perform weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features; perform masking and splicing operation on the question sentence weight features and the response sentence weight features to obtain whole sentence weight features; find the target response text that matches the question text set from the response text set based on the question sentence weight features, the response sentence weight features, and the whole sentence weight features, and respond to the question text set based on the target response text. This application achieves mutual matching between question and answer texts by combining word weights, question sentence weights, answer sentence weights, and whole sentence weights of the question and answer texts. It realizes automatic response to question and answer texts by combining semantic and character features, thereby improving the efficiency and accuracy of the response. Attached Figure Description

[0041] Figure 1 This is a flowchart of the intelligent response method provided in the embodiments of this application;

[0042] Figure 2 yes Figure 1 The flowchart of step S102 in the document;

[0043] Figure 3 yes Figure 2 The flowchart of step S201 in the text;

[0044] Figure 4 yes Figure 1 The flowchart of step S103 in the process;

[0045] Figure 5 yes Figure 1 The flowchart of step S104 in the process;

[0046] Figure 6 yes Figure 1 The flowchart of step S105 in the process;

[0047] Figure 7 yes Figure 1 The flowchart of step S106 in the process;

[0048] Figure 8 This is a schematic diagram of the structure of the intelligent response device provided in the embodiments of this application;

[0049] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0053] First, let's analyze some of the terms used in this application:

[0054] Artificial intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.

[0055] Based on this, embodiments of this application provide an intelligent response method and apparatus, electronic device and storage medium, aiming to improve the efficiency and accuracy of responses.

[0056] The intelligent response method, apparatus, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the intelligent response method in the embodiments of this application is described.

[0057] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0058] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0059] The intelligent response method provided in this application relates to the field of artificial intelligence technology. The intelligent response method provided in this application can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the intelligent response method, but is not limited to the above forms.

[0060] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0061] Figure 1 This is an optional flowchart of the intelligent response method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S106.

[0062] Step S101: Obtain the question text set and the answer text set.

[0063] Step S102: Extract features from the question text set to obtain the question sentence feature set, and extract features from the response text set to obtain the response sentence feature set.

[0064] Step S103: Assign word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features.

[0065] Step S104: The question sentence feature set is weighted and summed according to the weighted word weight features to obtain the question sentence weight features. The response sentence feature set is weighted and summed according to the weighted word weight features to obtain the response sentence weight features.

[0066] Step S105: Perform a masking and splicing operation on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the whole sentence.

[0067] Step S106: Based on the question sentence weight features, response sentence weight features, and whole sentence weight features, find the target response text that matches the question text set from the response text set, and respond to the question text set based on the target response text.

[0068] Steps S101 to S106 as shown in this embodiment involve: acquiring a question text set and a response text set; extracting features from the question text set to obtain a question sentence feature set, and extracting features from the response text set to obtain a response sentence feature set; assigning word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features; performing a weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and performing a weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features; performing a masking and splicing operation on the question sentence weight features and the response sentence weight features to obtain whole sentence weight features; finding the target response text that matches the question text set from the response text set based on the question sentence weight features, the response sentence weight features, and the whole sentence weight features, and then responding to the question text set based on the target response text. This application achieves mutual matching between question and answer texts by combining word weights, question sentence weights, answer sentence weights, and whole sentence weights of the question and answer texts. It realizes automatic response to question and answer texts by combining semantic and character features, thereby improving the efficiency and accuracy of the response.

[0069] In step S101 of some embodiments, the question text set refers to the set of question texts raised by the user, which can be determined based on the actual business, and is not limited here.

[0070] For example, in the financial field, a question text set could be a text asking about types of low-risk financial products or types of insurance products.

[0071] Specifically, the response text set refers to the collection of texts that respond to a question. The specific details can be determined based on actual business needs and are not limited here.

[0072] For example, in the financial field, if the question is "What types of insurance are there?", the answer could be "There are many types of insurance. Depending on the insured party and the coverage, they can include life insurance, health insurance, accident insurance, property insurance, liability insurance, credit insurance, and guarantee insurance, etc."

[0073] Specifically, the question and answer text sets can be obtained from a pre-set question and answer database, which can be the company's backend database.

[0074] Please see Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S202:

[0075] Step S201: Encode the question text set to obtain the question word vector set, and encode the response text set to obtain the response word vector set.

[0076] Step S202: Perform pooling operation on the question word vector set to obtain the question sentence feature set, and perform pooling operation on the response word vector set to obtain the response sentence feature set.

[0077] In step S201 of some embodiments, the question word vector set refers to the set of word vector forms of the question text; the response word vector set refers to the set of word vector forms of the response text.

[0078] Specifically, the encoding layer in the trained response model can be used to extract the feature sets of question sentences and response sentences. This response model is a neural network model composed of an encoding layer, a word weighting layer, a sentence weighting layer, a concatenation layer, and a response output layer. The encoding layer generates context-relevant question sentence feature sets from the question text set and context-relevant response sentence feature sets from the response text set. The word weighting layer represents the weight distribution of each word in the question and response sentence feature sets. The sentence weighting layer represents the weight distribution of each sentence composed of each word in the question and response sentence feature sets, improving the model's ability to represent semantic information between sentences. The concatenation layer represents the weight distribution of the overall features combining the input question features and response features. The response output layer outputs the response text that matches the question text.

[0079] In one embodiment of the present invention, when training the response model, the following steps are taken: First, the actual response text corresponding to the question text is obtained. Then, the sentence vector sets of the question text and the response text are extracted through the encoding layer. Next, the word weighting layer is used to assign word weights to the question sentence feature set and the response sentence feature set. Then, the sentence weighting layer is used to perform a weighted summation of the question sentence feature set and the response sentence feature set. Second, the question sentence weight features and the response sentence weight features are masked and spliced ​​through the splicing layer. Then, the response output layer is used to predict the response text that matches the question text set to obtain the predicted response text. Finally, the loss value between the actual response result and the predicted response text is calculated using a loss function. The parameters of the response model are adjusted according to the loss value until the loss value meets a preset threshold, thus obtaining the trained response model.

[0080] Specifically, the loss value can be calculated using the following formula:

[0081]

[0082] Where H represents the loss value, and n represents the total number of features in the question word / phrase feature set and the response sentence feature set; y i p represents the actual response text corresponding to the weight features of the concatenated question sentence, the weight features of the response sentence, and the weight features of the entire sentence after concatenation; i This represents the predicted response text corresponding to the weight features of the question sentence, the response sentence, and the entire sentence after concatenation of the i-th concatenated text.

[0083] Please see Figure 3 In some embodiments, step S201 may include, but is not limited to, steps S301 to S302:

[0084] Step S301: The question text set is segmented using preset identifiers to obtain the question word set, and the response text set is segmented using preset identifiers to obtain the response word set.

[0085] Step S302: Perform word embedding operation on the question word set to obtain question word vectors, and perform word embedding operation on the response word set to obtain response word vectors.

[0086] In step S301 of some embodiments, the preset identifiers include [CLS], [SEP] and [WORD] identifiers; wherein, the [CLS] identifier is used to represent the overall sequence of the input question text set; the [SEP] identifier is used to separate sentences in the input sequence; and the [WORD] identifier is used to identify the boundary of each word in the input sequence.

[0087] For example, in the financial field, if the input question text set is "What types of insurance are there?", then the segmented question word set and response word set could be "[CLS][WORD]insurance[WORD]types[WORD]which[WORD]s[SEP]". If the input response text set is "life insurance, health insurance, accident insurance, property insurance, liability insurance, and credit and guarantee insurance", then the segmented response word set could be "[CLS][WORD]life[WORD]insurance,[WORD]health[WORD]insurance,".

[0088] Accidental injury insurance, property insurance, liability insurance, credit insurance, and guarantee insurance, etc.

[0089] In this embodiment, since the identifier is a symbol without obvious semantic information, segmenting the question text set and the answer text set by the identifier can better integrate the semantic information of each word in the text by combining word and sentence dimensions, thereby better representing the semantics of the whole sentence.

[0090] In step S302 of some embodiments, the word embedding operation can be an embedding operation, which can convert discrete words or symbols (such as words, characters or tokens) into continuous vector representations that capture the semantic and syntactic features of the input words.

[0091] Specifically, embedding operations include Token Embeddings, Segment Embeddings, and Position Embeddings. Token Embeddings provide rich semantic features for each token, enabling the model to understand the meaning of each word and its variations in different contexts. Segment Embeddings help the model distinguish between different sentences or paragraphs, allowing the model to understand whether each token belongs to the question text set or the answer text set when processing sentence pairs. Position Embeddings provide positional information for each token in the input sequence, enabling the model to better capture long-distance dependencies in the sequence.

[0092] In this embodiment, by performing word embedding operations on the question word set and the response word set, question word vectors and response word vectors with contextual semantic relationships can be generated. This can represent the question word set and the response word set as a low-dimensional dense vector space and takes into account the correlation between words in the question text and the response text, thereby more accurately representing the question text set and the response text set.

[0093] In step S202 of some embodiments, the question sentence feature set refers to the set of sentence vector forms of the question text. The response sentence feature set refers to the set of sentence vector forms of the response text.

[0094] Specifically, the pooling operation is a max pooling operation, which sequentially scans all regions of the question word vector set by using a certain number and size of convolution kernels, and extracts feature values ​​from the question word vectors through each convolution kernel. The embedding vectors of all tokens in the question word vector set sequence are aggregated into a single vector to obtain the question sentence feature set.

[0095] Specifically, by sequentially scanning all regions of the response word vector set using a certain number and size of convolutional kernels, and extracting feature values ​​from the response word vectors through each convolutional kernel, the embedding vectors of all tokens in the response word vector set sequence are aggregated into a single vector to obtain the response sentence feature set.

[0096] In this embodiment, by performing pooling operations on the question word vector set and the response word vector set, the sequence of word vector sets can be converted into sentence vectors of a fixed size, i.e., sentence feature sets. These sentence feature sets aggregate the information of the entire sequence and can accurately represent the semantic information between sentences. This achieves the goal of removing some unnecessary features while fully extracting the important features from the question word vector set and the response word vector set. This ensures the semantic representation capability of the sentence feature sets while reducing the computational load of the model, making it easier to improve the efficiency of the model in providing intelligent responses in the future.

[0097] Please see Figure 4 In some embodiments, step S103 may include, but is not limited to, steps S401 to S403:

[0098] Step S401: Calculate word weights for the question sentence feature set and the response sentence feature set using the trained word weight model to obtain word weight features.

[0099] Step S402: Obtain the question word vector set corresponding to the question sentence feature set, and obtain the response word vector set corresponding to the response sentence feature set.

[0100] Step S403: Perform a weighted operation on the question word vector set, the response word vector set, and the word weight features to obtain the weighted word weight features.

[0101] In step S401 of some embodiments, the word weight layer is the trained word weight model, which can be a Transformer model.

[0102] Specifically, word weight features can be calculated using the following formula:

[0103]

[0104] Among them, W n Q represents the weight feature of the nth word; n represents the total number of features in the question word feature set and the response sentence feature set; t represents a question sentence feature or a response sentence feature; Q n,t Q represents the t-th question sentence feature or answer sentence feature in the overall feature set n of the question sentence feature set and the answer sentence feature set; n This represents the overall feature set of the question word / phrase feature set and the response sentence feature set.

[0105] In step S402 of some embodiments, the question word vector set and the response word vector set are the same as those in step S201, and will not be described again here.

[0106] In step S403 of some embodiments, specifically, weighted word weight features can be obtained by multiplying the question word vector set and the response word vector set obtained after embedding with the word weight features.

[0107] Specifically, the weighted word weight features can be represented by the following formula:

[0108] E weight =E n *W n

[0109] Among them, E weight E represents the weighted word weight feature; n = [e1,e2…e n ] represents the word vector of the nth question or the word vector of the answer; W n This represents the weight feature of the nth word.

[0110] Among them, E weight Including E A and E B E A E represents the weight feature of the question word. B This represents the weight features of the response words, and the total number of question word weight features and response word weight features is also n.

[0111] In this embodiment, by performing a weighted operation on the question word vector set, the response word vector set, and the word weight features, the weight distribution of each word in the question sentence feature set and the response sentence feature set can be redefined. This distinguishes the situation where the same word has different weights in different contexts, and further gives more attention to important words in the context, thereby improving the semantic representation of the features and facilitating the improvement of the accuracy of subsequent responses.

[0112] Please see Figure 5 In some embodiments, step S104 may also include, but is not limited to, steps S501 to S502:

[0113] Step S501: Obtain the length of the question sentence in the question sentence feature set and the number of question words contained in the question sentence length; obtain the length of the response sentence in the response sentence feature set and the number of response words contained in the response sentence length.

[0114] Step S502: Perform an average weighting operation on the question sentence feature set based on the weighted word weight features, the question sentence length, and the number of question words to obtain the question sentence weight features. Perform an average weighting operation on the response sentence feature set based on the weighted word weight features, the response sentence length, and the number of response words to obtain the response sentence weight features.

[0115] In step S501 of some embodiments, specifically in the word embedding operation, the length of the question sentence and the length of the response sentence can be read through the [SEP] identifier. The sentence weight layer is used to represent the weight distribution of each sentence composed of each word in the question sentence feature set and the response sentence feature set, thereby improving the model's ability to learn and represent semantic information between sentences.

[0116] Specifically, the number of question words refers to the number of question words contained in the length of the question sentence; the number of response words refers to the number of response words contained in the length of the response sentence.

[0117] In step S502 of some embodiments, the weight features of the question sentence can be obtained by the following formula:

[0118]

[0119] Among them, E a_weightsum Indicates the weight feature of the question sentence; d A Indicates the length of the question sentence; A indicates the number of question words; E A This represents the weighted feature of the question word in the weighted word weight feature.

[0120] Specifically, the weight features of the response sentence can be obtained using the following formula:

[0121]

[0122] Among them, E B_weightsum Indicates the weight feature of the response sentence; d B B indicates the length of the response sentence, and E indicates the number of words in the response. B This represents the response word weight feature in the weighted word weight feature.

[0123] Specifically, it can be determined from E based on the [SEP] identifier. weight Extract the weighted word weight feature E belonging to feature A of the question sentence. A And the weighted word weight feature E belonging to response sentence feature B B .

[0124] In this embodiment, by performing an average weighting operation on the question sentence feature set based on the weighted word weight features, the question sentence length, and the number of question words, and by performing an average weighting operation on the response sentence feature set based on the weighted word weight features, the response sentence length, and the number of response words, the weight distribution of each sentence composed of each word in the question sentence feature set and the response sentence feature set can be determined. This helps to understand each sentence more accurately. Furthermore, by averaging the weighted results, the representation degree of different sentences can be balanced, avoiding the situation where the representation of one sentence dominates the representation of the entire input sequence, which can further improve the accuracy of sentence representation of semantic features.

[0125] Please see Figure 6 In some embodiments, step S105 includes, but is not limited to, steps S601 to S603:

[0126] Step S601: Obtain the question boundary identifier and question filling identifier of the question sentence weight feature, and obtain the response boundary identifier and response filling identifier of the response sentence weight feature;

[0127] Step S602: Perform a masking operation on the question boundary identifier and the question filling identifier to obtain the masked question sentence weight features; perform a masking operation on the response boundary identifier and the response filling identifier to obtain the masked response sentence weight features.

[0128] Step S603: Concatenate the masked question sentence weight features with the masked response sentence weight features to obtain the whole sentence weight features.

[0129] In step S601 of some embodiments, the boundary identifier is the [WORD] identifier.

[0130] Specifically, during the masking process, since the lengths of the question sentence weight features and the response sentence weight features need to be consistent with the length of the overall input sequence in order to process the features together in the model, when the length of the question sentence weight features or the response sentence weight features is shorter than the length of the overall sequence, padding is performed at the shorter positions to ensure the consistency of the length sequence.

[0131] Specifically, padding can be used to represent fill indicators.

[0132] In step S602 of some embodiments, the mask operation can be implemented through the model's self-attention mechanism.

[0133] Specifically, a mask vector of the same length as the input sequence is determined using the first attention_mask (self-attention mask). Each element of this vector is either 0 or 1; 1 corresponds to the actual input data of the token (such as insurance), and 0 corresponds to the pad (padding marker), which has no specific meaning. A second attention_mask is also used to mask the [WORD] identifier, making its corresponding feature 0. This ensures that when calculating self-attention for the token, the attention_mask is used to weight the attention score corresponding to the token, guaranteeing that the model does not focus on the masked position.

[0134] In this embodiment, by masking the question boundary identifier and question filling identifier, and by masking the response boundary identifier and response filling identifier, the model can focus on effective input when processing sequence data, while ignoring unnecessary filling information and boundary identifier information, thus improving the efficiency of the model's response. Furthermore, by ignoring the boundary identifier, the model can be trained in conjunction with traditional semantic similarity features, thereby improving the accuracy of the response.

[0135] In step S603 of some embodiments, the whole sentence weight feature refers to the common feature sequence of the question sentence feature set and the response sentence feature set input by the model.

[0136] Specifically, in the splicing layer, the weight features of the [CLS] identifier and the masked question sentence and the masked response sentence can be used as the weight features of the whole sentence.

[0137] Please see Figure 7 In some embodiments, step S106 may include, but is not limited to, steps S701 to S702:

[0138] Step S701: Calculate the semantic matching degree between the question sentence feature set and the response sentence feature set based on the question sentence weight features, response sentence weight features, and whole sentence weight features.

[0139] Step S702: Based on the semantic matching degree, find the target response text that matches the question text set from the response text set.

[0140] In step S701 of some embodiments, the semantic similarity between the question sentence feature set and the response sentence feature set can be calculated using cosine similarity, Euclidean distance or Jaccard similarity calculation methods.

[0141] In step S702 of some embodiments, a target response text that matches the question text set is found from the response text set based on the semantic matching degree.

[0142] For example, the question text set is "I want to buy medical insurance for my whole family, please recommend suitable types of insurance"; while the response text set includes comprehensive family medical insurance, critical illness insurance, accident insurance, and outpatient medical insurance, etc. Among them, the semantic matching degree of comprehensive family medical insurance is 0.98, that of critical illness insurance is 0.78, that of accident insurance is 0.6, and that of outpatient medical insurance is 0.8. Therefore, comprehensive family medical insurance with a semantic matching degree of 0.98 is selected as the target response text.

[0143] Specifically, the system can respond to a set of questions based on the target response text, meaning that intelligent customer service can use the target response text to answer customer questions.

[0144] For example, if a customer's question text is "I have 100,000 yuan of idle funds and want to make short-term investments. Please give me some investment advice," the intelligent customer service can reply with "Based on the amount of idle funds and the investment period, you can consider money market funds or short-term bond funds."

[0145] In this embodiment, by finding the target response text that matches the question text set from the response text set based on the question sentence weight features, response sentence weight features, and whole sentence weight features, semantic representation can be performed by combining word, sentence dimensions, and traditional sentence feature dimensions, which improves the accuracy of the response. Furthermore, by responding to the question text set based on the target response text, the system can automatically respond to the question and answer texts, thereby improving the efficiency of the response.

[0146] This application's embodiments involve acquiring a question text set and a response text set; extracting features from the question text set to obtain a question sentence feature set, and extracting features from the response text set to obtain a response sentence feature set; assigning word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features; performing a weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and performing a weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features; performing a masking and splicing operation on the question sentence weight features and the response sentence weight features to obtain whole sentence weight features; and finding the target response text that matches the question text set from the response text set based on the question sentence weight features, response sentence weight features, and whole sentence weight features, and then responding to the question text set based on the target response text. This application achieves mutual matching between question and response texts by combining the word weights, question sentence weight features, response sentence weight features, and whole sentence weight features of the question and response texts, realizing automatic responses to question and response texts by combining semantic and character features, thereby improving the efficiency and accuracy of responses.

[0147] Please see Figure 8 This application also provides an intelligent response device that can implement the above-described intelligent response method. The device includes:

[0148] The text acquisition module is used to acquire the question text set and the answer text set;

[0149] The feature extraction module is used to extract features from the question text set to obtain a question sentence feature set, and to extract features from the response text set to obtain a response sentence feature set;

[0150] The weight allocation module is used to allocate word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features;

[0151] The sentence weighting module is used to perform weighted summation on the question sentence feature set according to the weighted word weight features to obtain the question sentence weight features, and to perform weighted summation on the response sentence feature set according to the weighted word weight features to obtain the response sentence weight features;

[0152] The mask stitching module is used to perform a mask stitching operation on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the whole sentence.

[0153] The intelligent response module is used to find the target response text that matches the question text set from the response text set based on the question sentence weight feature, the response sentence weight feature and the whole sentence weight feature, and to respond to the question text set based on the target response text.

[0154] The specific implementation of this intelligent response device is basically the same as the specific embodiment of the intelligent response method described above, and will not be repeated here.

[0155] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described intelligent response method. This electronic device can be any intelligent terminal, including tablet computers, in-vehicle computers, etc.

[0156] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0157] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0158] The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the intelligent response method of the embodiments of this application.

[0159] The 903 input / output interface is used to implement information input and output.

[0160] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0161] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);

[0162] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.

[0163] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described intelligent response method.

[0164] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0165] The intelligent response method, intelligent response device, electronic device, and storage medium provided in this application embodiment acquire a question text set and a response text set; extract features from the question text set to obtain a question sentence feature set, and extract features from the response text set to obtain a response sentence feature set; assign word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features; perform weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and perform weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features; perform masking and splicing operation on the question sentence weight features and the response sentence weight features to obtain whole sentence weight features; find the target response text that matches the question text set from the response text set based on the question sentence weight features, the response sentence weight features, and the whole sentence weight features, and respond to the question text set based on the target response text. This application achieves mutual matching between question and answer texts by combining word weights, question sentence weights, answer sentence weights, and whole sentence weights of the question and answer texts. It realizes automatic response to question and answer texts by combining semantic and character features, thereby improving the efficiency and accuracy of the response.

[0166] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0167] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0168] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0169] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0170] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0171] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0172] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, or indirect coupling or communication connection between the apparatus or units, and may be electrical, mechanical, or other forms.

[0173] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0174] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0175] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0176] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. An intelligent response method, characterized in that, The method includes: Retrieve the question text set and the answer text set; Feature extraction is performed on the question text set to obtain a question sentence feature set, and feature extraction is performed on the response text set to obtain a response sentence feature set; The question sentence feature set and the response sentence feature set are weighted by word weights to obtain weighted word weight features; The question sentence feature set is weighted and summed according to the weighted word weight features to obtain the question sentence weight features. The response sentence feature set is weighted and summed according to the weighted word weight features to obtain the response sentence weight features. A masking and splicing operation is performed on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the entire sentence. Based on the question sentence weight features, the response sentence weight features, and the whole sentence weight features, the target response text that matches the question text set is found from the response text set, and the question text set is responded to based on the target response text.

2. The method according to claim 1, characterized in that, The step of assigning word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features includes: The word weight features are obtained by calculating word weights on the question sentence feature set and the response sentence feature set using the trained word weight model. Obtain the question word vector set corresponding to the question sentence feature set, and obtain the response word vector set corresponding to the response sentence feature set; The question word vector set, the response word vector set, and the word weight features are weighted to obtain the weighted word weight features.

3. The method according to claim 1, characterized in that, The step of performing a weighted summation on the question sentence feature set based on the weighted word weight features to obtain question sentence weight features, and performing a weighted summation on the response sentence feature set based on the weighted word weight features to obtain response sentence weight features, includes: Obtain the length of the question sentence in the question sentence feature set and the number of question words contained in the question sentence length; obtain the length of the response sentence in the response sentence feature set and the number of response words contained in the response sentence length. The question sentence feature set is averaged and weighted according to the weighted word weight features, the question sentence length, and the number of question words to obtain the question sentence weight features. The response sentence feature set is averaged and weighted according to the weighted word weight features, the response sentence length, and the number of response words to obtain the response sentence weight features.

4. The method according to claim 1, characterized in that, The step of performing a masking and concatenation operation on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the entire sentence includes: Obtain the question boundary identifier and question filling identifier of the question sentence weight feature, and obtain the response boundary identifier and response filling identifier of the response sentence weight feature; A masking operation is performed on the question boundary identifier and the question filling identifier to obtain masked question sentence weight features; a masking operation is performed on the response boundary identifier and the response filling identifier to obtain masked response sentence weight features. The weight features of the masked question sentence and the weight features of the masked response sentence are concatenated to obtain the weight features of the whole sentence.

5. The method according to any one of claims 1 to 4, characterized in that, The step of extracting features from the question text set to obtain a question sentence feature set, and extracting features from the response text set to obtain a response sentence feature set, includes: The question text set is encoded to obtain a question word vector set, and the response text set is encoded to obtain a response word vector set; The question word vector set is pooled to obtain the question sentence feature set, and the response word vector set is pooled to obtain the response sentence feature set.

6. The method according to claim 5, characterized in that, The process of encoding the question text set to obtain a question word vector set, and encoding the response text set to obtain a response word vector set, includes: The question text set is segmented using preset identifiers to obtain a question word set, and the response text set is segmented using preset identifiers to obtain a response word set. The question word set is subjected to word embedding operation to obtain the question word vector, and the response word set is subjected to word embedding operation to obtain the response word vector.

7. The method according to claim 6, characterized in that, The step of finding the target response text that matches the question text set from the response text set based on the question sentence weight feature, the response sentence weight feature, and the whole sentence weight feature includes: The semantic matching degree between the question sentence feature set and the response sentence feature set is calculated based on the question sentence weight feature, the response sentence weight feature, and the whole sentence weight feature. Based on the semantic matching degree, the target response text that matches the question text set is found from the response text set.

8. An intelligent response device, characterized in that, The device includes: The text acquisition module is used to acquire the question text set and the answer text set; The feature extraction module is used to extract features from the question text set to obtain a question sentence feature set, and to extract features from the response text set to obtain a response sentence feature set; The weight allocation module is used to allocate word weights to the question sentence feature set and the response sentence feature set to obtain weighted word weight features; The sentence weighting module is used to perform weighted summation on the question sentence feature set according to the weighted word weight features to obtain the question sentence weight features, and to perform weighted summation on the response sentence feature set according to the weighted word weight features to obtain the response sentence weight features; The mask stitching module is used to perform a mask stitching operation on the weight features of the question sentence and the weight features of the response sentence to obtain the weight features of the whole sentence. The intelligent response module is used to find the target response text that matches the question text set from the response text set based on the question sentence weight feature, the response sentence weight feature and the whole sentence weight feature, and to respond to the question text set based on the target response text.

9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the intelligent response method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the intelligent response method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Question and answer matching method, question and answer matching device, electronic equipment and storage medium

    CN115033674A

  • Reply method and device and electronic equipment

    CN117808096A