Question and answer retrieval method, device, equipment and storage medium

By introducing domain knowledge and linguistic feature extraction rules into the retrieval-based question answering method and combining it with word order weight calculation, the problems of loose domain knowledge and large corpus size are solved, achieving more accurate question answering retrieval and reducing maintenance difficulty.

CN115757705BActive Publication Date: 2025-09-09QINDAO HAIER REFRIGERATOR CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210975632.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2025-09-09
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

In existing retrieval-based question answering methods, domain knowledge is not tight enough, the corpus is large and the collection cost is high, resulting in inaccurate calculation results and difficult maintenance.

Method used

Adopting feature extraction rules based on domain knowledge and linguistic knowledge, through word segmentation, feature extraction and mixed sequence processing, combined with word order weight calculation, the optimal candidate question text is selected for output.

Benefits of technology

It improves the accuracy of calculation results and the efficiency of corpus maintenance, reduces the size of the corpus and the maintenance workload, and improves the retrieval effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757705B_ABST
    Figure CN115757705B_ABST
Patent Text Reader

Abstract

The present invention provides a question-answer retrieval method, apparatus, device and storage medium. The question-answer retrieval method, through the comprehensive application of word segmentation sequence, feature sequence and mixed sequence of question text, firstly, integrates application domain knowledge and language knowledge into the structural analysis of question text, so that the calculation results can be more in line with the expectations of business personnel. Secondly, by utilizing feature sequences, the training corpus in the corpus can be deduplicated, reducing the impact of changes in the specific values ​​of features on the calculation results. On the one hand, the accuracy of the calculation is improved, and on the other hand, the requirements for the amount of change in the corpus in the corpus are reduced, reducing the workload and difficulty of corpus maintenance. Thirdly, by calculating and adding word order weights, the word order factor is added on the basis of cosine similarity, which improves the accuracy of the calculation and sorting results and enhances the overall retrieval effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a question-and-answer retrieval method, apparatus, device, and storage medium. Background Art

[0002] Retrieval-based question answering is a method for implementing conversational systems. In this approach, developers first build a corpus of question and answer pairs (or categories) of a certain size. When a user asks a question, the system uses a series of algorithms to select a question from the corpus that is most similar to the user's question and outputs the corresponding answer or category, thus achieving effective question answering. However, existing methods for retrieving question sentences suffer from a lack of reliance on domain knowledge, require a large corpus, and are prohibitively expensive to collect. Summary of the Invention

[0003] The purpose of the present invention is to provide a question-answer retrieval method, apparatus, device and storage medium.

[0004] The present invention provides a question-answer retrieval method, including a model training process and a model application process, wherein the model training process includes the following steps:

[0005] Performing word segmentation processing on the training question text in the corpus to obtain a training question text word segmentation sequence, performing feature extraction on the training question text through a rule model to obtain a training question text feature sequence, and performing mixing processing on the words at corresponding positions in the word segmentation sequence by filling the empty character strings in the feature sequence to obtain a mixed sequence;

[0006] The model application process includes the following steps:

[0007] Obtaining a user question input by a user, performing word segmentation processing on the user question text and performing feature extraction using the rule model to obtain its word segmentation sequence and feature sequence, and mixing the two to obtain its mixed sequence;

[0008] Searching for the training question text having the same features as the user question text as a candidate question text;

[0009] Comparing each candidate question text with the user question text, selecting the mixed sequence with the smaller number of elements as a short mixed sequence and the longer one as a long mixed sequence, calculating the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of the elements in the two mixed sequences, and obtaining an ordered overlap number between the two, and calculating the word order weight value of each candidate question text and the user question text based on the ordered overlap number;

[0010] Taking the feature sequence as input, respectively calculating the similarity value between each candidate question text and the user question text;

[0011] A comprehensive similarity value between the candidate question text and the user question text is calculated based on the word order weight value and the similarity value, and an optimal candidate question text is selected for output according to the comprehensive similarity value.

[0012] As a further improvement of the present invention, the feature extraction of the training question text by the rule model to obtain the training question text feature sequence specifically includes:

[0013] Determine the field to which the training question text belongs, perform feature extraction on the training question text using a rule model, and obtain a feature sequence of the training question text, wherein the features include:

[0014] Entity nouns are concrete entities involved in the pre-defined field;

[0015] Event verbs, which are possible user actions involved in the preset field;

[0016] Function words, which are functional words in the linguistic sense;

[0017] Marker words are sentence meaning marker words in the linguistic sense.

[0018] As a further improvement of the present invention, the model training process further includes the steps of:

[0019] A necessary feature sequence is extracted from the training question text feature sequence, where the necessary feature sequence includes preset features required to be included when determining that the user question is similar to the training question.

