Question-answering matching methods, media, devices, and computing equipment

By applying Newton's law of universal gravitation and the Jaccard similarity coefficient to determine the gravitational norm of word vectors in a question-answering system, the problem of low accuracy in sentence similarity calculation is solved, and the matching degree of user answers is improved.

CN116450790BActive Publication Date: 2026-07-31HANGZHOU NETEASE ZHIQI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU NETEASE ZHIQI TECH CO LTD
Filing Date
2023-03-30
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In existing question-answering systems, the accuracy of sentence similarity calculation methods is low, resulting in users receiving answers with poor matching accuracy.

Method used

A method combining Newton's law of universal gravitation and Jaccard similarity coefficient is adopted to determine sentence similarity by the gravitational norm of word vectors, including the magnitude and direction of word vectors, thereby improving the accuracy of similarity calculation.

Benefits of technology

It significantly improves the accuracy of sentence similarity, thereby increasing the matching degree of user question answers and reducing user churn.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116450790B_ABST
    Figure CN116450790B_ABST
Patent Text Reader

Abstract

This disclosure provides a question-and-answer matching method. The method includes: acquiring a query statement and a target statement; determining the gravitational norm of the query statement and the target statement based on a first word vector of the query statement and a second word vector of the target statement; determining the similarity between the query statement and the target statement based on the gravitational norm; and, in response to the similarity reaching a preset condition, determining the answer corresponding to the target statement as the target answer for the query statement and outputting the target answer. Determining the similarity between the query statement and the target statement by using the gravitational norm between their vectors improves the accuracy of similarity determination, thereby significantly improving the matching degree of the answers obtained after a user asks a question, providing a better user experience, and reducing user churn. Furthermore, this disclosure also provides a medium, apparatus, and computing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this disclosure relate to the field of natural language processing technology, and more specifically, to question-and-answer matching methods, media, apparatus, and computing devices. Background Technology

[0002] This section is intended to provide background or context for the embodiments of this disclosure as set forth in the claims. The description herein is not an admission that it is prior art simply because it is included in this section.

[0003] Frequently Asked Questions (FAQ) systems are currently the most widely used question-and-answer systems in industry. These systems have a clear structure, are simple to implement, and are easy to understand. Building a comprehensive and rich FAQ knowledge base is a prerequisite for a question-and-answer system. A knowledge base typically contains many knowledge points, each including a standard question, similar questions, and answers. Once the knowledge base is available, the user's question is searched and matched against each knowledge point in the knowledge base to calculate a similarity score. In other words, the similarity between two sentences is compared. If the similarity score between the user's question and a knowledge point in the knowledge base exceeds a set threshold, then the answer for that knowledge point is selected and presented to the user.

[0004] In related technologies, when comparing the similarity of two sentences, each sentence is usually converted into a vector of fixed dimensions, and then the Euclidean distance or cosine distance between the two vectors is used as the similarity score, thus determining the similarity between the two sentences. However, the accuracy of the similarity score obtained in this way is relatively low, resulting in a low matching degree of the answers received after the user asks a question. Summary of the Invention

[0005] This disclosure provides a question-and-answer matching method, medium, apparatus, and computing device to improve the matching accuracy of answers obtained after a user asks a question.

[0006] In a first aspect of this disclosure, a question-and-answer matching method is provided, comprising: acquiring a query statement and a target statement, wherein the query statement is a statement input by a user and the target statement is a statement in a FAQ knowledge base; determining the gravitational norm of the query statement and the target statement based on a first word vector of the query statement and a second word vector of the target statement; determining the similarity between the query statement and the target statement based on the gravitational norm; and, in response to the similarity reaching a preset condition, determining the answer corresponding to the target statement as the target answer of the query statement and outputting the target answer, wherein the preset condition includes that the similarity is greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base.

[0007] In one embodiment of this disclosure, before determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement, the method further includes: performing word segmentation on the query statement to obtain at least one first word; performing encoding on each of the at least one first word to obtain a first word vector, the first word vector including a third word vector corresponding to each first word; performing word segmentation on the target statement to obtain at least one second word; and performing encoding on each of the at least one second word to obtain a second word vector, the second word vector including a fourth word vector corresponding to each second word.

[0008] In another embodiment of this disclosure, determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: for each third word vector in the first word vector, determining the first gravitational force between the third word vector and all fourth word vectors in the second word vector; obtaining the sum of the first gravitational forces to obtain the second gravitational force, the second gravitational force being used to represent the gravitational force exerted by the target statement on the query statement; and determining the magnitude of the gravitational force of the second gravitational force as the gravitational norm.

[0009] In another embodiment of this disclosure, determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: for each fourth word vector in the second word vector, determining the third gravitational force between the fourth word vector and all third word vectors in the first word vector; obtaining the sum of the third gravitational forces to obtain the fourth gravitational force, which is used to represent the gravitational force exerted on the target statement by the query statement; and determining the magnitude of the fourth gravitational force as the gravitational norm; wherein the magnitudes of the second gravitational force and the fourth gravitational force are the same.

[0010] In another embodiment of this disclosure, before determining the first attraction between the third word vector and all fourth word vectors in the second word vector, the method further includes: obtaining the first norm of the third word vector, the second norm of the fourth word vector, the distance between the third word vector and the fourth word vector, and the unit vector pointing from the third word vector to the fourth word vector; determining the fifth attraction between the third word vector and each fourth word vector based on the first norm, the second norm, the distance, and the unit vector; determining the first attraction between the third word vector and all fourth word vectors in the second word vector includes: summing all the fifth attraction forces to determine the first attraction force.

[0011] In another embodiment of this disclosure, obtaining the distance between the third word vector and the fourth word vector includes: determining the dot product of the third word vector and the fourth word vector; and determining the distance based on a preset similarity coefficient, according to the first norm, the second norm, and the dot product.

[0012] In yet another embodiment of this disclosure, determining the similarity between a query statement and a target statement based on the gravitational norm includes: determining the gravitational norm as the similarity.

[0013] In yet another embodiment of this disclosure, the method further includes: in response to the similarity not meeting a preset condition, outputting a prompt message indicating that the query has failed.

