Question and answer matching method and device, computer device and storage medium

By filtering and adjusting the semantic similarity of candidate questions, the problem of inaccurate matching of questions with the same literal meaning but different semantics in the existing technology is solved, and more accurate question-answer matching is achieved.

CN115934919BActive Publication Date: 2025-12-19INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310118476.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-02
Publication Date
2025-12-19
Estimated Expiration
2043-02-02

AI Technical Summary

Technical Problem

Existing question-answering systems cannot accurately match user intent when faced with questions that are literal but semantically different, resulting in inaccurate answers.

Method used

By acquiring the user's question and its candidate questions, the target candidate questions whose longest common substring length meets the preset conditions are selected, and the semantic similarity is adjusted based on the semantic differences of the substring. Finally, the target question matching the user's question is selected from the candidate questions.

Benefits of technology

It improves the accuracy of question-and-answer matching, ensuring that the answer matches the user's intent in the question and solving the problem of semantically dissimilar but literally identical answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934919B_ABST
    Figure CN115934919B_ABST
Patent Text Reader

Abstract

The application relates to a question and answer matching method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: obtaining a user question and a plurality of candidate questions corresponding to the user question; screening a target candidate question from the candidate questions; the target candidate question is a candidate question whose length of a longest common substring between the user question and the target candidate question satisfies a preset length condition; for any target candidate question, adjusting the semantic similarity between the target candidate question and the user question based on the difference between the semantics represented by the corresponding longest common substring in the target candidate question and the semantics represented in the user question, to obtain a new semantic similarity corresponding to the target candidate question; screening a target question matched with the user question from the candidate questions; the answer corresponding to the target question is an answer matched with the user question. The method can improve the accuracy of question and answer matching.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, in particular to a question and answer matching method and device, computer equipment, a storage medium and a computer program product. BACKGROUND

[0002] With the development of natural language processing and artificial intelligence related technologies, people can gradually use machines to process unstructured natural language data to complete complex tasks, such as question and answer systems. The question and answer system mainly solves the real intention analysis of the question, the matching relationship between the question and the answer, understands the user's question described in natural language form, and returns the correct answer matching.

[0003] The key technology for the question and answer system to answer user questions is question matching. However, the ambiguity of natural language leads to the difficulty of different semantics with the same literal content in question matching. For example, the user question and the candidate question have overlapping literal content, but the question has different semantics. The question and answer matching method used in the related technology still calculates a high matching degree for the user question and the candidate question in this case, which may cause errors in subsequent semantic determination of the user question, and thus cannot accurately give an answer that meets the user's question intention.

[0004] Therefore, the related technology has the problem of low accuracy of question and answer matching. SUMMARY

[0005] Therefore, it is necessary to provide a question and answer matching method, device, computer equipment, computer readable storage medium and computer program product capable of improving the accuracy of question and answer matching.

[0006] In a first aspect, the present application provides a question and answer matching method. The method comprises:

[0007] obtaining a user question and a plurality of candidate questions corresponding to the user question; the literal matching degree between each candidate question and the user question satisfies a preset matching degree condition;

[0008] selecting a target candidate question from each candidate question; the target candidate question is a candidate question whose length of the longest common substring between the user question and the target candidate question satisfies a preset length condition;

[0009] For any target candidate question, based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented in the user question, the semantic similarity between the any target candidate question and the user question is adjusted to obtain a new semantic similarity corresponding to the any target candidate question;

[0010] According to the new semantic similarity corresponding to each of the target candidate question, a target question matching the user question is screened out from each of the candidate questions; the answer corresponding to the target question is the answer matching the user question.

[0011] In one of the embodiments, the length of the longest common sub-string is one; and the adjusting of the semantic similarity between the any target candidate question and the user question to obtain the new semantic similarity corresponding to the any target candidate question, based on the difference between the semantic represented by the corresponding longest common sub-string in the any target candidate question and the semantic represented in the user question, includes:

[0012] the longest common string is taken as the target same character between the any target candidate question and the user question;

[0013] a target synonym pair in which both of the two words in the target synonym pair have the target same character is queried from the synonym database as a target synonym pair; each of the target synonym pairs includes two words with the same semantic;

[0014] in the case that the target synonym pair does not exist in the user question and the any target candidate question, it is determined that the semantic represented by the word in which the target same character is located in the any target candidate question is different from the semantic represented by the word in which the target same character is located in the user question;

[0015] in the case that the semantic corresponding to the target same character is different, the semantic similarity corresponding to the any target candidate question is adjusted to obtain the new semantic similarity corresponding to the any target candidate question.

[0016] In one of the embodiments, the adjusting of the semantic similarity corresponding to the any target candidate question to obtain the new semantic similarity corresponding to the any target candidate question in the case that the semantic corresponding to the target same character is different, includes:

[0017] the number of the target same characters corresponding to the different semantic between the any target candidate question and the user question is determined as a first character number, and the number of the characters in the user question is determined as a second character number;

[0018] the semantic similarity corresponding to the any target candidate question is adjusted according to the ratio between the second character number and the first character number and a preset similarity adjustment parameter to obtain the new semantic similarity corresponding to the any target candidate question; the new semantic similarity is less than the semantic similarity.

[0019] In one of the embodiments, the similarity adjustment parameter is a constant with a corresponding numerical value greater than zero; and the adjusting the semantic similarity corresponding to the any target candidate question according to the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter to obtain a new semantic similarity corresponding to the any target candidate question comprises:

[0020] determining a sum of the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter;

[0021] determining a quotient between the semantic similarity corresponding to the any target candidate question and the sum to obtain the new semantic similarity corresponding to the any target candidate question; and the new semantic similarity is in a positive correlation with the first character quantity.

[0022] In one of the embodiments, the method further comprises:

[0023] matching the two words in the target synonym pair with the any target candidate question and the user question respectively;

[0024] when different words in the target synonym pair are respectively matched in the any target candidate question and the user question, determining that the target synonym pair exists in the user question and the any target candidate question;

[0025] when different words in the target synonym pair are not respectively matched in the any target candidate question and the user question, determining that the target synonym pair does not exist in the user question and the any target candidate question.

[0026] In one of the embodiments, the screening the target candidate question from the candidate questions comprises:

[0027] screening an incomplete match candidate question from the candidate questions; the incomplete match candidate question is a candidate question with a corresponding character string not completely equal to a corresponding character string of the user question;

[0028] screening a partial match candidate question from the incomplete match candidate questions; the partial match candidate question is an incomplete match candidate question with a same character between the user question and the partial match candidate question;

[0029] screening the target candidate question from the partial match candidate questions; the target candidate question is a partial match candidate question with a length of a longest common substring between the user question and the target candidate question being one.

[0030] In one of the embodiments, the filtering out of the target question sentence matching the user question sentence from the candidate question sentences according to the new semantic similarity corresponding to each of the target candidate question sentences comprises:

