Question and answer processing method and device

By using search agents and importance parameter screening technology in the Q&A system, the question of accuracy of large language models in the field of timeliness is solved, and high-quality and timeliness question-and-anss answers are achieved.

CN119323262BActive Publication Date: 2025-05-23ZHUO SHI TECH (HAINAN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411841090.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-05-23
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

When existing large language models deal with areas with strong timeliness, it is difficult to provide accurate answers, and the data quality of information retrieval recalls is uneven, which may lead to logical contradictions or incorrect answers.

Method used

By using the search agent to search for the search triplet of the to-process problem, the importance parameters of each search response content are calculated, multiple first candidate content and second candidate content are filtered out, and structured them to generate preliminary answers and obtain target answers through enhanced processing.

Benefits of technology

It improves the accuracy of the answers of the Q&A system in areas with strong timeliness, ensures the quality and timeliness of the output, and avoids logical contradictions and incorrect answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119323262B_ABST
    Figure CN119323262B_ABST
Patent Text Reader

Abstract

The present invention provides a question-answering processing method and device, which relates to the field of artificial intelligence technology. The method includes: using a search agent to search and process the search triples of the problem to be processed to obtain the search response content; calculating the importance parameter corresponding to each search response content; using the importance parameter and the correlation parameter to determine multiple first candidate contents and multiple second candidate contents; performing structured processing on the multiple first candidate contents and multiple second candidate contents to obtain the first structured content and the second structured content; generating a preliminary answer based on the problem to be processed and the first structured content of all search triples; and enhancing the preliminary answer based on the second structured content of all search triples to obtain the target answer. The present invention screens and grades the searched content, generates a preliminary answer with part of the content, and then enhances the preliminary answer with another part of the content, which can ensure that the target answer takes into account both timeliness and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a question-answering processing method and device. Background Art

[0002] With the rapid development of artificial intelligence technology, large language models are widely used in various question-answering systems to quickly answer users' questions. Existing large language models generate answers based on existing training data. When users' questions involve time-sensitive areas such as current hot topics and rapidly changing technical information, large language models show obvious limitations and are difficult to provide accurate answers.

[0003] Currently, information retrieval can be introduced to improve the accuracy of answers. This method makes up for the timeliness issue to a certain extent. However, the data recalled by information retrieval is diverse and the quality of these data varies. This may cause the large language model to output some logically contradictory and incorrect answers, which will reduce the quality of question and answer. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide a question-answering processing method and device, which can mine effective content from the retrieved content and provide accurate background information for the model to improve the accuracy of the question and answer.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0006] In one aspect, the present invention provides a question-answering processing method, comprising:

[0007] Using a search agent to search and process the search triple of the problem to be processed, and obtain a search response content corresponding to the search triple, wherein the search triple includes a core search term, a search-related term, and a time attribute in the problem to be processed, and the search-related term is a field in the problem to be processed that is associated with the core search term;

[0008] Calculating, according to the search triples, an importance parameter corresponding to each of the search response contents, the importance parameter including a timeliness parameter related to the time attribute, and a relevance parameter related to the core search term and the search-related term;

[0009] Determine a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents;

[0010] Performing structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triples to obtain first structured contents and second structured contents of the search triples;

[0011] Generate a preliminary answer to the question to be processed according to the question to be processed and the first structured contents of all the search triples;

[0012] The preliminary answer is enhanced according to the second structured content of all the search triples to obtain a target answer to the question to be processed.

[0013] Optionally, the using a search agent to perform search processing on the search triple of the problem to be processed to obtain search response content corresponding to the search triple includes:

[0014] Performing semantic analysis on the problem to be processed to extract search core words, search related words and time attributes from the problem to be processed to obtain search triples;

[0015] For each of the search triples, generating a search task corresponding to the search triple;

[0016] The search agent is called to execute the search task in a preset database to obtain the search response content corresponding to the search triplet.

[0017] Optionally, calculating the importance parameter corresponding to each search response content according to the search triplet includes:

[0018] For each of the search response contents, determining a weight parameter of the search response content based on the search triplet and the domain type of the search response content;

[0019] Calculating the timeliness parameter of the search response content by using the time information in the search response content and the time attribute in the search triplet;

[0020] Calculating the cosine similarity between the search response content and the specified text to obtain a relevance parameter of the search response content, wherein the specified text includes the core search term and the search-related term;

[0021] An importance parameter of the search response content is calculated based on the weight parameter, the timeliness parameter, and the relevance parameter.

[0022] Optionally, the weight parameter includes a timeliness weight and a relevance weight, and the calculating the importance parameter of the search response content based on the weight parameter, the timeliness parameter and the relevance parameter includes:

[0023] Calculating a quality parameter of the search response content based on the source of the search response content and the richness of the search response content;

[0024] The timeliness parameter is weighted by using the timeliness weight to obtain a weighted timeliness parameter;

[0025] weighting the association parameter using the association weight to obtain a weighted association parameter;

[0026] The importance parameter is calculated by combining the quality parameter, the weighted timeliness parameter, and the weighted relevance parameter.

[0027] Optionally, the determining a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents comprises:

[0028] Obtaining a first importance threshold, a second importance threshold, and a relevance threshold, wherein the first importance threshold is greater than the second importance threshold;

[0029] For each search response content of the search triplet, taking the search response content whose importance parameter is greater than or equal to the first importance threshold as the first candidate content;

[0030] Determine the search response content whose importance parameter is greater than or equal to the second importance threshold and less than the first importance threshold as intermediate content;

[0031] The intermediate content whose relevance parameter is greater than or equal to the relevance threshold is determined as the second candidate content.

[0032] Optionally, the performing structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triple to obtain the first structured content and the second structured content of the search triple includes:

[0033] For each of the first candidate contents, split the first candidate contents into a plurality of first segments, and sort the first segments according to positions of the first candidate contents to obtain a first segment sequence;

[0034] For each of the search triples, all first fragment sequences corresponding to the search triple are merged to obtain first structured content of the search triple;

[0035] For each second candidate content, split the second candidate content into a plurality of second segments, and sort the second segments according to positions of the second candidate content to obtain a second segment sequence;

[0036] For each of the search triples, all second fragment sequences corresponding to the search triple are merged to obtain second structured content of the search triple.