[0020] As a further improvement of the present invention, the model application process further includes:

[0021] Extracting necessary feature sequences from the user question text feature sequence;

[0022] After obtaining the candidate question text, the necessary feature sequence of the candidate question text and the necessary feature sequence of the user question text are compared respectively. When the two do not contain common features, the candidate question text is eliminated.

[0023] As a further improvement of the present invention, after obtaining the mixed sequence, the present invention further comprises the steps of:

[0024] The mixed sequence of the training question text is detected, and when the same mixed sequence exists, redundant repeated mixed sequences are deleted.

[0025] As a further improvement of the present invention, the step of calculating the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of arrangement of elements in the two mixed sequences specifically includes:

[0026] In the short mixed sequence, when there is a first element arranged before the second element that can be projected into the long mixed sequence, it is only detected whether the second element can be projected into the element located after the first element in the long mixed sequence.

[0027] As a further improvement of the present invention, the word order weight values ​​of each candidate question text and the user question text are calculated based on the ordered overlap number, specifically including:

[0028] The word order weight values ​​of each candidate question text and the user question text are calculated based on the ordered overlap number, and the calculation formula is:

[0029]

[0030] The length of the long mixed sequence is the number of elements in the long mixed sequence, the ordered overlap number is the ordered overlap number between the candidate question and the user question, and the weight coefficient is a preset parameter.

[0031] As a further improvement of the present invention, the method of taking the feature sequence as input and calculating the similarity value between each candidate question text and the user question text respectively includes:

[0032] The candidate question text feature sequence and the user question text feature sequence are respectively taken as input, and the cosine similarity value between each candidate question text and the user question text is calculated.

[0033] As a further improvement of the present invention, the calculating of the comprehensive similarity value between the candidate question text and the user question text based on the word order weight value and the similarity value, and selecting the optimal candidate question text for output according to the comprehensive similarity value, specifically includes:

[0034] The comprehensive similarity value between the candidate question text and the user question text is calculated based on the word order weight value and the cosine similarity value, and the calculation formula is:

[0035]

[0036] Sort by comprehensive similarity value from large to small, select the candidate question text with the largest comprehensive similarity value and higher than the preset minimum similarity requirement as the optimal candidate question output. If no condition is met, it will be returned that the optimal solution cannot be found.

[0037] As a further improvement of the present invention, the model training process further includes:

[0038] Compile an index dictionary based on the non-empty features in the training question text feature sequence;

[0039] The model application process also includes:

[0040] The training question text having the same features as the user question text is anchored through the index dictionary as a candidate question text.

[0041] As a further improvement of the present invention, the index dictionary is compiled based on the non-empty features in the training question text feature sequence, specifically including:

[0042] An index dictionary is compiled using the feature name as an index keyword, and the training question text containing the corresponding feature name is used as an index item set of the index keyword.

[0043] As a further improvement of the present invention, anchoring the training question text having the same features as the user question text as the candidate question text through the index dictionary specifically includes:

[0044] Acquire features included in the user question text feature sequence;

[0045] Search the index item set corresponding to the feature in the index dictionary, and use the training question text as the candidate question text. When there are multiple features and index item sets corresponding to the features, perform continuous intersection operations on the multiple index item sets, and use the training question text finally obtained as the candidate question text.

[0046] As a further improvement of the present invention, the model application process further includes the steps of:

[0047] The absolute values ​​of the length differences between the feature sequences of the candidate question texts and the feature sequences of the user question are calculated respectively, and a preset number of the candidate question texts are retained in ascending order of the absolute values ​​of the length differences.

[0048] As a further improvement of the present invention, before performing word segmentation processing on the training question text in the corpus, the present invention further includes the following steps:

[0049] The training question texts in the corpus are preprocessed, including filtering out irrelevant text content from the training question texts by means of keyword replacement and / or regular expression replacement.

[0050] A question-answer retrieval device, comprising:

[0051] A voice acquisition module configured to acquire user questions input by a user;

[0052] The text processing module is configured to perform word segmentation processing on the training question text in the corpus to obtain a training question text word segmentation sequence, perform feature extraction on the training question text through a rule model to obtain a training question text feature sequence, fill the empty character strings in the feature sequence with words at corresponding positions in the word segmentation sequence to perform mixing processing to obtain a mixed sequence; and perform word segmentation processing on the user question text to perform feature extraction through the rule model to obtain its word segmentation sequence and feature sequence, and mix the two to obtain its mixed sequence;

[0053] A retrieval module configured to search for the training question text having the same features as the user question text as a candidate question text;

[0054] a word order weight value calculation module configured to compare each candidate question text with the user question text, select the mixed sequence with the smaller number of elements as a short mixed sequence and the longer one as a long mixed sequence, calculate the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of the elements in the two mixed sequences, obtain an ordered overlap number between the two, and calculate the word order weight value of each candidate question text and the user question text based on the ordered overlap number;

