An ABI question-answering method and system for aligning large models with databases

By using the method of aligning large language model and database in the machine Q&A system, combining statement length, structure and semantic differences, adjusting the matching degree to filter out the best answers, the problem of inaccurate keyword matching caused by text noise interference is solved, and the accuracy of the Q&A system is improved.

CN119760106BActive Publication Date: 2025-08-19HENAN ZHONGCHENG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411820914.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-08-19
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

The existing machine Q&A system causes inaccurate keyword matching due to text noise interference, which reduces the accuracy of the Q&A system.

Method used

By obtaining multiple keywords and answer sentences in the user-entered question statement, using a large language model for matching analysis, combining sentence length, structure and semantic differences, adjusting the matching degree to filter out the best answer sentences, and generating accurate question-and-answer results.

Benefits of technology

It improves the accuracy of the machine question and answer system, ensures that the output answers can accurately solve user problems, and reduces the situation of answering non-questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760106B_ABST
    Figure CN119760106B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of machine question answering, and in particular to an ABI question answering method and system for aligning a large model with a database. The method first obtains multiple keywords and multiple answer statements in a question statement input by a user, matches each keyword with a target answer statement, obtains the label value of each keyword on the target answer statement, obtains the initial matching degree of the target keyword on the target answer statement according to the label value of other keywords on the target answer statement, adjusts the initial matching degree according to the difference in length, structure and semantics between the question statement and the target answer statement, obtains the true matching degree of the target keyword on the target answer statement, and filters out the best answer statement of the target keyword, and generates the best answer based on the best answer statement of all keywords of the question statement. The present invention can accurately output answers to related questions and improve the accuracy of the ABI question answering system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine question answering, and in particular to an ABI question answering method and system for aligning a large model with a database. Background Art

[0002] ABI Q&A is a machine question-answering system. Users input the questions they want to query or ask into it. The large language model embedded in it analyzes the questions raised by the users and filters out information that solves the questions from the relevant database, and then outputs the corresponding answers to the users, meeting the users' needs to obtain information anytime and anywhere.

[0003] In related technologies, keywords are usually extracted from questions raised by users, and the keywords are matched with information in a database. The information with a higher matching degree is selected as the best answer and output. However, due to the interference of text noise in the questions raised by users and the information in the database, the accuracy of keyword matching is affected, which makes it impossible to accurately output answers to relevant questions through existing methods, thereby reducing the accuracy of the question-answering system. Summary of the Invention

[0004] To address the technical problem that existing methods cannot accurately output answers to relevant questions, thereby reducing the accuracy of question-answering systems, the present invention aims to provide an ABI question-answering method and system that aligns a large model with a database. The technical solutions adopted are as follows:

[0005] The present invention proposes an ABI question-answering method for aligning a large model with a database, the method comprising:

[0006] Obtain multiple keywords in the question sentence input by the user and multiple answer sentences of the question sentence;

[0007] Take any answer sentence as the target answer sentence, match each keyword with the target answer sentence, and obtain the label value of each keyword with respect to the target answer sentence; take any keyword as the target keyword, and obtain the initial matching degree of the target keyword with respect to the target answer sentence based on the label values of other keywords except the target keyword with respect to the target answer sentence;

[0008] According to the difference in length and structure between the question sentence and the target answer sentence, the initial matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the adjusted matching degree of the target keyword with respect to the target answer sentence; according to the difference in semantics between the question sentence and the target answer sentence, the adjusted matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the true matching degree of the target keyword with respect to the target answer sentence; based on the true matching degree of the target keyword with respect to each answer sentence, the best answer sentence for the target keyword is screened out from all answer sentences;

[0009] Based on the best answer sentence of all keywords of the question sentence, the best answer to the question sentence is generated.

[0010] Furthermore, obtaining the initial matching degree of the target keyword with respect to the target answer sentence includes:

[0011] Keywords other than the target keyword are used as reference keywords for the target keyword, and the cumulative value of the label values of all reference keywords with respect to the target answer statement is used as the initial matching degree of the target keyword with respect to the target answer statement.

[0012] Furthermore, obtaining the adjusted matching degree of the target keyword with respect to the target answer sentence includes:

[0013] Use any one of the question sentence and the target answer sentence as the sentence to be tested;