[0037] Optionally, generating a preliminary answer to the question to be processed according to the question to be processed and the first structured contents of all the search triples includes:

[0038] For each of the search triples, screening out a first target segment from a first structured content of the search triple;

[0039] Generate data to be inferred using all the first target segments, the problem to be processed and preset prompt words;

[0040] The data to be inferred is inferred through the problem processing model to obtain a preliminary answer to the problem to be processed.

[0041] Optionally, the first structured content includes a plurality of first segments, and for each of the search triples, selecting a first target segment from the first structured content of the search triple includes:

[0042] Obtaining the maximum input length of the problem processing model, the number of the search triples, and the problem length of the problem to be processed;

[0043] Dividing the difference between the maximum input length and the problem length by the number of search triples to obtain a base length;

[0044] The basic length is weighted by using the adjustment coefficient corresponding to the search triplet to obtain the target length corresponding to the search triplet;

[0045] For each of the search triples, a first target segment is determined from the plurality of first segments according to the target length.

[0046] Optionally, the enhancing the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed includes:

[0047] Dividing the preliminary answer into multiple answer segments according to semantics;

[0048] Combining the answer segments in pairs to obtain multiple segment groups;

[0049] For each of the segment groups, using the detection model to perform logical contradiction detection processing on two answer segments in the segment group to obtain a detection result;

[0050] The detection results represent a group of fragments whose two answer fragments are logically contradictory, and determine them as a group to be enhanced;

[0051] The second structured contents of all search triples are used to perform contradiction correction processing on two answer segments in the to-be-enhanced group in the preliminary answer to obtain a target answer.

[0052] On the other hand, the present invention further provides a question-answer processing device, used to implement any of the above methods, the device comprising:

[0053] A search module, used to use a search agent to search and process the search triple of the problem to be processed, and obtain the search response content corresponding to the search triple, wherein the search triple includes the core search term, search-related term and time attribute in the problem to be processed, and the search-related term is a field in the problem to be processed that is associated with the core search term;

[0054] A parameter calculation module, configured to calculate, based on the search triples, an importance parameter corresponding to each of the search response contents, wherein the importance parameter includes a timeliness parameter associated with the time attribute, and a relevance parameter associated with the core search terms and the search-related terms;

[0055] A determination module, configured to determine a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents;

[0056] A structuring module, configured to perform structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triples, to obtain first structured contents and second structured contents of the search triples;

[0057] A generating module, configured to generate a preliminary answer to the question to be processed based on the question to be processed and the first structured contents of all the search triples;

[0058] An enhancement module is used to enhance the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed.

[0059] On the other hand, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute the steps in any question and answer processing method provided by the present invention.

[0060] On the other hand, the present invention also provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the steps in any question and answer processing method provided by the present invention.

[0061] On the other hand, the present invention further provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps in any one of the question-answering processing methods provided by the present invention.

[0062] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0063] In the embodiment of the present invention, a search agent can be used to search and process the search triples of the problem to be processed, obtain the search response content corresponding to the search triples, calculate the importance parameters of each search response content, and screen out multiple first candidate content and second candidate content based on the importance parameters and the correlation parameters, so as to screen and grade the search response content, and then perform structured processing on it to obtain the first structured content and the second structured content. Using the first structured content to generate a preliminary answer to the problem to be processed, and then using the second structured content to enhance the preliminary answer, it can ensure that the target answer obtained later takes into account both timeliness and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0065] Figure 1 Schematic diagram of an application scenario of the question-answering processing method provided by an embodiment of the present invention;

[0066] Figure 2 is a flowchart of a question-and-answer processing method provided by an embodiment of the present invention;

[0067] Figure 3 is a schematic diagram of obtaining first candidate content and second candidate content provided by an embodiment of the present invention;

[0068] Figure 4 is a schematic diagram of a merging process provided by an embodiment of the present invention;

[0069] Figure 5 is a schematic diagram of the structure of a question-answer processing device provided by an embodiment of the present invention;

[0070] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0072] The embodiments of the present invention provide a question-answering processing method and device, which can mine effective content from retrieved content and provide accurate background information for the model to improve the accuracy of the question-answering.

[0073] It is understandable that in the specific implementation of the present invention, data related to user information, etc., needs to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0074] See also Figure 1 , showing a schematic diagram of an application scenario of the question-answering processing method. The application scenario may include a terminal 101 and a server 102, and data may be exchanged between the terminal 101 and the server 102 via a network, and an application program related to question-answering may be installed on the terminal 101. The terminal 101 may be a mobile phone, a tablet computer, a smart Bluetooth device, a computer, a large screen device, a robot, etc.; the server 102 may be a single server or a server cluster consisting of multiple servers.

[0075] The user can send the pending question to the server 102 through the terminal 101. The server 102 can use the search agent to search and process the search triple of the pending question to obtain the search response content corresponding to the search triple, wherein the search triple includes the core search term, search-related terms and time attributes in the pending question, and the search-related terms are fields associated with the core search term in the pending question; according to the search triple, the importance parameters corresponding to each search response content are calculated, and the importance parameters include timeliness parameters related to the time attributes, and correlation parameters related to the core search term and the search-related terms; using the importance parameters and correlation parameters of each search response content, multiple first candidate contents and multiple second candidate contents of the search triple are screened out; the multiple first candidate contents and multiple second candidate contents corresponding to the search triple are structured to obtain the first structured content and the second structured content of the search triple; according to the first structured content of the pending question and all the search triples, a preliminary answer to the pending question is generated; according to the second structured content of all the search triples, the preliminary answer is enhanced to obtain the target answer to the pending question. The server 102 may send the target answer to the terminal 101 to display the target answer to the user.

[0076] In this embodiment, a question-answering processing method is provided, such as Figure 2 As shown, the specific process of the question-answering processing method can be as follows:

[0077] S110. Use a search agent to perform search processing on the search triple of the problem to be processed, and obtain search response content corresponding to the search triple.

[0078] Pending questions refer to questions input by users that need to be answered. Pending questions can be input in text form or voice form, and are eventually converted into text form for subsequent processing.