[0055] A similarity value calculation module is configured to take a feature sequence as an input item and calculate a similarity value between each candidate question text and the user question text;

[0056] The comprehensive similarity value calculation module is configured to calculate the comprehensive similarity value of the candidate question text and the user question text based on the word order weight value and the similarity value, and select the optimal candidate question text for output according to the comprehensive similarity value.

[0057] An electrical device, comprising:

[0058] a memory for storing executable instructions;

[0059] The processor is configured to implement the above-mentioned question-and-answer retrieval method when running the executable instructions stored in the memory.

[0060] A refrigerator, comprising:

[0061] a memory for storing executable instructions;

[0062] The processor is configured to implement the above-mentioned question-and-answer retrieval method when running the executable instructions stored in the memory.

[0063] A computer-readable storage medium stores executable instructions, which implement the above-mentioned question-answer retrieval method when executed by a processor.

[0064] The beneficial effects of the present invention are as follows: first, the present invention integrates application domain knowledge and language knowledge into the structural analysis of the question text through the comprehensive application of the word segmentation sequence, feature sequence and mixed sequence of the question text, so that the calculation results can be more in line with the expectations of business personnel. Second, by utilizing the feature sequence, the training corpus in the corpus can be deduplicated, reducing the impact of the specific value changes of the features on the calculation results. On the one hand, it improves the accuracy of the calculation, and on the other hand, it reduces the requirements for the amount of change of the corpus in the corpus, reducing the workload and difficulty of corpus maintenance. Third, through the calculation and addition of word order weights, the word order factor is added on the basis of cosine similarity, which improves the accuracy of the calculation and sorting results and enhances the overall retrieval effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 Schematic diagram of the model training process steps of the question-answering retrieval method in one embodiment of the present invention.

[0066] Figure 2 It is a schematic diagram of the steps of the question-answering retrieval method model application process in one embodiment of the present invention.

[0067] Figure 3 It is a structural diagram of a question-answer retrieval device in one embodiment of the present invention. DETAILED DESCRIPTION

[0068] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0069] The embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and are not to be construed as limiting the present invention.

[0070] This embodiment provides a question-answering retrieval method that integrates feature text extraction and word order weighting, which is mainly used to solve the problems that traditional retrieval-based question search methods are not closely integrated with relevant domain knowledge, the required corpus is too large, and the corpus collection cost is too high. The question-answering retrieval method introduces feature extraction rules based on domain knowledge and linguistic knowledge, thereby introducing a large number of domain knowledge features and a small amount of linguistic knowledge into the natural language text before similarity calculation, and comprehensively considering word order factors and similarity factors in the calculation process, thereby improving the accuracy of calculation and detection. At the same time, this feature extraction also reduces the requirements for the amount of corpus variation in the corpus, allowing corpus maintainers to not generalize too much on corpus with the same features, thereby reducing the size of the corpus and the corresponding workload of maintaining and expanding the corpus.

[0071] In this embodiment, the method is explained based on a smart refrigerator with interactive functions. During daily use, users will ask the smart refrigerator questions such as "When does the yogurt in the refrigerator expire?" and "What other vegetables are in the refrigerator?" After detecting and identifying the questions asked by the users, the smart refrigerator finds the most similar questions in the corpus and outputs corresponding answers based on the questions.

[0072] The question-answer retrieval method integrating feature text extraction and word order weighting includes a model training process and a model application process. In the model training process, the question text in the corpus is structured and parsed, the parsing results are saved and an index is established; in the model application process, when a new question input by the user is obtained, the best similar question is retrieved and calculated from the corpus based on the saved structured results and index.

[0073] like Figure 1 As shown, the model training process includes the following steps:

[0074] Sa1: Perform word segmentation processing on the training question text in the corpus to obtain the word segmentation sequence of the training question text, perform feature extraction on the training question text through the rule model to obtain the feature sequence of the training question text, fill the empty string of the feature sequence with the words at the corresponding position of the word segmentation sequence, and perform mixing processing to obtain a mixed sequence.

[0075] Sa2: Compile an index dictionary based on the non-empty features in the training question text feature sequence.

[0076] like Figure 2 As shown, the model application process includes the following steps:

[0077] Sb1: Get the user question input by the user, segment the user question text and extract features through the rule model to obtain its segmentation sequence and feature sequence, and mix the two to obtain its mixed sequence.

[0078] Sb2: Through the index dictionary, anchor the training question texts with the same features as the user question texts as candidate question texts.