[0014] In a second aspect of the present disclosure, a medium is provided that stores computer execution instructions, which, when executed by a processor, are used to implement the question-and-answer matching method as described in the first aspect.

[0015] In a third aspect of this disclosure, a question-and-answer matching apparatus is provided, comprising: an acquisition module for acquiring a query statement and a target statement, wherein the query statement is a statement input by a user and the target statement is a statement in a FAQ knowledge base; a first determination module for determining the gravitational norm of the query statement and the target statement based on a first word vector of the query statement and a second word vector of the target statement; a second determination module for determining the similarity between the query statement and the target statement based on the gravitational norm; and an output module for determining the answer corresponding to the target statement as the target answer of the query statement and outputting the target answer in response to the similarity reaching a preset condition, wherein the preset condition includes that the similarity is greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base.

[0016] In a fourth aspect of this disclosure, a computing device is provided, including: a processor and a memory connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the question-and-answer matching method as described in the first aspect.

[0017] According to the question-and-answer matching method, medium, apparatus, and computing device of this disclosure, a first word vector of a user-input query statement and a second word vector of a target statement from a FAQ knowledge base can be obtained. The similarity between the first and second word vectors is determined by assessing the magnitude of the gravitational force between them. Since the magnitude of the gravitational force between vectors can be represented by the gravitational norm, the similarity between the query statement and the target statement can be determined using the gravitational norm between the first and second word vectors. This gravitational force includes both magnitude and direction, significantly improving the accuracy of determining the similarity between the first and second word vectors, and consequently, improving the accuracy of determining the similarity between the query statement and the target statement. This results in a higher degree of matching between the answers received after a user asks a question, leading to a better user experience and reduced user churn. Attached Figure Description

[0018] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which:

[0019] Figure 1 A schematic diagram illustrating an application scenario of the question-and-answer matching method provided in this embodiment of the disclosure;

[0020] Figure 2 A flowchart illustrating the question-and-answer matching method provided in this embodiment of the disclosure;

[0021] Figure 3 This is a schematic diagram of the structure of the storage medium according to an embodiment of the present disclosure;

[0022] Figure 4 This is a schematic diagram of the question-and-answer matching device according to an embodiment of the present disclosure;

[0023] Figure 5 This is a schematic diagram of the structure of a computing device according to an embodiment of the present disclosure.

[0024] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0025] The principles and spirit of this disclosure will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement this disclosure, and are not intended to limit the scope of this disclosure in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.

[0026] Those skilled in the art will recognize that embodiments of this disclosure can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0027] According to embodiments of this disclosure, a question-and-answer matching method, medium, apparatus, and computing device are proposed.

[0028] In this article, it is important to understand that the terms used refer to the following:

[0029] Word embedding: A vector from words or phrases in a vocabulary that is mapped to real numbers. It involves a mathematical embedding from a one-dimensional space for each word to a continuous vector space with a lower dimension.

[0030] Norm: Used to measure the length or size of each vector in a vector space (or matrix).

[0031] Furthermore, the number of any elements in the accompanying drawings is for illustrative purposes only and not for limitation, and any naming is for distinction only and has no limiting meaning.

[0032] In addition, the data involved in this disclosure may be data authorized by the user or fully authorized by all parties. The collection, dissemination and use of the data shall comply with the requirements of relevant national laws and regulations. The implementation methods / executives of this disclosure may be combined with each other.

[0033] The principles and spirit of this disclosure will be explained in detail below with reference to several representative embodiments. Invention Overview

[0035] Currently, the most widely used question-answering system in industry is the FAQ system. This type of system has a clear structural framework, is simple to implement, and easy to understand. Its prerequisite is the construction of a comprehensive and rich FAQ knowledge base. A knowledge base typically includes many knowledge points, and each knowledge point can contain standard questions, similar questions, and answers. Once the knowledge base is in place, the user's question is searched and matched against each knowledge point in the knowledge base, and a similarity score is determined. If the similarity score between the user's question and a knowledge point in the knowledge base exceeds a set threshold, the answer corresponding to that knowledge point will be selected and presented to the user.

[0036] The inventors have discovered that in related technologies, when determining the similarity score between two sentences, the two sentences are typically encoded as vectors of a fixed dimension, and then the Euclidean distance or cosine distance between the vectors is used as the similarity between the two sentences; the smaller the Euclidean or cosine distance, the higher the similarity between the two sentences. However, Euclidean distance treats the differences between various indicators or variables equally, while cosine distance does not consider the magnitude of the vectors, only the direction between the two vectors. Therefore, although using the Euclidean or cosine distance between vectors as the similarity between two sentences is relatively simple, the accuracy of the final determined similarity between the two sentences is low.

[0037] Therefore, this disclosure provides a question-and-answer matching method. After a user submits a question, both the question and each knowledge point in the FAQ knowledge base are converted into word vectors. Then, inspired by Newton's law of universal gravitation and the Jaccard similarity coefficient, the magnitude of the gravitational force between two word vectors is determined. The similarity between two word vectors is determined by the magnitude of this gravitational force. The magnitude of the gravitational force between two word vectors can be represented by the gravitational norm. Therefore, by determining the gravitational norm between two word vectors, the similarity between them can be determined, thereby determining the similarity between the user's question and the knowledge points in the FAQ knowledge base. In other words, the larger the gravitational norm between the user's question and the knowledge points in the FAQ knowledge base, the higher the similarity between them.

[0038] This disclosure, inspired by Newton's law of universal gravitation, determines gravity by including both magnitude and direction, thus ensuring the accuracy of the similarity determination between two statements. Furthermore, by introducing the Jaccard similarity coefficient to redefine the method for determining the distance between the word vectors of two statements when determining the magnitude of gravity, it avoids ignoring differences between various indicators or variables in the two statements, further improving the accuracy of determining the similarity between the two statements. Therefore, the question-and-answer matching method provided by this disclosure can improve the accuracy of the similarity determination between two statements, thereby increasing the matching degree of the answers received after a user asks a question, providing a better user experience, and reducing user churn.

[0039] After introducing the basic principles of this disclosure, various non-limiting embodiments of this disclosure will be described in detail below.

[0040] Application Scenarios Overview