[0079] The search triple is the content extracted from the problem to be processed after semantic analysis of the problem to be processed. The search triple may include core search terms, search related terms, and time attributes, where the core search terms are the words or phrases that best represent the subject of the problem to be processed; search related terms are words or phrases that are closely related to the core search terms and can provide more information and details; and time attributes are words or phrases that describe the time in the problem to be processed.

[0080] It should be noted that, depending on the actual semantic analysis, more than one search triple may be extracted. For example, the question to be processed is: Are Xiaohong's deeds ten years ago consistent with her current behavior? The extracted search triples may be [Xiaohong-deeds-ten years ago] and [Xiaohong-behavior-now].

[0081] An agent is a system that can autonomously perceive the environment, make decisions, and execute response actions, while a search agent is an agent dedicated to search. The search agent can search and process the search triple to obtain the search response content corresponding to the search triple. The search response content is the searched content related to the search triple.

[0082] As an implementation method, when calling a search agent to perform search processing on the search triples of the problem to be processed and obtaining the search response content corresponding to the search triples, it can be to perform semantic analysis processing on the problem to be processed to extract search core words, search related words and time attributes from the problem to be processed to obtain the search triples; for each search triple, generate a search task corresponding to the search triple; call the search agent to execute the search task in a preset database to obtain the search response content corresponding to the search triples.

[0083] Optionally, when extracting the search triples from the problem to be processed, the problem to be processed may be vectorized to obtain the vector to be processed; the vector to be processed may be semantically parsed using a large language model to extract the core search terms, search-related terms, and time attributes therein. The extracted core search terms, search-related terms, and time attributes may be stored in a fixed format to obtain the search triples.

[0084] The concatenated data of the problem to be processed and the extraction prompt template are input into the large language model so that the large language model can understand the problem to be processed and accurately extract the search triples. The extracted search triples can be multiple. Among them, the extraction prompt template can be pre-set, which can include the extraction examples, extraction steps, extraction restrictions and question slots of the search triples. The problem to be processed is filled into the question slot to obtain the corresponding concatenated data.

[0085] For each search triple, its corresponding search task can be defined, and then the search agent can assign the search task to the search engine tool for searching. The preset database is the search scope of the search engine. The preset database can be pre-built or a network database. In an embodiment of the present invention, the preset database can be an Internet database, that is, a database composed of data on various websites. The search engine tool searches the preset database according to the search triple to recall the content related to the search triple from the preset database, that is, the search response content. Among them, the search response content can be multiple, and the search response content can include at least one of an image, text, and video.

[0086] S120: Calculate the importance parameter corresponding to each search response content according to the search triples.

[0087] For each search triple, the search response content corresponding to the search triple can be obtained. For each search response content, the importance parameter corresponding to the search response content can be calculated using its corresponding search triple. The importance parameter is a parameter used to measure the importance of the search response content. The larger the importance parameter, the more important the search response content is.

[0088] The importance parameter may include a timeliness parameter and a relevance parameter. Here, "included" means that when calculating the importance parameter, the timeliness parameter and the relevance parameter need to be calculated first. The timeliness parameter is a parameter used to evaluate the timeliness of the search response content. The larger the timeliness parameter, the newer the search response content. The relevance parameter is a parameter used to evaluate the relevance between the search response content and the search triple. The larger the relevance parameter, the more relevant the search response content and the search triple.

[0089] As an implementation method, when calculating the importance parameters of the search response content, it can be that for each of the search response contents, based on the search triples and the domain type of the search response content, the weight parameters of the search response content are determined; the time information in the search response content and the time attributes in the search triples are used to calculate the timeliness parameters of the search response content; the cosine similarity between the search response content and the specified text is calculated to obtain the relevance parameters of the search response content, wherein the specified text is the concatenated text of the core search terms and the search-related terms; and the importance parameters of the search response content are calculated based on the weight parameters, the timeliness parameters and the relevance parameters.

[0090] The domain type of the search triple and the domain type of the search response content can be obtained by combining the semantic analysis of the problem to be processed. If the domain type of the search triple is consistent with the domain type of the search response content, the weight parameter of the search response content is determined to be the first weight; if the domain type of the search triple is inconsistent with the domain type of the search response content, the weight parameter of the search response content is determined to be the second weight, wherein the first weight is greater than the second weight.

[0091] For example, "Xiao Hong" has people with the same name in the medical industry and the entertainment industry. The domain type of the search triple is the medical field, and the domain type of the search response content is the entertainment type. Then the weight parameter of the search response content is the second weight.

[0092] The time information in the search response content and the time attribute in the search triple can be used to calculate the timeliness parameter of the search response content. The time information in the search response content can include the release time and the last update time of the search response content, and the time attribute is the time-related description of the problem to be processed. For example, if the time attribute in the problem to be processed is ten years ago, it can be converted into a timestamp for use, that is, subtract 10 years from the current time to obtain information such as year, month, and day.

[0093] Optionally, the timeliness parameter of the search response content may be calculated according to the following formula:

[0094]

[0095] in, represents the timeliness parameter of the i-th search response content corresponding to the search triple; time represents the time attribute in the problem to be processed; T publish represents the publishing time of the i-th search response content; T update Indicates the last update time of the i-th search response content.

[0096] The cosine similarity between the search response content and the specified text is calculated to obtain the relevance parameter of the search response content. The specified text refers to the text obtained by concatenating the core search term and the search-related term. For example, if the search triple is [Xiaohong-deeds-ten years ago], the specified text is "Xiaohong deeds". Specifically, the specified text can be vectorized to obtain a specified vector; the search response content can be vectorized to obtain a response vector; the cosine similarity between the specified vector and the response vector is calculated to obtain the relevance parameter.

[0097] For details, please refer to the following formula:

[0098] ;

[0099] in, A relevance parameter representing the i-th search response content corresponding to the search triple; The vector representation that represents the content of the i-th search response, that is, the response vector; embedding(text) represents the specified vector.

[0100] Finally, the importance parameter of the search response content can be calculated using the weight parameter, timeliness parameter, and relevance parameter. As an implementation method, when calculating the importance parameter using these parameters, the quality parameter of the search response content can be calculated based on the source of the search response content and the richness of the search response content; the timeliness parameter is weighted using the timeliness weight to obtain the weighted timeliness parameter; the relevance parameter is weighted using the relevance weight to obtain the weighted relevance parameter; and the importance parameter is calculated by combining the quality parameter, the weighted timeliness parameter, and the weighted relevance parameter.