[0079] Sb3: Compare each candidate question text with the user question text respectively, select the mixed sequence with fewer elements as the short mixed sequence and the longer one as the long mixed sequence, and based on the order of the elements in the two mixed sequences, calculate the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence to obtain the ordered overlap number of the two, and calculate the word order weight value of each candidate question text and user question text respectively based on the ordered overlap number.

[0080] Sb4: Take the feature sequence as input and calculate the similarity value between each candidate question text and the user question text.

[0081] Sb5: Calculate the comprehensive similarity between the candidate question text and the user question text based on the word order weight value and similarity value, and select the optimal candidate question text for output based on the comprehensive similarity value.

[0082] The following is a detailed description of the model training process and model application process.

[0083] Before step Sa1, the method further includes:

[0084] Preprocess the training question texts in the corpus.

[0085] The corpus includes training question texts collected from questions asked by users to the smart refrigerator. In some embodiments of the present invention, the corpus also includes training question texts automatically generated by an algorithm based on the user question texts.

[0086] Preprocessing includes cleaning the training question text, specifically filtering out some irrelevant text content through keyword replacement, regular expression replacement, etc. The existing text preprocessing algorithm can be used to process the training text, and the present invention will not go into details here.

[0087] In step Sa1, the word segmentation sequence, feature sequence and mixed sequence of the training question text are extracted, which specifically includes:

[0088] Sa11: Segment the training question text using a word segmentation algorithm to obtain its word segmentation sequence.

[0089] Word segmentation is the process of automatically adding separators between words in a text by the processor through relevant algorithms. There has been a lot of research on Chinese word segmentation. The word segmentation algorithm can use the existing algorithms commonly used in the current natural language processing field, which will not be discussed here.

[0090] Sa12: Determine the field to which the training question text belongs. Use a rule model developed through an inventor's self-developed rule framework to extract features from the training question text, obtaining a feature sequence of the training question text. The features included in the rule model are as follows:

[0091] Entity nouns, which are concrete entities involved in the preset field. Exemplarily, in this embodiment, entity nouns are nouns such as "tomato", "yogurt", etc. representing food ingredient names "FD_slots", nouns such as "refrigerator compartment", "freezer compartment", etc. representing refrigerator-related equipment names "ref_dev", etc.

[0092] Event verbs, which are possible user action behaviors involved in the preset field. Exemplarily, in this embodiment, event verbs are verbs such as "add", "place", etc. representing actions of adding items into the refrigerator "verb_put", etc.

[0093] Function words, which are function words in the linguistic sense. Exemplarily, in this embodiment, function words are locative words such as "inside", "in", etc. representing the inside of the refrigerator "localizer_in", etc.

[0094] Marker words, which are sentence meaning marker words in the linguistic sense. Exemplarily, in this embodiment, marker words are marker words such as "right", "is it", etc. representing yes / no questions "yn_form", etc.

[0095] The feature extraction process specifically includes: According to factors such as the word list and syntactic structure, mark the words in the word segmentation sequence of the training question text that conform to the above features as corresponding features, and represent the words that do not belong to the above features with empty strings.

[0096] The above four types of features can cover most of the keywords involved in the daily use of users in the intelligent refrigerator field. By extracting them as a feature sequence, it is possible to perform a structured analysis on the training question text in the corpus based on the usage characteristics of the intelligent refrigerator to obtain a feature sequence, improving the accuracy of the feature sequence, so that the calculation results can better meet the expectations of business personnel.

[0097] Determining the field to which the training question text belongs can be achieved through presetting or manual adjustment.

[0098] In other embodiments of the present invention, features can also be added or deleted and the words included in the features can be adjusted according to the usage field of the specific object. For example, when applying this method to an air conditioner, features specifically used to represent temperature can be added, and event verbs can be represented as "turn on", "turn off", etc.

[0099] Sa13: Mix the words at the corresponding positions in the word segmentation sequence by filling the empty strings in the feature sequence, obtaining a mixed sequence.

[0100] A mixed sequence is a text sequence that contains both feature names and words that are not features.

[0101] Furthermore, in some embodiments of the present invention, step Sa1 further includes:

[0102] Sa14: Extract the necessary feature sequence from the training question text feature sequence. The necessary feature sequence includes the preset features required to determine whether the user question is similar to the training question.

[0103] Illustratively, in this embodiment, the necessary feature sequences are "FD_slots" and "verb_put".

[0104] Necessary features are features that must be included when judging whether the training question text is similar to the user question text. By adding the step of extracting the necessary feature sequence and then adding the corresponding step of comparing the necessary feature sequence of the user question text and the training question text, the accuracy of the judgment can be further increased and the possibility of irrelevant questions can be reduced.

[0105] In summary, through step Sa1, the word segmentation sequence, feature sequence, mixed sequence and necessary feature sequence of the training question text can be extracted. For example, for the text "I put the tomatoes in the refrigerator", the extracted sequences include:

[0106] Word sequence: ['I', 'put', 'tomato', 'put', 'refrigerator', 'in'].

[0107] Feature sequence: [",",'FD_slots','verb_put','ref_dev','localizer_in'].

[0108] Mixed sequence: ['i','put','FD_slots','verb_put','ref_dev','localizer_in'].

[0109] Required feature sequence: ['FD_slots','verb_put'].

[0110] Furthermore, in some embodiments of the present invention, after step Sa1, the process further includes the following steps:

[0111] Detect the mixed sequences of the training question text, and delete the redundant repeated mixed sequences when the same mixed sequences exist.

[0112] The results are deduplicated based on the mixed sequence, and only the information of one of the multiple repeated mixed sequences is retained, which can reduce the consumption of subsequent computing resources.

[0113] In step Sa2, it specifically includes:

[0114] An index dictionary is compiled using the feature name as the index keyword, and the training question text containing the corresponding feature name is used as the index item set of the index keyword.

[0115] For example, an index dictionary can be represented as:

[0116] {“FD_slots”:{1,2,3},

[0117] "verb_put":{2,3,4},

[0118] "ref_dev":{1,3,4}}

[0119] Among them, 1, 2, 3, and 4 are the training question text numbers, which point to the questions containing the previous features.

[0120] After completing the above model training process, the calculation results are stored in the memory for direct reading in subsequent applications.

[0121] In step Sb1, it specifically includes:

[0122] Read the model training results from the storage and load them into the memory for use.

[0123] The smart refrigerator's voice acquisition device captures the user's question and converts the voice into text. This text conversion algorithm can use an existing algorithm, or the user's input text can be directly obtained. The user's question text is then structurally parsed using the aforementioned text processing method to obtain its word segmentation sequence, feature sequence, and mixed sequence.

[0124] In some embodiments of the present invention, step Sb1 further includes:

[0125] Extract necessary feature sequences from user question text.

[0126] In step Sb2, it specifically includes:

[0127] Obtain the features included in the user question text feature sequence;

[0128] Search the index item set corresponding to the feature in the index dictionary, and use the training question text as the candidate question text. When there are multiple features and index item sets corresponding to the features, perform continuous intersection operations on the multiple index item sets, and use the final training question text as the candidate question text.

[0129] Exemplarily, the user question text A contains two non-empty features, "FD_slots" and "verb_put". Based on the above-indexed dictionary, the key values are retrieved from the indexed dictionary as follows:

[0130] {"FD_slots": {1, 2, 3},

[0131] "verb_put": {2, 3, 4}}

[0132] Performing an intersection operation on the two values yields the candidate question B ({1, 2, 3} & {2, 3, 4} = {2, 3}).

[0133] After performing the intersection operation, if the resulting set B is an empty set, directly return that the best similar question cannot be found and no further calculations are performed.

[0134] In step Sb3, calculate the word order weight values of each candidate question text and the user question text based on the ordered overlap count, specifically including:

[0135] Calculate the word order weight values of each candidate question text and the user question text based on the ordered overlap count. The calculation formula is:

[0136]

[0137] Among them, the length of the long mixed sequence is the number of elements in the mixed sequence with more elements between a candidate question text and the user question text. The ordered overlap count is the ordered overlap count between this candidate question and the user question. The weight coefficient is a preset adjustable parameter.

[0138] Exemplarily, when the mixed sequence of the user question text is ["verb_put", "particle_le1", "FDquanity", "FD_slots", "呢"], and the mixed sequence of the candidate question text is ["verb_put", "particle_le1", "FDunit", "FD_slots"], first calculate their lengths. The number of elements in the mixed sequence of the user question text is 5, which is the long mixed sequence. The number of elements in the mixed sequence of the candidate question text is 4, which is the short mixed sequence. Therefore, calculate the number of elements in the mixed sequence of the candidate question text that can be projected into the user question text sequence. "verb_put", "particle_le1", and "FD_slots" can be projected, that is, their ordered overlap count is 3.

[0139] It should be noted that the so-called based on the arrangement order of elements in the mixed sequence means that when considering whether an element can be projected, the arrangement order of the elements also needs to be considered. In the short mixed sequence, when there is a first element arranged before the second element that can be projected into the long mixed sequence, only whether the second element can be projected into the elements after the first element in the long mixed sequence is detected. For example, if the short mixed sequence n is [a, b] and the long mixed sequence m is [b, a, c], although both the short mixed sequence n and the long mixed sequence m contain the element b, in the short mixed sequence n, the element b is after the element a, while in the long mixed sequence m, there is only the element c after the element a, and the element b cannot be projected. Therefore, only the element a in the mixed sequence n can be projected into the long mixed sequence m, and the ordered overlap number is 1.