[0014] Counting the number of characters in the sentence to be tested as the text length of the sentence to be tested, and performing negative correlation mapping on the absolute value of the difference in text length between the question sentence and the target answer sentence to obtain the length similarity between the question sentence and the target answer sentence;

[0015] Use a word segmentation tool to segment the test sentence to obtain the phrases of the test sentence, and then filter out the content phrases of the test sentence from all the phrases. Based on the difference in the proportion of the content phrases in all the phrases between the question sentence and the target answer sentence, the structural similarity between the question sentence and the target answer sentence is obtained;

[0016] Combining the length similarity and the structure similarity to obtain a comprehensive similarity between the question sentence and the target answer sentence;

[0017] The product value of the comprehensive similarity and the initial matching degree of the target keyword with respect to the target answer sentence is used as the adjusted matching degree of the target keyword with respect to the target answer sentence.

[0018] Furthermore, obtaining the structural similarity between the question sentence and the target answer sentence includes:

[0019] The number of content phrases in the sentence to be tested is used as the numerator, the number of all phrases in the sentence to be tested is used as the denominator, and the ratio is used as the content word density of the sentence to be tested;

[0020] The absolute value of the difference in the density of the content words between the question sentence and the target answer sentence is negatively correlated to obtain the structural similarity between the question sentence and the target answer sentence.

[0021] Furthermore, obtaining the comprehensive similarity between the question statement and the target answer statement includes:

[0022] The sum of the length similarity and the structure similarity between the question sentence and the target answer sentence is used as the comprehensive similarity between the question sentence and the target answer sentence.

[0023] Furthermore, obtaining the true matching degree of the target keyword with respect to the target answer sentence includes:

[0024] Input the question sentence and the target answer sentence into the DSSM model to obtain the semantic similarity between the question sentence and the target answer sentence;

[0025] The product value of the semantic similarity between the question sentence and the target answer sentence and the adjusted matching degree of the target keyword with respect to the target answer sentence is used as the true matching degree of the target keyword with respect to the target answer sentence.

[0026] Furthermore, the method of filtering out the best answer sentence for the target keyword from all answer sentences includes:

[0027] The answer sentence corresponding to the maximum value of the true matching degree of the target keyword with respect to all answer sentences is taken as the best answer sentence for the target keyword.

[0028] Furthermore, the best answer to the generated question statement includes:

[0029] Performing different permutations and combinations of the best answer statements for all keywords to obtain multiple combined answer statements;

[0030] Input each combined answer sentence into the N-gram model to obtain the fluency of each combined answer sentence;

[0031] The combined answer sentence corresponding to the maximum value of the fluency is taken as the best answer to the question sentence.

[0032] Furthermore, obtaining the label value of each keyword with respect to the target answer sentence includes:

[0033] For any keyword, based on the regular expression method, keyword matching is performed between the keyword and the target answer statement. If the target answer statement contains the keyword, the label value of the keyword with respect to the target answer statement is set to the value 1. If the target answer statement does not contain the keyword, the label value of the keyword with respect to the target answer statement is set to the value 0.

[0034] The present invention also proposes an ABI question-and-answer system for aligning a large model with a database. The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the steps of the ABI question-and-answer method for aligning a large model with a database.

[0035] The present invention has the following beneficial effects:

[0036] The present invention takes into account that the existing methods cannot accurately output answers to relevant questions, which reduces the accuracy of the question-answering system. Therefore, the present invention first obtains multiple keywords in the question sentence input by the user and multiple answer sentences of the question sentence. Since there are multiple answer sentences in the question sentence, the correlation between different answer sentences and the question sentence is different. Therefore, each keyword of the question sentence is first matched with the target answer sentence. The label value can intuitively reflect whether a certain keyword of the question sentence is in the target answer sentence and the correlation between each keyword and the target answer sentence, providing a data basis for the subsequent matching analysis between the keyword and the target answer sentence. Considering that the text noise in the question sentence and the answer sentence will interfere with the accuracy of the above-mentioned keyword matching analysis, resulting in matching errors between each keyword and the target answer sentence, and considering that each keyword comes from the same question sentence and there is a logical connection between each keyword, it can be The initial matching degree preliminarily reflects the degree of association between the target keyword and the target answer sentence. Considering that the impact of noise on the sentence is relatively random, but has little impact on the length and structure of the overall content of the sentence, for the answer sentence that is closely related to the question sentence, its content length and content structure are relatively similar to the question sentence. Therefore, the initial matching degree can be adjusted through this feature to improve the accuracy of the matching degree analysis between the keyword and the answer sentence. Considering that text noise does not change the semantics of the sentence to a large extent, and for the answer sentence that is closely related to the question sentence, its semantics are also relatively similar to the question sentence, the matching degree can be adjusted again based on this feature to obtain a higher precision true matching degree, further improving the accuracy of the matching degree analysis between the keyword and the answer sentence, and then accurately generating the best answer to the question sentence through the best answer sentence of each keyword screened out, thereby improving the accuracy of the ABI question-answering system. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0038] Figure 1 A flowchart of an ABI question-answering method for aligning a large model with a database, provided in one embodiment of the present invention;