[0101] A quality parameter can also be introduced into the importance parameter to measure the content quality of the search response content. The higher the quality parameter, the better the content of the search response content. The quality parameter can be calculated based on the credibility of the search response content and the richness of the content. Specifically, a mapping relationship between a preset source and a preset credibility can be pre-set. Specifically, the preset credibility can be set according to the domain name of the source website. For example, the preset credibility of org is generally lower than that of gov. According to the mapping relationship, the corresponding credibility can be directly determined by using the domain name of the source website of the search response content. Of course, the citation of the search response content can also be considered, and the credibility is determined by comprehensively considering the application and the source. Multi-label recognition is performed on the search response content, and the richness of the content is calculated based on the number of recognized labels, wherein the labels can be pre-defined.

[0102] The weight parameters obtained by the above calculation may include timeliness weight and association weight. The timeliness weight can be used to weight the timeliness parameter to obtain the weighted timeliness parameter; the association weight can be used to weight the association parameter to obtain the weighted association parameter.

[0103] The importance parameter can be calculated by combining the quality parameter, the weighted timeliness parameter, and the weighted relevance parameter. Specifically, the importance parameter can be calculated according to the following formula:

[0104]

[0105] Among them, P priority The importance parameter of the i-th search response content; α i Represents the association weight; γ i Characterize the timeliness weight; A relevance parameter representing the content of the i-th search response; A timeliness parameter representing the content of the i-th search response; Characterize the credibility of the i-th search response content; Characterizes the richness of the content of the i-th search response; β characterizes the exponential adjustment coefficient of the relevance parameter, which is used to adjust its nonlinear impact on the importance parameter. The default value is 1 and can be adjusted according to actual needs.

[0106] It can be seen that the importance parameters of the search response content include relevance parameters, timeliness parameters, credibility and richness. Comprehensively evaluating the search response content from multiple dimensions is more scientific and accurate.

[0107] S130: Filter out a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each search response content.

[0108] When calculating the importance parameter of each search response content, the relevance parameter of the search response content is also calculated. The first candidate content and the second candidate content of the search triple can be screened out by using the importance parameter and the relevance parameter.

[0109] Among them, the first candidate content only relies on the importance parameter screening, and the second candidate content needs to rely on the importance parameter and the relevance parameter screening.

[0110] As an implementation mode, when determining the first candidate content and the second candidate content of a search triple, a first importance threshold, a second importance threshold and a relevance threshold may be obtained, wherein the first importance threshold is greater than the second importance threshold; for the search response content of each search triple, the search response content whose importance parameter is greater than or equal to the first importance threshold is determined as the first candidate content; the search response content whose importance parameter is greater than or equal to the second importance threshold and less than the first importance threshold is determined as the intermediate content; and the intermediate content whose relevance parameter is greater than or equal to the relevance threshold is determined as the second candidate content.

[0111] The first importance threshold and the second importance threshold are preset thresholds related to the importance parameter, wherein the first importance threshold is greater than the second importance threshold. The relevance threshold is a preset threshold related to the relevance parameter.

[0112] See also Figure 3 , showing a schematic diagram of obtaining the first candidate content and the second candidate content. For each search triple, the search response content whose importance parameter is greater than or equal to the first importance threshold among the corresponding multiple search response contents can be determined as the first candidate content. For example, Figure 3 In , the importance parameter of the search response content is recorded as Pi, and the first importance threshold is P1. If Pi is greater than or equal to P1, the search response content is the first candidate content.

[0113] Among the multiple search response contents, the search response contents whose importance parameters are greater than or equal to the second importance threshold and less than the first importance threshold are determined as the intermediate contents, and the intermediate contents whose relevance parameters are greater than or equal to the relevance threshold are determined as the second candidate contents. Figure 3 In the example, the second importance threshold is recorded as P2. If Pi is less than P1, we can continue to determine whether Pi is greater than or equal to P2. If so, we can continue to determine whether its relevance parameter Si is greater than or equal to the relevance threshold S1. If so, it is used as the second candidate content.

[0114] It can be seen that the first candidate content is the search response content with a higher importance parameter, and the importance parameter of the second candidate content is lower than that of the first candidate content but is more closely related to the search triple. In this way, for each search triple, the corresponding first candidate content and second candidate content can be screened out.

[0115] S140: Structuring the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triples to obtain first structured contents and second structured contents of the search triples.

[0116] In order to facilitate the subsequent use of the first candidate content and the second candidate content, the first candidate content and the second candidate content corresponding to the search triplet may be structured to obtain the first structured content and the second structured content of the search triplet.

[0117] Optionally, for each of the first candidate contents, the first candidate contents are split into multiple first segments, and the first segments are sorted according to positions in the first candidate contents to obtain a first segment sequence; for each of the search triples, all the first segment sequences corresponding to the search triples are merged to obtain the first structured content of the search triples; for each of the second candidate contents, the second candidate contents are split into multiple second segments, and the second segments are sorted according to positions in the second candidate contents to obtain a second segment sequence; for each of the search triples, all the second segment sequences corresponding to the search triples are merged to obtain the second structured content of the search triples.

[0118] The aforementioned first candidate content corresponds to the search triple. For each first candidate content of each search triple, the first candidate content can be divided into multiple semantic segments, namely first segments, based on a semantic parsing algorithm. Each first segment can represent a single semantic information in the first candidate content. The first segment of each first candidate content can be sorted according to the position of the first segment in the first candidate content to obtain a first segment sequence.

[0119] The first structured content can be obtained by merging multiple first fragment sequences corresponding to the search triple. For example, for each search triple, multiple first candidate contents are sorted in descending order of importance parameters to obtain a first content sequence; the first candidate contents corresponding to the first content sequence are replaced with the first fragment sequence to obtain a first sequence to be merged; and the semantically similar first fragments in the first sequence to be merged are merged to obtain the first structured content of the search triple.

