A question and answer data processing method and device
By constructing a knowledge base to extract words with implicit and synonym relationships, the problem of insufficient synonym matching in question-answering systems is solved, thereby improving the accuracy of question matching and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2026-04-07
AI Technical Summary
In existing question-answering systems, insufficient domain synonym matching between similar sentences leads to deviations in similarity calculation results, and redundant information in the implied relationships affects matching accuracy.
By constructing a knowledge base, we obtain words with implied relationships and synonyms. Using word segmentation and similarity calculation, combined with local and global optimization, we extract words with implied relationships and domain synonyms, filter redundant information, and improve matching accuracy.
It improves the accuracy of question matching in scenarios such as training, robot customer service, health consultation and insurance consultation, enhances user experience and reduces labor costs.
Smart Images

Figure CN115269776B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a question and answer data processing method and device. BACKGROUND
[0002] At present, the question and answer system includes processing the question input by the user, obtaining the similar sentence candidates in the corpus through the retrieval technology, then obtaining the text matched with the user question through the similarity calculation between the texts, and finally feeding back the answer corresponding to the text to the user end.
[0003] In the process of implementing the present application, the inventors found that at least the following problems exist in the prior art: in the actual application scenario, the domain synonyms between the similar sentences cannot be effectively matched through the existing synonym forest or semantic similarity. Moreover, the entailment relationship contained in the question, and the entailed vocabulary in the entailment relationship are often redundant information, and if the entailed vocabulary is not contained in the corresponding similar sentence in the matching process, it is very likely that the similarity between the similar sentences is low, thereby causing matching errors. SUMMARY
[0004] Therefore, the embodiments of the present application provide a question and answer data processing method and device, which can solve the problem that the similarity calculation result is deviated due to the redundant information and domain synonyms in the sentence in the prior art, and overcome the disadvantage of the labeling requirement of a large amount of data in the supervised manner.
[0005] To achieve the above object, according to one aspect of the embodiments of the present application, a question and answer data processing method is provided, which includes responding to a question and answer request, determining a request domain, calling a knowledge base to obtain corresponding entailment relationship words and synonymous relationship words; performing word segmentation processing on the sentence in the question and answer request, and then removing the entailed segmented words in the sentence after the word segmentation processing based on the entailment relationship words to obtain a to-be-retrieved sentence; calling a preset corpus, and performing similarity calculation on the to-be-retrieved sentence through the synonymous relationship words to obtain the sentence with the highest similarity and output.
[0006] Optionally, before calling the knowledge base to obtain the corresponding entailment relationship words and synonymous relationship words, the following steps are included:
[0007] Obtaining a to-be-retrieved sentence data set and a candidate sentence data set, and generating a similar sentence pair set through a preset matching model;
[0008] Performing word segmentation processing on each similar sentence pair in the similar sentence pair set to obtain a segmented word set of each similar sentence pair, and generating all possible knowledge relationship solutions of each similar sentence pair; wherein the possible knowledge relationship solutions include the entailment relationship words and the synonymous relationship words;
[0009] Based on the pre-defined probabilities of possible solutions for each knowledge relation in each group, the sum of probabilities of possible solutions for the same knowledge relation in the set of similar sentence pairs is calculated to obtain the possible solution for the knowledge relation with the highest probability.
[0010] Multiple results to be processed are formed by combining the possible solutions of knowledge relations with the highest probability among the remaining words in the word segmentation set;
[0011] Based on multiple pending results, determine the pending results that can cover all words in the word segmentation set, and store the knowledge relationships included in the pending results as the final result in the knowledge base.
[0012] Optionally, the dataset of sentences to be retrieved and the dataset of candidate sentences are obtained, and a set of similar sentence pairs is generated using a preset matching model, including:
[0013] Obtain a dataset of statements to be retrieved in a specific domain. Based on each standard statement in the dataset, obtain similar statements through a pre-defined deep learning model or a pre-defined search engine. Then, generate a candidate statement dataset from the similar statements.
[0014] Based on the dataset of sentences to be retrieved and the dataset of candidate sentences, each standard sentence is paired with its corresponding similar sentences to obtain similar sentence pairs, and then a set of similar sentence pairs is generated.
[0015] Optionally, obtain the word segmentation set for each pair of similar sentences, and generate all possible solutions for the knowledge relations of each pair of similar sentences, including:
[0016] For each set of similar sentence pairs, the word segmentation set is encoded. Words with the same code are deleted to obtain the first encoding set, and the words with the same code are combined to generate the second encoding set.
[0017] Based on the word segmentation of standard sentences and similar sentences in the first encoding set, as well as the word segmentation in the first encoding set and the word segmentation in the second encoding set, all possible solutions of knowledge relations for each pair of similar sentences are generated; among them, the word segmentation of standard sentences and similar sentences in the first encoding set can generate synonym words, and the word segmentation in the first encoding set and the word segmentation in the second encoding set can generate implied words.
[0018] Optionally, before performing word segmentation encoding on the word segmentation set of each group of similar sentences, the following steps are included:
[0019] For each set of similar sentences, the word segmentation set is labeled with part-of-speech tags to locate the target word segmentation part-of-speech and remove the word segmentation with the target word segmentation part-of-speech.
[0020] Optionally, after segmenting and encoding the word set of each pair of similar sentences, it includes:
[0021] The system calls the preset thesaurus to determine the synonym relationships between word segments with different encodings. It then removes the two word segments with the same synonym relationship from the first encoding set and stores them in the second encoding set.
[0022] Optionally, it also includes:
[0023] Based on multiple pending results, determine the pending result that can cover all word segmentation and includes the fewest number of knowledge relations, and store the knowledge relations included in the pending result as the final result in the knowledge base.
[0024] In addition, the present invention also provides a question-and-answer data processing device, including an acquisition module for responding to a question-and-answer request, determining the request domain, and calling a knowledge base to obtain corresponding implied relation words and synonym relation words; a processing module for performing word segmentation on the statements in the question-and-answer request, and then removing the implied words in the segmented statements based on the implied relation words to obtain the statements to be retrieved; calling a preset corpus, calculating the similarity of the statements to be retrieved through the synonym relation words, and matching and outputting the statements with the highest similarity.
[0025] One embodiment of the above invention has the following advantages or beneficial effects: This invention, through the correspondence between similar sentences, utilizes a combination of local and global optimization to simultaneously extract phrase-level implication relationships and domain synonyms in an unsupervised manner, based on the probability of each relationship occurring. The extracted implication relationships and domain synonyms can improve the accuracy of similar sentence matching during question matching by filtering redundant information and increasing the weight of domain synonyms. Furthermore, in question-answering systems across multiple business scenarios such as training, chatbot customer service, health consultation, and insurance consultation, applying the extracted implication knowledge and domain synonyms to the question matching process of the FAQ system improves the accuracy of the question-answering system, accurately answers users' high-frequency questions, enhances user experience and reduces reliance on the system, reduces manual costs, and improves work efficiency.
[0026] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0027] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0028] Figure 1 This is a schematic diagram of the main flow of the question-and-answer data processing method according to the first embodiment of the present invention;
[0029] Figure 2 This is a schematic diagram of the main flow of the question-and-answer data processing method according to the second embodiment of the present invention;
[0030] Figure 3 This is a schematic diagram of the main modules of a question-and-answer data processing device according to an embodiment of the present invention;
[0031] Figure 4 This is an exemplary device architecture diagram in which embodiments of the present invention can be applied;
[0032] Figure 5 This is a schematic diagram of the structure of a computer device suitable for implementing terminal equipment or a server in the embodiments of the present invention. Detailed Implementation
[0033] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0034] Figure 1 This is a schematic diagram of the main flow of the question-and-answer data processing method according to the first embodiment of the present invention, the question-and-answer data processing method including:
[0035] Step S101: In response to the question-and-answer request, determine the request domain and call the knowledge base to obtain the corresponding implied relation terms and synonym relation terms.
[0036] In this embodiment, words may have different meanings in general scenarios but similar meanings in specific domains; therefore, they are called domain-specific synonyms. For example, the words "lump" and "mass" have different meanings in general scenarios but similar meanings in the medical and health context; therefore, they are synonyms in the medical and health context. Furthermore, if one word can imply the meaning of another word, then there is an implicative relationship between the two words; they are implicative words. For example, although theoretically both men and women have breasts, in practical applications, "breast" generally refers specifically to the female organ; therefore, the word "breast" implies the meaning of "woman," and the word "breast" has an implicative relationship with "woman," with "woman" being the implied word.
[0037] In some embodiments, before calling the knowledge base to obtain the corresponding implied relation terms and synonym relation terms, a knowledge base for implied relation terms and synonym relation terms for different domains can be constructed. The specific implementation process includes: obtaining a dataset of sentences to be retrieved and a dataset of candidate sentences; generating a set of similar sentence pairs using a preset matching model; performing word segmentation on each set of similar sentence pairs to obtain a word segmentation set for each set of similar sentence pairs; and generating all possible solutions for knowledge relations for each set of similar sentence pairs; wherein, the possible solutions for knowledge relations include implied relation terms and synonym relation terms. Based on the preset probabilities of each possible solution for each set of knowledge relations, calculating the sum of probabilities of the same possible solution for knowledge relations in the set of similar sentence pairs to obtain the possible solution for knowledge relations with the highest probability. Combining the possible solutions for knowledge relations with the possible solution for knowledge relations with the highest probability with all possible solutions for knowledge relations between the remaining words in the word segmentation set, forming multiple results to be processed. Based on the multiple results to be processed, determining the result that can cover all words in the word segmentation set, and storing the knowledge relations included in this result as the final result in the knowledge base.
[0038] In a preferred embodiment, a dataset of sentences to be retrieved and a dataset of candidate sentences are obtained. A set of similar sentence pairs is generated using a preset matching model. The specific implementation process includes: obtaining a dataset of sentences to be retrieved in a specific domain; obtaining similar sentences based on each standard sentence in the dataset using a preset deep learning model or a preset search engine; and then generating a dataset of candidate sentences using these similar sentences. Based on the dataset of sentences to be retrieved and the dataset of candidate sentences, each standard sentence is paired with its corresponding similar sentence to obtain similar sentence pairs, thereby generating a set of similar sentence pairs.
[0039] For example, after preprocessing the dataset of sentences to be retrieved in the domain (e.g., a corpus dataset), similar sentences are generated. Similar sentences can be generated in various ways. Deep models can be used to encode the text in the dataset (e.g., BERT models, Simbert models, etc.), and similar sentences Q[[q0,q00,q01...],[q1,q10,q11...]...] can be obtained through vector indexing. Alternatively, similar sentences can be obtained through searches on search engines. Then, each pair of similar text results is paired to obtain several semantically similar sentence pairs. Here, the sentence to be retrieved (e.g., a standard question) can be paired with the word segmentation results of the similar questions. For a sentence to be retrieved q0, the corresponding similar sentences are [q00,q01,q02], resulting in the following sentence pairs:
[0040] [q0q00,q0q01,q0q02]
[0041] You can also pair any question with other questions in the same group to get the following results:
[0042] [q0q00,q0q01,q0q02,q00q01,q00q02,q01q02]
[0043] In some preferred embodiments, a word segmentation set for each pair of similar sentences is obtained, and all possible solutions for knowledge relations for each pair of similar sentences are generated. The specific implementation process includes: encoding the word segmentation set for each pair of similar sentences by deleting words with the same encoding to obtain a first encoding set, and combining words with the same encoding to generate a second encoding set. Based on the word segmentation of the standard sentence and the word segmentation of similar sentences in the first encoding set, as well as the word segmentation in the first encoding set and the word segmentation in the second encoding set, all possible solutions for knowledge relations for each pair of similar sentences are generated; wherein, the word segmentation of the standard sentence and the word segmentation of similar sentences in the first encoding set can generate synonymous words, and the word segmentation in the first encoding set and the word segmentation in the second encoding set can generate implied words.
[0044] For example, each pair of similar sentences is segmented using a word segmentation tool (such as jieba, HanLP, etc.), and the segmented words are encoded (e.g., a1, a2, a3...). The encoding results in each sentence pair are compared, and duplicate codes are removed. Based on the correspondence, hypothetical reasoning is performed on the correspondence between the remaining word codes in each sentence pair (domain synonymy) and whether they are implicit information of other words in the original sentence (domain implication) to obtain all possible solutions.
[0045] Furthermore, before performing word segmentation encoding on the word segmentation set of each group of similar sentences, word segmentation part-of-speech tagging can be performed on the word segmentation set of each group of similar sentences to locate the target word segmentation part-of-speech, so as to remove the word segmentation with the target word segmentation part-of-speech.
[0046] For example, each pair of similar sentences is segmented using word segmentation tools (such as jieba, HanLP, etc.), and part-of-speech tagging is performed. Then, words with part-of-speech tags that are interrogative words or stop words are removed from the text, and the remaining words in the segmentation results are encoded (a1, a2, a3...).
[0047] It is worth noting that after segmenting and encoding the word set of each pair of similar sentences, the process can include: calling a preset thesaurus, determining the synonym relationships between the different encoded words, deleting the two words with the synonym relationship from the first encoding set, and storing them in the second encoding set.
[0048] For example, the remaining vocabulary codes in each sentence pair are analyzed to find common synonyms between the two sentences (e.g., using a thesaurus). If any exist, the codes corresponding to the two words are removed. As a specific example, suppose one of the sentence pair codes is as follows:
[0049] Table 1 shows examples of encoding.
[0050] q0 token encoding A1, A2, A3 q1 token encoding A2, A3, A4
[0051] Since the two sentences are semantically similar, after removing identical words, A1 remains in q0, and A4 remains in q1. Therefore, the first encoding set includes A1 and A4, and the second encoding set includes A2 and A3. A1 and A4 may be synonyms in the domain (i.e., A1 = A4), or they may be implied in the words of the second encoding set in both sentences (where the word before the '-' in the implied relation implies the word after it). All possible solutions are:
[0052] Table 2 Examples of Possible Solutions
[0053] Possible solutions A1 = A4 A2 - A1, A2 - A4 A2 - A1, A3 - A4 A3 - A1, A2 - A4 A3 - A1, A3 - A4
[0054] For each solution in each sentence pair, the probabilities of occurrence of knowledge (e.g., implied relation words and synonym relation words) are summed to obtain the result with the highest value. The probability of each knowledge item in a sentence pair can be pre-configured; for example, the probability of each knowledge item in a sentence pair can be 1, or all knowledge items can have the same probability with a sum of 1 (as shown in Table 3). Finally, the probabilities of the same knowledge item (implied relation words or synonym relation words) in each sentence pair are summed.
[0055] Table 3 shows the probability statistics of possible outcomes.
[0056] Implication / synonymy Probability A1 = A4 1 / 5 A2 - A1 1 / 5 A2 - A4 1 / 5 A3 - A1 1 / 5 A3 - A4 1 / 5
[0057] In some embodiments, based on multiple pending results, the pending result that covers all word segments and includes the fewest knowledge relations is determined, and the knowledge relations included in this pending result are stored in the knowledge base as the final result. For example, during the calculation process, the knowledge with the highest probability sum is selected as the interim result. If the knowledge included in the result does not completely cover the remaining words of all sentence pairs, the knowledge that matches the result and has the highest probability sum is selected from the remaining knowledge and merged with the result as a new extraction result. The coverage rate of the new result on the remaining words of the sentence pairs is then calculated. If all words have been covered, the calculation stops; otherwise, the aforementioned process is repeated until the result completely covers the remaining words, and this result is taken as the final extraction result. For example: Suppose the remaining words of all sentence pairs of a standard question are (A1, A2, A3, A4). If the result shown in Table 4 is obtained in a certain round of calculation, and the coverage of the remaining words has been completed, the calculation stops, and the result is output.
[0058] Table 4
[0059] Possible outcomes Covering vocabulary A2 - A1, A3 = A4 A1, A2, A3, A4
[0060] It's worth noting that multiple pieces of knowledge may simultaneously have the highest probability. These pieces of knowledge are merged with the original results and then sorted according to the number of remaining words covered. If multiple items are tied for first place in the new results, the results are sorted again based on the number of knowledge items they contain, and the one with the fewest knowledge items is selected as the final result. For example, as shown in Table 5, assuming the following results are obtained after analyzing and calculating all sentence pairs, the first result is selected as the extraction result according to the above rules.
[0061] Table 5
[0062] Possible outcomes Covering vocabulary Number of pieces of knowledge A2 - A1, A3 = A4 A1, A2, A3, A4 2 A3 - A1, A4 = A1, A2 - A4 A1, A2, A3, A4 3 A2 - A1, A4 - A1 A1, A2, A4 2
[0063] In other words, the highest-ranked result is selected. If it covers all remaining words, it is taken as the final result; otherwise, it is carried over to the next round of calculation. If multiple results with the same number of covered words and the same number of knowledge items are ranked first after sorting, these results are carried over to the next round of calculation, and the above steps are repeated until the result covers all remaining words, at which point the calculation stops. Furthermore, the extraction results are output and stored. If multiple results meet the criteria, all are output, and results can be selected later based on different scenarios.
[0064] It can be seen that based on all sentence pairs, several candidate entailment and synonym relationships can be generated. These relationships can form different solutions (knowledge sets), but only one is truly correct. This invention aims to find this correct solution. To ensure the accuracy of knowledge extraction and simplify the calculation process, it is assumed that each word in each sentence exists in at most one entailment or synonym relationship. All possible solutions for these words are obtained. The sum of probabilities of each knowledge in the possible solutions is used as the optimization condition. In each round of calculation, the knowledge corresponding to the maximum probability sum is extracted, and the calculation is terminated when the extracted knowledge covers all words. If multiple maximum probability results exist during the calculation process, the result containing the fewest knowledge is selected as the final extraction result.
[0065] Step S102: The statement in the question-and-answer request is segmented into words, and then the implied words in the segmented statement are removed based on the implied relation words to obtain the statement to be retrieved.
[0066] Step S103: Call the preset corpus, calculate the similarity of the searched statement with the synonyms, and output the statement with the highest similarity.
[0067] Figure 2 This is a schematic diagram of the main flow of a question-and-answer data processing method according to a second embodiment of the present invention, the question-and-answer data processing method including:
[0068] Step S201: Obtain a dataset of statements to be retrieved in a specific domain. Based on each standard statement in the dataset, obtain similar statements through a preset deep learning model or a preset search engine, and then generate a candidate statement dataset through the similar statements.
[0069] Step S202: Based on the dataset of sentences to be retrieved and the dataset of candidate sentences, each standard sentence is paired with its corresponding similar sentences to obtain similar sentence pairs, and then a set of similar sentence pairs is generated.
[0070] Step S203: Perform word segmentation on each group of similar sentence pairs in the set of similar sentence pairs to obtain the word segmentation set of each group of similar sentences.
[0071] Step S204: Perform part-of-speech tagging on the word segmentation set of each group of similar sentences, locate the target word segmentation part of speech, and remove the word segmentation with the target word segmentation part of speech.
[0072] Step S205: Perform word segmentation encoding on the word segmentation set after removing the word segmentation with the target word segmentation, so as to delete the word segmentation with the same encoding to obtain the first encoding set, and combine the word segmentation with the same encoding to generate the second encoding set.
[0073] Step S206: Call the preset thesaurus, determine the synonym relationships between the segmented words with different codes, delete the two segmented words with the synonym relationship from the first code set, and store them in the second code set.
[0074] Step S207: Based on the word segmentation of standard sentences and similar sentences in the first encoding set, as well as the word segmentation in the first encoding set and the word segmentation in the second encoding set, generate all possible solutions of knowledge relations for each pair of similar sentences.
[0075] Among them, the word segmentation of standard sentences in the first encoding set and the word segmentation of similar sentences can generate synonym words, and the word segmentation in the first encoding set and the word segmentation in the second encoding set can generate words with implied relationships.
[0076] Step S208: Based on the preset probabilities of each possible solution of each knowledge relationship in each group, calculate the sum of probabilities of possible solutions of the same knowledge relationship in the set of similar sentence pairs, so as to obtain the possible solution of the knowledge relationship with the highest probability.
[0077] Step S209: Combine the possible solutions of knowledge relations with the highest probability with all possible solutions of knowledge relations between the remaining words in the word segmentation set to form multiple results to be processed.
[0078] Step S210: Based on multiple results to be processed, determine the result to be processed that can cover all word segmentation and includes the fewest number of knowledge relations, and store the knowledge relations included in the result to be processed as the final result in the knowledge base.
[0079] Step S211: In response to the question-and-answer request, determine the request domain and call the knowledge base to obtain the corresponding implied relation terms and synonym relation terms.
[0080] Step S212: The statement in the question-and-answer request is segmented into words, and then the implied words in the segmented statement are removed based on the implied relation words to obtain the statement to be retrieved.
[0081] Step S213: Call the preset corpus, calculate the similarity of the searched statement with the synonyms, and output the statement with the highest similarity.
[0082] As a specific example, taking the standard question "What should I do if a woman has a lump in her breast" from existing medical corpora, similar sentences were generated based on vector-level similarity, and then encoded using the Simbert model. Partial encoding results are shown below:
[0083] -0.029, -0.036, -0.005, -0.013, -0.024, 0.089, 0.006, 0.026, 0.040, 0.007...
[0084] Several similar questions were generated based on the encoding and segmented using jieba, as shown in Table 6:
[0085] Table 6 shows the similarity question and word segmentation results.
[0086]
[0087]
[0088] Then, word segmentation and part-of-speech tagging are performed on the word segmentation set of each group of similar sentences. The segmentation results after locating and removing interrogative words and stop words are then paired, resulting in 45 sentence pairs. Table 7 only analyzes and calculates the results of two sentence pairs, which are as follows:
[0089] Table 7 Sentence segmentation results
[0090]
[0091] The word segmentation results after removing interrogative words and stop words are encoded, and the code corresponding to each word segment is shown in Table 8:
[0092] Table 8. Word segmentation corresponding codes
[0093] Tokenization Encoding Female A1 Breast A2 Long A3 Lump A4 Rise A5 Nodule A6
[0094] The encoding results corresponding to the obtained sentence pairs are shown in Table 9:
[0095] Table 9 shows the corresponding word segmentation codes.
[0096] Number q1 encoding q2 encoding Sentence pair 1 A1, A2, A3, A4 A2, A3, A4 Sentence pair 2 A1, A2, A5, A6 A2, A5, A4
[0097] Furthermore, each sentence pair is compared and analyzed, and identical codes are removed. A thesaurus is then used to search within the sentence pairs. If a common synonym exists, its corresponding code is removed, generating a first code set and a second code set. For example, in sentence pair 1, there are no common synonyms, and the repeated codes A2, A3, and A4 are discarded and stored in the second code set. In sentence pair 2, the repeated codes A2 and A5 are also discarded, as there are no common synonyms. Finally, the remaining word segmentation codes for the two sentence pairs, i.e., the first code set, are shown in Table 10.
[0098] Table 10 shows the deduplication results for the encoded data.
[0099] Number q1 encoding q2 encoding Sentence pair 1 A1 - Sentence pair 2 A1, A6 A4
[0100] In sentence pair 1, q2 has no remaining word encoding, indicating that all words in this segmentation result have corresponding words in q1. Therefore, there are no domain synonyms in sentence pair 1. The remaining word A1 in q1 indicates that A1 did not find a corresponding word in the standard question. It may be implicit information, contained in other words in the second encoding set of similar questions. Finally, three possible solutions containing single knowledge points were obtained, with the following probability values:
[0101] Table 11 shows possible solutions for sentence pair 1.
[0102] Number Possible solutions Probability 1 A2 - A1 1 / 3 2 A3 - A1 1 / 3 3 A4 - A1 1 / 3
[0103] In sentence pair 2, both the standard question and the similarity question contain remaining vocabulary encodings, meaning they contain words from the first encoding set. This indicates that there may be domain synonyms between the two sentences (e.g., A1 = A4, A6 = A4...). Simultaneously, several implication relations exist. For example, assuming only one set of domain synonyms exists, A1 = A4, and A6 has no corresponding word in q2, then A6, as implicit information, may be implied in the words of the second encoding set of q1, resulting in the corresponding implication relations (A1-A6, A2-A6, A5-A6). Similarly, all possible solutions when A6 = A5 can be obtained. Furthermore, the case where there is no corresponding relationship between the remaining words of the two sentences (no domain synonyms) should also be considered. In this case, the remaining words are implied in the words of the second encoding set. For example, in obtaining all possible solutions, it is assumed that each word in a sentence implies at most one word. After statistically analyzing all solutions, the following is obtained:
[0104] Table 12 shows possible solutions for sentence pair 2.
[0105] Number Possible solutions 1 A1 = A4, A1 - A6 2 A1 = A4, A2 - A6 3 A1 = A4, A5 - A6 4 A4 = A6, A2 - A1 5 A4 = A6, A5 - A1 6 A4 = A6, A6 - A1 7 A2 - A1, A5 - A6, A2 - A4 8 A2 - A1, A5 - A6, A5 - A4 9 A5 - A1, A2 - A6, A2 - A4 10 A5 - A1, A2 - A6, A5 - A4
[0106] Based on the possible solutions, we obtain the knowledge they encompass, assuming that the probabilities of these knowledge points are equal and their sum is 1, we get:
[0107] Table 13 lists the knowledge and probabilities contained in sentence pair 2.
[0108] Number Covering knowledge Probability 1 A1 = A4 1 / 10 2 A1 - A6 1 / 10 3 A2 - A6 1 / 10 4 A5 - A6 1 / 10 5 A4 = A6 1 / 10 6 A2 - A1 1 / 10 7 A5 - A1 1 / 10 8 A6 - A1 1 / 10 9 A2 - A4 1 / 10 10 A5 - A4 1 / 10
[0109] Next, the results are integrated. In practical applications, the results from all sentence pairs should be integrated and calculated for greater accuracy. However, for clarity and conciseness, only the results from the analysis of two sets of sentence pairs are integrated here, resulting in the sum of probabilities for each type of knowledge:
[0110] Table 14 Results Probabilities and
[0111]
[0112]
[0113] In the implication relation, A2-A1 (breast-female) has the highest value, so it is used as the knowledge extracted in this round. The relation of word A1 in the remaining words (A1, A4, A6) of the sentence pair is now determined. Based on this knowledge and the probability of the remaining words in the knowledge set, the possible relations of the remaining words (A4, A6) are obtained. Only one piece of knowledge is added at a time. Since there are a total of 4 pieces of knowledge involved in (A4, A6) with the same probability (1 / 10 each), 4 results are obtained. The results are sorted according to the coverage of the remaining words and the number of knowledge points included, resulting in the following:
[0114] Table 15
[0115] Number Second round possible solutions Covering remaining vocabulary Number of pieces of knowledge 1 A2 - A1, A4 = A6 A1, A4, A6 2 2 A2 - A1, A2 - A4 A1, A4 2 3 A2 - A1, A5 - A4 A1, A4 2 4 A2 - A1, A5 - A6 A1, A6 2
[0116] The first possible solution in the calculated results covers all remaining words, so it is saved to the final result candidates, and the calculation stops. In summary, the final extracted knowledge is:
[0117] Table 16 Final Knowledge Extraction
[0118] Synonymy A4 = A6 Lump = nodule Implication A2 - A1 Breast - female
[0119] The extracted knowledge was applied to the FAQ question-answering system. Taking "What to do about lumps in a woman's breast" as an example, the system first identified the implicit relationship "breast-woman" using existing knowledge. The search query after removing "woman" was then used to retrieve the results. Subsequently, in calculating the similarity, the system referenced synonym relationships from existing domains to identify "lumps = bumps". The similarity of candidate sentences including domain synonym relationships was then improved. The candidate sentences and their similarities were compared with previous results as follows:
[0120] Table 17 Comparison of Candidate Rankings
[0121]
[0122] The correct matching result was obtained for "What to do about breast lumps". The similarity ranking improved from 3rd to 1st, and the similarity was also improved compared to before. The original "What to do about lumps in women" dropped from 1st to 4th. It can be seen that the present invention can effectively improve the accuracy of question matching in practical applications.
[0123] Figure 3 This is a schematic diagram of the main modules of a question-and-answer data processing device according to an embodiment of the present invention, such as... Figure 3 As shown, the question-and-answer data processing device 300 includes an acquisition module 301 and a processing module 302. The acquisition module 301, in response to a question-and-answer request, determines the request domain and calls a knowledge base to obtain corresponding implicit relation words and synonym relation words. The processing module 302 performs word segmentation on the statements in the question-and-answer request, and then removes the implied words from the segmented statements based on the implicit relation words to obtain the statement to be retrieved. It then calls a preset corpus and calculates the similarity of the statement to be retrieved using the synonym relation words to match and output the statement with the highest similarity.
[0124] In some embodiments, before the acquisition module 301 calls the knowledge base to obtain the corresponding implied relation words and synonym relation words, it includes:
[0125] The process involves acquiring a dataset of sentences to be retrieved and a dataset of candidate sentences, generating a set of similar sentence pairs using a pre-defined matching model, segmenting each similar sentence pair into words to obtain a segmentation set for each pair, and generating all possible solutions for knowledge relations for each pair. These solutions include implied relation words and synonym relation words. Based on the pre-defined probabilities of each possible solution for each knowledge relation, the sum of probabilities of the same possible solution in the similar sentence pair set is calculated to obtain the possible solution with the highest probability. Multiple processing results are then formed by combining the possible solution with the highest probability with all possible solutions for knowledge relations between the remaining words in the segmentation set. Finally, a processing result that covers all words in the segmentation set is selected and stored as the final result in the knowledge base.
[0126] In some embodiments, the acquisition module 301 acquires the dataset of sentences to be retrieved and the dataset of candidate sentences, and generates a set of similar sentence pairs through a preset matching model, including:
[0127] A dataset of sentences to be retrieved in a specific domain is obtained. Based on each standard sentence in the dataset, similar sentences are obtained through a pre-defined deep learning model or a pre-defined search engine. Then, a candidate sentence dataset is generated from the similar sentences. Based on the dataset of sentences to be retrieved and the candidate sentence dataset, each standard sentence is paired with its corresponding similar sentence to obtain similar sentence pairs, and then a set of similar sentence pairs is generated.
[0128] In some embodiments, the acquisition module 301 obtains the word segmentation set for each pair of similar sentences and generates all possible solutions for the knowledge relations of each pair of similar sentences, including:
[0129] For each pair of similar sentences, the word segmentation set is segmented and encoded. Words with the same code are deleted to obtain the first encoding set, and the word segments with the same code are combined to generate the second encoding set. Based on the word segments of the standard sentence and the similar sentences in the first encoding set, as well as the word segments in the first encoding set and the word segments in the second encoding set, all possible solutions of knowledge relations for each pair of similar sentences are generated. Among them, the word segments of the standard sentence and the similar sentences in the first encoding set can generate synonym words, and the word segments in the first encoding set and the word segments in the second encoding set can generate implied words.
[0130] In some embodiments, before the acquisition module 301 performs word segmentation encoding on the word segmentation set of each group of similar sentences, it includes:
[0131] For each set of similar sentences, the word segmentation set is labeled with part-of-speech tags to locate the target word segmentation part-of-speech and remove the word segmentation with the target word segmentation part-of-speech.
[0132] In some embodiments, after the acquisition module 301 performs word segmentation encoding on the word segmentation set of each group of similar sentence pairs, it includes:
[0133] The system calls the preset thesaurus to determine the synonym relationships between word segments with different encodings. It then removes the two word segments with the same synonym relationship from the first encoding set and stores them in the second encoding set.
[0134] In some embodiments, the processing module 302 is further configured to:
[0135] Based on multiple pending results, determine the pending result that can cover all word segmentation and includes the fewest number of knowledge relations, and store the knowledge relations included in the pending result as the final result in the knowledge base.
[0136] It should be noted that the question-and-answer data processing method and the question-and-answer data processing device described in this invention are related in their specific implementation, so repeated content will not be described again.
[0137] Figure 4 An exemplary device architecture 400 is shown for which the question-and-answer data processing method or question-and-answer data processing apparatus of the present invention can be applied.
[0138] like Figure 4 As shown, the device architecture 400 may include terminal devices 401, 402, and 403, a network 404, and a server 405. The network 404 serves as a medium for providing a communication link between the terminal devices 401, 402, and 403 and the server 405. The network 404 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0139] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, and 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and social media platforms (examples only).
[0140] Terminal devices 401, 402, and 403 can be various electronic devices with question-and-answer data processing screens and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0141] Server 405 can be a server providing various services. For example, this could be a backend management server supporting a shopping website browsed by a user using terminal devices 401, 402, and 403 (for example only). The backend management server can analyze and process received data such as product information query requests, and then feed back the processing results (example target push information, product information – for example only) to the terminal device.
[0142] It should be noted that the question-and-answer data processing method provided in the embodiments of the present invention is generally executed by server 405, and correspondingly, the computing device is generally located in server 405.
[0143] It should be understood that Figure 4 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0144] The following is for reference. Figure 5 It shows a structural schematic diagram of a computer device 500 suitable for implementing a terminal device of the present invention. Figure 5 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0145] like Figure 5 As shown, the computer device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage section 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the computer device 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0146] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal query-answering data processor (LCD), and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card and a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.
[0147] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of this invention includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined in the apparatus of this invention.
[0148] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. Examples of computer-readable storage media include, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution device, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution device, apparatus, or apparatus. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0149] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based device that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0150] The modules described in the embodiments of this invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor may be described as including an acquisition module and a processing module. The names of these modules do not necessarily limit the functionality of the module itself.
[0151] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to, in response to a question-and-answer request, determine the request domain, invoke a knowledge base to obtain corresponding implied relation words and synonym relation words; perform word segmentation on the statements in the question-and-answer request, and then remove the implied words from the segmented statements based on the implied relation words to obtain the statement to be retrieved; invoke a preset corpus, calculate the similarity of the statement to be retrieved using the synonym relation words, and output the statement with the highest similarity.
[0152] According to the technical solution of the present invention, the present invention can solve the problem that the similarity calculation results are biased due to redundant information in the statement and domain synonyms, and overcome the disadvantage of the need for annotation of a large amount of data in the supervised method.
[0153] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A question-and-answer data processing method, characterized in that, include: In response to a question-and-answer request, the request domain is determined, and the knowledge base is invoked to obtain the corresponding implied relation terms and synonym relation terms; The statements in the question-and-answer request are segmented into words, and then the implied words in the segmented statements are removed based on the implied relation words to obtain the statements to be retrieved. The system calls a preset corpus and calculates the similarity of the searched statement using the synonyms mentioned above, so as to match and output the statement with the highest similarity. Before calling the knowledge base to retrieve the corresponding implied relation terms and synonym relation terms, the following steps are included: Obtain the dataset of sentences to be retrieved and the dataset of candidate sentences, and generate a set of similar sentence pairs using a preset matching model; Each pair of similar sentences in the set of similar sentence pairs is segmented to obtain a segmented set for each pair, generating all possible solutions for knowledge relations for each pair; among them, possible solutions for knowledge relations include implied relation words and synonym relation words; Based on the pre-defined probabilities of possible solutions for each knowledge relation in each group, the sum of probabilities of possible solutions for the same knowledge relation in the set of similar sentence pairs is calculated to obtain the possible solution for the knowledge relation with the highest probability. Multiple results to be processed are formed by combining the possible solutions of knowledge relations with the highest probability among the remaining words in the word segmentation set; Based on multiple pending results, determine the pending results that can cover all words in the word segmentation set, and store the knowledge relationships included in the pending results as the final result in the knowledge base.
2. The method according to claim 1, characterized in that, Obtain the dataset of sentences to be retrieved and the dataset of candidate sentences, and generate a set of similar sentence pairs using a preset matching model, including: Obtain a dataset of statements to be retrieved in a specific domain. Based on each standard statement in the dataset, obtain similar statements through a pre-defined deep learning model or a pre-defined search engine. Then, generate a candidate statement dataset from the similar statements. Based on the dataset of sentences to be retrieved and the dataset of candidate sentences, each standard sentence is paired with its corresponding similar sentences to obtain similar sentence pairs, and then a set of similar sentence pairs is generated.
3. The method according to claim 1, characterized in that, Obtain the word segmentation set for each pair of similar sentences, and generate all possible solutions for the knowledge relations of each pair of similar sentences, including: For each set of similar sentence pairs, the word segmentation set is encoded. Words with the same code are deleted to obtain the first encoding set, and the words with the same code are combined to generate the second encoding set. Based on the word segmentation of standard sentences and similar sentences in the first encoding set, as well as the word segmentation in the first encoding set and the word segmentation in the second encoding set, all possible solutions of knowledge relations for each pair of similar sentences are generated; among them, the word segmentation of standard sentences and similar sentences in the first encoding set can generate synonym words, and the word segmentation in the first encoding set and the word segmentation in the second encoding set can generate implied words.
4. The method according to claim 3, characterized in that, Before performing word segmentation encoding on each set of similar sentences, the following steps are included: For each set of similar sentences, the word segmentation set is labeled with part-of-speech tags to locate the target word segmentation part-of-speech and remove the word segmentation with the target word segmentation part-of-speech.
5. The method according to claim 3, characterized in that, After segmenting and encoding the word segmentation set of each pair of similar sentences, it includes: The system calls the preset thesaurus to determine the synonym relationships between word segments with different encodings. It then removes the two word segments with the same synonym relationship from the first encoding set and stores them in the second encoding set.
6. The method according to claim 1, characterized in that, Also includes: Based on multiple pending results, determine the pending result that can cover all word segmentation and includes the fewest number of knowledge relations, and store the knowledge relations included in the pending result as the final result in the knowledge base.
7. A question-and-answer data processing device, characterized in that, include: The acquisition module is used to respond to question-and-answer requests, determine the request domain, and call the knowledge base to obtain the corresponding implied relation words and synonym relation words; The processing module is used to perform word segmentation on the statements in the question-and-answer request, and then remove the implied words in the processed statements based on the implied relation words to obtain the statements to be retrieved; it calls a preset corpus, calculates the similarity of the statements to be retrieved through the synonym relation words, and outputs the statements with the highest similarity. The acquisition module is also used to acquire the dataset of sentences to be retrieved and the dataset of candidate sentences, and generate a set of similar sentence pairs through a preset matching model; it performs word segmentation on each set of similar sentence pairs to obtain a word segmentation set for each set of similar sentence pairs, and generates all possible solutions for knowledge relations for each set of similar sentence pairs; among which, possible solutions for knowledge relations include implied relation words and synonym relation words; based on the preset probabilities of each set of possible solutions for knowledge relations, it calculates the sum of probabilities of the same possible solution for knowledge relations in the set of similar sentence pairs to obtain the possible solution for knowledge relations with the highest probability; it forms multiple results to be processed by combining the possible solution for knowledge relations with the highest probability with all possible solutions for knowledge relations between the remaining words in the word segmentation set; based on the multiple results to be processed, it determines the result to be processed that can cover all words in the word segmentation set, and stores the knowledge relations included in the result to be processed as the final result in the knowledge base.
8. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Question and answer method based on knowledge graph, and agricultural encyclopedia question and answer system
CN108804521A
Method for constructing verb phrase implication map and related equipment
CN112149427A