Question and answer processing method and apparatus
By constructing a multimodal knowledge graph and updating question-answer pairs based on behavioral preference information, the problem of unsatisfactory accuracy in traditional question-answering methods is solved, achieving more accurate and personalized question-answering processing.
Patent Information
- Application Number
- CN202411553266.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-11-01
AI Technical Summary
Traditional question-answering methods struggle to accurately filter out the information users need when processing large amounts of data, and they cannot delve into the complex semantic relationships and contextual information behind the text, resulting in recommendation results that do not meet personalized needs and have unsatisfactory accuracy.
By acquiring multimodal data from the target domain, a target knowledge graph is constructed. Knowledge is fused using modality weights to generate target question-answer pairs. The question-answer pairs are then updated based on behavioral preference information to determine the target answer.
It improves the accuracy and efficiency of the question-answering system, enabling it to better understand user intent and uncover user preferences, and provide personalized recommendation results.
Smart Images

Figure CN119494392B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, in particular to a question and answer processing method and device. BACKGROUND
[0002] With the explosive growth of information, the traditional question and answer method based on content and collaborative filtering is not capable of handling a large amount of information. The method provided in the related art is difficult to accurately filter out the information that the user really needs from a large amount of information, resulting in information overload. At the same time, due to the sparsity of data, there is often not enough basis when recommending results, so that the recommended results do not meet the actual needs of the person skilled in the art. Moreover, the traditional question and answer method can only understand the surface text information when processing natural language, and it is difficult to deeply mine the complex semantic relationship and context information behind the text, resulting in limitations of these methods in understanding user intent and mining user preferences, which cannot meet the user's demand for personalized recommendation, and it is difficult to adapt to the dynamic changes of knowledge and user preferences, and there is a problem of unsatisfactory accuracy of providing answers.
[0003] In view of the above problems, no effective solution has been proposed so far. SUMMARY
[0004] The embodiments of the present application provide a question and answer processing method and device to at least solve the technical problem of unsatisfactory accuracy of question and answer in the related art.
[0005] According to an aspect of an embodiment of the present application, a question and answer processing method is provided, comprising: obtaining target data of a target field, wherein a modality of the target data is included in a plurality of predetermined modalities; performing knowledge fusion on the target data according to a modality weight corresponding to each of the plurality of predetermined modalities, to construct a target knowledge graph corresponding to the target field; generating a plurality of target question and answer pairs of the target field based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on a historical question of the target field and a historical answer corresponding to the historical question; and in response to a question and answer request of the target field, determining a target answer corresponding to the question and answer request based on the plurality of target question and answer pairs.
[0006] Optionally, the generating, based on the target knowledge graph, a plurality of target question-answer pairs of the target domain comprises: for a first question-answer pair in the plurality of initial question-answer pairs, in a case where a historical question included in the first question-answer pair corresponds to a plurality of historical answers, determining behavior preference information of the target domain based on processing of the target knowledge graph; determining preference weights respectively corresponding to the plurality of historical answers based on the behavior preference information; updating the first question-answer pair according to the historical question, the plurality of historical answers, and the preference weights respectively corresponding to the plurality of historical answers, to obtain a target question-answer pair corresponding to the first question-answer pair; and obtaining the plurality of target question-answer pairs based on the plurality of initial question-answer pairs by using a manner of updating the target question-answer pair based on the first question-answer pair.
[0007] Optionally, the target knowledge graph comprises entities, relationships, and attributes, wherein the relationships represent interactions between the entities, and the attributes represent properties of the entities; the determining, based on processing of the target knowledge graph, behavior preference information of the target domain comprises: obtaining historical behavior data of the target domain; performing interaction analysis on the relationships and the entities based on the historical behavior data to determine a preference mode of the target domain; performing path analysis based on the entities, the relationships, and the attributes to determine an association relationship of the target domain; and determining the behavior preference information based on the preference mode and the association relationship.
[0008] Optionally, the determining, based on the behavior preference information, preference weights respectively corresponding to the plurality of historical answers comprises: determining an initial preference model, wherein the preference model uses a predetermined loss function, the predetermined loss function is used to enhance a weight of a preferred answer and reduce a weight of a non-preferred answer; updating the predetermined loss function based on the behavior preference information to obtain an updated loss function; obtaining an updated preference model based on the updated loss function; and determining the preference weights respectively corresponding to the plurality of historical answers by processing the plurality of historical answers based on the updated preference model.
[0009] Optionally, the determining, based on the plurality of target question-answer pairs, a target answer corresponding to the question-answer request in response to the question-answer request of the target domain comprises: determining, in a plurality of target questions respectively corresponding to the plurality of target question-answer pairs, a request question matching the question-answer request; in a case where a candidate answer corresponding to the request question is a plurality of candidate answers, determining the target answer in the plurality of candidate answers according to preference weights respectively corresponding to the plurality of candidate answers; or determining a predetermined number of candidate answers in the plurality of candidate answers according to the preference weights respectively corresponding to the plurality of candidate answers; and obtaining the target answer based on combination of the predetermined number of candidate answers.
[0010] Optionally, the knowledge fusion of the target data according to the modal weights corresponding to the plurality of predetermined modalities comprises: in a case where the modalities of the target data include a text modality and an image modality, obtaining text features by processing the target data based on a feature embedding method; obtaining image features by processing the target data based on a convolutional neural network; and performing knowledge fusion on the text features, the text modality corresponding modal weight, the image features, and the image modality corresponding modal weight to obtain the target knowledge graph.
[0011] Optionally, the obtaining of the target data of the target field comprises: extracting structured data, semi-structured data, and unstructured data based on a data source of the target field, wherein the structured data is data in a preset organization structure, the semi-structured data is data with dynamic changes in a predetermined structure, and the unstructured data is multi-modal data in multiple data formats; and performing preprocessing on the structured data, the semi-structured data, and the unstructured data to obtain the target data, wherein the preprocessing comprises cleaning processing and / or conversion processing.
[0012] Optionally, the knowledge fusion of the target data according to the modal weights corresponding to the plurality of predetermined modalities comprises: in a case where the target data includes structured data, extracting the target data to determine entities, relationships, and attributes, wherein the attributes are used to represent properties of the entities, and the relationships are used to represent interactions between the entities; and performing knowledge fusion on the entities, the relationships, the attributes, and the modal weights corresponding to the plurality of predetermined modalities by using a weighted average method to determine the target knowledge graph.
[0013] Optionally, the knowledge fusion of the target data according to the modal weights corresponding to the plurality of predetermined modalities comprises: in a case where the target data includes semi-structured data and / or structured data, extracting the target data to determine entities; determining semantic features based on the entities; determining attributes based on feature categories of the semantic features, wherein the attributes are used to represent properties of the entities; determining relationships by using a natural language processing method based on syntax structures and context information included in the semantic features, wherein the relationships are used to represent interactions between the entities; and performing knowledge fusion on the entities, the relationships, the attributes, and the modal weights corresponding to the plurality of predetermined modalities by using a weighted average method to determine the target knowledge graph.
[0014] According to another aspect of the embodiments of the present application, a question and answer processing apparatus is provided, comprising: a data acquisition module configured to acquire target data of a target field, wherein a modality of the target data is included in a plurality of predetermined modalities; a graph module configured to perform knowledge fusion on the target data according to a modality weight corresponding to each of the plurality of predetermined modalities, and construct a target knowledge graph corresponding to the target field; a question and answer pair generation module configured to generate a plurality of target question and answer pairs of the target field based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on a historical question of the target field and a historical answer corresponding to the historical question; and an answering module configured to determine a target answer corresponding to a question and answer request of the target field based on the plurality of target question and answer pairs in response to the question and answer request.
[0015] In the embodiments of the present application, an adaptive question and answer processing method based on a knowledge graph is adopted. Target data of a target field is acquired, wherein a modality of the target data is included in a plurality of predetermined modalities. Knowledge fusion is performed on the target data according to a modality weight corresponding to each of the plurality of predetermined modalities, and a target knowledge graph corresponding to the target field is constructed. A plurality of target question and answer pairs of the target field are generated based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on a historical question of the target field and a historical answer corresponding to the historical question. In response to a question and answer request of the target field, a target answer corresponding to the question and answer request is determined based on the plurality of target question and answer pairs. The purpose of improving the answer accuracy of a question and answer system is achieved, and the technical effect of knowledge fusion and question and answer generation by focusing on different modalities of data in a specific field is achieved, thereby solving the technical problem of unsatisfactory question and answer accuracy in the related art. BRIEF DESCRIPTION OF DRAWINGS
[0016] The accompanying drawings, which are included to provide a further understanding of the present application, form a part of the present application and illustrate the illustrative embodiments of the present application and together with the description serve to explain the present application. In the drawings:
[0017] Figure 1 is a flowchart of an optional question and answer processing method according to an embodiment of the present application;
[0018] Figure 2 is a graph schematic diagram of an optional question and answer processing method according to an embodiment of the present application;
[0019] Figure 3 is a question and answer interface schematic diagram of an optional question and answer processing method according to an embodiment of the present application;
[0020] Figure 4is a flow diagram of an optional question and answer processing method according to an embodiment of the present application;
[0021] Figure 5 is a principle block diagram of an optional question and answer processing method according to an embodiment of the present application;
[0022] Figure 6 is a schematic diagram of an optional question and answer processing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, 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 "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] According to an embodiment of the present application, a method embodiment of question and answer processing is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.
[0026] Figure 1 is a flow diagram of an optional question and answer processing method according to an embodiment of the present application, as Figure 1 shown, the method comprises the following steps:
[0027] Step S102, obtaining target data of a target field, wherein the modalities of the plurality of predetermined modalities include the modalities of the target data;
[0028] It can be understood that the target field (such as the power construction field, the defect detection field, etc.) needing to be processed is determined, and then relevant data in the field is collected as target data, which can come from various sources such as databases, documents, images, videos, etc., and collectively constitutes the knowledge base of the target field. By collecting the data of the target field, comprehensive knowledge information of the field can be obtained, which provides necessary data support for subsequent knowledge graph construction and question and answer system generation.
[0029] In an optional embodiment, the target data of the target field is obtained by extracting based on the data source of the target field to obtain structured data, semi-structured data, and unstructured data, wherein the structured data is data stored according to a preset organization structure, the semi-structured data is data that changes dynamically according to a predetermined structure, and the unstructured data is multi-modal data in multiple data formats; and the target data is obtained by preprocessing the structured data, the semi-structured data, and the unstructured data, wherein the preprocessing includes cleaning and / or conversion.
[0030] It can be understood that data is extracted from the corresponding data source according to the characteristics of the target field, including structured data, semi-structured data, and unstructured data. Structured data is usually stored according to a preset organization structure, such as data in a relational database, semi-structured data is data that changes dynamically according to a predetermined structure, such as XML or JSON format data, and unstructured data is data without a fixed structure, such as text, images, audio, and video, which can exist in multiple data formats and constitute multi-modal data. After the original data is extracted, preprocessing operations can be performed to clean and convert the data format as needed, so that subsequent knowledge fusion and knowledge graph construction can be more effective. By distinguishing structured, semi-structured, and unstructured data and performing corresponding preprocessing according to different data types, the accuracy and usability of the data can be ensured, and obtainable data support can be provided for subsequent knowledge graph construction and question and answer system generation.
[0031] Optionally, the cleaning process can include removing duplicate data, correcting incorrect data, filling missing values, etc., and the conversion process can include data format conversion, data normalization or standardization, etc. Through data cleaning and conversion processing, noise and errors in the original data can be removed, and the accuracy and reliability of the data can be improved. Special preprocessing operations can also be performed on different types of data, which can optimize the data processing process and improve the data processing efficiency.
[0032] In an optional embodiment, the target data is knowledge fused according to modal weights corresponding to a plurality of predetermined modalities, and a target knowledge graph corresponding to a target field is constructed, including: in the case that the target data includes structured data, the target data is extracted, entities, relationships, and attributes are determined, wherein the attributes are used to represent the properties of the entities, and the relationships are used to represent the interactions between the entities; knowledge fusion is performed based on the entities, the relationships, the attributes, and the modal weights corresponding to the plurality of predetermined modalities by using a weighted average manner, and the target knowledge graph is determined.
[0033] It can be understood that, in order to construct a knowledge graph corresponding to a specific field, a method based on multi-modal data fusion is adopted. If the obtained data contains structured information, the structured information includes key elements such as entities, relationships, and attributes. Entities represent basic constituent units in the knowledge graph, are objects with clear characteristics and identities, relationships reveal the interactions and connections between multiple entities, and attributes are used to describe the specific characteristics or marks of entities. In the data processing stage, these entities, relationships, and attributes are recognized and extracted from the obtained data, and natural language processing technology, rule matching, and other means can be used. Since the obtained data can come from multiple modalities (such as text, image, sound, etc.), and each modality has its value and importance in constructing the knowledge graph. Therefore, each modality is assigned a corresponding modal weight, which can be adjusted according to specific application requirements and scenarios, thereby reflecting the importance of different modalities in the construction process. In the fusion process, a weighted average strategy is adopted. Each entity, relationship, and attribute is combined with the weight of the corresponding modality, and the results under all modalities are summarized, which not only integrates the rich information in multi-modal data, but also balances the importance of information through the introduction of weights, thereby ensuring the accuracy and integrity of the knowledge graph.
[0034] It should be noted that by integrating data of multiple modalities, various information sources can be fully utilized, thereby reducing errors that may be caused by information missing or a single data source. At the same time, by assigning specific modal weights to each modality, the fusion of multi-modal data brings more rich information to the knowledge graph, not limited to text data, but also including image features, sound features, etc., providing more comprehensive and rich content for the construction of the knowledge graph. By applying the knowledge graph construction in multiple fields, adjusting the data sources and modal weights according to the characteristics and needs of specific fields, strong adaptability and flexibility can be achieved.
[0035] In an optional embodiment, the target data is knowledge fused according to the modal weights corresponding to the plurality of predetermined modalities, and a target knowledge graph corresponding to the target field is constructed, including: in the case that the target data includes semi-structured and / or structured data, extracting the target data to determine entities; determining semantic features based on the entities; determining attributes based on the feature categories of the semantic features, wherein the attributes are used to represent the properties of the entities; determining relationships based on the syntax structures and context information included in the semantic features using a natural language processing method, wherein the relationships are used to represent the interactions between the entities; and knowledge fusion is performed based on the entities, relationships, attributes, and the modal weights corresponding to the plurality of predetermined modalities using a weighted average method to determine the target knowledge graph.
[0036] It can be understood that, for the processing of semi-structured and / or structured data, entities are extracted from the target data, and the entities are basic elements of the knowledge graph. Subsequently, semantic features of the entities are further analyzed and determined based on the extracted entities, and the semantic features are detailed descriptions of the meanings of the entities in the knowledge field. The attributes of the entities are determined according to the feature categories of the semantic features, and the attributes are metadata describing the properties of the entities. After the attributes and the entities are determined, the syntax structures and context information in the semantic features are analyzed using a natural language processing technique, thereby determining the relationships between the entities, and the relationships represent the interactions and connections between the entities and are connecting links in the knowledge graph. The entities, relationships, and attributes are knowledge fused using a weighted average method in combination with the modal weights corresponding to the plurality of predetermined modalities. This step comprehensively considers the importance of different modal data, and ensures the accuracy and comprehensiveness of the finally constructed knowledge graph.
[0037] In step S104, the target data is knowledge fused according to the modal weights corresponding to the plurality of predetermined modalities, and a target knowledge graph corresponding to the target field is constructed;
[0038] It can be understood that, after the target data is obtained, the data is processed according to different modalities (such as text, image, video, etc.). Each modality corresponds to a modal weight, and the modal weight reflects the importance of the modality in the knowledge graph. The target data is fused according to the modal weight, thereby constructing a structured target knowledge graph for the target field. By modality weighted fusion of the target data, the knowledge structure and characteristics of the target field can be more accurately reflected. At the same time, since the importance of different modalities is considered, the constructed knowledge graph is more in line with the needs of actual applications, and the accuracy and efficiency of the question and answer system are improved.
[0039] Optionally, Figure 2is a graph diagram of an optional question and answer processing method provided by the embodiment of the application. A graph is established for the power construction field, which includes multiple entities such as construction safety specifications, defect detection, power calculation methods and the like. Arrows represent relationships. The specific content in the graph is only for illustration and can be set according to specific requirements.
[0040] In an optional embodiment, the target data is knowledge fused according to the modal weights corresponding to the multiple predetermined modalities, to construct a target knowledge graph corresponding to the target field, including: in the case that the modalities of the target data include a text modality and an image modality, a feature embedding method is used to process the target data based on the target data to obtain text features; a convolutional neural network is used to process the target data to obtain image features; and the text features, the modal weight corresponding to the text modality, the image features, and the modal weight corresponding to the image modality are knowledge fused to obtain the target knowledge graph.
[0041] It can be understood that for the multi-modal data such as the text modality and the image modality, different technical strategies are used to extract and fuse information. For the data of the text modality, a feature embedding method is used for processing. Feature embedding is a method of converting text data into numerical representation, making it easier for programs to process and understand text information. Through feature embedding, key information such as keywords, phrases or sentences in the text can be extracted and converted into a calculable feature vector, i.e., text features. For the data of the image modality, a convolutional neural network (CNN) is used for processing, which can automatically extract feature information such as edges, textures, shapes, etc. in the image, and convert these feature information into image features. After obtaining the text features and the image features, knowledge fusion is performed according to the modal weights corresponding to the text modality and the image modality, respectively. The text features and the image features are combined through weighted averaging to form a knowledge graph that integrates multi-modal information.
[0042] By simultaneously processing the data of the text modality and the image modality, key information in the text and the image can be more accurately extracted and fused into the knowledge graph, fully utilizing the rich information in the multi-modal data. Not only can the accuracy and completeness of the knowledge graph be improved, but also more dimensions and details can be provided for the knowledge graph.
[0043] Optionally, when knowledge fusion is performed, the importance of different modal knowledge in the multi-modal knowledge in the question and answer system is inconsistent, therefore, according to the importance and relevance of different modalities, a soft attention mechanism (Soft Attention) is used to calculate the weight of each modality, and the modal features are weighted and averaged and fused. The convolutional neural network can set the intermediate layer and the hidden layer, use the sigmoid activation function and the weight matrix to learn and represent the high-level features of the data, and generate the final fusion features. Among them, a suitable loss function is used for back propagation and parameter updating of the neural network model. After multi-modal knowledge fusion, mapping is performed based on the traditional triple trans model, and the knowledge graph of the power construction question and answer is constructed.
[0044] In step S106, a plurality of target question and answer pairs of the target domain are generated based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on historical questions of the target domain and historical answers corresponding to the historical questions;
[0045] It can be understood that after the target knowledge graph is constructed, the target knowledge graph and the existing initial question and answer pairs are used to generate new target question and answer pairs. The initial question and answer pairs are obtained based on historical questions and answers of the target domain. The target question and answer pairs will be used as the core resources of the question and answer system to answer the user's questions. By generating new target question and answer pairs based on the target knowledge graph and the initial question and answer pairs, the coverage of the question and answer system can be automatically expanded and the answer quality can be improved, so that the question and answer system is more comprehensive, accurate and practical.
[0046] In step S108, in response to a question and answer request of the target domain, a target answer corresponding to the question and answer request is determined based on the plurality of target question and answer pairs.
[0047] It can be understood that when the user raises a question about the target domain to the system, the user's question and the existing target question and answer pairs are matched and reasoned to find the target answer that best matches the question and return it to the user. Through the above processing, accurate and practical answers can be quickly provided. The question and answer method based on the knowledge graph not only improves the accuracy and efficiency of the answers, but also enhances the explainability and maintainability of the question and answer. At the same time, since the question and answer pairs are generated based on the knowledge graph of the target domain, the user's question can be better understood and targetedly processed, which helps to provide more personalized services.
[0048] Optionally, Figure 3 is a question and answer interface schematic diagram of an optional question and answer processing method provided by an embodiment of the present application, as Figure 3As shown, the Q&A (question & answer) interface is only an illustrative way, by inputting the question "What aspects should be paid attention to in the safety detection of electric power construction site personnel?", the target answer can be obtained, including the detection of personal protective equipment and the related content of electrical safety detection, and according to the specific answer of the target answer, feedback such as "recommendation", "general", "poor" and the like can be provided, which is helpful to improve the optimization efficiency of the model. A feedback component of "tell me more" can also be set, and by interacting with this component, more content associated with the request question can be obtained, and the efficiency of question and answer can be improved.
[0049] In an optional embodiment, based on the target knowledge graph, a plurality of target question and answer pairs of the target domain are generated, including: for a first question and answer pair in the plurality of initial question and answer pairs, in a case where a historical question included in the first question and answer pair corresponds to a plurality of historical answers, processing based on the target knowledge graph to determine behavior preference information of the target domain; based on the behavior preference information, determining preference weights respectively corresponding to the plurality of historical answers; updating the first question and answer pair according to the historical question, the plurality of historical answers, and the preference weights respectively corresponding to the plurality of historical answers, to obtain a target question and answer pair corresponding to the first question and answer pair; and using the manner of generating the target question and answer pair based on the first question and answer pair, generating the plurality of target question and answer pairs based on the plurality of initial question and answer pairs.
[0050] It can be understood that when processing an initial question and answer pair, if the question has multiple different answers in the historical data, the system will use the constructed target knowledge graph to analyze and determine the behavior preference information in the target domain. The behavior preference information can include the preferences, tendencies or trends of a user group on a certain question or topic. Based on the behavior preference information, a preference weight is assigned to each historical answer. The preference weight represents the matching degree or importance of the answer to the behavior preference of the target domain. According to the historical question, the plurality of historical answers and the respective preference weights, the initial question and answer pair is updated to generate a target question and answer pair that is more matched with the behavior preference of the target domain.
[0051] By introducing the target knowledge graph and the behavior preference information, the real needs and expected answers of users in the target domain to the question can be more accurately grasped, which is helpful to generate question and answer pairs that are more relevant and accurate to the target domain, and thus more user-expected answers can be provided, thereby optimizing the user experience and enhancing the intelligence and adaptability of the system.
[0052] In an optional embodiment, the target knowledge graph includes entities, relations, and attributes, wherein the relations represent interactions between the entities, and the attributes represent properties of the entities. The processing based on the target knowledge graph determines behavior preference information of the target domain, including: obtaining historical behavior data of the target domain; performing interaction analysis on the relations and the entities based on the historical behavior data to determine preference patterns of the target domain; performing path analysis on the entities, the relations, and the attributes to determine association relationships of the target domain; and determining the behavior preference information based on the preference patterns and the association relationships.
[0053] It can be understood that the historical behavior data of the target domain is collected, which records various operations and behaviors of the user or system at a specific time, such as processing records of the user performing power maintenance, search history of searching for keywords related to power safety protection, and the like. Based on the collected historical behavior data, interaction analysis is performed on the relations and the entities in the target knowledge graph to determine the interactions between different entities and specific patterns or trends formed, which helps to understand the preferences of the user or system in the target domain. Path analysis is performed on the entities, the relations, and the attributes in the target knowledge graph, and the path analysis identifies the association relationships between different entities and attributes by tracking the connection paths in the knowledge graph, which is beneficial to more deeply understand the structure and internal rules of the target domain. According to the results of the interaction analysis and the path analysis, combined with specific requirements and background knowledge of the target domain, behavior preference information in the domain is determined, including user preferences for specific products or services, operation trends or potential risks of the power system, and the like.
[0054] By utilizing the target knowledge graph to perform interaction analysis and path analysis, the internal rules and knowledge structure of the target domain can be mined, which helps to determine the characteristics and requirements of the entities included in the target domain.
[0055] In an optional embodiment, based on the behavior preference information, preference weights corresponding to a plurality of historical answers are determined, including: determining an initial preference model, wherein the preference model adopts a predetermined loss function, the predetermined loss function is used to enhance the weight of a preferred answer and reduce the weight of a non-preferred answer; updating the predetermined loss function using the behavior preference information to obtain an updated loss function; obtaining an updated preference model based on the updated loss function; and processing the plurality of historical answers using the updated preference model to determine the preference weights corresponding to the plurality of historical answers, respectively.
[0056] It can be understood that an initial preference model is determined, a predetermined loss function is used to enhance the weight of the answers (i.e. preferred answers) matching the behavior preference, and reduce the weight of the answers (i.e. non-preferred answers) not matching the behavior preference. The behavior preference information is used to update the predetermined loss function, so that the loss function is more in line with the actual preference of the target field, and the quality of the answers is more accurately evaluated. Based on the updated loss function, an updated updated preference model can be obtained. The updated preference model can more accurately reflect the preference of the target field, and feedback the answers based on the preference. The updated preference model is used to process a plurality of historical answers, and a preference weight is assigned to each answer according to the matching degree of the answer and the behavior preference. Reflects the preference degree of the answer in the target field, and provides weight support for subsequent question and answer pair generation and recommendation.
[0057] By introducing the behavior preference information and updating the loss function, the preference model can more accurately reflect the preference of the target field, and can more accurately evaluate the matching degree of the answer and the behavior preference when determining the preference weight of the historical answer, thereby improving the accuracy of the weight allocation. And because the updated preference model is determined based on the actual preference of the target field, it is more suitable for the target field.
[0058] Optionally, when the preference of the target field changes, it is necessary to collect the behavior preference information again, update the loss function, and update the preference model again to adapt to the new preference.
[0059] Optionally, the user's historical behavior and preference data are used to construct the preference model, the hidden correlation and user preference mode are found by using the reasoning and correlation analysis capability of the graph, and the language answer style conforming to the normal order is obtained after debugging, so as to provide more accurate and diversified recommendation results.
[0060] The initial question and answer pair with expert experience in power construction is collected and labeled manually, and the template is packaged and optimized by the self-recurrence loss optimization model L a (i.e. the above-mentioned preference model) can be represented in the following way:
[0061]
[0062] Wherein, a i is the i-th labeled answer, q i is the i-th labeled question; a i,j is the j-th answer of the i-th labeled question; P M is the probability predicted by the model M; I is the packaging template of the question and answer pair.
[0063] Meanwhile, a set of preferred answers is designed, and a preference weight is designed for each answer in the question-answer pair, and a higher weight indicates that the answer is more in line with the requirements of the personnel in the power construction field. A preference loss function L p (i.e., the loss function described above) is designed in combination with the model M and the preference set, aiming to enhance the weight of the preferred answer and reduce the probability of the occurrence of the non-preferred answer. Therefore, the overall loss function L loss of the model training is represented as: L loss = L a + L p .
[0064] In an optional embodiment, in response to a question-answer request in a target field, a target answer corresponding to the question-answer request is determined based on a plurality of target question-answer pairs, including: determining a request question matching the question-answer request in the target questions corresponding to the plurality of target question-answer pairs; in the case that the candidate answers corresponding to the request question are multiple, determining the target answer in the plurality of candidate answers according to the preference weights corresponding to the plurality of candidate answers; or, determining a predetermined number of candidate answers in the plurality of candidate answers according to the preference weights corresponding to the plurality of candidate answers; and combining the predetermined number of candidate answers to obtain the target answer.
[0065] It can be understood that, in the target questions corresponding to the plurality of target question-answer pairs, a request question matching the question in the current question-answer request is sought. If the candidate answer corresponding to the request question is only one, then this candidate answer becomes the target answer. If the candidate answer corresponding to the request question is multiple, the target answer is determined according to the preference weights of the candidate answers. The candidate answers are sorted according to the preference weights from high to low, and the answer with the highest weight is selected as the target answer. A combined answer containing multiple answers can be provided as the target answer. At this time, the system can select a predetermined number of answers with higher weights according to the preference weights of the candidate answers, and combine these answers to form a comprehensive target answer. Such a combined answer can be more comprehensive and accurate, and can better meet the needs of users.
[0066] Optionally, natural language processing (NLP) techniques such as text similarity calculation can be used to ensure that the target question most similar or identical to the request question can be accurately found.
[0067] Through the above step S102, the target data of the target field is obtained, wherein the modal of the target data is included in the plurality of predetermined modalities; step S104, according to the modal weight corresponding to each of the plurality of predetermined modalities, knowledge fusion is performed on the target data to construct a target knowledge graph corresponding to the target field; step S106, based on the target knowledge graph and a plurality of initial question and answer pairs, a plurality of target question and answer pairs of the target field are generated, wherein the plurality of initial question and answer pairs are obtained based on historical questions of the target field and historical answers corresponding to the historical questions; step S108, in response to a question and answer request of the target field, based on the plurality of target question and answer pairs, a target answer corresponding to the question and answer request is determined. The purpose of improving the accuracy of the question and answer system is achieved, the technical effect of knowledge fusion and question and answer generation by focusing on different modal data in a specific field is achieved, and the technical problem of unsatisfactory question and answer accuracy in the related art is solved.
[0068] Based on the above embodiments and optional embodiments, the present application provides an optional implementation, Figure 4 is a flow diagram of an optional question and answer processing method according to an embodiment of the present application, as Figure 4 shown, collecting equipment operation manual, technical specification operation document, construction table data, etc., and preprocessing the data. Collect data from various data sources and preprocess data according to different data types. Exclude low-quality, duplicate and problem data, etc.
[0069] Figure 5 is a principle block diagram of an optional question and answer processing method according to an embodiment of the present application, as Figure 5 shown, structured and unstructured knowledge representation is extracted from text, table, image and other data, and based on natural language processing, data mining and other technologies, key semantic extraction and relationship extraction of different modalities are performed. Perform semantic preference mining, collect and label common questions and interpretation pairs in the power construction field, and combine historical behavior and preferences of users to perform deep preference mining.
[0070] Based on the knowledge fusion technology, the multi-modal knowledge is fused to construct a rich and preferred knowledge graph, and the question and answer module for question and answer is generated based on the target knowledge graph.
[0071] The above optional embodiments at least achieve the following effects: by utilizing the structured knowledge and correlation analysis capability of the knowledge graph, the user demand can be more accurately understood and the hidden correlation can be more accurately mined, so that more accurate and personalized recommendation results can be provided. Through multi-source data fusion and context-aware recommendation, more comprehensive and diversified recommendation content can be provided for the user to meet the needs of different scenarios and interests of the user. By deeply mining the user interest and semantic correlation, the user preference and demand can be better understood, and personalized recommendation results that meet the preferences of the user can be provided to improve user satisfaction and user experience.
[0072] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.
[0073] In this embodiment, a question and answer processing device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again. As used below, the term "module" "device" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and is contemplated.
[0074] According to the embodiments of the present application, a device embodiment for implementing the question and answer processing method is also provided, Figure 6 is a schematic diagram of a question and answer processing device according to an embodiment of the present application, as Figure 6 shown, the above-mentioned question and answer processing device comprises a data acquisition module 602, a graph module 604, a question and answer pair generation module 606, an answer module 608, and the device will be described below.
[0075] The data acquisition module 602 is configured to acquire target data of a target field, wherein the target data is included in a modality of a plurality of predetermined modalities;
[0076] The graph module 604 is connected with the data acquisition module 602, and is configured to perform knowledge fusion on the target data according to a modality weight corresponding to each of the plurality of predetermined modalities, and construct a target knowledge graph corresponding to the target field;
[0077] The question and answer pair generation module 606 is connected with the graph module 604, and is configured to generate a plurality of target question and answer pairs of the target field based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on historical questions of the target field and historical answers corresponding to the historical questions;
[0078] The answering module 608, connected with the question-answer pair generation module 606, is configured to determine a target answer corresponding to a question-answer request based on the plurality of target question-answer pairs in response to the question-answer request for the target domain.
[0079] The question-answer processing device provided in the embodiment of the present application comprises a data acquisition module configured to acquire target data of a target domain, wherein a modality of the plurality of predetermined modalities comprises the target data; a graph module configured to perform knowledge fusion on the target data according to a modality weight corresponding to each of the plurality of predetermined modalities, and construct a target knowledge graph corresponding to the target domain; a question-answer pair generation module configured to generate a plurality of target question-answer pairs of the target domain based on the target knowledge graph and a plurality of initial question-answer pairs, wherein the plurality of initial question-answer pairs are obtained based on historical questions of the target domain and historical answers corresponding to the historical questions; and an answering module configured to determine a target answer corresponding to a question-answer request based on the plurality of target question-answer pairs in response to the question-answer request for the target domain. The question-answer system is improved in accuracy, the technical effect of knowledge fusion and question-answer generation by focusing on different modalities of data in a specific domain is achieved, and the technical problem of unsatisfactory question-answer accuracy in the related art is solved.
[0080] It should be noted that each of the above modules can be implemented by software or hardware. For example, for the latter, the above modules can be located in the same processor, or in different processors in any combination.
[0081] It should be noted that the data acquisition module 602, the graph module 604, the question-answer pair generation module 606, and the answering module 608 correspond to steps S102 to S108 in the embodiment, and have the same instances and application scenarios as the corresponding steps, but are not limited to the disclosure of the above embodiment. It should be noted that the above modules can run in a computer terminal as part of the device.
[0082] It should be noted that the optional or preferred embodiments of the present embodiment can refer to the related description in the embodiment, which will not be repeated here.
[0083] The question-answer processing device can further comprise a processor and a memory, and the data acquisition module 602, the graph module 604, the question-answer pair generation module 606, and the answering module 608 are stored in the memory as program units, and the processor executes the above program units stored in the memory to realize the corresponding functions.
[0084] The processor includes a core, and the core retrieves corresponding program units in the memory. The core can be one or more. The memory can include a non-permanent memory in a computer readable medium, a random access memory (RAM), and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory includes at least one memory chip.
[0085] An embodiment of the present application provides a non-volatile storage medium, which stores a program, and the program is executed by a processor to implement the question and answer processing method.
[0086] An embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining target data in a target field, wherein a modality of the target data is included in a plurality of predetermined modalities; performing knowledge fusion on the target data according to modality weights corresponding to the plurality of predetermined modalities respectively, to construct a target knowledge graph corresponding to the target field; generating a plurality of target question and answer pairs in the target field based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on historical questions in the target field and historical answers corresponding to the historical questions; and in response to a question and answer request for the target field, determining a target answer corresponding to the question and answer request based on the plurality of target question and answer pairs. The device in the present document can be a server, a PC, or the like.
[0087] The present application also provides a computer program product, which, when executed on a data processing device, is adapted to execute a program that is initialized with the following method steps: obtaining target data in a target field, wherein a modality of the target data is included in a plurality of predetermined modalities; performing knowledge fusion on the target data according to modality weights corresponding to the plurality of predetermined modalities respectively, to construct a target knowledge graph corresponding to the target field; generating a plurality of target question and answer pairs in the target field based on the target knowledge graph and a plurality of initial question and answer pairs, wherein the plurality of initial question and answer pairs are obtained based on historical questions in the target field and historical answers corresponding to the historical questions; and in response to a question and answer request for the target field, determining a target answer corresponding to the question and answer request based on the plurality of target question and answer pairs.
[0088] Those skilled in the art should understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.
[0089] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0090] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0091] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0092] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0093] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, for storing instructions and data. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other non-volatile memory. The memory can be a memory of a computer-readable medium.
[0094] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0095] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusions, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but also other elements not explicitly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0096] Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system or computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.
[0097] The above merely provides embodiments of the present application and is not intended to limit the present application. Various modifications and changes can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the scope of the claims of the present application.
Claims
1. A question-and-answer processing method, characterized in that, include: Acquire target data in a target domain, wherein the target data is included in a plurality of predetermined modalities; According to the modality weights corresponding to the multiple predetermined modalities, the target data is fused to construct a target knowledge graph corresponding to the target domain; Based on the target knowledge graph and multiple initial question-answer pairs, multiple target question-answer pairs are generated in the target domain, wherein the multiple initial question-answer pairs are obtained based on historical questions in the target domain and the historical answers corresponding to the historical questions; In response to a question-and-answer request for the target domain, a target answer corresponding to the question-and-answer request is determined based on the plurality of target question-and-answer pairs; The step of generating multiple target question-answer pairs in the target domain based on the target knowledge graph includes: for a first question-answer pair among the multiple initial question-answer pairs, where the historical questions included in the first question-answer pair correspond to multiple historical answers, processing is performed based on the target knowledge graph to determine behavioral preference information in the target domain; based on the behavioral preference information, preference weights corresponding to the multiple historical answers are determined; the first question-answer pair is updated according to the historical questions, the multiple historical answers, and the preference weights corresponding to the multiple historical answers to obtain the target question-answer pairs corresponding to the first question-answer pair; and the multiple target question-answer pairs are obtained based on the multiple initial question-answer pairs by updating the target question-answer pairs based on the first question-answer pairs. The target knowledge graph includes entities, relationships, and attributes. Relationships represent interactions between multiple entities, and attributes represent the properties of entities. Processing based on the target knowledge graph to determine behavioral preference information for the target domain includes: acquiring historical behavioral data for the target domain; performing interaction analysis on the relationships and entities based on the historical behavioral data to determine preference patterns for the target domain; performing path analysis on the entities, relationships, and attributes to determine associations within the target domain; and determining the behavioral preference information based on the preference patterns and associations.
2. The method according to claim 1, characterized in that, The step of determining the preference weights corresponding to the multiple historical answers based on the behavioral preference information includes: An initial preference model is determined, wherein the preference model employs a predetermined loss function, which is used to enhance the weight of preferred answers and reduce the weight of non-preferred answers; The predetermined loss function is updated using the behavioral preference information to obtain the updated loss function; Based on the aforementioned update loss function, the updated preference model is obtained; The aforementioned preference update model is used to process the multiple historical answers and determine the preference weights corresponding to each of the multiple historical answers.
3. The method according to claim 1, characterized in that, The step of responding to a question-and-answer request in the target domain, based on the plurality of target question-and-answer pairs, to determine the target answer corresponding to the question-and-answer request, includes: Among the target questions corresponding to the plurality of target question-answer pairs, the request question that matches the question-answer request is determined; When there are multiple candidate answers to the requested question, the target answer is determined from the multiple candidate answers according to the preference weights corresponding to each candidate answer; or, Based on the preference weights corresponding to the multiple candidate answers, a predetermined number of candidate answers are determined from the multiple candidate answers; the target answer is obtained by combining the predetermined number of candidate answers.
4. The method according to any one of claims 1 to 3, characterized in that, The step of performing knowledge fusion on the target data according to the modality weights corresponding to the multiple predetermined modalities to construct a target knowledge graph corresponding to the target domain includes: When the target data includes both text and image modalities, a feature embedding method is used to process the target data to obtain text features; A convolutional neural network is used to process the target data to obtain image features; Based on the text features, the modality weights corresponding to the text modalities, the image features, and the modality weights corresponding to the image modalities, knowledge fusion is performed to obtain the target knowledge graph.
5. The method according to any one of claims 1 to 3, characterized in that, The acquisition of target data in the target domain includes: Based on the data source of the target domain, structured data, semi-structured data, and unstructured data are extracted to obtain structured data, semi-structured data, and unstructured data. The structured data is data organized according to a preset structure, the semi-structured data is data that dynamically changes according to a predetermined structure, and the unstructured data is multimodal data with multiple data formats. The target data is obtained by preprocessing the structured data, the semi-structured data, and the unstructured data, wherein the preprocessing includes cleaning and / or transformation.
6. The method according to claim 5, characterized in that, The step of performing knowledge fusion on the target data according to the modality weights corresponding to the multiple predetermined modalities to construct a target knowledge graph corresponding to the target domain includes: In the case of structured data included in the target data, the target data is extracted to determine entities, relationships, and attributes, wherein the attributes are used to represent the properties of the entities, and the relationships are used to represent the interactions between multiple entities; The target knowledge graph is determined by using a weighted average method to perform knowledge fusion based on the entity, the relationship, the attribute, and the modality weights corresponding to the multiple predetermined modalities.
7. The method according to claim 5, characterized in that, The step of performing knowledge fusion on the target data according to the modality weights corresponding to the multiple predetermined modalities to construct a target knowledge graph corresponding to the target domain includes: In the case where the target data includes semi-structured and / or unstructured data, the target data is extracted to identify entities; Based on the entity, determine semantic features; Based on the feature categories of the semantic features, attributes are determined, wherein the attributes are used to represent the properties of the entity; Using natural language processing, relationships are determined based on the syntactic structure and contextual information included in the semantic features, wherein the relationships are used to represent the interactions between multiple entities; The target knowledge graph is determined by using a weighted average method to perform knowledge fusion based on the entity, the relationship, the attribute, and the modality weights corresponding to the multiple predetermined modalities.
8. A question-and-answer processing device, characterized in that, include: A data acquisition module is used to acquire target data in a target domain, wherein the target data is included in a plurality of predetermined modalities; The graph module is used to perform knowledge fusion on the target data according to the modality weights corresponding to the multiple predetermined modalities, and construct a target knowledge graph corresponding to the target domain. The question-answer pair generation module is used to generate multiple target question-answer pairs in the target domain based on the target knowledge graph and multiple initial question-answer pairs, wherein the multiple initial question-answer pairs are obtained based on historical questions in the target domain and historical answers corresponding to the historical questions; The answering module is used to respond to a question-and-answer request for the target domain and, based on the multiple target question-and-answer pairs, determine the target answer corresponding to the question-and-answer request; The question-answer pair generation module is further configured to, for the first question-answer pair among the plurality of initial question-answer pairs, if the historical question in the first question-answer pair corresponds to multiple historical answers, process based on the target knowledge graph to determine the behavioral preference information of the target domain; determine the preference weights corresponding to the multiple historical answers based on the behavioral preference information; update the first question-answer pair according to the historical question, the multiple historical answers, and the preference weights corresponding to the multiple historical answers to obtain the target question-answer pair corresponding to the first question-answer pair; and obtain the plurality of target question-answer pairs based on the plurality of initial question-answer pairs by updating the target question-answer pairs based on the first question-answer pair. The question-answering pair generation module is further configured to, given that the target knowledge graph includes entities, relationships, and attributes, wherein the relationships represent interactions between multiple entities and the attributes represent the properties of entities, acquire historical behavioral data of the target domain; perform interaction analysis on the relationships and entities based on the historical behavioral data to determine the preference patterns of the target domain; perform path analysis on the entities, relationships, and attributes to determine the association relationships of the target domain; and determine the behavioral preference information based on the preference patterns and the association relationships.
Citation Information
Patent Citations
Data processing method and device, equipment and storage medium
CN116089573A
Question and answer method and device based on multi-modal input and knowledge graph
CN117521814A
Multi-modal question and answer method and system based on multi-modal knowledge graph
CN118014062A