[0120] The first sequence to be merged includes the first segment of each first candidate content. In order to reduce the subsequent calculation amount, the first segments can be combined in pairs to form multiple first segment groups; for each first segment group, the two first segments in the first segment group are semantically encoded and then the cosine similarity is calculated; if the cosine similarity is greater than the preset similarity, it can be considered that the two first segments in the first segment group are semantically similar, and only one of them can be retained. After traversing each of the above first segment groups, a new first sequence to be merged can be obtained, which is considered to be the completion of a merging process. The merging process can be repeated multiple times until each first segment group can no longer be merged to obtain the first structured content. That is, the similarity between any two first segments in the first structured content is less than the preset similarity. For example, refer to Figure 4 , a schematic diagram of the merging process is shown, wherein the search triple contains two first candidate contents, and a total of 4 first segments are split, which can be combined into 6 segment groups. Assuming that the cosine similarity calculated in group 23 is greater than the preset similarity, the first segment 2 is retained after the merge, then the new sequence to be merged is: the first segment 1, the first segment 2 and the first segment 4. The combination and merging process can be continued until there is no first segment group whose cosine similarity is greater than the preset similarity.

[0121] The aforementioned second candidate content corresponds to the search triple. For each second candidate content of each search triple, the second candidate content can be divided into multiple semantic segments, namely, second segments, based on a semantic parsing algorithm. Each second segment can represent a single semantic information in the second candidate content. The second segment of each second candidate content can be sorted according to the position of the second segment in the second candidate content to obtain a second segment sequence.

[0122] The second structured content can be obtained by merging multiple second fragment sequences corresponding to the search triple. For example, for each search triple, multiple second candidate contents are sorted in descending order of importance parameters to obtain a second content sequence; the second candidate contents corresponding to the second content sequence are replaced with the second fragment sequence to obtain a second sequence to be merged; and the second fragments with similar semantics in the second sequence to be merged are merged to obtain the second structured content of the search triple.

[0123] The second sequence to be merged includes the second segment of each second candidate content. In order to reduce the subsequent calculation amount, the second segments can be combined in pairs to form multiple second segment groups; for each second segment group, the two second segments in the second segment group are semantically encoded and the cosine similarity is calculated; if the cosine similarity is greater than the preset similarity, it can be considered that the two second segments in the second segment group are semantically similar, and only one of them can be retained. After traversing each of the above second segment groups, a new second sequence to be merged can be obtained, which is considered to be the completion of a merging process. The merging process can be repeated multiple times until each second segment group can no longer be merged to obtain the second structured content. That is, the similarity between any two second segments in the second structured content is less than the preset similarity. Among them, the preset similarity can be set according to actual needs and is not specifically limited here.

[0124] S150: Generate a preliminary answer to the question to be processed based on the question to be processed and the first structured contents of all the search triples.

[0125] The first structured content of the search triple may include multiple first segments. In combination with the multiple first segments and the question to be processed, a preliminary answer corresponding to the question to be processed may be generated using the question processing model.

[0126] As an implementation method, for each search triple, a first target segment is screened out from multiple first segments in the first structured content of the search triple; data to be inferred is generated using all of the first target segments, the question to be processed, and preset prompt words; the data to be inferred is inferred through a question processing model to obtain a preliminary answer to the question to be processed.

[0127] The first structured content of the search triple contains multiple first segments, and the first target segment is the selected first segment. Among them, a specified number of first segments can be randomly extracted from the first segment of each search triple as the first target segment. The first target segment can provide more background knowledge when the problem processing model infers the preliminary answer corresponding to the problem to be processed, so as to ensure the accuracy of the preliminary answer.

[0128] Among them, the problem processing model can be a large language model, and the large language model usually has a certain length limit for its input. In order to ensure that effective background knowledge can be provided within a limited length, when screening the first target segment, the maximum input length of the problem processing model, the number of search triples and the problem length of the problem to be processed can be obtained; the difference between the maximum input length and the problem length is divided by the number of search triples to obtain a basic length; the basic length is weighted using the adjustment coefficient corresponding to the search triple to obtain a target length corresponding to the search triple; for each search triple, the first target segment is determined from the multiple first segments according to the target length.

[0129] The maximum input length of the problem processing model refers to the maximum number of characters that the problem processing model can process at one time, and the problem length of the problem to be processed refers to the number of characters in the problem to be processed. There may be multiple search triples mentioned above. In order to ensure that part of the first target segment can be selected from each search triple, the maximum input length can be subtracted from the problem length to obtain the difference between the two, and then the difference is divided by the number of search triples to obtain the basic length. For different search triples, an adjustment coefficient can be set in advance. The adjustment coefficient is a value between 0 and 1, which can be set according to actual needs. The basic length is weighted by the adjustment coefficient of the search triple to obtain the target length, which is the maximum length of the first target segment of the search triple.

[0130] For each of the search triples, a target segment can be determined from multiple first segments based on the target length. As an implementation, the first first segment in the first structured content is selected as the designated segment; if the length of the designated segment is not greater than the target length, the segment length of the next first segment is obtained; if the sum of the segment length and the length of the designated segment is not greater than the target length, the next first segment is added to the designated segment to obtain a new designated segment; if the sum of the segment length and the length of the designated segment is greater than the target length, the designated segment is determined as the first target segment.

[0131] As another implementation, in order to make full use of the limited length, the first first segment in the first structured content is selected as the designated segment; if the length of the designated segment is less than the target length, the next first segment is added to the designated segment to obtain a new designated segment; if the length of the designated segment is equal to the target length, the designated segment is determined as the first target segment; if the length of the designated segment is greater than the target length, the designated segment is truncated according to the target length to obtain the first target segment.

[0132] The data to be inferred is generated using the first target segment, the problem to be processed and the preset prompt words, and the data to be inferred is input into the problem processing model for reasoning to obtain a preliminary answer to the problem to be processed. The preset prompt words may include the pre-set reasoning steps, context slots and question slots for guiding the problem processing model. The first target segment is filled into the context slot, and the problem to be processed is filled into the question slot to obtain the data to be inferred. The data to be inferred is input into the problem processing model, and the output content of the problem processing model is obtained as the preliminary answer.

[0133] S160: Enhance the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed.