[0039] Figure 2 A flow chart of a method for obtaining an adjusted matching degree of a target keyword with respect to a target answer sentence provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0040] To further illustrate the technical means and effectiveness of the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation, structure, features, and effectiveness of an ABI question-and-answer method and system for aligning a large model with a database, as proposed by the present invention. In the following description, references to different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.

[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0042] The following describes in detail a specific solution of an ABI question-answering method and system for aligning a large model with a database provided by the present invention in conjunction with the accompanying drawings.

[0043] See also Figure 1 , which shows a flow chart of an ABI question-answering method for aligning a large model with a database, provided by one embodiment of the present invention. The method includes:

[0044] Step S1: Acquire multiple keywords in a question sentence input by a user and multiple answer sentences to the question sentence.

[0045] ABI Q&A is a machine question-answering system that can output corresponding answers to questions raised by users, meeting the users' needs to obtain information anytime and anywhere. In related technologies, the best answers are usually generated and output by extracting keywords from the questions raised by users and matching the keywords with the information in the database. However, due to the interference of text noise in the questions raised by users and the information in the database, the accuracy of keyword matching is affected, which makes it impossible to accurately output answers to relevant questions through existing methods, resulting in irrelevant answers and reducing the accuracy of the question-answering system. Therefore, an embodiment of the present invention proposes an ABI question-answering method that aligns a large model with a database to improve the accuracy of the large language model in retrieving information in the database, thereby improving the accuracy of the ABI question-answering system.

[0046] The embodiment of the present invention first obtains the question sentence input by the user in the ABI question-answering system, and then uses the large language model embedded in the ABI question-answering system to process the question sentence input by the user, extracts multiple keywords in the question sentence, and performs information retrieval from the relevant database to obtain multiple answer sentences corresponding to the question sentence, wherein the large language model includes the LLaMA language model or the GPT series language model, etc., which are not limited or elaborated here.

[0047] Step S2: Take any answer statement as the target answer statement, match each keyword with the target answer statement, and obtain the label value of each keyword with respect to the target answer statement; take any keyword as the target keyword, and obtain the initial matching degree of the target keyword with respect to the target answer statement based on the label values of other keywords except the target keyword with respect to the target answer statement.

[0048] Since there are multiple answer statements for a question statement, the correlation between different answer statements and the question statement is different, that is, some answer statements are irrelevant to the question statement. Therefore, in order to improve the ability of the answer output by the ABI question-answering system to accurately solve the corresponding problem, it is necessary to select an answer statement with a strong connection with the question statement from the numerous answer statements as the output of the ABI question-answering system to improve the accuracy of the ABI question-answering system. The embodiment of the present invention first analyzes any answer statement and takes any answer statement as the target answer statement. Since the keywords come from the question statement, the connection between the keywords and the target answer statement can reflect the connection between the question statement and the target answer statement to a certain extent. If the target answer statement contains a certain keyword, it means that the target answer statement is more relevant to the keyword. Therefore, the embodiment of the present invention first matches each keyword with the target answer statement, and intuitively reflects whether a keyword of the question statement appears in the target answer statement through the label value, and intuitively reflects the correlation between each keyword and the target answer statement through the label value, providing a data basis for subsequent matching analysis between keywords and target answer statements.

[0049] Preferably, in one embodiment of the present invention, the method for obtaining the label value of each keyword with respect to the target answer sentence specifically includes:

[0050] Regular expression is a powerful text processing tool used for pattern matching, search, replacement and other operations in text. Therefore, for any keyword, the keyword can be matched with the target answer statement based on the regular expression method. If the target answer statement contains the keyword, the label value of the keyword with respect to the target answer statement is set to the value 1. If the target answer statement does not contain the keyword, the label value of the keyword with respect to the target answer statement is set to the value 0. The label value of each keyword of the question statement with respect to the target answer statement can be obtained by the same method as above. Among them, regular expressions are a technical field well known to technicians in this field and will not be elaborated here.

[0051] Taking into account that the text noise existing in the question statement and the answer statement will interfere with the accuracy of the above-mentioned keyword matching analysis, resulting in matching errors between each keyword and the target answer statement, the label value set above cannot accurately reflect the correlation between each keyword and the target answer statement. At the same time, considering that each keyword comes from the same question statement, there is a logical connection between each keyword. Therefore, if the matching degree between other keywords and the target answer statement is high, then the matching degree between the target keyword and the target answer statement is also high. Therefore, the overall level of the label values of other keywords other than a certain keyword with respect to the target answer statement can be used to reflect the correlation between the keyword and the target answer statement. Therefore, the embodiment of the present invention first analyzes any keyword in the question statement, takes any keyword as the target keyword, and obtains the initial matching degree of the target keyword with respect to the target answer statement based on the label values of other keywords other than the target keyword with respect to the target answer statement. The initial matching degree preliminarily reflects the degree of correlation between the target keyword and the target answer statement. The larger the initial matching degree, the stronger the correlation between the target answer statement and the target keyword. The initial matching degree can be further adjusted subsequently to accurately generate the best answer to the question statement and improve the accuracy of the ABI question-answering system.

[0052] Preferably, in one embodiment of the present invention, the method for obtaining the initial matching degree of the target keyword with respect to the target answer sentence specifically includes:

[0053] Keywords other than the target keyword are used as reference keywords for the target keyword. The more reference keywords there are in the target answer sentence, the stronger the connection between the target keyword and the target answer sentence. Therefore, the cumulative value of the label values of all reference keywords with respect to the target answer sentence can be used as the initial matching degree of the target keyword with respect to the target answer sentence.

[0054] As an example, in one embodiment of the present invention, the expression of the initial matching degree of the target keyword with respect to the target answer sentence may be specifically, for example:

[0055]

[0056] Where A represents the initial matching degree of the target keyword to the target answer sentence; q n Represents the label value of the nth reference keyword of the target keyword with respect to the target answer sentence; N represents the number of keywords in the question sentence, and N-1 represents the number of reference keywords of the target keyword.

[0057] At this point, the initial matching degree of the target keyword with respect to the target answer sentence is obtained. The initial matching degree can be further adjusted subsequently to reduce the interference of text noise on the matching degree analysis and improve the accuracy of the matching degree analysis between the keyword and the answer sentence.

[0058] Step S3: According to the difference in length and structure between the question sentence and the target answer sentence, the initial matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the adjusted matching degree of the target keyword with respect to the target answer sentence; according to the difference in semantics between the question sentence and the target answer sentence, the adjusted matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the true matching degree of the target keyword with respect to the target answer sentence; based on the true matching degree of the target keyword with respect to each answer sentence, the best answer sentence of the target keyword is screened out from all answer sentences.

[0059] Since the impact of text noise on sentences is relatively random, it will only interfere with some phrases or words in the sentence, and has little impact on the length and structure of the overall content of the sentence. Therefore, for answer sentences that are closely related to the question sentence, their content length and content structure are relatively similar to the question sentence. Therefore, we can first analyze the length differences and structure differences between the question sentence and the target answer sentence, and adjust the initial matching degree of the target keyword with respect to the target answer sentence, so as to reduce the interference of text noise on the matching degree analysis between the question sentence keywords and the answer sentence, and accurately reflect the correlation between the target keyword and the target answer sentence through the obtained adjusted matching degree. The larger the adjusted matching degree, the stronger the correlation between the target keyword and the target answer sentence.

[0060] Preferably, in one embodiment of the present invention, the method for obtaining the adjusted matching degree of the target keyword with respect to the target answer sentence specifically includes:

[0061] See also Figure 2 , which shows a flow chart of a method for obtaining an adjusted matching degree of a target keyword with respect to a target answer sentence provided by one embodiment of the present invention.

[0062] Step S301: Take any one of the question sentence and the target answer sentence as the sentence to be tested, count the number of characters contained in the sentence to be tested as the text length of the sentence to be tested, perform negative correlation mapping on the absolute value of the difference in text length between the question sentence and the target answer sentence, and obtain the length similarity between the question sentence and the target answer sentence.

[0063] From the above analysis, it can be seen that if the number of words contained in the question statement is more, the amount of information contained in the answer statement with a stronger correlation with the question statement is also more. That is to say, if the correlation between the target answer statement and the question statement is stronger, the content length between the target answer statement and the question statement is more similar. Therefore, any one of the question statement and the target answer statement can be used as the test statement first, and the number of words contained in the test statement can be counted as the text length of the test statement using, for example, the built-in len() function of the Python programming language or other methods. The above method can be used to obtain the text length of the question statement and the target answer statement respectively, and then the absolute value of the difference in text length between the question statement and the target answer statement can be negatively correlated to obtain the length similarity between the question statement and the target answer statement. The greater the length similarity, the more similar the content length between the question statement and the target answer statement is, providing a data basis for subsequent adjustment of the initial matching degree of the target keyword with respect to the target answer statement.

[0064] Step S302: Use a word segmentation tool to perform word segmentation on the sentence to be tested, obtain the phrases of the sentence to be tested, and filter out the content phrases of the sentence to be tested from all the phrases. According to the difference in the proportion of the content phrases in all the phrases between the question sentence and the target answer sentence, obtain the structural similarity between the question sentence and the target answer sentence.

[0065] From the above analysis, we can see that for answer sentences that are closely related to question sentences, their content structures are also similar to those of question sentences. Here, content structure mainly refers to the content phrases contained in the sentence, such as nouns, verbs, adjectives and adverbs. These types of phrases constitute the main content of a sentence. In other words, the proportion of content phrases contained in answer sentences that are closely related to question sentences is close to the proportion of content phrases contained in question sentences. Since existing word segmentation tools such as NLTK or Jieba can segment sentences and mark the parts of speech of the divided phrases, the content of the sentence can be filtered out. Therefore, a word segmentation tool can be used to segment the sentence to be tested, obtain the phrases of the sentence to be tested, and filter out the content phrases of the sentence to be tested from all the phrases. The same method as above can be used to obtain the phrases and content phrases of the question sentence and the target answer sentence respectively. Then, according to the difference in the proportion of content phrases in all phrases between the question sentence and the target answer sentence, the structural similarity between the question sentence and the target answer sentence can be obtained. The greater the structural similarity, the more similar the content structure between the question sentence and the target answer sentence is, which provides a data basis for the subsequent adjustment of the initial matching degree of the target keyword with respect to the target answer sentence.

[0066] Preferably, in one embodiment of the present invention, the method for obtaining the structural similarity between the question sentence and the target answer sentence specifically includes:

[0067] The number of content phrases in the sentence to be tested is taken as the numerator, the number of all phrases in the sentence to be tested is taken as the denominator, and the ratio is taken as the content word density of the sentence to be tested. The content word density can reflect the proportion of the number of content phrases in the sentence to be tested. The larger the content word density, the larger the proportion of the number of content phrases in the sentence to be tested. The content word density of the question sentence and the target answer sentence can be obtained respectively by the same method as above, and then the absolute value of the difference in content word density between the question sentence and the target answer sentence is negatively correlated to obtain the structural similarity between the question sentence and the target answer sentence.

[0068] Step S303: The length similarity and the structure similarity are integrated to obtain the integrated similarity between the question sentence and the target answer sentence.

[0069] Then, we can combine the length similarity and the structural similarity at the same time, integrate the two, and obtain the comprehensive similarity between the question sentence and the target answer sentence. The greater the comprehensive similarity, the more similar the question sentence and the target answer sentence are in length and structure. Subsequently, based on the comprehensive similarity, we can adjust the initial matching degree of the target keyword with respect to the target answer sentence to improve the accuracy of the matching analysis between the target keyword and the target answer sentence.

[0070] Preferably, in one embodiment of the present invention, the sum of the length similarity and the structure similarity between the question sentence and the target answer sentence can be used as the comprehensive similarity between the question sentence and the target answer sentence.