[0140] After obtaining the ordered overlap number, the word order weight value is calculated. Exemplarily, when the mixed sequence of the user question text is ["verb_put", "particle_le1", "FDquanity", "FD_slots", "呢"], and the mixed sequence of the candidate question text is ["verb_put", "particle_le1", "FDunit", "FD_slots"], and its ordered overlap number is 3, and the weight coefficient is set as p, then the word order weight value of the candidate question text sequence is 0.4p.

[0141] In step Sb3, the word order weight between the user question text and the candidate question text is calculated by the above method. In addition to obtaining the judgment result based on the similarity, the dimension of the word order is added, and the detection accuracy can be increased through multi-dimensional judgment.

[0142] In other embodiments of the present invention, the calculation formula of the word order weight value can also be adjusted, and on the basis of the word order weight value, weight values such as the edit distance and the Hamming distance can also be added to further increase the accuracy of the judgment result.

[0143] In some embodiments of the present invention, before step Sb3, it further includes:

[0144] The absolute value of the length difference between the candidate question text feature sequence and the user question feature sequence is calculated respectively, and a preset number of candidate question texts are retained in ascending order of the absolute value of the length difference.

[0145] By comparing the absolute value of the length difference, the number of candidate question texts is further reduced, thereby reducing the calculation amount of step Sb3 and subsequent steps and improving the calculation speed. <00​​​​The candidate question text feature sequence and the user question text feature sequence are taken as input respectively, and the cosine similarity value between each candidate question text and the user question text is calculated.

[0148] Here, the summarized extracted feature sequence is used as the cosine similarity input item. By deduplicating the feature sequence, the impact of the specific value changes of the features on the calculation results is reduced. On the one hand, it can improve the accuracy of the calculation. On the other hand, it can reduce the requirements for the amount of corpus changes in the corpus, thereby reducing the workload and difficulty of corpus maintenance.

[0149] In other embodiments of the present invention, other commonly used similarity calculation methods may also be used to calculate the similarity between the candidate question text feature sequence and the user question text feature sequence, and the present invention does not impose any specific limitation on this.

[0150] In step Sb5, it specifically includes:

[0151] The comprehensive similarity between the candidate question text and the user question text is calculated based on the word order weight value and cosine similarity value. The calculation formula is:

[0152]

[0153] Sort by comprehensive similarity value from large to small, select the candidate question text with the largest comprehensive similarity value and higher than the preset minimum similarity requirement as the optimal candidate question output. If no condition is met, it will be returned that the optimal solution cannot be found.

[0154] In other embodiments of the present invention, the formula for calculating the comprehensive similarity value may also be adjusted, as long as it is based on the word order weight and similarity.

[0155] Furthermore, in some embodiments of the present invention, step Sb5 further includes:

[0156] Extract necessary feature sequences from user question text feature sequences.

[0157] After obtaining the candidate question text, the necessary feature sequence of the candidate question text and the necessary feature sequence of the user question text are compared respectively. If the two do not contain common features, the candidate question text is eliminated.

[0158] This corresponds to the above extraction of necessary feature sequences of user question texts, which can further increase the accuracy of judgment and reduce the possibility of irrelevant questions.

[0159] In summary, the present invention, through the comprehensive application of word segmentation sequence, feature sequence and mixed sequence of question text, firstly, integrates application domain knowledge and language knowledge into the structural analysis of question text, so that the calculation results can be more in line with the expectations of business personnel. Secondly, by utilizing feature sequences, the training corpus in the corpus can be deduplicated, reducing the impact of changes in the specific values ​​of features on the calculation results. On the one hand, it improves the accuracy of the calculation, and on the other hand, it reduces the requirements for the amount of change in the corpus in the corpus, reducing the workload and difficulty of corpus maintenance. Thirdly, through the calculation and addition of word order weights, the word order factor is added on the basis of cosine similarity, which improves the accuracy of the calculation and sorting results and enhances the overall retrieval effect.

[0160] like Figure 3 As shown, based on the same inventive concept, this embodiment further provides a question-answer retrieval device, comprising:

[0161] A voice acquisition module 1 is configured to acquire a user question input by a user;

[0162] The text processing module 2 is configured to perform word segmentation processing on the training question text in the corpus to obtain a training question text word segmentation sequence, perform feature extraction on the training question text through a rule model to obtain a training question text feature sequence, fill the empty character strings in the feature sequence with words at corresponding positions in the word segmentation sequence to perform mixing processing to obtain a mixed sequence; and perform word segmentation processing on the user question text to perform feature extraction through a rule model to obtain its word segmentation sequence and feature sequence, and mix the two to obtain its mixed sequence;

[0163] Retrieval module 3, which is configured to search for training question texts having the same features as the user question text as candidate question texts;