[0041] First refer to Figure 1 , Figure 1 This diagram illustrates an application scenario of the question-and-answer matching method provided in this disclosure. The question-and-answer matching method provided in this disclosure can be applied to… Figure 1 The question-and-answer matching system shown may include a query statement acquisition module, a FAQ knowledge base, and a similarity determination module. The similarity determination module may include a vector transformation unit, a gravity determination unit, and a similarity determination unit.

[0042] Specifically, when a user wants to ask a question, the user can enter a query. Optionally, the query acquisition module can be equipped with an input area where users can enter information, and users can enter their query through the input area on the query acquisition module.

[0043] Specifically, the query statement acquisition module can acquire the query statement entered by the user and transmit the query statement entered by the user to the similarity determination module.

[0044] Specifically, after obtaining the query statement, the similarity determination module compares the similarity between the query statement and each knowledge point in the FAQ knowledge base to obtain the similarity between the query statement and each knowledge point, and returns the target answer corresponding to the knowledge point with the highest similarity exceeding the threshold to the user.

[0045] Specifically, when comparing the similarity of the query statement with each knowledge point in the FAQ knowledge base, the similarity determination module can proceed as follows: A vector transformation unit performs vector transformation on the query statement and the knowledge points being compared, resulting in two word vectors, which are then transmitted to a gravity determination unit. Based on Newton's law of universal gravitation and the Jaccard similarity coefficient, the gravity determination unit determines the magnitude of the gravitational force between the two word vectors, represents this force using a gravity norm, and transmits the gravity norm to the similarity determination unit. The similarity determination unit then uses the gravity norm to determine the similarity between the two word vectors, thereby determining the similarity between the query statement and the knowledge points in the FAQ knowledge base, and returns the target answer corresponding to the knowledge point with the highest similarity exceeding a threshold to the user. A larger gravity norm indicates a higher similarity between the query statement and the knowledge points in the FAQ knowledge base.

[0046] Since the gravity determined by this disclosure, inspired by Newton's law of universal gravitation, includes both the magnitude and direction of gravity, and by introducing the Jaccard similarity coefficient, the differences between various indicators or variables are not ignored, the question-and-answer matching method provided by this disclosure can improve the accuracy of the similarity between two sentences, thereby improving the matching degree of the answers obtained after users ask questions, bringing a better user experience, and reducing user churn.

[0047] Exemplary methods

[0048] The following is combined Figure 1 Application scenarios, refer to Figure 2 This description outlines an answer matching method based on exemplary embodiments of the present disclosure. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in any way. Rather, the embodiments of the present disclosure can be applied to any applicable scenario.

[0049] Figure 2 This is a flowchart illustrating the question-and-answer matching method provided in this embodiment of the disclosure. Figure 2 In this context, the question-and-answer matching method includes the following steps:

[0050] S201: Obtain the query statement and target statement.

[0051] Specifically, the query statement is the statement entered by the user, and the target statement is the statement in the FAQ knowledge base.

[0052] Specifically, the query can be a question entered by the user. The FAQ knowledge base can include multiple knowledge points, each of which can include a standard question, similar questions, and answers. For example, one knowledge point in the FAQ knowledge base could be as follows:

[0053] Standard Question:

[0054] What is the official website / online store address?

[0055] answer:

[0056] The official flagship store is: xxxxxx

[0057] Similar questions:

[0058] 1. Do you have an official website or online store address?

[0059] 2. How do I find the online store address?

[0060] 3. Send me the e-commerce website.

[0061] Specifically, the answers to the standard questions and similar questions within a knowledge point are the same; both are answers specific to that knowledge point.

[0062] S202: Determine the gravitational norms of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement.

[0063] Specifically, after obtaining the query statement and the target statement, the query statement can be converted into a first word vector, and the target statement can be converted into a second word vector.

[0064] Specifically, to consider both the magnitude and direction of the first and second word vectors simultaneously, we can determine the gravitational force between them based on Newton's law of universal gravitation. This gravitational force is a vector that includes both magnitude and direction, and its magnitude is the gravitational norm. The gravitational norm between the first and second word vectors is the gravitational norm of the query statement and the target statement.

[0065] S203: Determine the similarity between the query statement and the target statement based on the gravitational norm.

[0066] Specifically, the magnitude of the gravitational force between the first and second word vectors, i.e., the gravitational norm, can indirectly represent the distance between them. Therefore, the gravitational norm of the query and target statements can indirectly represent the distance between them, and this distance characterizes their similarity. Thus, the similarity between the query and target statements can be determined by their gravitational norm.

[0067] S204: In response to the similarity reaching the preset condition, the answer corresponding to the target statement is determined as the target answer of the query statement, and the target answer is output.

[0068] Specifically, the preset conditions include a similarity greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base.

[0069] Specifically, the similarity between the query statement and all statements in the FAQ knowledge base can be determined. Among them, the similarity between the target statement and the query statement is the highest among all similarities, and the similarity between the target statement and the query statement must be greater than or equal to a preset value. Thus, it can be determined that the target statement and the query statement are the most similar in the FAQ knowledge base. Therefore, the answer corresponding to the target statement can be determined as the target answer of the query statement, and the target answer can be output to the user.

[0070] After determining the similarity between the query statement and the target statement

[0071] The question-and-answer matching method disclosed herein can obtain the first word vector of the query statement entered by the user and the second word vector of the target statement in the FAQ knowledge base. By determining the magnitude of the attraction between the first word vector and the second word vector, the similarity between the first word vector and the second word vector can be determined. The magnitude of the attraction between the vectors can be represented by the gravity norm. Therefore, by using the gravity norm between the first word vector and the second word vector, the similarity between the query statement and the target statement can be determined, thereby significantly improving the matching degree of the answers obtained after the user asks a question, bringing a better user experience and reducing user churn.

[0072] In one embodiment of this disclosure, before determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement, the method further includes: performing word segmentation on the query statement to obtain at least one first word; performing encoding on each of the at least one first word to obtain a first word vector, the first word vector including a third word vector corresponding to each first word; performing word segmentation on the target statement to obtain at least one second word; and performing encoding on each of the at least one second word to obtain a second word vector, the second word vector including a fourth word vector corresponding to each second word.