[0071] In other embodiments of the present invention, the product value of length similarity and structure similarity may also be used as the comprehensive similarity between the question sentence and the target answer sentence, which is not limited here.

[0072] As an example, in one embodiment of the present invention, the expression of the comprehensive similarity between the question sentence and the target answer sentence can be specifically, for example, as follows:

[0073]

[0074] Among them, S represents the comprehensive similarity between the question sentence and the target answer sentence; L represents the text length of the question sentence; L ′ Indicates the text length of the target answer sentence; represents the length similarity between the question sentence and the target answer sentence; ρ represents the content word density of the question sentence; ρ ′ Indicates the content word density of the target answer sentence; Represents the structural similarity between the question statement and the target answer statement; ε1 and ε2 represent the preset first adjustment parameter and the preset second adjustment parameter, respectively. The value range of ε1 and ε2 is [0.001, 0.01]. In one embodiment of the present invention, ε1 and ε2 are set to 0.01. The specific values of ε1 and ε2 can also be set by the implementer according to the specific implementation scenario, which is not limited here.

[0075] It should be noted that in other embodiments of the present invention, negative correlation mapping may be achieved through other basic mathematical operations, which will not be described in detail here.

[0076] Step S304: The product value of the comprehensive similarity and the initial matching degree of the target keyword with respect to the target answer sentence is used as the adjusted matching degree of the target keyword with respect to the target answer sentence.

[0077] The greater the comprehensive similarity, the more relevant the target answer statement is to the question statement, and the target keyword belongs to the question statement, which is the key content of the question statement. Therefore, the greater the comprehensive similarity, the stronger the correlation between the target keyword and the target answer statement. Therefore, the comprehensive similarity can be used to perform a weighted adjustment on the initial matching degree of the target keyword with respect to the target answer statement, and the product value of the comprehensive similarity and the initial matching degree of the target keyword with respect to the target answer statement is used as the adjusted matching degree of the target keyword with respect to the target answer statement.

[0078] As an example, in one embodiment of the present invention, the expression for the adjusted matching degree of the target keyword with respect to the target answer sentence may be specifically, for example:

[0079] B=S×A

[0080] Among them, B represents the adjusted matching degree of the target keyword with respect to the target answer sentence; S represents the comprehensive similarity between the question sentence and the target answer sentence; A represents the initial matching degree of the target keyword with respect to the target answer sentence.

[0081] For answer statements that are closely related to question statements, their semantics are also relatively similar to the question statements, while text noise interference is highly random. When text noise interferes with a statement, it does not significantly change the semantics of the statement. Therefore, the semantic differences between the question statement and the target answer statement can be analyzed, and the adjusted matching degree of the target keyword with respect to the target answer statement can be further adjusted to obtain the true matching degree of the target keyword with respect to the target answer statement, thereby further improving the accuracy of the matching degree analysis of the target keyword and the target answer statement, so that the ABI question-answering system can make accurate answers to question statements and improve the accuracy of the ABI question-answering system.

[0082] Preferably, in one embodiment of the present invention, the method for obtaining the true matching degree of the target keyword with respect to the target answer sentence specifically includes:

[0083] The DSSM model can analyze the degree of semantic similarity between texts. Therefore, the question sentence and the target answer sentence can be input into the DSSM model to obtain the semantic similarity between the question sentence and the target answer sentence. The greater the semantic similarity, the more similar the semantics between the question sentence and the target answer sentence are. Then, the product value of the semantic similarity between the question sentence and the target answer sentence and the adjusted matching degree of the target keyword with respect to the target answer sentence can be used as the true matching degree of the target keyword with respect to the target answer sentence. Among them, the DSSM model is a technical means well known to those skilled in the art and will not be elaborated here.

[0084] As an example, in one embodiment of the present invention, the expression of the true matching degree of the target keyword with respect to the target answer sentence may be specifically, for example:

[0085] C=E×B

[0086] Among them, C represents the true matching degree of the target keyword with respect to the target answer sentence; E represents the semantic similarity between the question sentence and the target answer sentence; and B represents the adjusted matching degree of the target keyword with respect to the target answer sentence.