[0031] According to the new semantic similarity corresponding to each of the target candidate question sentences and the semantic similarity corresponding to each of the remaining candidate question sentences in each of the candidate question sentences, the candidate question sentence corresponding to the maximum semantic similarity is filtered out from the candidate question sentences as a candidate question sentence to be compared; each of the remaining candidate question sentences is a candidate question sentence other than each of the target candidate question sentences in each of the candidate question sentences.

[0032] In a case where the semantic similarity corresponding to the candidate question sentence to be compared is greater than a preset similarity threshold, the candidate question sentence to be compared is taken as the target question sentence.

[0033] In a second aspect, the present application further provides a question and answer matching device. The device comprises:

[0034] The obtaining module is configured to obtain a user question sentence and a plurality of candidate question sentences corresponding to the user question sentence; literal matching degrees between each of the candidate question sentences and the user question sentence satisfy a preset matching degree condition.

[0035] The first filtering module is configured to filter out target candidate question sentences from the candidate question sentences; the target candidate question sentences are candidate question sentences whose lengths of longest common substrings between the target candidate question sentences and the user question sentence satisfy a preset length condition.

[0036] The adjusting module is configured to, for any one of the target candidate question sentences, adjust a semantic similarity between the any one of the target candidate question sentences and the user question sentence based on a difference between semantics represented by a corresponding longest common substring in the any one of the target candidate question sentences and semantics represented in the user question sentence, to obtain a new semantic similarity corresponding to the any one of the target candidate question sentences.

[0037] The second filtering module is configured to filter out a target question sentence matching the user question sentence from the candidate question sentences according to the new semantic similarity corresponding to each of the target candidate question sentences; an answer corresponding to the target question sentence is an answer matching the user question sentence.

[0038] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0039] The user question sentence and the plurality of candidate question sentences corresponding to the user question sentence are obtained; literal matching degrees between each of the candidate question sentences and the user question sentence satisfy a preset matching degree condition.

[0040] selecting a target candidate question from the candidate questions; the target candidate question being a candidate question whose length of longest common substring with the user question meets a preset length condition;

[0041] For any target candidate question, adjusting semantic similarity between the target candidate question and the user question based on a difference between semantics represented by the corresponding longest common substring in the target candidate question and semantics represented by the user question, to obtain a new semantic similarity corresponding to the target candidate question;

[0042] selecting a target question matching the user question from the candidate questions according to the new semantic similarity corresponding to each target candidate question; an answer corresponding to the target question being an answer matching the user question.

[0043] In a fourth aspect, the present application also provides a computer readable storage medium. The computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the following steps:

[0044] obtaining a user question and a plurality of candidate questions corresponding to the user question; literal matching degrees between each candidate question and the user question meeting a preset matching degree condition;

[0045] selecting a target candidate question from the candidate questions; the target candidate question being a candidate question whose length of longest common substring with the user question meets a preset length condition;

[0046] For any target candidate question, adjusting semantic similarity between the target candidate question and the user question based on a difference between semantics represented by the corresponding longest common substring in the target candidate question and semantics represented by the user question, to obtain a new semantic similarity corresponding to the target candidate question;

[0047] selecting a target question matching the user question from the candidate questions according to the new semantic similarity corresponding to each target candidate question; an answer corresponding to the target question being an answer matching the user question.

[0048] In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program, and the computer program, when executed by a processor, implements the following steps:

[0049] obtaining a user question and a plurality of candidate questions corresponding to the user question; literal matching degrees between each candidate question and the user question meeting a preset matching degree condition;

[0050] select a target candidate question from the candidate questions, the target candidate question being a candidate question whose length of longest common substring with the user question meets a preset length condition;

[0051] For any target candidate question, based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented in the user question, the semantic similarity between the any target candidate question and the user question is adjusted to obtain a new semantic similarity corresponding to the any target candidate question;

[0052] According to the new semantic similarity corresponding to each target candidate question, a target question matching the user question is selected from the candidate questions, and the answer corresponding to the target question is an answer matching the user question.

[0053] The above question and answer matching method, device, computer equipment, storage medium and computer program product, by obtaining a user question and a plurality of candidate questions corresponding to the user question, wherein the literal matching degree between each candidate question and the user question meets a preset matching degree condition, then selecting a target candidate question from the candidate questions, wherein the target candidate question is a candidate question whose length of longest common substring with the user question meets a preset length condition, and for any target candidate question, based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented in the user question, the semantic similarity between the any target candidate question and the user question is adjusted to obtain a new semantic similarity corresponding to the any target candidate question, finally, according to the new semantic similarity corresponding to each target candidate question, a target question matching the user question is selected from the candidate questions, wherein the answer corresponding to the target question is an answer matching the user question.

[0054] Thus, after determining multiple candidate questions corresponding to the user's question through literal matching, the target candidate question is then selected from these. Since there is a longest common substring between the target candidate question and the user's question, there is character overlap. Due to the ambiguity of natural language, question matching faces the challenge of identical literal meanings but different semantics. The overlapping characters between the target candidate question and the user's question may represent different meanings, resulting in semantic dissimilarity between them. The difference between the semantics represented by the longest common substring in the target candidate question and the semantics represented in the user question helps to distinguish between the target candidate question and the user's question. Adjusting the semantic similarity between user questions can optimize the rationality of the semantic similarity corresponding to the target candidate questions, resulting in new semantic similarity for the target candidate questions. This allows for accurate selection of the target question that matches the user question from among the candidate questions based on the new semantic similarity, making the answer determined based on the target question more consistent with the user's intent. This addresses the problem in related technologies where high semantic similarity is given even when there is character overlap between the user question and candidate questions but their semantics are not similar, leading to inaccurate semantic judgment of the user question and an inability to accurately determine the answer that matches the user's intent. This effectively improves the accuracy of question-and-answer matching. Attached Figure Description

[0055] Figure 1 This is a flowchart illustrating a question-and-answer matching method in one embodiment;

[0056] Figure 2 This is a flowchart illustrating the steps of selecting the target candidate question from among the candidate questions in one embodiment.

[0057] Figure 3 This is a flowchart illustrating another question-and-answer matching method in one embodiment;

[0058] Figure 4 This is a flowchart illustrating a question-and-answer matching method in another embodiment;

[0059] Figure 5 This is a structural block diagram of a question-and-answer matching device in one embodiment;

[0060] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0062] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The implementation described in the following exemplary embodiments does not represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0063] In one embodiment, as shown in Figure 1 a question and answer matching method is provided, which can be understood to also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through interaction of the terminal and the server, for example, the system can be an automatic question and answer system. The server can be a stand-alone server or a server cluster composed of multiple servers. The present embodiment takes the method applied to a FAQ (Frequently Asked Questions) question and answer system as an example, and the method comprises the following steps:

[0064] Step S110, obtaining a user question and a plurality of candidate questions corresponding to the user question.

[0065] Among them, the literal matching degree between each candidate question and the user question meets a preset matching degree condition.

[0066] In a specific implementation, the user can input a question through the terminal, and the question input by the user on the terminal is taken as the user question. The terminal can obtain the user question in response to the user's question input operation, and send the user question to the server for the server to obtain the user question.

[0067] The server's question and answer database stores a large number of high-frequency standard questions and mapping relationships of standard answers frequently asked by users, and also stores different questions corresponding to each standard question, i.e. similar questions. When the user question matches the standard question or similar question in the question and answer database, the server can directly feed back the corresponding standard answer to the user.

[0068] Thus, when the server receives the user question, the server can perform rough screening through literal matching, and perform literal matching between the user question and a large number of standard questions in the question and answer database and similar questions corresponding to the standard questions, and screen out the standard questions or similar questions that satisfy a preset matching degree condition with the user question as the literal matching degree between the user question and the standard questions or similar questions, as a plurality of candidate questions corresponding to the user question. For example, the server can screen out the standard questions or similar questions that have a literal matching degree greater than a preset matching degree threshold with the user question as the candidate questions corresponding to the user question.

[0069] Then, the server calculates the semantic similarity matching score between the user question and each candidate question by using an FAQ (Frequently Asked Questions) question semantic matching fine screening method based on a deep model, to obtain the semantic similarity between the user question and each candidate question.

[0070] Step S120, screening a target candidate question from the candidate questions.

[0071] The target candidate question is a candidate question that satisfies a preset length condition with the length of the longest common substring between the user question.

[0072] In a specific implementation, the server can screen, from the candidate questions, a candidate question that satisfies a preset length condition with the length of the longest common substring between the user question, as the target candidate question.

[0073] Step S130, for any target candidate question, adjusting the semantic similarity between the target candidate question and the user question based on the difference between the semantics represented by the corresponding longest common substring in the target candidate question and the semantics represented in the user question, to obtain a new semantic similarity corresponding to the target candidate question.

[0074] In a specific implementation, for any target candidate question, the server can adjust the semantic similarity between the target candidate question and the user question based on the difference between the semantics represented by the longest common substring between the target candidate question and the user question and the semantics represented in the user question, to obtain a new semantic similarity corresponding to the target candidate question. In this way, the server can determine the new semantic similarity between the target candidate questions and the user question.

[0075] Step S140, screening a target question that matches the user question from the candidate questions according to the new semantic similarity corresponding to each target candidate question.

[0076] The answer corresponding to the target question is an answer that matches the user question.

[0077] In specific implementation, the server can screen out a target question sentence that is semantically matched with the user question sentence from the candidate question sentences according to the new semantic similarity of each target candidate question sentence, take the target question sentence as the target question sentence, and take the standard answer corresponding to the target question sentence as the answer matched with the user question sentence, and return the answer to the terminal for the user to view.

[0078] In the above question and answer matching method, the user question sentence and a plurality of candidate question sentences corresponding to the user question sentence are obtained, wherein the literal matching degree between each candidate question sentence and the user question sentence satisfies a preset matching degree condition; then, a target candidate question sentence is screened out from the candidate question sentences, wherein the target candidate question sentence is a candidate question sentence whose length of the longest common substring between the target candidate question sentence and the user question sentence satisfies a preset length condition; for any target candidate question sentence, the semantic similarity between the target candidate question sentence and the user question sentence is adjusted based on the difference between the semantics represented by the corresponding longest common substring in the target candidate question sentence and the semantics represented in the user question sentence, to obtain a new semantic similarity corresponding to the target candidate question sentence; finally, a target question sentence matched with the user question sentence is screened out from the candidate question sentences according to the new semantic similarity of each target candidate question sentence, wherein the answer corresponding to the target question sentence is the answer matched with the user question sentence.

[0079] In this way, after the plurality of candidate question sentences corresponding to the user question sentence are determined through the literal matching degree, the target candidate question sentence is screened out from the candidate question sentences. Since the target candidate question sentence and the user question sentence have the longest common substring therebetween, the target candidate question sentence and the user question sentence have character overlap. Since the natural language has ambiguity, the question sentence matching faces the difficulty that the semantics represented by the overlapping characters between the target candidate question sentence and the user question sentence can be different, which leads to the fact that the semantics of the target candidate question sentence and the user question sentence are not similar. The adjustment of the semantic similarity between the target candidate question sentence and the user question sentence based on the difference between the semantics represented by the longest common substring in the target candidate question sentence and the semantics represented in the user question sentence can optimize the rationality of the semantic similarity corresponding to the target candidate question sentence, to obtain the new semantic similarity corresponding to the target candidate question sentence. Therefore, the target question sentence matched with the user question sentence can be accurately screened out from the candidate question sentences according to the new semantic similarity of each target candidate question sentence, so that the answer determined according to the target question sentence is more consistent with the user question intention. The problem that in the related art, when the user question sentence and the candidate question sentence have character overlap but the semantics are not similar, a high semantic similarity is given, which leads to inaccurate semantic determination of the user question sentence and the inability to accurately determine the answer matched with the user question intention is solved. The accuracy of the question and answer matching is effectively improved.

[0080] In one embodiment, the length of the longest common substring is one; for any target candidate question, based on the difference between the semantics represented by the corresponding longest common substring in any target candidate question and the semantics represented in the user question, the semantic similarity between any target candidate question and the user question is adjusted to obtain the new semantic similarity corresponding to any target candidate question, including: taking the longest common string as the target same character between any target candidate question and the user question; querying the synonym database to obtain a target synonym pair in which both corresponding two words contain the target same character, as the target synonym pair; each synonym pair includes two semantically identical words; in the case where the target synonym pair does not exist in the user question and any target candidate question, it is determined that the semantics represented by the word in which the target same character is located in any target candidate question is different from the semantics represented by the word in which the target same character is located in the user question; in the case where the semantics corresponding to the target same character are different, the semantic similarity corresponding to any target candidate question is adjusted to obtain the new semantic similarity corresponding to any target candidate question.

[0081] In a specific implementation, the target candidate question is a longest common substring between the user question and the candidate question, and the length of the longest common substring is one, i.e., the target candidate question is a case where there is a single character overlap between the user question and the candidate question. Single character overlap refers to the same literal content between the user question and the candidate question being discontinuous single characters. For example, the longest common substring between the user question "graphical code" and the candidate question "two-dimensional code check-in" is "code", and there is one character overlap between them, so the length of the longest common substring is one, and therefore, the candidate question "two-dimensional code check-in" is the target candidate question corresponding to the user question "graphical code". For another example, the longest common substring between the user question "fitness card" and the candidate question "health card check" is "healthy" or "card", and there are two discontinuous single character overlaps between them, the longest common substring "healthy" or "card" each contains one character, so the length of the longest common substring is one, and therefore, the candidate question "health card check" is the target candidate question corresponding to the user question "fitness card".