[0073] Specifically, when using computers to determine the similarity between two sentences, since computers cannot recognize text, it is necessary to first encode the text and determine the mapping relationship between the text and the numerical vector space. That is, before determining the gravitational norm between the query and target statements, the first word vector of the query statement and the second word vector of the target statement can be obtained. This allows the determination of the gravitational force between the first and second word vectors. Based on this gravitational force, the similarity between the first and second word vectors can be determined, thus determining the similarity between the query and target statements. Because the gravitational force between vectors includes both direction and magnitude, the accuracy of the determined similarity between the two sentences can be improved.

[0074] Specifically, when obtaining the first word vector of a query statement, a word segmentation tool can be used to segment the query statement, that is, the query statement is represented by at least one first word. Then, each first word is encoded, and the mapping relationship between each first word and the numerical vector space is found to obtain the word vector of each first word. The word vectors of all first words constitute the first vector of the query statement. An example is as follows:

[0075] If the query is represented by A, then after segmenting A using a word segmentation tool, at least one first word is obtained as follows:

[0076] A = [A1, A2, A3, ..., A n ]

[0077] Among them, A1, A2, A3, ..., A n This can be used to represent the first word in A. Each first word is encoded, and the mapping relationship between each first word and the numerical vector space is found, resulting in the word vector for each first word as follows:

[0078] A i =[a1 i a2 i a3 i ,...,at i ]

[0079] Among them, A i This can be used to represent the word vector of the i-th first word, which is also the third word vector, a t It can be used to represent A i The t-th vector in the array.

[0080] The target statement is represented by B. Similarly, at least one second word is as follows:

[0081] B = [B1, B2, B3, ..., B m ]

[0082] Among them, B1, B2, B3, ..., B m This can be used to represent the second word in B. The word vector for each second word is as follows:

[0083] B j =[b1 j b2 j b3 j ,...,b t j ]

[0084] Among them, B j This can be used to represent the word vector of the j-th second word, which is also the fourth word vector, b t It can be used to represent B j The t-th vector in the array.

[0085] Taking A as "I like cats" and B as "I love China" as an example, after word segmentation, we get:

[0086] A = ["I", "like", "cats"]

[0087] B = ["I", "love", "China"]

[0088] Encoding each word in A yields the following word vector:

[0089] “I” = [a1 1 a2 1 a3 1 ,...,a n 1 ]

[0090] “Like” = [a1 2 a2 2 a3 2 ,...,a n 2 ]

[0091] "cat" = [a1 3 a2 3 a3 3 ,...,a n 3 ]

[0092] Encoding each word in B yields the following word vector:

[0093] “I” = [b1 1 b2 1 b3 1 ,...,b n 1 ]

[0094] "Love" = [b1 2 b2 2 b3 2 ,...,b n 2 ]

[0095] “China” = [b1 3 b2 3 b3 3 ,...,b n 3 ]

[0096] Taking A as the standard question in step S201, "What is the official website / online store address?", and B as "the official website / online store address", after word segmentation, we get:

[0097] A = ["Official Website", "Online Store", "Address", "Is", "What"]

[0098] B = ["Official Website", "of", "Online Store", "Address"]

[0099] Encoding each word in A yields the following word vector:

[0100] "Official Website" = [a1 1 a2 1 a3 1 ,...,a n 1 ]

[0101] "online store" = [a1 2 a2 2 a3 2 ,...,a n 2 ]