[0087] The same method as above can be used to obtain the true matching degree of the target keyword for each answer statement. Since the true matching degree of the target keyword for different answer statements is different, the greater the true matching degree of the target keyword for a certain answer statement, the stronger the correlation between the answer statement and the target keyword, and thus the more relevant the answer statement is to the question statement. Therefore, based on the true matching degree of the target keyword for each answer statement, the best answer statement for the target keyword is screened out from all answer statements. Subsequently, based on the best answer statement for each keyword in the question statement, the best answer to the question statement can be accurately generated, thereby improving the accuracy of the ABI question-answering system.

[0088] Preferably, in one embodiment of the present invention, the answer sentence corresponding to the maximum true matching degree of the target keyword with respect to all answer sentences may be used as the best answer sentence for the target keyword.

[0089] The best answer statement for each keyword in the question statement can be obtained by the same method as above.

[0090] Step S4: Generate the best answer to the question sentence based on the best answer sentences of all keywords in the question sentence.

[0091] The best answer statement for each keyword is obtained through the above steps. Keywords are the key content of the question statement. Therefore, the best answer statement for each keyword is highly correlated with the question statement and contains accurate information to answer the question statement. Therefore, the best answer to the question statement can be generated based on the best answer statement of all keywords in the question statement, thereby improving the accuracy of the ABI question-answering system.

[0092] Preferably, in one embodiment of the present invention, the method for obtaining the best answer to the question statement specifically includes:

[0093] Since there are multiple best answer sentences, in order to achieve unified output, the best answer sentences of all keywords are first arranged and combined in different ways to obtain multiple combined answer sentences. The combined answer sentences obtained after the arrangement and combination may not be smooth when reading, so each combined answer sentence is input into the N-gram model to obtain the fluency of each combined answer sentence, and the combined answer sentence corresponding to the maximum fluency is used as the best answer to the question sentence. The N-gram model is a technical means well known to technicians in this field and will not be elaborated here.

[0094] It should be noted that when the best answer statements for all keywords are arranged and combined, there may be cases where the best answer statements for different keywords are the same. In this case, you only need to select one best answer statement from multiple identical best answer statements. In other words, the best answer statements in the subsequent arrangement and combination are different from each other.

[0095] In other embodiments of the present invention, the best answer sentences for all keywords may be input into a large language model, which extracts the core content from each best answer sentence to generate the best answer to the question sentence.

[0096] One embodiment of the present invention provides an ABI question-answering system for aligning a large model with a database. The system includes a memory, a processor, and a computer program, wherein the memory is used to store the corresponding computer program, and the processor is used to run the corresponding computer program. When the computer program runs in the processor, it can implement the method described in steps S1 to S4.

[0097] In summary, the embodiment of the present invention first obtains multiple keywords in the question sentence input by the user and multiple answer sentences of the question sentence; takes any answer sentence as the target answer sentence, matches each keyword with the target answer sentence, and obtains the label value of each keyword with respect to the target answer sentence; takes any keyword as the target keyword, and obtains the initial matching degree of the target keyword with respect to the target answer sentence based on the label values of other keywords other than the target keyword with respect to the target answer sentence; adjusts the initial matching degree of the target keyword with respect to the target answer sentence based on the length difference and structure difference between the question sentence and the target answer sentence, and obtains the adjusted matching degree of the target keyword with respect to the target answer sentence; adjusts the adjusted matching degree of the target keyword with respect to the target answer sentence based on the semantic difference between the question sentence and the target answer sentence, and obtains the real matching degree of the target keyword with respect to the target answer sentence; based on the real matching degree of the target keyword with respect to each answer sentence, screens out the best answer sentence of the target keyword from all answer sentences; and generates the best answer to the question sentence based on the best answer sentences of all keywords in the question sentence.

[0098] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not necessarily represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0099] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

Claims