[0134] The second structured content may include multiple second segments, and the second structured content is mainly used to correct unreasonable parts in the preliminary answer to obtain the target answer. As an implementation method, the preliminary answer may be analyzed first to determine the unreasonable text, and then corrected using multiple second segments. For example, the preliminary answer may be divided into multiple answer segments according to semantics; the answer segments are combined in pairs to obtain multiple segment groups; for each segment group, the two answer segments in the segment group are subjected to logical contradiction detection processing using a detection model to obtain a detection result; the segment group in which the detection result represents the logical contradiction between the two answer segments is determined as the group to be enhanced; the two answer segments in the group to be enhanced in the preliminary answer are subjected to contradiction correction processing using the second structured content of all search triples to obtain the target answer.

[0135] According to semantics, the preliminary answer can be divided into multiple answer segments. Each answer segment contains certain semantic information. Multiple answer segments can be combined in pairs to form multiple segment groups. For each segment group, the detection model can be used to perform logical contradiction detection on the segment group. Specifically, it can be the semantics of the two answer segments in the segment group to determine whether there is a contradiction in the semantics. If there is, the detection result is contradictory; if not, the detection result is normal. For example, answer segment 1 is: The development of AI has made significant progress, especially in the field of natural language processing; answer segment 2 is: However, AI still cannot truly understand human emotions and intentions; answer segment 3 is: AI's emotional understanding ability has reached the human level and can accurately identify and respond to human emotions.

[0136] Segment group 1 may include answer segment 1 and answer segment 2, segment group 2 may include answer segment 1 and answer segment 3, and segment group 3 may include answer segment 2 and answer segment 3. When segment group 3 is analyzed again, a semantic contradiction between the two may be detected, and segment group 3 is the group to be enhanced.

[0137] Then, the second structured content of all search triples is used to correct the contradictions of the two answer segments in the group to be enhanced in the preliminary answer to obtain the target answer. Here, the second target segment can be screened out from the second structured content by referring to the aforementioned method of screening out the first target segment from the first structured content. Then, the second target segment and the group to be enhanced are input into the large language model for correction to obtain the corrected content, and then the two answer segments in the group to be enhanced are replaced with the corrected content to obtain the final target answer.

[0138] The question-answering processing scheme provided by the embodiment of the present invention can be applied in various intelligent question-answering scenarios. For example, taking policy-related questions and answers as an example, the scheme provided by the embodiment of the present invention can quickly retrieve the latest policy information on the Internet, and screen these policy information according to importance parameters and relevance parameters, use relatively important policy information to assist in generating preliminary answers, and use less important but more relevant policy information to correct logical contradictions in the preliminary answers, so that the answers output by the model can take into account both timeliness and accuracy.

[0139] From the above, it can be seen that the embodiment of the present invention can call the search agent to retrieve the content related to the problem to be processed according to the search triple, and comprehensively consider the credibility, richness, timeliness and relevance of the content to the problem to be processed, screen out the first candidate content and the second candidate content, avoid the influence of poor quality content on the reasoning of the model, and structure the first candidate content and the second candidate content to obtain the first structured content and the second structured content, which can reduce the difficulty of the model to understand the content, and finally use the relatively important first structured content to generate a preliminary answer, and use the less important but more relevant second structured content to correct the logical contradictions in the preliminary answer, so that the output answer of the model can take into account both timeliness and accuracy, and the quality of the produced answers is higher.

[0140] In order to better implement the above method, the embodiment of the present invention further provides a question-answer processing device, which can be integrated in an electronic device, and the electronic device can be a terminal, a server, etc. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.

[0141] For example, in this embodiment, the method of the embodiment of the present invention is described in detail by taking the question and answer processing device being specifically integrated in a server as an example.

[0142] For example, Figure 5 As shown, the question and answer processing device 200 may include a search module 210 , a parameter calculation module 220 , a determination module 230 , a structuring module 240 , a generation module 250 and an enhancement module 260 .

[0143] Search module 210, used to use search agents to search for search triples of the problem to be processed, and obtain search response content corresponding to the search triples, wherein the search triples include core search terms, search-related terms, and time attributes in the problem to be processed, and the search-related terms are fields in the problem to be processed that are associated with the core search terms;

[0144] A parameter calculation module 220, configured to calculate, based on the search triples, an importance parameter corresponding to each of the search response contents, wherein the importance parameter includes a timeliness parameter associated with the time attribute, and a relevance parameter associated with the core search terms and the search-related terms;

[0145] A determination module 230, configured to determine a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents;

[0146] The structuring module 240 is used to perform structural processing on the multiple first candidate contents and the multiple second candidate contents corresponding to the search triple to obtain the first structured content and the second structured content of the search triple;

[0147] A generating module 250, configured to generate a preliminary answer to the question to be processed based on the question to be processed and the first structured contents of all the search triples;

[0148] The enhancement module 260 is used to enhance the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed.

[0149] In some embodiments, the search module 210 is specifically used to:

[0150] Performing semantic analysis on the problem to be processed to extract search core words, search related words and time attributes from the problem to be processed to obtain search triples;

[0151] For each of the search triples, generating a search task corresponding to the search triple;

[0152] The search agent is called to execute the search task in a preset database to obtain the search response content corresponding to the search triplet.

[0153] In some embodiments, the parameter calculation module 220 is specifically used to:

[0154] For each of the search response contents, determining a weight parameter of the search response content based on the search triplet and the domain type of the search response content;

[0155] Calculating the timeliness parameter of the search response content by using the time information in the search response content and the time attribute in the search triplet;

[0156] Calculating the cosine similarity between the search response content and a specified text to obtain a relevance parameter of the search response content, wherein the specified text includes the core search term and the search-related term;

[0157] An importance parameter of the search response content is calculated based on the weight parameter, the timeliness parameter, and the relevance parameter.

[0158] In some embodiments, the weight parameters include timeliness weight and association weight, and the parameter calculation module 220 is specifically used to:

[0159] Calculating a quality parameter of the search response content based on the source of the search response content and the richness of the search response content;

[0160] The timeliness parameter is weighted by using the timeliness weight to obtain a weighted timeliness parameter;

[0161] weighting the association parameter using the association weight to obtain a weighted association parameter;

[0162] The importance parameter is calculated by combining the quality parameter, the weighted timeliness parameter, and the weighted relevance parameter.

