Search

CN-114510561-B - Answer selection method, device, equipment and storage medium

CN114510561BCN 114510561 BCN114510561 BCN 114510561BCN-114510561-B

Abstract

The application discloses an answer selection method, device, equipment and storage medium, for each candidate answer, the scheme provided by the application can be based on the similarity of the candidate answer and other candidate answers, and obtaining intermediate semantic vectors of the candidate answers, and splicing the intermediate semantic vectors with the initial semantic vectors to obtain updated semantic vectors of the candidate answers. Because the updated semantic vector not only contains the information of the candidate answer but also contains the supporting evidence information of other candidate answers, the accuracy of the target answer determined from the plurality of candidate answers can be ensured to be higher based on the updated semantic vector of the plurality of candidate answers.

Inventors

  • XIE RUNQUAN
  • ZHANG HENG
  • SHAO JICHUN

Assignees

  • 腾讯科技(深圳)有限公司

Dates

Publication Date
20260505
Application Date
20220217

Claims (17)

  1. 1. An answer selection method, the method comprising: Encoding each candidate answer in the plurality of candidate answers of the target question to obtain an initial semantic vector of each candidate answer; For each candidate answer in the plurality of candidate answers, weighting the initial semantic vector of each other candidate answer based on the similarity of the candidate answer and each other candidate answer to obtain an intermediate semantic vector of the candidate answer, wherein the intermediate semantic vector of the candidate answer is the supporting evidence information of each other candidate answer on the candidate answer; For each candidate answer in the plurality of candidate answers, splicing the initial semantic vector of the candidate answer with the intermediate semantic vector to obtain an updated semantic vector of the candidate answer; and determining a target answer from the plurality of candidate answers based on the updated semantic vectors of the plurality of candidate answers.
  2. 2. The method of claim 1, wherein for each candidate answer of the plurality of candidate answers, stitching the initial semantic vector of the candidate answer with the intermediate semantic vector to obtain an updated semantic vector of the candidate answer, comprising: for each candidate answer in the plurality of candidate answers, splicing an initial semantic vector of the candidate answer, a middle semantic vector of the candidate answer and a product vector of the candidate answer to obtain an updated semantic vector of the candidate answer; The product vector is a vector product of an initial semantic vector of the candidate answer and an intermediate semantic vector of the candidate answer.
  3. 3. The method according to claim 1, wherein the method further comprises: for each candidate answer of the plurality of candidate answers, determining the similarity of the candidate answer to other respective candidate answers based on the point multiplication of the initial semantic vector of the candidate answer and the initial semantic vector of the other respective candidate answers.
  4. 4. A method according to any one of claims 1 to 3, wherein said encoding each candidate answer of the plurality of candidate answers to the target question to obtain an initial semantic vector for each candidate answer comprises: For each candidate answer in the plurality of candidate answers of the target question, splicing the target question and the candidate answer to obtain a spliced text; And encoding the spliced text to obtain the initial semantic vector of the candidate answer.
  5. 5. A method according to any one of claims 1 to 3, wherein prior to encoding each candidate answer of the plurality of candidate answers to the target question, the method further comprises: Acquiring a plurality of documents associated with the target problem based on the target problem; and acquiring one candidate answer of the target question for each document in the plurality of documents to obtain a plurality of candidate answers.
  6. 6. A method according to any one of claims 1 to 3, wherein said determining a target answer from said plurality of candidate answers based on said updated semantic vectors of said plurality of candidate answers comprises: inputting the updated semantic vectors of the plurality of candidate answers to an answer selection model; And determining a target answer from the plurality of candidate answers based on the output result of the answer selection model.
  7. 7. The method of claim 6, wherein the method further comprises: obtaining a plurality of answer samples of a question sample, and a label of each answer sample, wherein the label is used for indicating whether the answer sample is a correct answer of the question sample; encoding each answer sample in the answer samples to obtain an initial semantic vector of each answer sample; For each answer sample in the plurality of answer samples, weighting the initial semantic vectors of other answer samples based on the similarity between the answer sample and other answer samples to obtain intermediate semantic vectors of the answer samples; For each answer sample in the answer samples, splicing an initial semantic vector and an intermediate semantic vector of the answer sample to obtain an updated semantic vector of the answer sample; an answer selection model is trained based on the updated semantic vectors of the plurality of answer samples and the labels of the plurality of answer samples.
  8. 8. An answer selection device, said device comprising: the coding module is used for coding each candidate answer in the plurality of candidate answers of the target question to obtain an initial semantic vector of each candidate answer; The weighting module is used for carrying out weighting processing on initial semantic vectors of other candidate answers based on the similarity between the candidate answer and the other candidate answers to obtain intermediate semantic vectors of the candidate answers, wherein the intermediate semantic vectors of the candidate answers are support evidence information of the other candidate answers on the candidate answers; The splicing module is used for splicing the initial semantic vector and the intermediate semantic vector of each candidate answer in the plurality of candidate answers to obtain an updated semantic vector of the candidate answer; And the determining module is used for determining a target answer from the plurality of candidate answers based on the updated semantic vectors of the plurality of candidate answers.
  9. 9. The apparatus of claim 8, wherein the stitching module is configured to stitch, for each candidate answer of the plurality of candidate answers, an initial semantic vector of the candidate answer, a product vector of an intermediate semantic vector of the candidate answer and the candidate answer to obtain an updated semantic vector of the candidate answer, wherein the product vector is a vector product of the initial semantic vector of the candidate answer and the intermediate semantic vector of the candidate answer.
  10. 10. The apparatus of claim 8, wherein the weighting module is further configured to determine, for each candidate answer of the plurality of candidate answers, a similarity of the candidate answer to each other candidate answer based on a point multiplication of an initial semantic vector of the candidate answer with an initial semantic vector of each other candidate answer.
  11. 11. The apparatus according to any one of claims 8 to 10, wherein the encoding module is configured to, for each candidate answer of the plurality of candidate answers to the target question, splice the target question with the candidate answer to obtain a spliced text, and encode the spliced text to obtain an initial semantic vector of the candidate answer.
  12. 12. The apparatus according to any one of claims 8 to 10, further comprising a first acquisition module; The first obtaining module is used for obtaining a plurality of documents related to the target question based on the target question, and obtaining a candidate answer of the target question for each document in the plurality of documents to obtain a plurality of candidate answers.
  13. 13. The apparatus according to any one of claims 8 to 10, wherein the determining module is configured to input updated semantic vectors of the plurality of candidate answers to an answer selection model, and determine a target answer from the plurality of candidate answers based on an output result of the answer selection model.
  14. 14. The apparatus of claim 13, further comprising a second acquisition module and a training module; The second obtaining module is configured to obtain a plurality of answer samples of a question sample, and a label of each answer sample, where the label is used to indicate whether the answer sample is a correct answer of the question sample; The coding module is further configured to code each answer sample in the plurality of answer samples to obtain an initial semantic vector of each answer sample; The weighting module is further configured to, for each answer sample in the plurality of answer samples, perform weighting processing on initial semantic vectors of other answer samples based on similarity between the answer sample and other answer samples, so as to obtain intermediate semantic vectors of the answer samples; The splicing module is further configured to splice, for each answer sample in the plurality of answer samples, an initial semantic vector and an intermediate semantic vector of the answer sample to obtain an updated semantic vector of the answer sample; The training module is used for training an answer selection model based on the updated semantic vectors of the answer samples and the labels of the answer samples.
  15. 15. A computer device comprising a processor and a memory having stored therein at least one instruction, at least one program, code set, or instruction set that is loaded and executed by the processor to implement the answer selection method of any one of claims 1 to 7.
  16. 16. A computer readable storage medium having stored therein at least one instruction, at least one program, code set, or instruction set, the at least one instruction, the at least one program, the code set, or instruction set being loaded and executed by a processor to implement the answer selection method of any one of claims 1 to 7.
  17. 17. A computer program product, characterized in that it comprises computer instructions stored in a computer-readable storage medium, from which computer instructions a processor of a computer device reads and executes the computer instructions, so that the computer device implements the answer selection method according to any one of claims 1 to 7.