[0102] "address" = [a1 3 a2 3 a3 3,...,a n 3

[0103] "Yes" = [a1 4 ,a2 4 ,a3 4 ,...,a n 4

[0104] "What" = [a1 5 ,a2 5 ,a3 5 ,...,a n 5

[0105] Encode each word in B to obtain word vectors as follows:

[0106] "Official website" = [b1 1 ,b2 1 ,b3 1 ,...,b n 1

[0107] "Of" = [b1 2 ,b2 2 ,b3 2 ,...,b n 2

[0108] "Online store" = [b1 3 ,b2 3 ,b3 3 ,...,b n 3

[0109] "Address" = [b1 4 ,b2 4 ,b3 4 ,...,b n 4

[0110] Optionally, encode the words to obtain word vectors, which can be done using methods such as word2vec, glove, etc.

[0111] ​​​​​​​In another embodiment of this disclosure, determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: for each third word vector in the first word vector, determining the first gravitational force between the third word vector and all fourth word vectors in the second word vector; obtaining the sum of the first gravitational forces to obtain the second gravitational force, the second gravitational force being used to represent the gravitational force exerted by the target statement on the query statement; and determining the magnitude of the gravitational force of the second gravitational force as the gravitational norm.

[0112] Specifically, Newton's law of universal gravitation in fundamental physics states that the attractive force between two objects is directly proportional to the product of their masses but inversely proportional to the square of the distance between them. The specific formula for universal gravitation is as follows:

[0113]

[0114] In this system, F can represent the gravitational force between two objects, G can represent the gravitational constant, M and m can represent the masses of the two objects, and R can represent the distance between them. Inspired by Newton's law of universal gravitation, we can define the vector gravitational force between two vectors in a high-dimensional data space. The gravitational force between two vectors is similar to the gravitational force between two objects; it is directly proportional to the product of the "masses" of the two vectors and inversely proportional to the square of the distance between them.

[0115] Since a vector is a mathematical concept, it has no weight in mathematical theory. However, every vector has a norm, which represents the magnitude of the vector itself. Let vector X = (x1, x2, x3, ..., x...). D )∈R D Then the norm ‖X‖ of vector X can be defined as follows:

[0116]

[0117] Let X, Y∈R D According to formula (1), the vector attraction between vectors X and Y can be defined as follows:

[0118]

[0119] Here, ||X|| and ||Y|| can be used to represent the norms of vectors X and Y, respectively, analogizing the magnitude of a vector's "mass" to the magnitude of its norm; R can be used to represent the distance between two vectors; u XY It can be used to represent a unit vector pointing from X to Y, and its calculation formula can be as follows:

[0120]

[0121] Specifically, add u XY This vector ensures that the gravitational force between the two vectors has a direction, conforming to the definition of force in physics. Therefore, Newton's law of universal gravitation can be applied to determine the gravitational force with both magnitude and direction between the two vectors in this disclosure, thereby improving the accuracy of determining the similarity between the two vectors, and consequently improving the accuracy of determining the similarity between the two statements.

[0122] Specifically, R in formula (3) 2 It can be:

[0123] R 2 =‖X‖ 2 +‖Y‖ 2 -X·Y (5)

[0124] Substituting formula (5) into formula (3), we can obtain the gravitational force F between vectors X and Y. XY for:

[0125]

[0126] Specifically, formula (6) can be used to define the attraction between two word vectors. The magnitude of the attraction between two word vectors can express the distance between two words. That is, the greater the attraction between two words, the smaller the distance between them, which indicates that they are very similar. Conversely, the smaller the attraction between two words, the greater the distance between them, which indicates that they are very similar.

[0127] Specifically, when determining the attraction between the first word vector and the second word vector, for each third word vector in the first word vector, the first attraction between the third word vector and all fourth word vectors in the second word vector can be determined. That is, for each third word vector, the first attraction is the attraction exerted by the second word vector on the third word vector. An example is as follows:

[0128] Let A represent the query statement and B represent the target statement. Then the i-th third word vector in the first word vector is A. i =[a1 i a2 i a3 i ,...,a t i The j-th fourth word vector in the second word vector is B. j =[b1 j b2 j b3 j ,...,b t jIf the first gravitational force is the sum of the gravitational forces exerted on the i-th third word vector by each fourth word vector in the second word vector, then the first gravitational force can be considered as the sum of the gravitational forces exerted on the i-th third word vector by each fourth word vector in the second word vector. This can be expressed by the following formula:

[0129]

[0130] According to formula (6), it can be determined that The specific calculation formula is as follows:

[0131]

[0132] Specifically, after obtaining the first gravitational force, the sum of the first gravitational forces can be used to obtain the second gravitational force representing the first word vector being affected by the second word vector. This second gravitational force is also the gravitational force of query statement A being affected by target statement B. Since the magnitude of gravitational force can be represented by a norm, the magnitude of the second gravitational force can be determined as the gravitational norm. Second gravitational force F AB This can be expressed by the following formula:

[0133]

[0134] Then the gravitational norm of the second gravitational force can be ||F||. AB ‖.

[0135] Alternatively, taking the aforementioned A as "I like cats" and B as "I love China" as an example, the first word "I" in A will be influenced by the attraction of "I", "love" and "China" in B. Therefore, the first word "I" in A will be influenced by the attraction F from B. 我 for:

[0136] F 我 =F 我,我 +F 我,爱 +F 我,中国 (10)

[0137] Based on the attraction between the two word vectors (Formula 6), F can be obtained. 我 The specific calculation formula is as follows:

[0138]

[0139] Similarly, the second word in A, "like," is affected by the gravitational pull F from B. 喜欢 for:

[0140]

[0141] The third word in A, "cat," is affected by gravitational pull F from B. 猫咪 for:

[0142]

[0143] The sum of the gravitational forces exerted by B on each word in A is equal to the gravitational force exerted by B on A:

[0144] F AB =F 我 +F 喜欢 +F 猫咪 (14)

[0145] Taking the standard question "What is the official website / online store address?" as A in step S201, and "The official website / online store address?" as B, the first word "official website" in A will be influenced by the words "official website", "of", "online store", and "address" in B. Therefore, the first word "official website" in A will be influenced by the gravitational force F from B. 官网 for:

[0146] F 官网 =F 官网,官网 +F 官网,的 +F 官网,网店 +F 官网,地址 (15)

[0147] Based on the attraction between the two word vectors (Formula 6), F can be obtained. 官网 The specific calculation formula is as follows:

[0148]

[0149] Similarly, the second word in A, "online store," is affected by the gravitational pull F from B. 网店 for:

[0150]

[0151] The third word in A, "address," is affected by gravitational pull F from B. 地址 for:

[0152]

[0153] The fourth word in A, "is", is affected by the gravitational pull F from B. 是 for:

[0154]

[0155] The fifth word in A, "what," is affected by the gravitational pull F from B. 什么 for:

[0156]

[0157] The sum of the gravitational forces exerted by B on each word in A is equal to the gravitational force exerted by B on A:

[0158] FAB =F 官网 +F 网店 +F 地址 +F 是 +F 什么 (twenty one)

[0159] In another embodiment of this disclosure, determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: for each fourth word vector in the second word vector, determining the third gravitational force between the fourth word vector and all third word vectors in the first word vector; obtaining the sum of the third gravitational forces to obtain the fourth gravitational force, which is used to represent the gravitational force exerted on the target statement by the query statement; and determining the magnitude of the fourth gravitational force as the gravitational norm; wherein the magnitudes of the second gravitational force and the fourth gravitational force are the same.

[0160] Specifically, when determining the attraction between the first word vector and the second word vector, it is also possible to determine the third attraction between the fourth word vector and all the third word vectors in the first word vector for each fourth word vector in the second word vector. That is, for each fourth word vector, the third attraction is the attraction of the fourth word vector to the first word vector.

[0161] Continuing with the example of the query statement denoted by A and the target statement denoted by B, the i-th third word vector in the first word vector is A. i =[a1 i a2 i a3 i ,...,a t i The j-th fourth word vector in the second word vector is B. j =[b1 j b2 j b3 j ,...,b t j If the third gravitational force is the sum of the gravitational forces exerted on the j-th fourth word vector by each third word vector in the first word vector, then the third gravitational force can be considered as follows: This can be expressed by the following formula:

[0162]

[0163] According to formula (6), it can be determined that The specific calculation formula is as follows:

[0164]

[0165] Specifically, after obtaining the third gravitational force, the sum of the third gravitational forces can be used to obtain the fourth gravitational force representing the influence of the first word vector on the second word vector. This fourth gravitational force is also the gravitational force of the target statement B on the query statement A. Since the magnitude of the gravitational force can be represented by a norm, the magnitude of the fourth gravitational force can be determined as the gravitational norm. The fourth gravitational force F BA This can be expressed by the following formula:

[0166]

[0167] Then the gravitational norm of the fourth gravitational force can be ||F||. BA ‖. Among them, the second gravitational force and the fourth gravitational force are of the same magnitude, that is, the gravitational force exerted on query statement A by target statement B is the same as the gravitational force exerted on target statement B by query statement A.

[0168] Specifically, since force is a vector that has both magnitude and direction, the gravitational force between A and B also has magnitude. The magnitude of the gravitational force is the norm of gravity, which is ||F||. AB ‖ and ‖F BA The magnitude of the gravitational force between A and B can indirectly represent the distance between them, and the distance between A and B can characterize their similarity, thus allowing the determination of the similarity between A and B. By applying Newton's law of universal gravitation to determine the gravitational force with both magnitude and direction between two vectors in this disclosure, the accuracy of determining the similarity between two vectors can be improved, thereby improving the accuracy of determining the similarity between two statements.

[0169] Alternatively, taking the aforementioned A as "I like cats" and B as "I love China" as an example, then similarly, the gravitational force exerted on B by A is:

[0170] F BA =F 我 +F 爱 +F 中国 (25)

[0171] Taking the standard question "What is the official website / online store address?" as A in step S201, and "The official website / online store address?" as B, then similarly, the attraction of A to B is as follows:

[0172] F BA =F 官网 +F 的 +F 网店 +F 地址 (26)

[0173] In another embodiment of this disclosure, before determining the first attraction between the third word vector and all fourth word vectors in the second word vector, the method further includes: obtaining the first norm of the third word vector, the second norm of each fourth word vector, the distance between the third word vector and the fourth word vector, and the unit vector pointing from the third word vector to the fourth word vector; determining the fifth attraction between the third word vector and each fourth word vector based on the first norm, the second norm, the distance, and the unit vector; determining the first attraction between the third word vector and all fourth word vectors in the second word vector includes: summing all the fifth attraction forces to determine the first attraction force.

[0174] Specifically, for each third word vector, the first gravitational force is the gravitational force exerted on the third word vector by the second word vector. That is, the first gravitational force is the sum of the gravitational forces exerted on a certain third word vector by all the fourth word vectors. Therefore, before determining the first gravitational force between the third word vector and all the fourth word vectors in the second word vector, we can first determine the gravitational force between a single third word vector and a single fourth word vector, that is, the fifth gravitational force.

[0175] Specifically, if the third word vector can be represented by X, the fourth word vector can be represented by Y, then the fifth gravitational force F XY This can be expressed by the following formula:

[0176]

[0177] Specifically, ||X|| can be used to represent the first norm, ||Y|| can be used to represent the second norm, R can be used to represent the distance between the third and fourth word vectors, and u XY It can be used to represent a unit vector pointing from the third word vector to the fourth word vector.

[0178] Specifically, after determining the fifth gravitational force F... XY Then, the attraction between a single third word vector and a single fourth word vector is determined. Thus, the sum of the fifth attraction can be determined as the attraction between a single third word vector and all fourth word vectors, that is, the first attraction.

[0179] Specifically, add u XY This vector ensures that the gravitational force between the two vectors has a direction, conforming to the definition of force in physics. Therefore, Newton's law of universal gravitation can be applied to determine the gravitational force with both magnitude and direction between the two vectors in this disclosure, thereby improving the accuracy of determining the similarity between the two vectors, and consequently improving the accuracy of determining the similarity between the two statements.

[0180] In another embodiment of this disclosure, obtaining the distance between the third word vector and the fourth word vector includes: determining the dot product of the third word vector and the fourth word vector; and determining the distance based on a preset similarity coefficient, according to the first norm, the second norm, and the dot product.

[0181] Specifically, in formula (27), since R represents the distance between two word vectors X and Y, if R is defined using the Euclidean distance between the two word vectors, the information of the angle between the two word vectors will be missing. Similarly, if R is defined using the cosine distance between the two word vectors X and Y, then there is no difference from directly using the cosine distance between X and Y to represent the similarity between the two words. Therefore, the distance R between word vectors can be defined using the idea of ​​secondary expansion:

[0182] R 2 =‖X‖ 2 +‖Y‖ 2 -2X·Y (28)

[0183] Where X·Y can be used to represent the dot product of two vectors, and X·Y can be expressed by the following formula:

[0184]

[0185] Specifically, to improve the accuracy of determining R, a pre-defined similarity coefficient can be introduced, such as the Jaccard similarity coefficient. Since the Jaccard similarity coefficient is a widely used indicator to measure the similarity between two sets, it is defined as the proportion of elements in the intersection of set A and set B in the union of set A and set B. The calculation formula is as follows:

[0186]

[0187] If the Jaccard similarity coefficient is expressed in the form of a bit vector, where the bit vector is a vector consisting only of 0s and 1s, then we have:

[0188]

[0189] |A∩B|=∑ k A k ∧B k =∑ k A k B k (32)

[0190] From formulas (29) and (32), we can determine that ∑ k A k B k The definition of the dot product with a vector They are the same, therefore:

[0191] |A∩B|=A·B (33)

[0192] Therefore, in formula (30), the denominator of the bit vector form based on the Jaccard similarity coefficient is:

[0193] ||A|| 2 +‖B‖ 2 -A·B (34)

[0194] The improved word vector gravity formula (27) can be obtained by referring to the Jaccard similarity coefficient. The modified R... 2 It can be defined as:

[0195] R 2 =‖X‖ 2 +‖Y‖ 2 -X·Y (35)

[0196] In yet another embodiment of this disclosure, determining the similarity between a query statement and a target statement based on the gravitational norm includes: determining the gravitational norm as the similarity.

[0197] Specifically, defining the magnitude of the attraction between statement A and statement B can indirectly represent the distance between them. This distance, in turn, characterizes the similarity between statements A and B. This provides a definition of the similarity between statements A and B, which can determine the similarity between two statements of the same length as well as two statements of different lengths. This improves the accuracy of determining the similarity between two statements, thereby increasing the matching accuracy of answers received after a user asks a question, leading to a better user experience and reducing user churn.

[0198] Specifically, the gravitational norm of the query statement and the target statement can be directly determined as the similarity between the query statement and the target statement, that is, Similarity(A,B)=‖F AB The similarity between a query statement and a target statement can also be indirectly determined by the gravitational norm of the query and target statements. For example, Similarity(A,B) = k||F. AB ‖, where k can be used to represent a preset coefficient, and k can be modified as needed.

[0199] In yet another embodiment of this disclosure, the method further includes: in response to the similarity not meeting a preset condition, outputting a prompt message indicating that the query has failed.

[0200] Specifically, if the similarity between the query statement and the target statement does not meet the preset conditions, that is, if the similarity between the target statement and the query statement is less than the preset value, it means that no knowledge points similar to the query statement were found in the FAQ knowledge base. Therefore, a prompt message indicating that the query failed can be output to inform the user that the query failed, so that the user can change the query statement or terminate the query, which can improve the user experience.

[0201] Exemplary media

[0202] After introducing the methods of exemplary embodiments of this disclosure, the following references are made. Figure 3 The storage medium of the exemplary embodiments of this disclosure will be described.

[0203] refer to Figure 3 As shown, the storage medium 30 stores a program product for implementing the above-described method according to embodiments of the present disclosure. This program product may be a portable compact disc read-only memory (CD-ROM) and includes computer-executable instructions for causing a computing device to execute the question-and-answer matching method provided in this disclosure. However, the program product of this disclosure is not limited thereto.

[0204] The program product may employ any combination of one or more readable media. A readable media may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0205] A readable signal medium may include data signals propagated in baseband or as part of a carrier wave, carrying computer-executed instructions. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium.

[0206] Computer-executable instructions for performing the operations disclosed herein can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The computer-executable instructions can be executed entirely on the user's computing device, partially on the user's computing device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN).

[0207] Exemplary device

[0208] Having introduced the medium of exemplary embodiments of this disclosure, the following references are made to... Figure 4 The question-and-answer matching apparatus of the exemplary embodiments of this disclosure is described to implement the method in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.

[0209] Figure 4 This is a schematic diagram of the question-and-answer matching device according to an embodiment of the present disclosure. Figure 4 In this context, the question-and-answer matching device 400 includes:

[0210] The acquisition module 401 is used to acquire the query statement and the target statement. The query statement is the statement entered by the user, and the target statement is the statement in the FAQ knowledge base.

[0211] The first determining module 402 is used to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement;

[0212] The second determining module 403 is used to determine the similarity between the query statement and the target statement based on the gravitational norm;

[0213] Output module 404 is used to determine the answer corresponding to the target statement as the target answer of the query statement in response to the similarity reaching a preset condition, and output the target answer. The preset conditions include that the similarity is greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base.

[0214] Optionally, the question-and-answer matching device 400 further includes: a processing module, configured to perform the following steps before determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement: performing word segmentation on the query statement to obtain at least one first word; performing encoding on each of the at least one first word to obtain a first word vector, the first word vector including a third word vector corresponding to each first word; performing word segmentation on the target statement to obtain at least one second word; and performing encoding on each of the at least one second word to obtain a second word vector, the second word vector including a fourth word vector corresponding to each second word.

[0215] Optionally, the first determining module 402 is used to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement through the following steps: for each third word vector in the first word vector, determine the first gravitational force between the third word vector and all fourth word vectors in the second word vector; obtain the sum of the first gravitational forces to obtain the second gravitational force, which is used to represent the gravitational force of the query statement on the target statement; and determine the magnitude of the gravitational force of the second gravitational force as the gravitational norm.

[0216] Optionally, the first determining module 402 is used to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement through the following steps: for each fourth word vector in the second word vector, determine the third gravitational force between the fourth word vector and all third word vectors in the first word vector; obtain the sum of the third gravitational forces to obtain the fourth gravitational force, which is used to represent the gravitational force exerted on the target statement by the query statement; determine the magnitude of the gravitational force of the fourth gravitational force as the gravitational norm; wherein the magnitudes of the second gravitational force and the fourth gravitational force are the same.

[0217] Optionally, the first determining module 402 is further configured to: obtain the first norm of the third word vector, the second norm of the fourth word vector, the distance between the third word vector and the fourth word vector, and the unit vector pointing from the third word vector to the fourth word vector before determining the first attraction between the third word vector and all the fourth word vectors in the second word vector; determine the fifth attraction between the third word vector and each of the fourth word vectors based on the first norm, the second norm, the distance and the unit vector; and determine the sum of all the fifth attraction as the first attraction.

[0218] Optionally, the first determining module 402 is used to obtain the distance between the third word vector and the fourth word vector through the following steps: determining the dot product of the third word vector and the fourth word vector; determining the distance based on a preset similarity coefficient, according to the first norm, the second norm and the dot product.

[0219] Optionally, the second determining module 403 is used to determine the similarity between the query statement and the target statement based on the gravity norm through the following steps: determining the gravity norm as the similarity.

[0220] Optionally, the output module 404 is also configured to output a prompt message indicating that the query failed in response to the similarity not meeting the preset conditions.

[0221] Exemplary computing device

[0222] Having described the methods, media, and apparatus of exemplary embodiments of this disclosure, the following references... Figure 5 A computing device according to an exemplary embodiment of the present disclosure will be described.

[0223] Figure 5 The computing device 50 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0224] Figure 5 This is a schematic diagram of the structure of a computing device according to an embodiment of the present disclosure, such as... Figure 5 As shown, the computing device 50 is presented in the form of a general-purpose computing device. The components of the computing device 50 may include, but are not limited to: at least one processing unit 501, at least one storage unit 502, and a bus 503 connecting different system components (including the processing unit 501 and the storage unit 502). The at least one storage unit 502 stores computer-executable instructions; the at least one processing unit 501 includes a processor that executes the computer-executable instructions to implement the methods described above.

[0225] Bus 503 includes a data bus, a control bus, and an address bus.

[0226] Storage unit 502 may include readable media in the form of volatile memory, such as random access memory (RAM) 5021 and / or cache memory 5022, and may further include readable media in the form of non-volatile memory, such as read-only memory (ROM) 5023.

[0227] Storage unit 502 may also include a program / utility 5025 having a set (at least one) program module 5024, such program module 5024 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0228] The computing device 50 can also communicate with one or more external devices 504 (e.g., keyboard, pointing device, etc.). This communication can be performed via the input / output (I / O) interface 505. Furthermore, the computing device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 506. Figure 5 As shown, network adapter 506 communicates with other modules of computing device 50 via bus 503. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with computing device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0229] It should be noted that although several units / modules or sub-units / modules of the question-and-answer matching device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.

[0230] Furthermore, although the operations of the methods disclosed herein are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all of the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0231] While the spirit and principles of this disclosure have been described with reference to several specific embodiments, it should be understood that this disclosure is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for convenience of expression. This disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims

1. A question-answering matching method, comprising: Obtain the query statement and the target statement, wherein the query statement is the statement entered by the user and the target statement is the statement in the FAQ knowledge base; Determine the gravitational norms of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement; Based on the gravity norm, determine the similarity between the query statement and the target statement; In response to the similarity reaching a preset condition, the answer corresponding to the target statement is determined as the target answer of the query statement, and the target answer is output. The preset condition includes that the similarity is greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base. Before determining the gravitational norms of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement, the method further includes: The query statement is segmented to obtain at least one first word; Encode each of the at least one first words to obtain the first word vector, wherein the first word vector includes the third word vector corresponding to each first word; The target statement is segmented to obtain at least one second word; Encode each of the at least one second word to obtain a second word vector, wherein the second word vector includes a fourth word vector corresponding to each second word; Determining the gravitational norms of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: For each third word vector in the first word vector, obtain the first norm of the third word vector, the second norm of the fourth word vector, the distance between the third word vector and the fourth word vector, and the unit vector from the third word vector to the fourth word vector; Based on the first norm, the second norm, the distance, and the unit vector, a fifth attraction is determined between the third word vector and each of the fourth word vectors; The sum of all fifth gravitational forces is determined as the first gravitational force; The sum of the first gravitational forces is obtained to obtain the second gravitational force, which is used to represent the gravitational force exerted by the target statement on the query statement; The magnitude of the second gravitational force is determined as the gravitational norm.

2. The question-answering matching method according to claim 1, wherein determining the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement includes: For each fourth word vector in the second word vector, determine the third attraction between the fourth word vector and all third word vectors in the first word vector; The sum of the third gravitational forces is obtained to obtain the fourth gravitational force, which is used to represent the gravitational force exerted on the target statement by the query statement; The magnitude of the fourth gravitational force is defined as the gravitational norm. The second gravitational force and the fourth gravitational force have the same gravitational force.

3. The question-answering matching method according to claim 1, wherein obtaining the distance between the third word vector and the fourth word vector includes: Determine the dot product of the third word vector and the fourth word vector; The distance is determined based on a preset similarity coefficient, the first norm, the second norm, and the dot product.

4. The question-answering matching method according to any one of claims 1 to 3, wherein determining the similarity between the query statement and the target statement based on the gravitational norm comprises: The gravitational norm is determined as the similarity.

5. The question-answering matching method according to any one of claims 1 to 3, further comprising: In response to the similarity not meeting the preset condition, a prompt message indicating query failure is output.

6. A medium storing computer-executable instructions, which, when executed by a processor, are used to implement the question-and-answer matching method as described in any one of claims 1 to 5.

7. A question-and-answer matching device, comprising: The acquisition module is used to acquire the query statement and the target statement, wherein the query statement is the statement entered by the user and the target statement is the statement in the FAQ knowledge base; The first determining module is used to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement; The second determining module is used to determine the similarity between the query statement and the target statement based on the gravity norm; An output module is used to determine the answer corresponding to the target statement as the target answer of the query statement in response to the similarity reaching a preset condition, and output the target answer. The preset condition includes that the similarity is greater than or equal to a preset value, and the similarity is the highest value among the similarities between the query statement and all statements in the FAQ knowledge base. The processing module is configured to perform the following steps before determining the gravitational norms of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement: The query statement is segmented to obtain at least one first word; Encode each of the at least one first words to obtain the first word vector, wherein the first word vector includes the third word vector corresponding to each first word; The target statement is segmented to obtain at least one second word; Encode each of the at least one second word to obtain a second word vector, wherein the second word vector includes a fourth word vector corresponding to each second word; The first determining module is configured to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement through the following steps: For each third word vector in the first word vector, obtain the first norm of the third word vector, the second norm of the fourth word vector, the distance between the third word vector and the fourth word vector, and the unit vector from the third word vector to the fourth word vector; Based on the first norm, the second norm, the distance, and the unit vector, a fifth attraction is determined between the third word vector and each of the fourth word vectors; The sum of all fifth gravitational forces is determined as the first gravitational force; The sum of the first gravitational forces is obtained to obtain the second gravitational force, which is used to represent the gravitational force exerted by the target statement on the query statement; The magnitude of the second gravitational force is determined as the gravitational norm.

8. The question-answering matching device according to claim 7, wherein the first determining module is configured to determine the gravitational norm of the query statement and the target statement based on the first word vector of the query statement and the second word vector of the target statement through the following steps: For each fourth word vector in the second word vector, determine the third attraction between the fourth word vector and all third word vectors in the first word vector; The sum of the third gravitational forces is obtained to obtain the fourth gravitational force, which is used to represent the gravitational force exerted on the target statement by the query statement; The magnitude of the fourth gravitational force is defined as the gravitational norm. in, The second gravitational force is the same as the fourth gravitational force.

9. The question-answering matching device according to claim 7, wherein the first determining module is configured to obtain the distance between the third word vector and the fourth word vector through the following steps: Determine the dot product of the third word vector and the fourth word vector; The distance is determined based on a preset similarity coefficient, the first norm, the second norm, and the dot product.

10. The question-answering matching apparatus according to any one of claims 7 to 9, wherein the second determining module is configured to determine the similarity between the query statement and the target statement based on the gravitational norm through the following steps: The gravitational norm is determined as the similarity.

11. The question-and-answer matching apparatus according to any one of claims 7 to 9, wherein the output module is further configured to output a prompt message indicating query failure in response to the similarity not meeting the preset condition.

12. A computing device, comprising: A processor, and a memory connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the question-and-answer matching method as described in any one of claims 1 to 6.