[0082] In this way, in the process of adjusting the semantic similarity between the any target candidate question and the user question based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented by the user question for the any target candidate question, the server can take the longest common substring between the any target candidate question and the user question as the target same character between the any target candidate question and the user question, and the server can query the synonym database to obtain the synonym pair corresponding to the target same character as the target synonym pair corresponding to the target same character; each synonym pair includes two words with the same semantics.

[0083] Specifically, the synonym database includes a synonym list, the synonym list is obtained by collecting and sorting according to common sense knowledge in advance, the synonym list includes a large number of synonym pairs, each synonym pair includes two words with the same semantics, and the format of the synonym list is, for example, [(food supplement, meal supplement), …, (house, house)]. For the target same character, the server can query the synonym database to obtain the synonym pair corresponding to the target same character as the target synonym pair corresponding to the target same character. For example, the target same character is “healthy”, and the two words in the synonym pair “healthy, healthy exercise” in the synonym database both include the target same character “healthy”. Therefore, the synonym pair “healthy, healthy exercise” is the target synonym pair corresponding to the target same character “healthy”.

[0084] Then, in the case where the target synonym pair corresponding to the target same character does not exist in the user question and the any target candidate question, the server can determine that the semantics represented by the word in which the target same character is located in the any target candidate question is different from the semantics represented by the word in which the target same character is located in the user question, that is, they are not synonyms. Therefore, the server can adjust the semantic similarity corresponding to the any target candidate question in the case where the semantics corresponding to the target same character are different, to obtain the new semantic similarity corresponding to the any target candidate question. In the case where the target synonym pair corresponding to the target same character exists in the user question and the any target candidate question, that is, the semantics corresponding to the target same character are the same, the server does not need to adjust the semantic similarity corresponding to the any target candidate question, and the new semantic similarity corresponding to the any target candidate question is equal to the original semantic similarity.

[0085] Specifically, after determining the target synonym pair corresponding to the target same character, the server can match the two words in the target synonym pair with the any target candidate question and the user question respectively; when different words in the target synonym pair are matched in the any target candidate question and the user question respectively, it is determined that the target synonym pair exists in the user question and the any target candidate question; when different words in the target synonym pair are not matched in the any target candidate question and the user question respectively, it is determined that the target synonym pair does not exist in the user question and the any target candidate question. In this way, by matching the two words in the target synonym pair with the any target candidate question and the user question respectively, and determining whether different words in the target synonym pair are matched in the any target candidate question and the user question respectively, it can be accurately determined whether the target synonym pair corresponding to the target same character exists in the user question and the any target candidate question.

[0086] For example, continuing the above example, the user question is "fitness card", the any target candidate question is "health card check", and the target synonym pair corresponding to the target same character "health" is "(fitness, health exercise)"; the server can match the two words "fitness" and "health exercise" in the target synonym pair with "health card check" and "fitness card" respectively. Since "fitness" and "health exercise" do not belong to "fitness card" and "health card check" respectively, i.e., different words in the target synonym pair "(fitness, health exercise)" are not matched in the user question "fitness card" and the any target candidate question "health card check" respectively, the user question "fitness card" and the any target candidate question "health card check" do not have the target synonym pair "(fitness, health exercise)", i.e., the semantics represented by the word in which the target same character "health" is located in the any target candidate question "health card check" is different from the semantics represented by the word in which the target same character "health" is located in the user question "fitness card", and they are not synonymous.

[0087] In addition, when there are at least two longest common strings, i.e., there are at least two target same characters between the any target candidate question and the user question, and the target synonym pair corresponding to each target same character exists in the user question and the any target candidate question, the server does not need to adjust the semantic similarity corresponding to the any target candidate question, and the new semantic similarity corresponding to the any target candidate question is equal to the original semantic similarity.

[0088] The technical scheme of the embodiment, when the longest common substring between the user question and the target candidate question is one, that is, there is single character overlap between the user question and the target candidate question, by judging whether the target same character corresponds to the target synonym binary tuple in the user question and the target candidate question, whether the semantics represented by the word where the target same character is located in the target candidate question is the same as the semantics represented by the word where the target same character is located in the user question is judged, so that the semantic similarity between any target candidate question and the user question is adjusted in the case of different semantics, the problem that the user question and the candidate question have single character overlap but the semantics are not similar, but a higher semantic similarity is given, causing inaccurate user question semantic judgment and reducing the accuracy of question and answer matching is solved; the rationality of the semantic similarity corresponding to the target candidate question is effectively optimized, the accuracy of the user question semantic judgment is improved, and the accuracy of the question and answer matching is further improved.

[0089] In one embodiment, in the case that the semantics corresponding to the target same character are different, the semantic similarity corresponding to any target candidate question is adjusted to obtain a new semantic similarity corresponding to any target candidate question, including: determining the number of target same characters between any target candidate question and the user question corresponding to different semantics as a first character number, and determining the number of characters in the user question as a second character number; according to the ratio between the second character number and the first character number and a preset similarity adjustment parameter, the semantic similarity corresponding to any target candidate question is adjusted to obtain a new semantic similarity corresponding to any target candidate question; the new semantic similarity is less than the semantic similarity.

[0090] Among them, the similarity adjustment parameter is a constant with a corresponding value greater than zero.

[0091] In a specific implementation, in the process of adjusting the semantic similarity corresponding to any target candidate question to obtain a new semantic similarity corresponding to any target candidate question in the case that the semantics corresponding to the target same character are different, the server can determine the number of target same characters between the target candidate question and the user question corresponding to different semantics as a first character number, and determine the number of characters in the user question as a second character number, and then the server can adjust the semantic similarity corresponding to the target candidate question according to the ratio between the second character number and the first character number and a preset similarity adjustment parameter, to obtain the new semantic similarity corresponding to the target candidate question.

[0092] Specifically, the similarity adjustment parameter is a constant with a corresponding value greater than zero; in the process of adjusting the semantic similarity corresponding to the any target candidate question according to the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter to obtain the new semantic similarity corresponding to the any target candidate question, the server can determine the sum of the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter; determine the quotient between the semantic similarity corresponding to the any target candidate question and the sum to obtain the new semantic similarity corresponding to the any target candidate question; wherein the new semantic similarity is in a direct proportional relationship with the first character quantity.