[0163] In some embodiments, the determination module 230 is specifically configured to:

[0164] Obtaining a first importance threshold, a second importance threshold, and a relevance threshold, wherein the first importance threshold is greater than the second importance threshold;

[0165] For each search response content of the search triplet, taking the search response content whose importance parameter is greater than or equal to the first importance threshold as the first candidate content;

[0166] Determine the search response content whose importance parameter is greater than or equal to the second importance threshold and less than the first importance threshold as intermediate content;

[0167] The intermediate content whose relevance parameter is greater than or equal to the relevance threshold is determined as the second candidate content.

[0168] In some embodiments, the structuring module 240 is specifically used to:

[0169] For each of the first candidate contents, split the first candidate contents into a plurality of first segments, and sort the first segments according to positions of the first candidate contents to obtain a first segment sequence;

[0170] For each of the search triples, all first fragment sequences corresponding to the search triple are merged to obtain first structured content of the search triple;

[0171] For each second candidate content, split the second candidate content into a plurality of second segments, and sort the second segments according to positions of the second candidate content to obtain a second segment sequence;

[0172] For each of the search triples, all second fragment sequences corresponding to the search triple are merged to obtain the second structured content of the search triple.

[0173] In some embodiments, the generation module 250 is specifically used to:

[0174] For each of the search triples, screening out a first target segment from a first structured content of the search triple;

[0175] Generate data to be inferred using all the first target segments, the problem to be processed and preset prompt words;

[0176] The data to be inferred is inferred through the problem processing model to obtain a preliminary answer to the problem to be processed.

[0177] In some embodiments, the first structured content includes a plurality of first segments, and the generating module 250 is specifically configured to:

[0178] Obtaining the maximum input length of the problem processing model, the number of the search triples, and the problem length of the problem to be processed;

[0179] Dividing the difference between the maximum input length and the problem length by the number of search triples to obtain a base length;

[0180] The basic length is weighted by using the adjustment coefficient corresponding to the search triplet to obtain the target length corresponding to the search triplet;

[0181] For each of the search triples, a first target segment is determined from the plurality of first segments according to the target length.

[0182] In some embodiments, the enhancement module 260 is specifically used to:

[0183] Dividing the preliminary answer into multiple answer segments according to semantics;

[0184] Combining the answer segments in pairs to obtain multiple segment groups;

[0185] For each of the segment groups, using the detection model to perform logical contradiction detection processing on two answer segments in the segment group to obtain a detection result;

[0186] The detection results represent a group of fragments whose two answer fragments are logically contradictory, and determine them as a group to be enhanced;

[0187] The second structured contents of all search triples are used to perform contradiction correction processing on two answer segments in the to-be-enhanced group in the preliminary answer to obtain a target answer.

[0188] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0189] As can be seen from the above, the problem processing device of this embodiment can use the search agent to search and process the search triples of the problem to be processed, obtain the search response content corresponding to the search triples, calculate the importance parameters of each search response content, and screen out multiple first candidate contents and second candidate contents based on the importance parameters and the correlation parameters, so as to screen and grade the search response content, and then perform structured processing on it to obtain the first structured content and the second structured content. Using the first structured content to generate a preliminary answer to the problem to be processed, and then using the second structured content to enhance the preliminary answer, it can ensure that the target answer obtained later takes into account both timeliness and accuracy.

[0190] The embodiment of the present invention further provides an electronic device, which may be a terminal, a server, or the like. The terminal may be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, or the like; the server may be a single server or a server cluster composed of multiple servers, or the like.

[0191] In some embodiments, the question and answer processing device may also be integrated into multiple electronic devices. For example, the question and answer processing device may be integrated into multiple servers, and the question and answer processing method of the present invention may be implemented by multiple servers.

[0192] In this embodiment, the electronic device of this embodiment is a server as an example for detailed description, for example, Figure 6 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0193] The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0194] The processor 310 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 320, and calling data stored in the memory 320. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 310.

[0195] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.

[0196] The electronic device also includes a power supply 330 for supplying power to various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 330 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0197] The electronic device may further include an input module 340, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0198] The electronic device may further include a communication module 350. In some embodiments, the communication module 350 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 350, thereby providing the user with wireless broadband Internet access. For example, the communication module 350 may be used to help the user send and receive emails, browse web pages, and access streaming media.

[0199] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 310 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 320 according to the following instructions, and the processor 310 will run the application programs stored in the memory 320, thereby implementing the steps in the methods of the embodiments of the present invention.

[0200] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0201] As can be seen from the above, the electronic device provided by this embodiment can use the search agent to search and process the search triple of the problem to be processed, obtain the search response content corresponding to the search triple, calculate the importance parameter of each search response content, and screen out multiple first candidate content and second candidate content based on the importance parameter and the correlation parameter, so as to screen and grade the search response content, and then perform structured processing on it to obtain the first structured content and the second structured content. Using the first structured content to generate a preliminary answer to the problem to be processed, and then using the second structured content to enhance the preliminary answer, it can ensure that the target answer obtained later takes into account both timeliness and accuracy.

[0202] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0203] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which multiple instructions are stored. The instructions can be loaded by a processor to execute the steps in any question and answer processing method provided by the embodiment of the present invention.

[0204] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0205] According to one aspect of the present invention, a computer program product or computer program is provided, the computer program product or computer program including a computer program / instruction, the computer program / instruction being stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the electronic device executes the method provided in various optional implementations of the search aspect or question-answer processing aspect provided in the above-mentioned embodiments.