Description

Answer selection method, device, equipment and storage medium Technical Field The present application relates to the field of natural language processing (Natural Language Processing, NLP), and in particular, to an answer selection method, apparatus, device, and storage medium. Background In recent years, text-based question-answering (Question Answering, QA) systems have been widely used in various fields of life (e.g., medical fields). For questions in text form presented by the user, the text-based question-answering system is able to return concise and accurate matching answers by retrieving a corpus, knowledge graph or question-answering knowledge base. In the related art, the process of determining matching answers by a text-based question-answer system generally includes three stages of retrieval, extraction and answer selection. In the retrieval stage, the question-answering system can acquire a plurality of documents containing answers. In the extraction stage, the question-answering system may determine a plurality of candidate answers from the plurality of documents obtained, which are capable of answering the question. Then, in the answer selection stage, the question-answering system can determine the correctness of each candidate answer based on the matching degree of each candidate answer and the question in grammar or semanteme, and select one candidate answer with highest correctness from the plurality of candidate answers as the best answer. However, the accuracy of the candidate answer, which is determined by the above answer selection method, is low only based on the degree of matching between the candidate answer and the question, and the accuracy of the candidate answer cannot be determined accurately. Disclosure of Invention The application provides an answer selection method, an answer selection device, answer selection equipment and a storage medium, which can effectively improve the accuracy of an optimal answer determined by the answer selection method. The technical scheme is as follows: in one aspect, there is provided an answer selection method, the method including: Encoding each candidate answer in the plurality of candidate answers of the target question to obtain an initial semantic vector of each candidate answer; For each candidate answer in the plurality of candidate answers, weighting the initial semantic vector of each other candidate answer based on the similarity between the candidate answer and each other candidate answer to obtain an intermediate semantic vector of the candidate answer; For each candidate answer in the plurality of candidate answers, splicing the initial semantic vector of the candidate answer with the intermediate semantic vector to obtain an updated semantic vector of the candidate answer; and determining a target answer from the plurality of candidate answers based on the updated semantic vectors of the plurality of candidate answers. In another aspect, a training method of an answer selection model is provided, the method including: obtaining a plurality of answer samples of a question sample, and a label of each answer sample, wherein the label is used for indicating whether the answer sample is a correct answer of the question sample; encoding each answer sample in the answer samples to obtain an initial semantic vector of each answer sample; For each answer sample in the plurality of answer samples, weighting the initial semantic vectors of other answer samples based on the similarity between the answer sample and other answer samples to obtain intermediate semantic vectors of the answer samples; for each answer sample in the plurality of answer samples, splicing an initial semantic vector of the answer sample and an intermediate semantic vector of the answer sample to obtain an updated semantic vector of the answer sample; an answer selection model is trained based on the updated semantic vectors of the plurality of answer samples and the labels of the plurality of answer samples. In yet another aspect, there is provided an answer selecting apparatus, the apparatus including: the coding module is used for coding each candidate answer in the plurality of candidate answers of the target question to obtain an initial semantic vector of each candidate answer; The weighting module is used for carrying out weighting processing on the initial semantic vectors of other candidate answers based on the similarity between the candidate answer and the other candidate answers to obtain intermediate semantic vectors of the candidate answers; The splicing module is used for splicing the initial semantic vector and the intermediate semantic vector of each candidate answer in the plurality of candidate answers to obtain an updated semantic vector of the candidate answer; And the determining module is used for determining a target answer from the plurality of candidate answers based on the updated semantic vectors of the plurality of candidate answers. In yet