[0093] The technical scheme of the embodiment determines the number of target same characters with different semantics between any target candidate question and the user question as the first character quantity, and determines the number of characters in the user question as the second character quantity; adjusts the semantic similarity corresponding to any target candidate question according to the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter to obtain the new semantic similarity corresponding to any target candidate question; the new semantic similarity is less than the semantic similarity; wherein the similarity adjustment parameter is a constant with a corresponding value greater than zero, and specifically, the sum of the ratio between the second character quantity and the first character quantity and the preset similarity adjustment parameter can be determined; the quotient between the semantic similarity corresponding to any target candidate question and the sum is determined to obtain the new semantic similarity corresponding to any target candidate question; the new semantic similarity is in a direct proportional relationship with the first character quantity. In this way, the new semantic similarity corresponding to the target candidate question is determined by the method, so that in the case that the target same characters between the user question and the target candidate question correspond to different semantics, the new semantic similarity corresponding to the target candidate question is less than the original semantic similarity, and in the case that there is single character overlap between the user question and the target candidate question but the semantics are not approximate, the rationality of the semantic similarity between the target candidate question and the user question is optimized, and the accuracy of the semantic determination of the user question can be improved in the case that the user question and the target candidate question have single character overlap.

[0094] In one embodiment, as shown in FIG. 1, Figure 2 Step S120, screening target candidate questions from the candidate questions, including:

[0095] Step S210, screening the incomplete match candidate question from the candidate questions; the incomplete match candidate question is a candidate question with a corresponding character string that is not completely equal to the corresponding character string of the user question.

[0096] In specific implementation, in the process in which the server screens out the target candidate question from the candidate questions, the server can first screen out, from the candidate questions, candidate questions in which the corresponding string is not completely equal to the string corresponding to the user question, as the not completely matched candidate questions.

[0097] In step S220, from the not completely matched candidate questions, a partially matched candidate question is screened out; the partially matched candidate question is a not completely matched candidate question in which there are same characters between the user question and the partially matched candidate question.

[0098] In specific implementation, the server can screen out, from the not completely matched candidate questions, a not completely matched candidate question in which there are same characters between the user question and the partially matched candidate question, as the partially matched candidate question.

[0099] In step S230, from the partially matched candidate questions, a target candidate question is screened out; the target candidate question is a partially matched candidate question in which the length of the longest common substring between the user question and the partially matched candidate question is one.

[0100] In specific implementation, the server can screen out, from the partially matched candidate questions, a partially matched candidate question in which the length of the longest common substring between the user question and the partially matched candidate question is one, as the target candidate question.

[0101] In this way, the server can screen out, from the candidate questions, a target candidate question in which there is single character overlap between the user question and the target candidate question, adjust the semantic similarity between the target candidate question and the user question based on the difference between the semantics represented by the longest common substring in the target candidate question and the semantics represented by the user question, and obtain a new semantic similarity corresponding to the target candidate question.

[0102] The technical scheme of the embodiment screens out not completely matched candidate questions from the candidate questions; the not completely matched candidate questions are candidate questions in which the corresponding string is not completely equal to the string corresponding to the user question; screens out, from the not completely matched candidate questions, a partially matched candidate question; the partially matched candidate question is a not completely matched candidate question in which there are same characters between the user question and the partially matched candidate question; screens out, from the partially matched candidate questions, a target candidate question; the target candidate question is a partially matched candidate question in which the length of the longest common substring between the user question and the partially matched candidate question is one; in this way, a candidate question in which there is single character overlap between the user question and the candidate question can be accurately screened out from the multiple candidate questions corresponding to the user question, as the target candidate question, so as to adjust the semantic similarity corresponding to the target candidate question in the case where there is single character overlap between the user question and the target candidate question but the semantics are not similar.

[0103] In an embodiment, the target question sentence matched with the user question sentence is screened from the candidate question sentences according to the new semantic similarity corresponding to each target candidate question sentence, including: screening, from the candidate question sentences, a candidate question sentence corresponding to the maximum semantic similarity as a comparison candidate question sentence according to the new semantic similarity corresponding to each target candidate question sentence and the semantic similarity corresponding to each remaining candidate question sentence in the candidate question sentences; the remaining candidate question sentences are the candidate question sentences other than the target candidate question sentences in the candidate question sentences; and the comparison candidate question sentence is taken as the target question sentence in a case where the semantic similarity corresponding to the comparison candidate question sentence is greater than a preset similarity threshold.

[0104] In a specific implementation, in the process of screening, from the candidate question sentences, the target question sentence matched with the user question sentence according to the new semantic similarity corresponding to each target candidate question sentence, the server can screen, from the candidate question sentences, a candidate question sentence corresponding to the maximum semantic similarity as a comparison candidate question sentence according to the new semantic similarity corresponding to each target candidate question sentence and the semantic similarity corresponding to each remaining candidate question sentence in the candidate question sentences other than the target candidate question sentences; and compare the comparison candidate question sentence with the preset similarity threshold, and take the comparison candidate question sentence as the target question sentence in a case where the semantic similarity corresponding to the comparison candidate question sentence is greater than the preset similarity threshold.

[0105] The technical solution of the embodiment can improve the matching degree between the target question sentence and the user question sentence by screening, from the candidate question sentences corresponding to the user question sentence, a comparison candidate question sentence corresponding to the maximum semantic similarity and taking the comparison candidate question sentence as the target question sentence matched with the user question sentence in a case where the semantic similarity corresponding to the comparison candidate question sentence is greater than a preset similarity threshold, so that the answer corresponding to the returned target question sentence meets the user question intention and the question and answer matching accuracy is further improved.

[0106] In an embodiment, another question and answer matching method is improved, and the method is applied to the FAQ question and answer system including the terminal and the server to illustrate, as shown in FIG. 1. Figure 3 As shown in FIG. 1, the method includes the following steps.

[0107] In step S310, a FAQ (Frequently Asked Questions) question sentence semantic matching and screening method based on a deep model is used to calculate the semantic similarity matching score of the user question sentence and each candidate question sentence, and the semantic similarity between the user question sentence and each candidate question sentence is obtained.

[0108] Specifically, the server can obtain the text q u of 1 user question sentence and the text q ia trained semantic similarity calculation model. Wherein, the user question may be, for example, "I want to open the health card" or "gym card" and the like, and the candidate question may be, for example, "How to open the electronic health card", "health card check". The trained semantic similarity calculation model is used to calculate the semantic similarity matching score by the existing deep model-based FAQ question semantic matching fine ranking method, for example, the method can be a pre-trained double-encoder-based question semantic matching fine ranking method, and the semantic similarity calculation model (referred to as model M D ) is composed of a user question encoding module, a candidate question encoding module, and an encoding matching module.

[0109] Then, the server can output the semantic similarity matching score S of 1 user question and N candidate questions. Specifically, the server can calculate the vector encoding E D corresponding to the user question text q u , and calculate the vector encoding E u corresponding to each candidate question text q i (1<=i<=N) through the model M c (q i ), E u is a 1*h-dimensional real number vector, E c is a N*h-dimensional real number vector, and then the semantic similarity matching score is calculated by using E u and E c and stored in S, S is a 1*N-dimensional real number vector, and S i is the matching score of q u and q i (1<=i<=N). Wherein, the specific process is as follows:

[0110] Step one: input the text q u of the user question into the user question encoding module of the model M D for vector encoding to obtain the vector encoding representation of the entire user question as the vector encoding E u corresponding to the user question.

[0111] For example, the user question encoding module of the model M D uses the Bert (Bidirectional Encoder Representation from Transformers, bidirectional encoding representation from Transformers) model to perform user question vector encoding, and the process is as follows:

[0112] 1) concatenate the user question into a string: "[CLS] user question text [SEP]";

[0113] 2) input the above string into the Bert model for vector encoding, and take the output encoding at the [CLS] position as the vector encoding corresponding to the user question, with a dimension of h, h is usually 768 or 1024;

[0114] For example, the text of the user question "I want to open the health card" is spliced into the string "[CLS] I want to open the health card [SEP]", which is input into the Bert model for vector encoding, and the output encoding at the [CLS] position is taken as the vector encoding E corresponding to the user question. u .

[0115] Step two: input the text q i of each candidate question into the candidate question encoding module of the model M D for vector encoding to obtain the vector encoding representation of each candidate question, as the vector encoding corresponding to each candidate question, and store it in E c .

[0116] For example, the process of the candidate question encoding module of the model M D using the Bert model for candidate question vector encoding is as follows:

[0117] 1) splice the text of each candidate question into a string respectively: "[CLS] text of the candidate question [SEP]", where [CLS] represents the start symbol of the string, and [SEP] represents the end symbol of the string;

[0118] 2) input the string into the Bert model for vector encoding, and take the output encoding at the [CLS] position as the vector encoding corresponding to the candidate question, with a dimension of h, h is usually 768 or 1024;

[0119] Based on the above step two, the text of the candidate question "how to open the electronic health card" and "health card check" are spliced into strings according to the above step two 1) and output h-dimensional vector encoding according to the above step two 2), and saved in E c .

[0120] Step three: input the vector encoding E u corresponding to the user question and the vector encoding E c corresponding to the candidate question into the encoding matching module of the model M D for encoding matching to obtain the semantic similarity matching score of the vector encoding corresponding to the user question and the vector encoding corresponding to each candidate question, and store it in S, where S i is the semantic similarity matching score of q u and q i (1 <= i <= N).

[0121] For example, calculating the vector code E corresponding to the user's question. u Vector encoding E corresponding to candidate questions c The inner product of the transposes of the vectors yields a 1*N dimensional real vector. Softmax (normalized exponential function) is then calculated on the N dimensions to normalize the vectors and obtain the semantic similarity probability distribution of the N candidate questions. This distribution serves as the semantic similarity matching score and is stored in S, where S... i For q u With q i The semantic similarity matching score (1 <= i <= N).

[0122] Thus, by matching the semantic similarity scores between the vector encoding corresponding to the user's question and the vector encoding corresponding to each candidate question, the semantic similarity between the user's question and each candidate question can be determined.

[0123] Step S320: For cases where there is single-character overlap between the user's question and the candidate question, adjust the semantic similarity matching score based on the longest common substring matching and synonym matching.

[0124] Specifically, the server can determine the type of query based on the text q of a user's question. u The text q of N candidate questions i The list of (1<=i<=N), the synonym list, and the semantic similarity matching score S between one user question and N candidate questions output in step S310, where S is a 1*N dimensional real vector, S i For q u With q i The semantic similarity matching score (1 <= i <= N) is used to output the adjusted semantic similarity matching score S between one user question and N candidate questions. r S is a 1*N dimensional real vector. ri For q u With q i The adjusted semantic similarity matching score (1 <= i <= N).

[0125] The adjustment process includes: for each candidate question, the text q i (1<=i<=N),

[0126] 1) If q u With q i If it's not a complete match, proceed to step 2); otherwise, q... u With q i A perfect match, without adjusting the semantic similarity score, allows S to... ri =S i End of targeting q i The processing;

[0127] Specifically, qu with q i whether completely match, through q u with q i corresponding string whether completely equal judgment.

[0128] 2) if q u with q i there are the same characters, then to 3) execution, otherwise q u with q i no same character, no need to adjust, let S ri =S i , end of processing for q i ;

[0129] Specifically, in the process of judging whether q u with q i there are the same characters, the server can first take out the set of all de-duplicated characters corresponding to q u with q i respectively, and then perform set intersection, let the number of elements contained in the intersection set be L, if L>0, then q u with q i there are the same characters. For example, the user question "fitness card" and the candidate question "health card check" have the same characters, and the user question "trip acquisition" and the candidate question "health card check" have no same characters.

[0130] 3) if the length of the longest common substring between q u with q i is 1, that is, it belongs to single character overlap, and if the word where the longest common substring is located in q u and the word where the longest common substring is located in q i are not synonymous, then adjust the semantic similarity matching score S u of q i with q i to S ri , otherwise no need to adjust, let S ri =S i , end of processing for q i ; wherein the candidate question with the length of the longest common substring between the user question and the candidate question being one is the target candidate question, and the candidate questions other than the target candidate question are the remaining candidate questions;

[0131] Specifically, the length of the longest common substring of q u with q i is calculated, first, the longest common substring of q u with q i is solved by using existing enumeration or dynamic programming algorithm, and then the number of characters contained in the longest common substring is solved.

[0132] wherein, whether the word where the longest common sub-string is located in q u and the word where the longest common sub-string is located in q i is a synonym of each other can refer to the specific implementation in the above embodiment, and will not be repeated here.

[0133] wherein, the semantic similarity matching score S u of q i and q i is S ri , and the process of adjusting S ri = S i / (len(q u ) / L ci +A), wherein len(q u ) is the number of all characters (the second character number) contained in the text q u of the user question, L ci is the number of characters (the first character number) that are the same as q u and q i , and the words where the characters are located are not synonyms of each other, and A>0 is a preset similarity adjustment parameter. The effect achieved by the formula is that the adjusted semantic similarity matching score S ri is absolutely less than the semantic similarity matching score S i , and the fewer the first character number between q u and q i , the smaller the adjusted semantic similarity matching score S ri , and A is used to adjust S ri to a specific value range, and the specific value is determined by experiments in specific scenarios.

[0134] In this way, through the adjusted semantic similarity matching score S ri of each candidate question corresponding to the user question, the new semantic similarity between each target candidate question and the user question, and the semantic similarity between each remaining candidate question and the user question can be determined.

[0135] Step S330, semantic similarity matching score sorting, user question semantic determination.

[0136] Specifically, the server can output the adjusted semantic similarity matching score S r of one user question and N candidate questions according to step S320, which is a 1*N-dimensional real number vector, S ri is the adjusted semantic similarity matching score of q u and q i (1<=i<=N), and the output is: the user question and the target question matched.