1. An ABI question-answering method for aligning a large model with a database, characterized in that: The method comprises: Obtain multiple keywords in the question sentence input by the user and multiple answer sentences of the question sentence; Take any answer sentence as the target answer sentence, match each keyword with the target answer sentence, and obtain the label value of each keyword with respect to the target answer sentence; take any keyword as the target keyword, and obtain the initial matching degree of the target keyword with respect to the target answer sentence based on the label values of other keywords except the target keyword with respect to the target answer sentence; According to the difference in length and structure between the question sentence and the target answer sentence, the initial matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the adjusted matching degree of the target keyword with respect to the target answer sentence; according to the difference in semantics between the question sentence and the target answer sentence, the adjusted matching degree of the target keyword with respect to the target answer sentence is adjusted to obtain the true matching degree of the target keyword with respect to the target answer sentence; based on the true matching degree of the target keyword with respect to each answer sentence, the best answer sentence for the target keyword is screened out from all answer sentences; Based on the best answer sentence of all keywords of the question sentence, the best answer to the question sentence is generated.

2. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: The obtaining of the initial matching degree of the target keyword with respect to the target answer sentence includes: Keywords other than the target keyword are used as reference keywords for the target keyword, and the cumulative value of the label values of all reference keywords with respect to the target answer statement is used as the initial matching degree of the target keyword with respect to the target answer statement.

3. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: The step of obtaining the adjusted matching degree of the target keyword with respect to the target answer sentence includes: Use any one of the question sentence and the target answer sentence as the sentence to be tested; Counting the number of characters in the sentence to be tested as the text length of the sentence to be tested, and performing negative correlation mapping on the absolute value of the difference in text length between the question sentence and the target answer sentence to obtain the length similarity between the question sentence and the target answer sentence; Use a word segmentation tool to segment the test sentence to obtain the phrases of the test sentence, and then filter out the content phrases of the test sentence from all the phrases. Based on the difference in the proportion of the content phrases in all the phrases between the question sentence and the target answer sentence, the structural similarity between the question sentence and the target answer sentence is obtained; Combining the length similarity and the structure similarity to obtain a comprehensive similarity between the question sentence and the target answer sentence; The product value of the comprehensive similarity and the initial matching degree of the target keyword with respect to the target answer sentence is used as the adjusted matching degree of the target keyword with respect to the target answer sentence.

4. The ABI question-answering method for aligning a large model with a database according to claim 3, characterized in that: The obtaining of the structural similarity between the question sentence and the target answer sentence includes: The number of content phrases in the sentence to be tested is used as the numerator, the number of all phrases in the sentence to be tested is used as the denominator, and the ratio is used as the content word density of the sentence to be tested; The absolute value of the difference in the density of the content words between the question sentence and the target answer sentence is negatively correlated to obtain the structural similarity between the question sentence and the target answer sentence.

5. The ABI question-answering method for aligning a large model with a database according to claim 3, characterized in that: Obtaining the comprehensive similarity between the question statement and the target answer statement includes: The sum of the length similarity and the structure similarity between the question sentence and the target answer sentence is used as the comprehensive similarity between the question sentence and the target answer sentence.

6. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: Obtaining the true matching degree of the target keyword with respect to the target answer sentence includes: Input the question sentence and the target answer sentence into the DSSM model to obtain the semantic similarity between the question sentence and the target answer sentence; The product value of the semantic similarity between the question sentence and the target answer sentence and the adjusted matching degree of the target keyword with respect to the target answer sentence is used as the true matching degree of the target keyword with respect to the target answer sentence.

7. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: The best answer sentence for the target keyword selected from all answer sentences includes: The answer sentence corresponding to the maximum value of the true matching degree of the target keyword with respect to all answer sentences is taken as the best answer sentence for the target keyword.

8. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: The best answers to the generated question sentences include: Performing different permutations and combinations of the best answer statements for all keywords to obtain multiple combined answer statements; Input each combined answer sentence into the N-gram model to obtain the fluency of each combined answer sentence; The combined answer sentence corresponding to the maximum value of the fluency is taken as the best answer to the question sentence.

9. The ABI question-answering method for aligning a large model with a database according to claim 1, characterized in that: Obtaining the label value of each keyword with respect to the target answer sentence includes: For any keyword, based on the regular expression method, keyword matching is performed between the keyword and the target answer statement. If the target answer statement contains the keyword, the label value of the keyword with respect to the target answer statement is set to the value 1. If the target answer statement does not contain the keyword, the label value of the keyword with respect to the target answer statement is set to the value 0.

10. An ABI question answering system for aligning a large model with a database, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Answer generation method and device based on artificial intelligence, equipment and storage medium

    CN113239169A

  • Knowledge question-answering method and device, equipment and storage medium

    CN117573821A