[0206] Since the instructions stored in the storage medium can execute the steps in any question and answer processing method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any question and answer processing method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0207] The above is a detailed introduction to a question and answer processing method and device provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A question-answering processing method, characterized in that: The method comprises: Using a search agent to search and process the search triple of the problem to be processed, and obtain a search response content corresponding to the search triple, wherein the search triple includes a core search term, a search-related term, and a time attribute in the problem to be processed, and the search-related term is a field in the problem to be processed that is associated with the core search term; Calculating, according to the search triples, an importance parameter corresponding to each of the search response contents, the importance parameter including a timeliness parameter related to the time attribute, and a relevance parameter related to the core search term and the search-related term; Determine a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents; Performing structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triples to obtain first structured contents and second structured contents of the search triples; Generate a preliminary answer to the question to be processed according to the question to be processed and the first structured contents of all the search triples; According to the second structured content of all the search triples, the preliminary answer is enhanced to obtain a target answer to the question to be processed; The first structured content includes a plurality of first segments, and generating a preliminary answer to the question to be processed based on the question to be processed and the first structured content of all the search triples includes: Obtain the maximum input length of the problem processing model, the number of search triples and the problem length of the problem to be processed; divide the difference between the maximum input length and the problem length by the number of search triples to obtain a basic length; perform weighted processing on the basic length using an adjustment coefficient corresponding to the search triple to obtain a target length corresponding to the search triple; for each search triple, determine a first target segment from the multiple first segments according to the target length; generate data to be inferred using all the first target segments, the problem to be processed and preset prompt words; infer the data to be inferred through the problem processing model to obtain a preliminary answer to the problem to be processed.

2. The method according to claim 1, characterized in that The method of using a search agent to perform search processing on the search triple of the problem to be processed, and obtaining search response content corresponding to the search triple, includes: Performing semantic analysis on the problem to be processed to extract search core words, search related words and time attributes from the problem to be processed to obtain search triples; For each of the search triples, generating a search task corresponding to the search triple; The search agent is called to execute the search task in a preset database to obtain the search response content corresponding to the search triplet.

3. The method according to claim 1, characterized in that Calculating the importance parameter corresponding to each search response content according to the search triplet includes: For each of the search response contents, determining a weight parameter of the search response content based on the search triplet and the domain type of the search response content; Calculating the timeliness parameter of the search response content by using the time information in the search response content and the time attribute in the search triplet; Calculating the cosine similarity between the search response content and the specified text to obtain a relevance parameter of the search response content, wherein the specified text includes the core search term and the search-related term; An importance parameter of the search response content is calculated based on the weight parameter, the timeliness parameter, and the relevance parameter.

4. The method according to claim 3, characterized in that The weight parameter includes a timeliness weight and a relevance weight, and the calculating the importance parameter of the search response content based on the weight parameter, the timeliness parameter and the relevance parameter includes: Calculating a quality parameter of the search response content based on the source of the search response content and the richness of the search response content; The timeliness parameter is weighted by using the timeliness weight to obtain a weighted timeliness parameter; weighting the association parameter using the association weight to obtain a weighted association parameter; The importance parameter is calculated by combining the quality parameter, the weighted timeliness parameter, and the weighted relevance parameter.

5. The method according to claim 1, characterized in that The step of determining a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each search response content comprises: Obtaining a first importance threshold, a second importance threshold, and a relevance threshold, wherein the first importance threshold is greater than the second importance threshold; For each search response content of the search triplet, taking the search response content whose importance parameter is greater than or equal to the first importance threshold as the first candidate content; Determine the search response content whose importance parameter is greater than or equal to the second importance threshold and less than the first importance threshold as intermediate content; The intermediate content whose relevance parameter is greater than or equal to the relevance threshold is determined as the second candidate content.

6. The method according to claim 1, characterized in that The step of performing structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triple to obtain the first structured contents and the second structured contents of the search triple includes: For each of the first candidate contents, split the first candidate contents into a plurality of first segments, and sort the first segments according to positions of the first candidate contents to obtain a first segment sequence; For each of the search triples, all first fragment sequences corresponding to the search triple are merged to obtain first structured content of the search triple; For each second candidate content, split the second candidate content into a plurality of second segments, and sort the second segments according to positions of the second candidate content to obtain a second segment sequence; For each of the search triples, all second fragment sequences corresponding to the search triple are merged to obtain the second structured content of the search triple.

7. The method according to claim 1, characterized in that The step of enhancing the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed includes: Dividing the preliminary answer into multiple answer segments according to semantics; Combining the answer segments in pairs to obtain multiple segment groups; For each of the segment groups, using the detection model to perform logical contradiction detection processing on two answer segments in the segment group to obtain a detection result; The detection results represent a group of fragments whose two answer fragments are logically contradictory, and determine them as a group to be enhanced; The second structured contents of all search triples are used to perform contradiction correction processing on two answer segments in the to-be-enhanced group in the preliminary answer to obtain a target answer.

8. A question-answer processing device, the device being used to implement the method according to any one of claims 1 to 7, characterized in that: The device comprises: A search module, used to use a search agent to search and process the search triple of the problem to be processed, and obtain the search response content corresponding to the search triple, wherein the search triple includes the core search term, search-related term and time attribute in the problem to be processed, and the search-related term is a field in the problem to be processed that is associated with the core search term; A parameter calculation module, configured to calculate, based on the search triples, an importance parameter corresponding to each of the search response contents, wherein the importance parameter includes a timeliness parameter associated with the time attribute, and a relevance parameter associated with the core search terms and the search-related terms; A determination module, configured to determine a plurality of first candidate contents and a plurality of second candidate contents of the search triplet by using the importance parameter and the relevance parameter of each of the search response contents; A structuring module, configured to perform structural processing on the plurality of first candidate contents and the plurality of second candidate contents corresponding to the search triples, to obtain first structured contents and second structured contents of the search triples; A generating module, configured to generate a preliminary answer to the question to be processed based on the question to be processed and the first structured contents of all the search triples; An enhancement module, configured to enhance the preliminary answer according to the second structured content of all the search triples to obtain a target answer to the question to be processed; The first structured content includes a plurality of first segments, and generating a preliminary answer to the question to be processed based on the question to be processed and the first structured content of all the search triples includes: Obtain the maximum input length of the problem processing model, the number of search triples and the problem length of the problem to be processed; divide the difference between the maximum input length and the problem length by the number of search triples to obtain a basic length; perform weighted processing on the basic length using an adjustment coefficient corresponding to the search triple to obtain a target length corresponding to the search triple; for each search triple, determine a first target segment from the multiple first segments according to the target length; generate data to be inferred using all the first target segments, the problem to be processed and preset prompt words; infer the data to be inferred through the problem processing model to obtain a preliminary answer to the problem to be processed.

Citation Information

Patent Citations

  • Question retrieval question answering method based on large language model and multi-dimensional technology fusion

    CN119106116A