[0164] A word order weight value calculation module 4 is configured to compare each candidate question text with the user question text, select the mixed sequence with the smaller number of elements as the short mixed sequence and the longer one as the long mixed sequence, calculate the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of the elements in the two mixed sequences, obtain the ordered overlap number of the two, and calculate the word order weight value of each candidate question text and the user question text based on the ordered overlap number;

[0165] A similarity calculation module 5 is configured to take the feature sequence as input and calculate the similarity value between each candidate question text and the user question text;

[0166] The comprehensive similarity value calculation module 6 is configured to calculate the comprehensive similarity value between the candidate question text and the user question text based on the word order weight value and the similarity value, and select the optimal candidate question text for output according to the comprehensive similarity value.

[0167] Based on the same inventive concept, this embodiment further provides an electrical device, including:

[0168] a memory for storing executable instructions;

[0169] The processor is configured to implement the above-mentioned question-answer retrieval method when running the executable instructions stored in the memory.

[0170] Based on the same inventive concept, this embodiment further provides a refrigerator, comprising:

[0171] a memory for storing executable instructions;

[0172] The processor is configured to implement the above-mentioned question-answer retrieval method when running the executable instructions stored in the memory.

[0173] Based on the same inventive concept, this embodiment further provides a computer-readable storage medium storing executable instructions, which implement the above-mentioned question-and-answer retrieval method when executed by a processor.

[0174] It should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation method can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

[0175] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.

Claims

1. A question-answer retrieval method, comprising a model training process and a model application process, characterized in that ; The model training process includes the following steps: Performing word segmentation processing on the training question text in the corpus to obtain a training question text word segmentation sequence, performing feature extraction on the training question text through a rule model to obtain a training question text feature sequence, and performing mixing processing on the words at corresponding positions in the word segmentation sequence by filling the empty character strings in the feature sequence to obtain a mixed sequence; The model application process includes the following steps: Obtaining a user question input by a user, performing word segmentation processing on the user question text and performing feature extraction using the rule model to obtain its word segmentation sequence and feature sequence, and mixing the two to obtain its mixed sequence; Searching for the training question text having the same features as the user question text as a candidate question text; Comparing each candidate question text with the user question text, selecting the mixed sequence with the smaller number of elements as a short mixed sequence and the longer one as a long mixed sequence, calculating the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of the elements in the two mixed sequences, and obtaining an ordered overlap number between the two, and calculating the word order weight value of each candidate question text and the user question text based on the ordered overlap number; Taking the feature sequence as input, respectively calculating the similarity value between each candidate question text and the user question text; A comprehensive similarity value between the candidate question text and the user question text is calculated based on the word order weight value and the similarity value, and an optimal candidate question text is selected for output according to the comprehensive similarity value.

2. The question-answer retrieval method according to claim 1, wherein: The feature extraction of the training question text by using the rule model to obtain the training question text feature sequence specifically includes: Determine the field to which the training question text belongs, perform feature extraction on the training question text using a rule model, and obtain a feature sequence of the training question text, wherein the features include: Entity nouns are concrete entities involved in the pre-defined field; Event verbs, which are possible user actions involved in the preset field; Function words, which are functional words in the linguistic sense; Marker words are sentence meaning marker words in the linguistic sense.

3. The question-answer retrieval method according to claim 2, wherein: The model training process also includes the following steps: A necessary feature sequence is extracted from the training question text feature sequence, where the necessary feature sequence includes preset features required to be included when determining that the user question is similar to the training question.

4. The question-answer retrieval method according to claim 3, wherein: The model application process also includes: Extracting necessary feature sequences from the user question text feature sequence; After obtaining the candidate question text, the necessary feature sequence of the candidate question text and the necessary feature sequence of the user question text are compared respectively. When the two do not contain common features, the candidate question text is eliminated.

5. The question-answer retrieval method according to claim 1, wherein: After obtaining the mixed sequence, the method further comprises the steps of: The mixed sequence of the training question text is detected, and when the same mixed sequence exists, redundant repeated mixed sequences are deleted.

6. The question-answer retrieval method according to claim 1, wherein: The step of calculating the number of elements in the short mixed sequence that can be projected into the long mixed sequence based on the order of arrangement of the elements in the two mixed sequences specifically includes: In the short mixed sequence, when there is a first element arranged before the second element that can be projected into the long mixed sequence, it is only detected whether the second element can be projected into the element located after the first element in the long mixed sequence.

7. The question-answer retrieval method according to claim 6, wherein: Calculating the word order weight value of each candidate question text and the user question text based on the ordered overlap number specifically includes: The word order weight values ​​of each candidate question text and the user question text are calculated based on the ordered overlap number, and the calculation formula is: The length of the long mixed sequence is the number of elements in the long mixed sequence, the ordered overlap number is the ordered overlap number between the candidate question and the user question, and the weight coefficient is a preset parameter.

