Response text recommendation method and device, electronic equipment and storage medium
By obtaining and processing multiple text features of the target object, constructing entity relationship sub-graphs and extracting embedded features, the problem of insufficient intention understanding in the prior art is solved, and the accuracy of reply text recommendations is improved.
Patent Information
- Application Number
- CN202411375024.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The prior art lacks understanding of the object's intention in the reply text recommendation, which affects the accuracy of the recommendation.
By obtaining the target problem text, object preference text, historical dialogue text and candidate reply text of the target object, text encoding and feature extraction are carried out, target entity relationship sub-graphs are constructed, entity embedding features are extracted, and candidate reply text is recommended based on these features.
Improve the accuracy of identifying the intent of the query object, thereby improving the accuracy of recommendation of the reply text.
Smart Images

Figure CN119622079A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology, and in particular to a reply text recommendation method and device, electronic device, and storage medium. Background Art
[0002] Response text recommendation is a method that provides response text recommendation services for questions raised by objects through natural language dialogue, such as news websites, social media, online video platforms, etc. For example, in the insurance information query of FinTech, if the user wants to query information about credit cards, specific product recommendations, insurance policies, etc., he can enter the question to be queried to get the corresponding response content.
[0003] At present, related technologies usually use graph neural networks to implement reply text recommendations, such as robust graph convolutional networks (RGCN), knowledge-aware graph networks (KagNet), etc., or use language model-based methods to implement reply text recommendations, such as the unified question answering framework (Unified Question Answering, UnifiedQA). However, these methods do not have a sufficient understanding of the object's intent, which affects the accuracy of reply text recommendations. Therefore, how to more accurately identify the intent of the query object, thereby improving the accuracy of reply text recommendations, has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a reply text recommendation method and device, electronic device, and storage medium, aiming to more accurately identify the intention of the query object, thereby improving the accuracy of reply text recommendations.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a reply text recommendation method, the method comprising:
[0006] Obtaining a target question text, a target preference text, a historical conversation text, and candidate answer texts of the target question text of the target object;
[0007] Performing text encoding processing on the object preference text to obtain object preference features;
[0008] Performing text encoding processing on the historical conversation text to obtain historical conversation features;
[0009] Performing text splicing on the target question text and the candidate answer text to obtain a question-answer splicing text, and performing text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature;
[0010] Constructing a subgraph based on the target question text, the candidate answer text, the historical conversation features, and the question-answer concatenation features to obtain a target entity relationship subgraph;
[0011] Based on the target entity relationship subgraph, embedded entity features are extracted to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features;
[0012] Based on the object preference feature, the question-answer concatenation feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature, feature concatenation is performed to obtain a target question-answer feature;
[0013] The candidate answer texts are recommended based on the target question and answer features.
[0014] In some embodiments, a subgraph is constructed based on the target question text, the candidate answer text, the historical conversation features, and the question-answer concatenation features to obtain a target entity relationship subgraph, including:
[0015] Perform entity extraction on the target question text based on a preset knowledge graph to obtain question entity data;
[0016] Perform entity extraction on the candidate reply text based on the preset knowledge graph to obtain reply entity data;
[0017] Constructing an entity relationship graph based on the question entity data and the answer entity data to obtain an initial entity relationship subgraph;
[0018] The initial entity relationship subgraph is updated based on the historical conversation features and the question-answer concatenation features to obtain the target entity relationship subgraph.
[0019] In some embodiments, the initial entity relationship subgraph includes a first subgraph node, the first subgraph node corresponds to a target question entity in the question entity data and a target answer entity in the answer entity data, and the subgraph updating of the initial entity relationship subgraph based on the historical conversation feature and the question-answer concatenation feature to obtain the target entity relationship subgraph includes:
[0020] Determine a second subgraph node based on the historical conversation feature and the question-answer concatenation feature;
[0021] Perform entity relationship extraction based on the question-answer concatenation feature and the target question entity to obtain a first entity relationship;
[0022] Perform entity relationship extraction based on the question-answer concatenation feature and the target answer entity to obtain a second entity relationship;
[0023] Extracting entity relationships based on the historical conversation features and the question-answer concatenation features to obtain a third entity relationship;
[0024] The initial entity relationship subgraph is updated based on a preset graph attention network, the first subgraph node, the second subgraph node, the first entity relationship, the second entity relationship and the third entity relationship to obtain the target entity relationship subgraph.
[0025] In some embodiments, the extracting of embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features includes:
[0026] Based on the target entity relationship subgraph, embedding entity features are extracted from the historical conversation features to obtain the target question entity embedding features;
[0027] Based on the target entity relationship subgraph, embedding entity features are extracted from the question-answer concatenation features to obtain the target dialogue entity embedding features;
[0028] Extracting embedded entity features of the remaining entities based on the target entity relationship subgraph to obtain remaining entity embedded features;
[0029] Performing feature preprocessing on the remaining entity embedding features based on a preset number of sub-graph entity embeddings to obtain preprocessed embedding features;
[0030] The preprocessed embedding features are pooled to obtain the entity joint embedding features.
[0031] In some embodiments, the performing text recommendation on the candidate answer text based on the target question and answer feature includes:
[0032] Performing feature conversion on the target question-answer feature to obtain a linear question-answer feature;
[0033] Normalizing the linear question-answering features to obtain a semantic matching result;
[0034] The candidate reply texts are recommended based on the semantic matching results.
[0035] In some embodiments, performing feature conversion on the target question-answer feature to obtain a linear question-answer feature includes:
[0036] Performing linear mapping on the target question-answer feature to obtain a linearly mapped question-answer feature;
[0037] Performing linear rectification on the linear mapping question-answer feature to obtain a linear rectification question-answer feature;
[0038] Linear mapping is performed on the linear rectified question-answering feature to obtain a linear question-answering feature.
[0039] In some embodiments, the performing text recommendation on the candidate reply text based on the semantic matching result includes:
[0040] Determining a target reply text from the candidate reply texts based on the semantic matching result;
[0041] Based on a pre-trained dialogue language model, a dialogue response is generated for the target question text and the target answer text to obtain a recommended answer text.
[0042] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a reply text recommendation device, the device comprising:
[0043] An acquisition module, used to acquire a target question text, a target object's preference text, a historical conversation text, and candidate answer texts for the target question text;
[0044] A first encoding module, used for performing text encoding processing on the object preference text to obtain object preference features;
[0045] A second encoding module is used to perform text encoding processing on the historical conversation text to obtain historical conversation features;
[0046] A third encoding module is used to perform text splicing on the target question text and the candidate answer text to obtain a question-answer splicing text, and perform text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature;
[0047] A subgraph construction module, used to construct a subgraph based on the target question text, the candidate answer text, the historical conversation features and the question-answer concatenation features to obtain a target entity relationship subgraph;
[0048] A feature extraction module is used to extract embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features;
[0049] A splicing module, configured to perform feature splicing based on the object preference feature, the question-answer splicing feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature to obtain a target question-answer feature;
[0050] A recommendation module is used to recommend the candidate answer text based on the target question and answer features.
[0051] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0052] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0053] The present application proposes a reply text recommendation method and device, electronic device, and storage medium, which obtains a target question text, an object preference text, a historical conversation text, and a candidate reply text of the target question text of a target object; further, performs text encoding processing on the object preference text to obtain an object preference feature; performs text encoding processing on the historical conversation text to obtain a historical conversation feature; performs text splicing on the target question text and the candidate reply text to obtain a question-answer splicing text, and performs text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature; further, performs sub-graph construction based on the target question text, the candidate reply text, the historical conversation feature, and the question-answer splicing feature to obtain a target entity relationship sub-graph; performs embedded entity feature extraction based on the target entity relationship sub-graph to obtain a target question entity embedding feature, a target conversation entity embedding feature, and an entity joint embedding feature; further, performs feature splicing based on the object preference feature, the question-answer splicing feature, the target question entity embedding feature, the target conversation entity embedding feature, and the entity joint embedding feature to obtain a target question-answer feature; further, performs text recommendation on the candidate reply text based on the target question-answer feature. Compared with related technologies, this application judges candidate reply texts by combining object preference text, historical conversation text and question-and-answer splicing text, which can better focus on the background knowledge of the target object, thereby improving the accuracy of intention recognition of the target object, and then making more accurate judgments on candidate reply texts to improve the recommendation accuracy of reply texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a flow chart of a reply text recommendation method provided by an embodiment of the present application;
[0055] Figure 2 yes Figure 1 A flowchart of step S150 in FIG.
[0056] Figure 3 yes Figure 2 A flowchart of step S240 in FIG.
[0057] Figure 4 yes Figure 1A flowchart of step S160 in FIG.
[0058] Figure 5 yes Figure 1 A flowchart of step S180 in FIG.
[0059] Figure 6 yes Figure 5 A flowchart of step S510 in FIG.
[0060] Figure 7 yes Figure 5 A flowchart of step S530 in FIG.
[0061] Figure 8 is a structural diagram of a reply text recommendation device provided in an embodiment of the present application;
[0062] Fig. 9 It is a hardware structure diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0064] It should be noted that, although the functional modules are divided in the device schematic diagram and the 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 above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0066] First, some nouns involved in this application are analyzed:
[0067] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0068] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0069] Knowledge Graph: An information system for storing and representing knowledge that can organize entities and their relationships in the form of a graph. Knowledge graphs are usually composed of nodes (representing entities, such as people, places, things, etc.) and edges (representing relationships between entities). This structure enables knowledge to be represented and queried in an intuitive way.
[0070] Robustly Optimized BERT Pre-training Approach (RoBERTa): is a large-scale language pre-training model based on a variant of BERT. RoBERTa aims to provide an efficient and optimized BERT model by improving the pre-training strategy to improve performance on a variety of natural language processing tasks.
[0071] Multi-Layer Perceptron (MLP): It is a basic feedforward neural network model and also a directional structured artificial neural network.
[0072] Sigmoid function: is an S-shaped curve function that compresses the input value between 0 and 1 so that the extreme values of the input are close to 0 or 1.
[0073] Rectified Linear Unit (ReLU): is a nonlinear activation function that implements nonlinear transformation through a simple threshold judgment. When the input is positive, the output is the same as the input, and when the input is negative or zero, the output is zero. This design makes ReLU very efficient in computation and helps alleviate the gradient vanishing problem when training deep networks.
[0074] Response text recommendation is a method that provides response text recommendation services for questions raised by objects through natural language dialogue, such as news websites, social media, online video platforms, etc. For example, in the insurance information query of FinTech, if the user wants to query information about credit cards, specific product recommendations, insurance policies, etc., he can enter the question to be queried to get the corresponding response content.
[0075] At present, the related technologies that use knowledge graphs to implement dialogue question-answering can be divided into two categories: (1) using methods based on graph neural networks to implement reply text recommendation, that is, graph neural networks such as graph convolutional networks and graph attention networks can be used to encode knowledge graphs and answer questions based on graph reasoning, such as robust graph convolutional networks (RGCN) and knowledge-aware graph networks (KagNet); (2) using methods based on language models to implement reply text recommendation, that is, language models such as BERT can be used to understand question semantics and combine knowledge graphs for question answering, such as unified question answering framework (UnifiedQA) and question answering with graph neural networks (QA-GNN). However, when these methods are applied to specific question-answering scenarios, they do not fully understand the intent of the object, which affects the accuracy of reply text recommendation. Therefore, how to more accurately identify the intent of the query object and improve the accuracy of reply text recommendation has become a technical problem that needs to be solved urgently.
[0076] Based on this, the embodiments of the present application provide a reply text recommendation method and device, an electronic device, and a storage medium, which aim to more accurately identify the intention of the query object, thereby improving the accuracy of reply text recommendations.
[0077] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0078] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0079] The reply text recommendation method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The recommendation method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the reply text recommendation method, etc., but is not limited to the above forms.
[0080] The present application can be used in many general or special computer system environments or configurations. For example: 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, distributed computing environments including any of the above systems or devices, etc. The present 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. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0081] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to the identity or characteristics of the object, such as object portrait information, object behavior data, and object historical behavior data, the permission or consent of the object will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain sensitive personal information of the object, the separate permission or separate consent of the object will be obtained through a pop-up window or jump to a confirmation page. After clearly obtaining the separate permission or separate consent of the object, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0082] See also Figure 1 , Figure 1 is an optional flow chart of the reply text recommendation method provided by the embodiment of the present application. In some embodiments of the present application, Figure 1 The method may specifically include but is not limited to steps S110 to S180.
[0083] Step S110, obtaining the target question text, the object preference text, the historical conversation text and the candidate answer text of the target question text of the target object;
[0084] Step S120, performing text encoding processing on the object preference text to obtain the object preference feature;
[0085] Step S130, performing text encoding processing on the historical conversation text to obtain historical conversation features;
[0086] Step S140, concatenating the target question text and the candidate answer text to obtain a question-answer concatenated text, and performing text encoding processing on the question-answer concatenated text to obtain a question-answer concatenated feature;
[0087] Step S150, constructing a subgraph based on the target question text, the candidate answer text, the historical conversation features, and the question-answer concatenation features to obtain a target entity relationship subgraph;
[0088] Step S160, extracting embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features;
[0089] Step S170, performing feature splicing based on the object preference feature, the question and answer splicing feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature to obtain the target question and answer feature;
[0090] Step S180, recommending candidate answer texts based on the target question and answer features.
[0091] Compared with the related art, the steps S110 to S180 of the present application judge the candidate reply text by combining the object preference text, the historical conversation text and the question-answer concatenation text, which can better focus on the background knowledge of the target object, thereby improving the accuracy of the recognition of the intention of the target object, and then more accurately judge the candidate reply text to improve the accuracy of the reply text recommendation. In the field of financial technology, the reply text recommendation method provided by the embodiment of the present application can be applied to investment consulting scenarios (such as answering questions about investment advice, market trends, risk assessment, etc.), financial product query scenarios (such as answering information queries about credit cards, loan products, insurance policies, etc.), financial norm interpretation scenarios (such as explaining financial regulations to help the object understand the connotation and scope of application of laws and regulations), etc., that is, it is used to recommend replies to questions raised by the object.
[0092] It should be noted that this solution is not limited to recommended responses being text only, but may also be structures, images, videos, etc., which are not limited here.
[0093] In step S110 of some embodiments, the target object may be a user of each application platform, a consumer group, etc. For example, in the field of personalized article recommendation, the target object may be a user who reads an article; in the field of personalized online shopping malls, the target object may be a buyer who purchases goods. The target object may enter the questions he wants to ask in the consultation interface of the target application, and the target application may use the reply text recommendation method of the present application to recommend more accurate reply content for the target object. Since the preferences and personal characteristics of each target object are different, even if the same target question text is entered, the obtained reply content should be different. However, when facing dialogue questions such as financial question-and-answer scenarios, the relevant technology does not have enough understanding of the background knowledge and intentions of the target object, resulting in inaccurate recommended reply content. The target application refers to the program software that the target object is browsing and using.
[0094] It should be noted that the target question text is used to represent the text of the problem to be solved input by the target object, and the answer content that can accurately answer the question needs to be obtained. For example, in the financial product query scenario, the target question text q can be "I am interested in index funds. How can I choose an index fund that suits me?"
[0095] It should be noted that the object preference text is used to characterize the personalized preference information of the target object in the scenario associated with the target question text, that is, the target object's past preference data, such as favorite investment methods, topics of concern, etc. The object preference text is used to characterize the characteristic information of the target object itself, and can be obtained through other public channels without specific limitation. In addition, if the personalized preference information of the target object collected is not in text form, the present application can also perform entity extraction on this information to obtain the object preference text, that is, the object preference text can be a collection of multiple keywords that can characterize the personalized preferences of the object. In the financial product query scenario, the object preference text s of the target object can be "['long-term investment', 'high-risk preference']".
[0096] It should be noted that the historical dialogue text can be a multi-round dialogue text of the target object in the scene associated with the target question text, including the questions previously raised by the target object and the answers of the system. For example, before entering the target question text, the target object of this application has had multiple rounds of dialogue in the target application. At this time, the historical dialogue text c may include "(Question Q1: "I have a sum of investable funds, but I hope to pursue higher returns. Are there any investment products suitable for me?", Reply A1: "Knowing your investment preferences and risk attitude, I can give you some advice."), (Question Q2: "I plan to invest the funds for more than 5 years.", Reply A2: "Based on your investment preferences and risk attitude, you can consider the following medium- and long-term investment products: stock funds, index funds or growth funds. These products usually have higher return potential, but are also accompanied by corresponding risks.")", so that a historical dialogue text containing two rounds of dialogue can be obtained. Among them, this application can select a specific number of historical dialogue texts according to the actual computing speed requirements and computing accuracy requirements, which are not specifically limited here.
[0097] It should be noted that the present application can first match the answer text to the target question text through a text matching model to obtain at least one candidate answer text. In order to improve the accuracy of the recommendation of the answer content, the present application will process each candidate answer text to determine the corresponding target question and answer features, thereby determining the degree of match between the candidate answer text and the target question text. For example, for the target question text q input by the target object, "I am interested in index funds. How do I choose an index fund that suits me?", the present application can obtain multiple candidate answer texts, which can be expressed as "["Target Index", "Tracking Error", "Expense Ratio", "Historical Performance", "Fund Size"], that is, five candidate answer texts can be included at this time.
[0098] In step S120 of some embodiments, the present application may input the target question text, the object preference text, the historical conversation text, and the candidate answer text of the target question text into a pre-trained answer text recommendation model, which may include an object encoding sub-model, a conversation encoding sub-model, a question-answer encoding sub-model, a sub-graph construction sub-model, an embedding feature extraction sub-model, and a text recommendation sub-model. Based on this, the present application may perform text encoding processing on the object preference text based on the object encoding sub-model to obtain the object preference feature.
[0099] The present application can convert the object preference text in natural language form into a feature vector through the object encoding sub-model, and the object encoding sub-model can be constructed based on structures such as BERT and Word2Vec to obtain object preference features for subsequent models to understand the needs of object personalization. For example, the object preference text is "['Long-term investment', 'High-risk preference']", which can represent the investment preference and risk attitude of the target object. At this time, all the texts in the object preference text can be spliced to obtain s1 = "Long-term investment [CLS] High-risk preference", where [CLS] is used to represent the beginning of the sentence in the text, which can correspond to the word vector of the first word in the input text, and the first neuron in the output layer of the model can usually be used to predict the category of the text. Furthermore, the spliced object preference text can be subjected to text encoding processing based on the object encoding sub-model to obtain the object preference feature. Among them, the object preference feature can be the CLS partial vector output by the object encoding sub-model constructed based on BERT, which can be expressed as s2 = BERT_cls (s1).
[0100] In step S130 of some embodiments, the present application may perform text encoding processing on the historical conversation text based on the conversation encoding sub-model to obtain historical conversation features. Specifically, the present application may first perform text splicing on the acquired historical conversation text, and then input the spliced text into the conversation encoding sub-model for text encoding processing. Among them, the conversation encoding sub-model may be constructed based on a pre-trained language model, such as a model constructed by BERT, RoBERTa, etc., that is, the conversation encoding sub-model and the object encoding sub-model may be the same or different, without limitation.
[0101] For example, two rounds of historical dialogue texts are selected as c = "(Question Q1: "I have a sum of investable funds, but I hope to pursue higher returns. Are there any investment products suitable for me?", Answer A1: "Knowing your investment preferences and risk attitude, I can give you some suggestions."), (Question Q2: "I plan to invest the funds for more than 5 years.", Answer A2: "Based on your investment preferences and risk attitude, you can consider the following medium- and long-term investment products: stock funds, index funds or growth funds. These products usually have higher return potential, but are also accompanied by corresponding risks.")", and the two rounds of historical dialogue texts are analyzed. The concatenation of the rows yields c1 = "[CLS] I have an investable fund, but I hope to pursue a higher return. Are there any investment products suitable for me? [SEP] Knowing your investment preferences and risk attitude, I can give you some advice. [SEP] I plan to invest the funds for more than 5 years. [SEP] Based on your investment preferences and risk attitude, you can consider the following medium- and long-term investment products: stock funds, index funds, or growth funds. These products generally have higher return potential, but are also accompanied by corresponding risks. [SEP]", where [SEP] is used to indicate the end of a sentence or document and is used to segment different sentences. Further, the concatenated historical conversation text is encoded based on the conversation encoding sub-model to obtain the historical conversation features representing the conversation context features, i.e., c2 = RoBERTa_cls(c1), RoBERTa represents the model structure of the conversation encoding sub-model, and RoBERTa_cls represents the output corresponding to the [CLS] token of RoBERTa.
[0102] In the above embodiments, the present application enables the model to better understand the object's intention and improve the accuracy of the recommendation of the reply text by considering personalized object preference features and historical conversation features that can reflect the object's historical interaction habits.
[0103] In step S140 of some embodiments, the present application will also merge the target question text and the candidate answer text to form a question-answer concatenation text, and further encode the question-answer concatenation text through the question-answer encoding sub-model to learn the relationship between the candidate answer text and the target text question. The question-answer encoding sub-model can be the same as the dialogue encoding sub-model and the object encoding sub-model, or it can be different, without limitation, and can be constructed based on a pre-trained language model, such as BERT, RoBERTa, etc.
[0104] For example, by concatenating the target question text q and a candidate answer text, we can get a question-answer concatenation text qa = "I am interested in index funds. How do I choose an index fund that suits me? [CLS] target index", and further use the question-answer encoding sub-model built based on RoBERTa to encode the question-answer concatenation text, and take the CLS part of the RoBERTa output to obtain the question-answer concatenation feature q1 = RoBERTa_cls(qa).
[0105] In step S150 of some embodiments, in order to further determine the relationship between the target question text, historical conversation text and candidate answer text, the present application may construct a subgraph based on the target question text, candidate answer text, historical conversation features and question-answer concatenation features to obtain a target entity relationship subgraph, so as to form a visual representation of the relationship between entities, thereby facilitating the subsequent extraction of key features.
[0106] See also Figure 2 , Figure 2 It is a specific flow chart of step S150 provided in an embodiment of the present application. In some embodiments of the present application, step S150 may specifically include but is not limited to steps S210 to S240.
[0107] Step S210, extracting entities from the target question text based on a preset knowledge graph to obtain question entity data;
[0108] Step S220, extracting entities from the candidate reply text based on a preset knowledge graph to obtain reply entity data;
[0109] Step S230, constructing an entity relationship graph based on the question entity data and the answer entity data to obtain an initial entity relationship subgraph;
[0110] Step S240, updating the initial entity relationship subgraph based on the historical dialogue features and the question-answer concatenation features to obtain the target entity relationship subgraph.
[0111] In step S210 and step S220 of some embodiments, the preset knowledge graph refers to a pre-constructed knowledge graph related to the field to which the target question text belongs, a database containing a large number of entities and their relationships in the field. At this time, the target question text and the candidate answer text can be respectively extracted based on the preset knowledge graph to extract the entities in the text. Among them, the algorithm used for entity extraction can be an entity recognition algorithm, such as named entity recognition (NER), etc., to extract the entities in the text and match them with the corresponding entities in the preset knowledge graph to obtain question entity data and answer entity data. Question entity data refers to the key entities and related information extracted from the target question text, and answer entity data refers to the key entities and related information extracted from the candidate answer text. For example, the target question text is q = "I am interested in index funds. How can I choose an index fund that suits me?", extract the entity a = "index fund" contained in question q, and initialize it to embed it as a1 = RoBERTa_cls (a), where question q can contain multiple entities.
[0112] In step S230 of some embodiments, the present application can extract all entities a contained in the target question text q and all entities e contained in the candidate answer text based on a preset knowledge graph, and construct an initial entity relationship subgraph G based on the nodes on all k-hop paths between all entities a and all entities e.
[0113] It should be noted that the embedding vectors of entities and relationships are needed when constructing the initial entity relationship subgraph G. For example, for the encoded embedding representation of entities, the entity and [CLS] token can be combined into text, such as "[CLS] index fund", and for the encoded embedding representation of relationships, the entity relationship and [CLS] token and [SEP] token can be combined into text, such as "[CLS] index fund and [SEP] fund have a relationship of [SEP] fund type".
[0114] In step S240 of some embodiments, in order to deeply learn the relationship between multiple types of texts, the present application can update the sub-graph based on historical conversation features and question-answer splicing features to obtain the target entity relationship sub-graph, so that the updated entity relationship sub-graph is more accurate and complete.
[0115] In the above embodiments, the present application can extract key entity information from the target object's questions and candidate answers, and construct a graph reflecting the relationships between entities, so as to better understand and respond to the object's queries.
[0116] It should be noted that the initial entity relationship subgraph includes a first subgraph node, and the first subgraph node corresponds to a target question entity in the question entity data and a target reply entity in the reply entity data. In other words, the edge connecting two first subgraph nodes in the initial entity relationship subgraph represents the relationship between the corresponding two entities.
[0117] See also Figure 3 , Figure 3 It is a specific flow chart of step S240 provided in an embodiment of the present application. In some embodiments of the present application, step S240 may specifically include but is not limited to steps S310 to S350.
[0118] Step S310, determining a second subgraph node based on the historical conversation features and the question-answer concatenation features;
[0119] Step S320, extracting entity relationships based on the question-answer concatenation feature and the target question entity to obtain a first entity relationship;
[0120] Step S330, extracting entity relationships based on the question-answer concatenation feature and the target answer entity to obtain a second entity relationship;
[0121] Step S340, extracting entity relationships based on historical conversation features and question-answer concatenation features to obtain a third entity relationship;
[0122] Step S350, based on the preset graph attention network, the first subgraph node, the second subgraph node, the first entity relationship, the second entity relationship and the third entity relationship, the initial entity relationship subgraph is updated to obtain the target entity relationship subgraph.
[0123] In step S310 of some embodiments, the present application may add the question-answer concatenation feature q1 (i.e., question embedding) and the historical conversation feature c2 (i.e., conversation context embedding) as additional nodes to the initial entity relationship subgraph, which may be used as the second subgraph node.
[0124] In steps S320 to S340 of some embodiments, at the same time, based on the question-answer concatenation feature q1, the historical conversation feature c2, the target question entity a, and the target answer entity e, the first entity relationship, the second entity relationship, and the third entity relationship are constructed. That is, while determining the second subgraph node, the present application will construct the first entity relationship between q1 and a as r1 = "question entity is...", the second entity relationship between q1 and e as r2 = "selection entity is...", and the third entity relationship between c2 and q1 as r3 = "conversation history is...".
[0125] In step S350 of some embodiments, further, the present application can perform a subgraph update on the initial entity relationship subgraph based on the preset graph attention network, the first subgraph node, the second subgraph node, the first entity relationship, the second entity relationship and the third entity relationship to obtain the target entity relationship subgraph.
[0126] The present application can update the node representation in the initial entity relationship subgraph based on Graph Attention Networks (GAT). For each node in the initial entity relationship subgraph, the representation of node t in the k+1th layer is updated using the following formula 1:
[0127]
[0128] In formula 1, N t represents all neighbor nodes of node t, α pt represents the attention weight of node p to node t, m pt represents the message transmitted by neighbor node p to t, represents the embedding representation of node t at the kth layer.
[0129] In step S160 of some embodiments, after K layers of GAT update, the target entity relationship subgraph is obtained. In order to extract deeper entity information, the present application can extract target question entity embedding features q_gnn, target dialogue entity embedding features c_gnn and entity joint embedding features r_gnn from the target entity relationship subgraph based on the embedding feature extraction submodel to reflect the linkage between entities.
[0130] See also Figure 4 , Figure 4 It is a specific flow chart of step S160 provided in an embodiment of the present application. In some embodiments of the present application, step S160 may specifically include but is not limited to steps S410 to S450.
[0131] Step S410, extracting embedded entity features from historical conversation features based on the target entity relationship subgraph to obtain target question entity embedded features;
[0132] Step S420, extracting embedded entity features from the question-answer concatenation features based on the target entity relationship subgraph to obtain target dialogue entity embedded features;
[0133] Step S430, extracting embedded entity features of the remaining entities based on the target entity relationship subgraph to obtain remaining entity embedded features;
[0134] Step S440, performing feature preprocessing on the remaining entity embedding features based on the preset sub-graph entity embedding quantity to obtain preprocessed embedding features;
[0135] Step S450, pooling is performed on the preprocessed embedding features to obtain entity joint embedding features.
[0136] In steps S410 to S430 of some embodiments, the present application can extract target question entity embedding features q_gnn, target dialogue entity embedding features c_gnn and remaining entity embedding features rs = [r1_gnn, r2_gnn, ...] from the target entity relationship subgraph based on the embedding feature extraction submodel, where the remaining entity embedding features represent the embedding representations of the new remaining entities in the subgraph.
[0137] In step S440 of some embodiments, further, the present application may perform feature preprocessing on the remaining entity embedding features based on a preset number of sub-graph entity embeddings w, that is, the present application may randomly select w entity embedding features from the remaining entity embedding features rs to form preprocessed embedding features. Among them, if w is greater than the vector length of rs, feature extraction is performed on the remaining entity embedding features rs, such as directly truncating the vector after the length w, or extracting w vectors to obtain preprocessed embedding features. If w is greater than the vector length of rs, a preset value (such as vector 0) may be used to fill the remaining entity embedding features rs to obtain preprocessed embedding features.
[0138] In step S450 of some embodiments, further, the preprocessed embedded features may be pooled (such as maximum pooling, average pooling, etc.) to obtain the entity joint embedded features r_gnn. For example, the preprocessed embedded features rw = [r_1_gnn, r_2_gnn, ... r_w_gnn] are subjected to a maximum pooling operation to obtain the final entity joint embedded features r_gnn = Max Pooling (rw).
[0139] In step S170 of some embodiments, in order to integrate multiple feature information to form a comprehensive question-answer feature, the present application may perform feature splicing on the object preference feature s2, the question-answer concatenation feature q1, the target question entity embedding feature q_gnn, the target dialogue entity embedding feature c_gnn, and the entity joint embedding feature r_gnn to obtain the target question-answer feature w1 = [q1; s2; q_gnn; c_gnn; r_gnn]. In this way, the model can be helped to combine multiple aspects of information to enhance the accuracy of recommendation.
[0140] In step S180 of some embodiments, further, the present application can make text recommendations for candidate answer texts corresponding to the target question and answer features based on the text recommendation sub-model. Specifically, the text recommendation sub-model includes a semantic matching unit, a sorting unit, and a dialogue language model. Among them, the semantic matching unit is used to predict the predicted matching probability between the candidate answer text and the target question text. The sorting unit is used to sort the predicted matching probabilities corresponding to multiple candidate answer texts, and determine the candidate answer text with the highest predicted matching probability. The dialogue language model is used to add prompts to make the generated answer content diverse and the answer content more naturally expressed.
[0141] In the above embodiment, the present application can use the target question and answer features to score the candidate reply texts (i.e., predict the matching probability), evaluate the degree of match between the answer and the object's needs, and sort the candidate answers according to the scoring results, and finally recommend the most relevant response to the target object. Through the above steps, an effective text recommendation system can be built to improve user experience and meet personalized needs. This process uses multiple text feature integration, embedded learning and recommendation mechanisms to achieve accurate question and answer matching.
[0142] See also Figure 5 , Figure 5 It is a specific flow chart of step S180 provided in an embodiment of the present application. In some embodiments of the present application, step S180 may specifically include but is not limited to steps S510 to S530.
[0143] Step S510, performing feature conversion on the target question-answer feature to obtain a linear question-answer feature;
[0144] Step S520, normalizing the linear question-answering features to obtain a semantic matching result;
[0145] Step S530: Recommend candidate reply texts based on the semantic matching results.
[0146] In step S510 and step S520 of some embodiments, the semantic matching unit of the present application can be constructed based on the MLP structure. The semantic matching unit includes an input layer, a hidden layer and an output layer. Each layer is composed of multiple neurons (also called nodes), and each neuron is connected to all neurons in the previous layer to form a full connection. The hidden layer is one or more layers of neurons located between the input layer and the output layer. The neurons in the hidden layer weight and transform the input through weights and activation functions, and pass the results to the next layer. The output layer is used to generate the final semantic matching result, which can be a predicted matching probability or a predicted matching score. Specifically, the target question and answer feature is input into the input layer of the semantic matching unit, and the target question and answer feature is converted based on the hidden layer of the semantic matching unit to obtain a linear question and answer feature. Furthermore, the linear question and answer feature is normalized based on the output layer of the semantic matching unit to obtain a semantic matching result. Among them, the normalization processing of the output layer can select an appropriate activation function according to the task type, such as the Sigmoid function for binary classification problems, the Softmax function for multi-classification problems, and the Relu activation function can solve the problem of gradient disappearance and improve the expression ability and prediction accuracy of the model. No specific limitation is made here.
[0147] See also Figure 6 , Figure 6 It is a specific flow chart of step S510 provided in an embodiment of the present application. In some embodiments of the present application, step S510 may specifically include but is not limited to steps S610 to S630.
[0148] Step S610, linear mapping is performed on the target question-answer feature to obtain a linearly mapped question-answer feature;
[0149] Step S620, linearly rectify the linear mapping question-answer feature to obtain a linear rectification question-answer feature;
[0150] Step S630, linear mapping is performed on the linear rectified question-answering features to obtain linear question-answering features.
[0151] In steps S610 to S630 of some embodiments, the structure for performing feature conversion on the target question and answer features in the present application may specifically include at least two layers of MLP, and the process of calculating the semantic matching result is shown in the following formula 2:
[0152] p=Simoid(Linear2(RELU(Linear1(w)))) (Formula 2)
[0153] In Formula 2, w represents the target question-answer feature, Linear1(w) represents the linear mapping question-answer feature, RELU(Linear1(w)) represents the linear rectification question-answer feature, Linear2(RELU(Linear1(w))) represents the linear question-answer feature, Simoid(·) is the normalization function, and p represents the semantic matching result.
[0154] In step S530 of some embodiments, after determining the semantic matching result of each candidate reply text, text recommendations may be made for the candidate reply text based on the semantic matching result.
[0155] See also Figure 7 , Figure 7 It is a specific flow chart of step S530 provided in an embodiment of the present application. In some embodiments of the present application, step S530 may specifically include but is not limited to steps S710 to S720.
[0156] Step S710, determining a target reply text from the candidate reply texts based on the semantic matching result;
[0157] Step S720, generating a dialogue response for the target question text and the target response text based on the pre-trained dialogue language model to obtain a recommended response text.
[0158] In steps S710 to S720 of some embodiments, the semantic matching result can represent the degree of matching between the candidate reply text and the target question text. If the semantic matching result is in the form of probability, the present application can obtain the predicted matching probability corresponding to each candidate reply text, and select the candidate answer with the highest probability as the correct target reply text. Furthermore, the target question text and the target reply text can be input into the dialogue language model, and the answers generated by it can be diversified and expressed more naturally by adding prompts. Among them, the dialogue language model can be constructed as a pre-trained ChatGLM structure.
[0159] It should be noted that the training process of the preset reply text recommendation model in the present application may specifically include: obtaining a training sample set, the training sample set includes multiple training samples, and each training sample includes a sample question text, a sample object preference text, a sample historical dialogue text, multiple sample candidate reply texts of the sample question text, and a sample target reply text. Further, referring to the above steps S120 to S170, the sample target question and answer features of the training samples are determined, the sample target question and answer features are processed based on the reply text recommendation model to determine the predicted sample reply text from the multiple sample candidate reply texts, and the predicted sample reply text is recommended according to the dialogue language model.
[0160] It should be noted that, in the process of training the reply text recommendation model, a cross entropy loss calculation can be performed based on the sample target reply text and the predicted sample reply text to obtain a model loss value, and the parameters of the reply text recommendation model can be adjusted according to the model loss value. When the reply text recommendation model after parameter adjustment meets the preset end condition, the final reply text recommendation model for actual use is obtained.
[0161] It should be noted that the preset end condition may be that the training of all training samples is completed, or the number of model iterations reaches a preset number threshold, or the recommendation accuracy at this time reaches a preset accuracy threshold, which is not specifically limited here.
[0162] It should be noted that the non-Company software tools or components appearing in the embodiments of the present application are merely examples and do not represent actual use.
[0163] The reply text recommendation method provided in the embodiment of the present application adds a feature extraction part for the object preference text and historical dialogue text of the target object on the basis of the QA-GNN model. For the input target question text, additional multi-round dialogue context history information and object preference feature information can be added, which enables the reply text recommendation system to pay attention to the background knowledge of different target objects, thereby improving the accuracy of the intention recognition of the target object. In addition, by combining the dialogue language model, the present application can make the reply content diverse for the determined target reply text, and the language expression is more natural, which greatly improves the interactive experience of the object.
[0164] See also Figure 8 The embodiment of the present application also provides a reply text recommendation device, which can implement the above reply text recommendation method, and the device includes:
[0165] An acquisition module 810 is used to acquire a target question text, a target object's preference text, a historical conversation text, and candidate answer texts for the target question text of the target object;
[0166] The first encoding module 820 is used to perform text encoding processing on the object preference text to obtain the object preference feature;
[0167] The second encoding module 830 is used to perform text encoding processing on the historical conversation text to obtain historical conversation features;
[0168] The third encoding module 840 is used to perform text splicing on the target question text and the candidate answer text to obtain a question-answer splicing text, and perform text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature;
[0169] A subgraph construction module 850 is used to construct a subgraph based on the target question text, the candidate answer text, the historical conversation features and the question-answer concatenation features to obtain a target entity relationship subgraph;
[0170] A feature extraction module 860 is used to extract embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features;
[0171] A splicing module 870 is used to perform feature splicing based on the object preference feature, the question and answer splicing feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature to obtain a target question and answer feature;
[0172] The recommendation module 880 is used to recommend candidate answer texts based on target question and answer features.
[0173] The specific implementation of the reply text recommendation device in the embodiment of the present application is basically the same as the specific implementation of the above-mentioned reply text recommendation method, and will not be repeated here.
[0174] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above reply text recommendation method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0175] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0176] The processor 910 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an 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 the present application;
[0177] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 920, and the processor 910 calls and executes the reply text recommendation method of the embodiment of this application;
[0178] Input / output interface 930, used to implement information input and output;
[0179] Communication interface 940, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0180] bus 950 , which transmits information between the various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );
[0181] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .
[0182] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned reply text recommendation method is implemented.
[0183] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0184] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0185] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0186] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0187] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0188] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0189] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0190] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0191] The units described above 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 on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0192] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0193] If the integrated unit is implemented in the form of 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 the present application, 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, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0194] The preferred embodiments of the present application are described above with reference to the accompanying drawings, but the scope of the rights of the present application is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application should be within the scope of the rights of the present application.
Claims
1. A reply text recommendation method, characterized in that: The method comprises: Obtaining a target question text, a target preference text, a historical conversation text, and candidate answer texts of the target question text of the target object; Performing text encoding processing on the object preference text to obtain object preference features; Performing text encoding processing on the historical conversation text to obtain historical conversation features; Performing text splicing on the target question text and the candidate answer text to obtain a question-answer splicing text, and performing text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature; Constructing a subgraph based on the target question text, the candidate answer text, the historical conversation features, and the question-answer concatenation features to obtain a target entity relationship subgraph; Based on the target entity relationship subgraph, embedded entity features are extracted to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features; Based on the object preference feature, the question-answer concatenation feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature, feature concatenation is performed to obtain a target question-answer feature; The candidate answer texts are recommended based on the target question and answer features.
2. The method according to claim 1, characterized in that A subgraph is constructed based on the target question text, the candidate answer text, the historical conversation features, and the question-answer concatenation features to obtain a target entity relationship subgraph, including: Perform entity extraction on the target question text based on a preset knowledge graph to obtain question entity data; Perform entity extraction on the candidate reply text based on the preset knowledge graph to obtain reply entity data; Constructing an entity relationship graph based on the question entity data and the answer entity data to obtain an initial entity relationship subgraph; The initial entity relationship subgraph is updated based on the historical conversation features and the question-answer concatenation features to obtain the target entity relationship subgraph.
3. The method according to claim 2, characterized in that The initial entity relationship subgraph includes a first subgraph node, the first subgraph node corresponds to a target question entity in the question entity data and a target answer entity in the answer entity data, and the subgraph updating of the initial entity relationship subgraph based on the historical conversation feature and the question-answer concatenation feature to obtain the target entity relationship subgraph includes: Determine a second subgraph node based on the historical conversation feature and the question-answer concatenation feature; Perform entity relationship extraction based on the question-answer concatenation feature and the target question entity to obtain a first entity relationship; Perform entity relationship extraction based on the question-answer concatenation feature and the target answer entity to obtain a second entity relationship; Extracting entity relationships based on the historical conversation features and the question-answer concatenation features to obtain a third entity relationship; The initial entity relationship subgraph is updated based on a preset graph attention network, the first subgraph node, the second subgraph node, the first entity relationship, the second entity relationship and the third entity relationship to obtain the target entity relationship subgraph.
4. The method according to claim 3, characterized in that The extracting of embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features includes: Based on the target entity relationship subgraph, embedding entity features are extracted from the historical conversation features to obtain the target question entity embedding features; Based on the target entity relationship subgraph, embedding entity features are extracted from the question-answer concatenation features to obtain the target dialogue entity embedding features; Extracting embedded entity features of the remaining entities based on the target entity relationship subgraph to obtain embedded features of the remaining entities; Performing feature preprocessing on the remaining entity embedding features based on a preset number of sub-graph entity embeddings to obtain preprocessed embedding features; The preprocessed embedding features are pooled to obtain the entity joint embedding features.
5. The method according to any one of claims 1 to 4, characterized in that: The recommending texts of the candidate answer texts based on the target question and answer features includes: Performing feature conversion on the target question-answer feature to obtain a linear question-answer feature; Normalizing the linear question-answering features to obtain a semantic matching result; The candidate reply texts are recommended based on the semantic matching results.
6. The method according to claim 5, characterized in that The step of performing feature conversion on the target question-answer feature to obtain a linear question-answer feature includes: Performing linear mapping on the target question-answer feature to obtain a linearly mapped question-answer feature; Performing linear rectification on the linear mapping question-answer feature to obtain a linear rectification question-answer feature; Linear mapping is performed on the linear rectified question-answering feature to obtain a linear question-answering feature.
7. The method according to claim 5, characterized in that The recommending texts for the candidate reply texts based on the semantic matching results includes: Determining a target reply text from the candidate reply texts based on the semantic matching result; Based on a pre-trained dialogue language model, a dialogue response is generated for the target question text and the target answer text to obtain a recommended answer text.
8. A reply text recommendation device, characterized in that: The device comprises: An acquisition module, used to acquire a target question text, a target preference text, a historical conversation text, and candidate answer texts of the target question text of a target object; A first encoding module, used for performing text encoding processing on the object preference text to obtain object preference features; A second encoding module is used to perform text encoding processing on the historical conversation text to obtain historical conversation features; A third encoding module is used to perform text splicing on the target question text and the candidate answer text to obtain a question-answer splicing text, and perform text encoding processing on the question-answer splicing text to obtain a question-answer splicing feature; A subgraph construction module, used to construct a subgraph based on the target question text, the candidate answer text, the historical conversation features and the question-answer concatenation features to obtain a target entity relationship subgraph; A feature extraction module is used to extract embedded entity features based on the target entity relationship subgraph to obtain target question entity embedding features, target dialogue entity embedding features and entity joint embedding features; A splicing module, configured to perform feature splicing based on the object preference feature, the question-answer splicing feature, the target question entity embedding feature, the target dialogue entity embedding feature and the entity joint embedding feature to obtain a target question-answer feature; A recommendation module is used to recommend the candidate answer text based on the target question and answer features.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Response recommendation method, reply recommendation device and intelligent equipment
CN112527998A
Text recommendation method and device, computer equipment and storage medium
CN113704422A
Answer recommendation method and device and storage medium
CN116991995A
Text visual question and answer method and device, computer equipment and storage medium
CN117033609A
Artificial intelligence-based named entity recognition method and apparatus, and electronic device
WO2021169400A1