[0137] wherein the calculating process comprises: calculating the semantic similarity between the user question and each candidate question in the candidate questions according to the semantic similarity adjusting parameter and the ratio between the second character quantity and the first character quantity corresponding to the candidate question. r The candidate question with the highest score is selected as the candidate question to be compared. If the semantic similarity matching score of the candidate question to be compared is greater than the preset similarity threshold value Theta, the candidate question to be compared is returned to the terminal as the target question matched with the user question. Otherwise, an empty value is returned.

[0138] In another embodiment, as shown in FIG. 4B, a question and answer matching method is provided. The method is applied to the FAQ question and answer system including the terminal and the server described above for illustration, and includes the following steps: Figure 4

[0139] Step S402: obtaining a user question and a plurality of candidate questions corresponding to the user question.

[0140] Step S404: screening a target candidate question from the candidate questions.

[0141] Step S406: taking the longest common string between any target candidate question and the user question as the target same character between the target candidate question and the user question.

[0142] Step S408: querying a target synonym pair in which the target same character exists in both words in the synonym database as the target synonym pair.

[0143] Step S410: in the case where the target synonym pair does not exist in the user question and any target candidate question, determining that the semantics represented by the word in which the target same character exists in any target candidate question is different from the semantics represented by the word in which the target same character exists in the user question.

[0144] Step S412: in the case where the semantics corresponding to the target same character are different, determining the number of target same characters corresponding to the different semantics between any target candidate question and the user question as the first character quantity, and determining the number of characters in the user question as the second character quantity.

[0145] Step S414: adjusting the semantic similarity corresponding to any target candidate question according to the ratio between the second character quantity and the first character quantity and the preset similarity adjusting parameter, to obtain the new semantic similarity corresponding to any target candidate question.

[0146] Step S416: screening a target question matched with the user question from the candidate questions according to the new semantic similarity corresponding to each target candidate question.

[0147] ​It should be noted that the specific definitions of the above steps can refer to the specific definitions of the question and answer matching method described above.

[0148] It should be understood that, although the steps in the flowcharts involved in the embodiments described above are displayed in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowcharts involved in the embodiments described above can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.

[0149] Based on the same inventive concept, the embodiments of the present application also provide a question and answer matching device for implementing the above-mentioned question and answer matching method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific definitions in one or more question and answer matching device embodiments provided below can refer to the definitions of a question and answer matching method described above, and will not be repeated here.

[0150] In one embodiment, as shown in Figure 5 a question and answer matching device is provided, comprising: an acquisition module 510, a first screening module 520, an adjustment module 530 and a second screening module 540, wherein:

[0151] The acquisition module 510 is configured to acquire a user question and a plurality of candidate questions corresponding to the user question. The literal matching degree between each of the candidate questions and the user question satisfies a preset matching degree condition.

[0152] The first screening module 520 is configured to screen target candidate questions from the candidate questions. The target candidate question is a candidate question whose length of the longest common substring between the user question and the target candidate question satisfies a preset length condition.

[0153] The adjustment module 530 is configured to, for any target candidate question, adjust the semantic similarity between the any target candidate question and the user question based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented in the user question, to obtain a new semantic similarity corresponding to the any target candidate question.

[0154] The second screening module 540 is configured to screen a target question from the candidate questions according to the new semantic similarity corresponding to each target candidate question, and the answer corresponding to the target question is the answer matched with the user question.

[0155] In one of the embodiments, the length of the longest common substring is one, and the adjusting module 530 is specifically configured to take the longest common substring as a target same character between the target candidate question and the user question, query a target synonym pair in which both of the two words corresponding to the target synonym pair exist in the target same character from a synonym database, and take the target synonym pair as the target synonym pair. Each of the target synonym pairs includes two words with the same semantic meaning. In a case where the target synonym pair does not exist in the user question and the target candidate question, it is determined that the semantic meaning represented by the word in which the target same character is located in the target candidate question is different from the semantic meaning represented by the word in which the target same character is located in the user question. In a case where the semantic meaning corresponding to the target same character is different, the semantic similarity corresponding to the target candidate question is adjusted to obtain a new semantic similarity corresponding to the target candidate question.

[0156] In one of the embodiments, the adjusting module 530 is specifically configured to determine the number of target same characters corresponding to the different semantic meanings between the target candidate question and the user question as a first character number, and determine the number of characters in the user question as a second character number. The semantic similarity corresponding to the target candidate question is adjusted according to the ratio between the second character number and the first character number and a preset similarity adjustment parameter to obtain a new semantic similarity corresponding to the target candidate question. The new semantic similarity is less than the semantic similarity.

[0157] In one of the embodiments, the similarity adjustment parameter is a constant with a value greater than zero, and the adjusting module 530 is specifically configured to determine the sum of the ratio between the second character number and the first character number and the preset similarity adjustment parameter, and determine the quotient between the semantic similarity corresponding to the target candidate question and the sum to obtain the new semantic similarity corresponding to the target candidate question. The new semantic similarity is in a positive correlation with the first character number.

[0158] In one of the embodiments, the apparatus further comprises a matching module, configured to match the two words in the target synonym pair to the any target candidate question and the user question respectively; and a judging module, configured to judge that the target synonym pair exists in the user question and the any target candidate question when different words in the target synonym pair are matched in the any target candidate question and the user question respectively; and judge that the target synonym pair does not exist in the user question and the any target candidate question when the same words in the target synonym pair are matched in the any target candidate question and the user question respectively.

[0159] In one of the embodiments, the first screening module 520 is specifically configured to screen out an incomplete match candidate question from each of the candidate questions; the incomplete match candidate question is a candidate question corresponding to a string which is not equal to a string corresponding to the user question; screen out a partial match candidate question from each of the incomplete match candidate questions; the partial match candidate question is an incomplete match candidate question having the same character as the user question; and screen out the target candidate question from each of the partial match candidate questions; the target candidate question is a partial match candidate question having a longest common substring with the user question and having a length of one.

[0160] In one of the embodiments, the second screening module 540 is specifically configured to screen out, from each of the candidate questions, a candidate question corresponding to a maximum semantic similarity as a comparison candidate question according to the new semantic similarity corresponding to each of the target candidate questions and the semantic similarity corresponding to each of the remaining candidate questions in each of the candidate questions; the remaining candidate question is a candidate question other than the target candidate question in each of the candidate questions; and take the comparison candidate question as the target question when the semantic similarity corresponding to the comparison candidate question is greater than a preset similarity threshold.

[0161] Each of the above modules in the question and answer matching apparatus can be realized by software, hardware and a combination thereof in whole or in part. Each of the above modules can be embedded in or independent of a processor in a computer device in a hardware form, or can be stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform operations corresponding to each of the above modules.

[0162] In one of the embodiments, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 1. Figure 6As shown in the figure. The computer device includes a processor, a memory, an input / output interface (I / O for short) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store standard questions, similar questions, standard answers and synonym list data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with the terminal outside through the network connection. The computer program is executed by the processor to realize a question and answer matching method.