8. The question-answer retrieval method according to claim 1, wherein: The step of taking the feature sequence as input and calculating the similarity value between each candidate question text and the user question text specifically includes: The candidate question text feature sequence and the user question text feature sequence are respectively taken as input, and the cosine similarity value between each candidate question text and the user question text is calculated.

9. The question-answer retrieval method according to claim 8, wherein: The calculating of the comprehensive similarity value between the candidate question text and the user question text based on the word order weight value and the similarity value, and selecting the optimal candidate question text for output according to the comprehensive similarity value, specifically includes: The comprehensive similarity value between the candidate question text and the user question text is calculated based on the word order weight value and the cosine similarity value, and the calculation formula is: Sort by comprehensive similarity value from large to small, select the candidate question text with the largest comprehensive similarity value and higher than the preset minimum similarity requirement as the optimal candidate question output. If no condition is met, it will be returned that the optimal solution cannot be found.

10. The question-answer retrieval method according to claim 1, wherein: The model training process also includes: Compile an index dictionary based on the non-empty features in the training question text feature sequence; The model application process also includes: The training question text having the same features as the user question text is anchored through the index dictionary as a candidate question text.

11. The question-answer retrieval method according to claim 10, wherein: The step of compiling an index dictionary based on the non-empty features in the training question text feature sequence specifically includes: An index dictionary is compiled using the feature name as an index keyword, and the training question text containing the corresponding feature name is used as an index item set of the index keyword.

12. The question-answer retrieval method according to claim 11, wherein: The step of anchoring the training question text having the same features as the user question text as the candidate question text by using the index dictionary specifically includes: Acquire features included in the user question text feature sequence; Search the index item set corresponding to the feature in the index dictionary, and use the training question text as the candidate question text. When there are multiple features and index item sets corresponding to the features, perform continuous intersection operations on the multiple index item sets, and use the training question text finally obtained as the candidate question text.

13. The question-answer retrieval method according to claim 1, wherein: The model application process further comprises the steps of: The absolute values ​​of the length differences between the feature sequences of the candidate question texts and the feature sequences of the user question are calculated respectively, and a preset number of the candidate question texts are retained in ascending order of the absolute values ​​of the length differences.

14. The question-answer retrieval method according to claim 1, wherein: Before the word segmentation processing of the training question text in the corpus, the method further includes the following steps: The training question texts in the corpus are preprocessed, including filtering out irrelevant text content from the training question texts by means of keyword replacement and / or regular expression replacement.

15. A question-answer retrieval device, characterized in that: include: A voice acquisition module configured to acquire user questions input by a user; The text processing module is configured to perform word segmentation processing on the training question text in the corpus to obtain a training question text word segmentation sequence, perform feature extraction on the training question text through a rule model to obtain a training question text feature sequence, fill the empty character strings in the feature sequence with words at corresponding positions in the word segmentation sequence to perform mixing processing to obtain a mixed sequence; and perform word segmentation processing on the user question text to perform feature extraction through the rule model to obtain its word segmentation sequence and feature sequence, and mix the two to obtain its mixed sequence; A retrieval module configured to search for the training question text having the same features as the user question text as a candidate question text; a word order weight value calculation module configured to compare each candidate question text with the user question text, select the mixed sequence with the smaller number of elements as a short mixed sequence and the longer one as a long mixed sequence, calculate the number of elements contained in the short mixed sequence that can be projected into the long mixed sequence based on the order of the elements in the two mixed sequences, obtain an ordered overlap number between the two, and calculate the word order weight value of each candidate question text and the user question text based on the ordered overlap number; A similarity value calculation module is configured to take a feature sequence as an input item and calculate a similarity value between each candidate question text and the user question text; The comprehensive similarity value calculation module is configured to calculate the comprehensive similarity value of the candidate question text and the user question text based on the word order weight value and the similarity value, and select the optimal candidate question text for output according to the comprehensive similarity value.

16. An electrical device, characterized in that: include: a memory for storing executable instructions; A processor, configured to implement the question-answer retrieval method according to any one of claims 1 to 14 when running the executable instructions stored in the memory.

17. A refrigerator, characterized in that: include: a memory for storing executable instructions; A processor, configured to implement the question-answer retrieval method according to any one of claims 1 to 14 when running the executable instructions stored in the memory.

18. A computer-readable storage medium storing executable instructions, characterized in that: When the executable instructions are executed by a processor, the question-answer retrieval method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Intelligent customer service response method and system

    CN110162611A

  • Chinese intelligent question and answer short text similarity calculation method oriented to medical field

    CN111581364A