[0163] Those skilled in the art can understand that, Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0164] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to realize the steps in each of the above method embodiments.

[0165] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by the processor to realize the steps in each of the above method embodiments.

[0166] In one embodiment, a computer program product is provided, including a computer program, and the computer program is executed by the processor to realize the steps in each of the above method embodiments.

[0167] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0168] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0169] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0170] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A question-and-answer matching method, characterized in that, The method comprises: acquiring a user question and a plurality of candidate questions corresponding to the user question; literal matching degrees between each of the candidate questions and the user question satisfy a preset matching degree condition; selecting target candidate questions from the candidate questions; the target candidate questions are candidate questions whose lengths of longest common substrings with the user question satisfy a preset length condition; for any target candidate question, based on a difference between semantics represented by a corresponding longest common substring in the target candidate question and semantics represented in the user question, adjusting a semantic similarity between the target candidate question and the user question to obtain a new semantic similarity corresponding to the target candidate question, comprising: taking the longest common substring as a target same character between the target candidate question and the user question; in a case where semantics corresponding to the target same character are different, adjusting the semantic similarity corresponding to the target candidate question to obtain the new semantic similarity corresponding to the target candidate question; wherein, in the case where semantics corresponding to the target same character are different, adjusting the semantic similarity corresponding to the target candidate question to obtain the new semantic similarity corresponding to the target candidate question comprises: determining a number of target same characters corresponding to different semantics between the target candidate question and the user question as a first character number, and determining a number of characters in the user question as a second character number; adjusting the semantic similarity corresponding to the target candidate question according to a ratio between the second character number and the first character number and a preset similarity adjustment parameter to obtain the new semantic similarity corresponding to the target candidate question; the new semantic similarity is less than the semantic similarity; wherein, the similarity adjustment parameter is a constant with a corresponding numerical value greater than zero; adjusting the semantic similarity corresponding to the target candidate question according to the ratio between the second character number and the first character number and the preset similarity adjustment parameter to obtain the new semantic similarity corresponding to the target candidate question comprises: determining a sum of the ratio between the second character number and the first character number and the preset similarity adjustment parameter; determining a quotient between the semantic similarity corresponding to the target candidate question and the sum to obtain the new semantic similarity corresponding to the target candidate question; the new semantic similarity is in a direct proportional relationship with the first character number; selecting a target question matching the user question from the candidate questions according to the new semantic similarity corresponding to each of the target candidate questions; an answer corresponding to the target question is an answer matching the user question.

2. The method of claim 1, wherein, The length of the longest common substring is one; the adjustment of the semantic similarity between the any target candidate question and the user question based on the difference between the semantics represented by the corresponding longest common substring in the any target candidate question and the semantics represented in the user question, to obtain the new semantic similarity corresponding to the any target candidate question, comprises: In the synonym database, query the synonym pair with the target same character existing in both corresponding two words as a target synonym pair; each target synonym pair comprises two words with the same semantics; In the case that the target synonym pair does not exist in the user question and the any target candidate question, determine that the semantics represented by the word in which the target same character is located in the any target candidate question is different from the semantics represented by the word in which the target same character is located in the user question.

3. The method of claim 2, wherein, The method further comprises: Match the two words in the target synonym pair with the any target candidate question and the user question respectively; In the case that different words in the target synonym pair are matched in the any target candidate question and the user question respectively, determine that the target synonym pair exists in the user question and the any target candidate question; In the case that different words in the target synonym pair are not matched in the any target candidate question and the user question respectively, determine that the target synonym pair does not exist in the user question and the any target candidate question.

4. The method of claim 1, wherein, The screening of the target candidate question from each candidate question comprises: Screen an incomplete match candidate question from each candidate question; the incomplete match candidate question is a candidate question with an incomplete match between the corresponding string and the corresponding string of the user question; Screen a partial match candidate question from each incomplete match candidate question; the partial match candidate question is an incomplete match candidate question with the same character between the user question and the partial match candidate question; Screen the target candidate question from each partial match candidate question; the target candidate question is a partial match candidate question with the length of the longest common substring between the user question and the target candidate question being one.

5. The method of claim 1, wherein, The screening of the target question matching the user question from each candidate question according to the new semantic similarity corresponding to each target candidate question comprises: Screen a candidate question with the largest corresponding semantic similarity from each candidate question as a candidate question to be compared according to the new semantic similarity corresponding to each target candidate question and the semantic similarity corresponding to each remaining candidate question in each candidate question; each remaining candidate question is a candidate question other than each target candidate question in each candidate question; In the case that the semantic similarity corresponding to the candidate question to be compared is greater than a preset similarity threshold, the candidate question to be compared is taken as the target question.

6. A question and answer matching apparatus characterized by comprising: The device comprises: The acquisition module is configured to acquire a user question and a plurality of candidate questions corresponding to the user question, wherein a literal matching degree between each of the candidate questions and the user question satisfies a preset matching degree condition; The first screening module is configured to screen a target candidate question from the plurality of candidate questions, wherein the target candidate question is a candidate question whose length of a longest common substring between the target candidate question and the user question satisfies a preset length condition; The adjustment module is configured to, for any target candidate question, adjust a semantic similarity between the target candidate question and the user question based on a difference between semantics represented by a corresponding longest common substring in the target candidate question and semantics represented in the user question, to obtain a new semantic similarity corresponding to the target candidate question. The adjustment module is specifically configured to: take the longest common substring as a target same character between the target candidate question and the user question; and adjust the semantic similarity corresponding to the target candidate question to obtain a new semantic similarity corresponding to the target candidate question in a case where semantics corresponding to the target same character are different. The adjustment module is specifically configured to: determine a number of target same characters between the target candidate question and the user question, which correspond to different semantics, as a first character number, and determine a number of characters in the user question as a second character number; and adjust the semantic similarity corresponding to the target candidate question according to a ratio between the second character number and the first character number and a preset similarity adjustment parameter, to obtain a new semantic similarity corresponding to the target candidate question, wherein the new semantic similarity is less than the semantic similarity. The similarity adjustment parameter is a constant with a value greater than zero. The adjustment module is specifically configured to: determine a sum of the ratio between the second character number and the first character number and the preset similarity adjustment parameter; determine a quotient between the semantic similarity corresponding to the target candidate question and the sum, to obtain the new semantic similarity corresponding to the target candidate question, wherein the new semantic similarity is in a positive correlation with the first character number. The second screening module is configured to screen a target question matching the user question from the plurality of candidate questions according to the new semantic similarity corresponding to each of the target candidate questions, wherein an answer corresponding to the target question is an answer matching the user question. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 5.

9. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Text semantic matching method and device, equipment and storage medium

    CN115292468A

  • Word meaning relationship extraction device

    US20150227505A1