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

By determining the question text vector and using random partitioning and similarity filtering methods to select target word vectors, the problem of low diversity of response information is solved, thereby improving the diversity and accuracy of response information.

CN116795966BActive Publication Date: 2026-06-05INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-06-28
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, the diversity of response information corresponding to question texts is not high, resulting in a lack of diversity and interest in the response information.

Method used

By determining the question text vector and repeating the operation until N target word vectors are obtained, and then using random partitioning and similarity filtering methods, target word vectors are selected from a preset set of word vectors to improve the diversity and accuracy of the response information.

Benefits of technology

It improves the diversity and accuracy of responses, enhances the interest and uniqueness of responses, and reduces the probability of word repetition in responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116795966B_ABST
    Figure CN116795966B_ABST
Patent Text Reader

Abstract

The present disclosure provides a question and answer method, device, equipment and storage medium, which can be applied to the field of artificial intelligence and finance. The method comprises: determining a question text vector; determining N target word vectors; determining answer information according to the N target word vectors; wherein, the N target word vectors are determined by repeatedly performing the following operations until the N target word vectors are obtained: under the condition that 1 < n ≤ N, determining an n th first candidate word vector set from a preset word vector set according to the question text vector and the first n-1 target word vectors in the preset word vector set; randomly dividing the n th first candidate word vector set to obtain a plurality of n th first candidate word vector subsets; determining an n th second candidate word vector set from the n th first candidate word vector subsets according to the n th first candidate word vector set, the question text vector and the first n-1 target word vectors in the preset word vector set; and determining an n th target word vector according to the n th second candidate word vector set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of artificial intelligence and financial technology, and in particular to a question-answering method, apparatus, electronic device and storage medium. Background Technology

[0002] With the development of information technology and the increasing demands for platform services, automated question answering has been applied in multiple industries. For example, text generation methods can be used to process question text and generate response information.

[0003] In the process of developing this disclosure, it was found that the diversity of the response information corresponding to the question text was not high. Summary of the Invention

[0004] In view of the above issues, this disclosure provides question-and-answer methods, apparatus, electronic devices, storage media, and program products.

[0005] According to the first aspect of this disclosure, a question-and-answer method is provided, comprising:

[0006] Determine the question text vector;

[0007] Determine N target word vectors, where N is an integer greater than 1; and

[0008] Based on the above N target word vectors, determine the response information corresponding to the above question text;

[0009] The process of determining N target word vectors involves repeatedly performing the following operations until the N target word vectors are obtained:

[0010] In the case that 1 < n ≤ N,

[0011] Based on the above-mentioned question text vector and the first n-1 target word vectors in the preset word vector set, determine the nth first candidate word vector set from the above-mentioned preset word vector set;

[0012] The above nth first candidate word vector set is randomly divided to obtain multiple nth first candidate word vector subsets;

[0013] Based on the aforementioned first candidate word vector set (nth digit), the aforementioned question text vector, and the first n-1 target word vectors in the aforementioned preset word vector set, determine the second candidate word vector set (nth digit) from the aforementioned first candidate word vector set (nth digit); and

[0014] Based on the above-mentioned second candidate word vector set (n), determine the target word vector (n).

[0015] According to embodiments of this disclosure, determining the nth first candidate word vector set from the preset word vector set based on the aforementioned problem text vector and the first n-1 target word vectors in the preset word vector set includes:

[0016] Based on the aforementioned question text vector and the first n-1 target word vectors in the aforementioned preset word vector set, the nth probability set is determined, wherein the probability of the nth target word vector included in the nth probability set represents the probability that the preset word vector included in the aforementioned preset word vector set is determined to be the nth target word vector; and

[0017] Based on the aforementioned nth probability set, the aforementioned nth first candidate word vector set is determined from the aforementioned preset word vector set.

[0018] According to embodiments of this disclosure, determining the nth second candidate word vector set from the nth first candidate word vector set based on the nth first candidate word vector set, the question text vector, and the first n-1 target word vectors in the preset word vector set includes:

[0019] The similarity between the nth candidate word vector set and the (n-1)th fused word vector is determined, resulting in multiple similarity scores. The (n-1)th fused word vector is determined based on the question text vector and the (n-1)th target word vector.

[0020] Based on the above multiple similarities, the above-mentioned second candidate word vector set is determined from the above-mentioned first candidate word vector set.

[0021] According to embodiments of this disclosure, determining the nth second candidate word vector set from the plurality of nth first candidate word vector subsets based on the plurality of similarities includes:

[0022] Based on at least one similarity to each of the aforementioned plurality of nth first candidate word vector subsets, the aforementioned nth second candidate word vector set is determined from the aforementioned plurality of nth first candidate word vector subsets, wherein the aforementioned nth second candidate word vector set is the subset with the smallest number of word vectors included in the aforementioned plurality of nth first candidate word vector subsets, and the sum of similarities with the aforementioned nth second candidate word vector set is greater than or equal to a preset similarity threshold, and the sum of similarities with the aforementioned nth second candidate word vector set is determined based on at least one similarity to the aforementioned plurality of nth first candidate word vector subsets.

[0023] According to embodiments of this disclosure, determining the nth target word vector based on the aforementioned nth second candidate word vector set includes:

[0024] Based on at least one similarity among the aforementioned multiple similarities corresponding to the aforementioned nth second candidate word vector set and the probability of at least one nth target word vector in the aforementioned nth probability set corresponding to the aforementioned nth second candidate word vector set, at least one nth matching degree corresponding to the aforementioned nth second candidate word vector set is determined; and

[0025] The nth target word vector is determined from the nth second candidate word vector set based on at least one nth matching degree corresponding to the nth second candidate word vector set.

[0026] According to embodiments of this disclosure, determining at least one nth matching degree corresponding to the nth second candidate word vector set based on at least one similarity among the plurality of similarities corresponding to the nth second candidate word vector set and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set includes:

[0027] For the second candidate word vector of the nth target word vector in the aforementioned nth second candidate word vector set, determine the difference between the similarity to the second candidate word vector of the aforementioned nth target word vector and the probability of the nth target word vector corresponding to the second candidate word vector of the aforementioned nth target word vector, and obtain the difference corresponding to the second candidate word vector of the aforementioned nth target word vector; and

[0028] The difference between the second candidate word vector and the target word vector is determined as the matching degree between the second candidate word vector and the target word vector.

[0029] According to embodiments of this disclosure, determining the nth first candidate word vector set from the preset word vector set based on the nth probability set includes:

[0030] The probabilities of at least one nth target word vector included in the above nth probability set are sorted in descending order to obtain sorting information;

[0031] Based on the sorting information, determine the probabilities of the top M nth target word vectors from the aforementioned nth probability set, where M is an integer greater than 1; and

[0032] The word vectors corresponding to the probabilities of the top M nth target word vectors are determined as the word vectors in the aforementioned first candidate word vector set.

[0033] According to embodiments of this disclosure, determining the nth probability set based on the question text vector and the first n-1 target word vectors in the preset word vector set includes:

[0034] The above-mentioned problem text vector and the first n-1 target word vectors in the above-mentioned preset word vector set are decoded to obtain the above-mentioned nth probability set.

[0035] According to embodiments of this disclosure, the above-described determination of the problem text vector includes:

[0036] The above-mentioned problem text is preprocessed to obtain the processed problem text; and

[0037] Feature extraction is performed on the text of the above-mentioned problem to obtain the text vector of the problem.

[0038] A second aspect of this disclosure provides a question-and-answer device, comprising:

[0039] The first determining module is used to determine the question text vector of the question text;

[0040] The second determining module is used to determine N target word vectors, where N is an integer greater than 1;

[0041] The third determining module is used to determine the response information corresponding to the above question text based on the above N target word vectors;

[0042] The process of determining N target word vectors involves repeatedly performing the following operations until the N target word vectors are obtained:

[0043] In the case that 1 < n ≤ N,

[0044] Based on the above-mentioned question text vector and the first n-1 target word vectors in the preset word vector set, determine the nth first candidate word vector set from the above-mentioned preset word vector set;

[0045] The above nth first candidate word vector set is randomly divided to obtain multiple nth first candidate word vector subsets;

[0046] Based on the aforementioned first candidate word vector set (nth digit), the aforementioned question text vector, and the first n-1 target word vectors in the aforementioned preset word vector set, determine the second candidate word vector set (nth digit) from the aforementioned first candidate word vector set (nth digit); and

[0047] Based on the above-mentioned second candidate word vector set (n), determine the target word vector (n).

[0048] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the method described above.

[0049] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the methods described above.

[0050] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0051] According to the technical solution of this disclosure, since multiple subsets of the nth first candidate word vectors are obtained by randomly partitioning the nth first candidate word vector set, and the nth second candidate word vector set is determined from multiple subsets of the nth first candidate word vectors, the nth second candidate word vector set has multiple possibilities. Based on this, since the response information of the question text is determined based on N target word vectors, and the nth target word vector is determined based on the nth second candidate word vector set, the diversity of the response information is improved. Furthermore, since the nth target word vector set is obtained through two selections, the accuracy of the target word vectors is improved, thereby improving the accuracy based on the response information. Attached Figure Description

[0052] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0053] Figure 1 The illustrations depict application scenarios of question-and-answer methods, apparatuses, electronic devices, media, and program products according to embodiments of the present disclosure.

[0054] Figure 2 A flowchart illustrating a question-and-answer method according to an embodiment of the present disclosure is shown schematically.

[0055] Figure 3 A flowchart illustrating a question-answering method using a natural language processing model according to an embodiment of the present disclosure is shown.

[0056] Figure 4 A block diagram of a question-and-answer device according to an embodiment of the present disclosure is shown schematically.

[0057] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing a question-and-answer method according to an embodiment of the present disclosure. Detailed Implementation

[0058] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0059] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0060] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0061] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0062] In the embodiments disclosed herein, the collection, updating, analysis, processing, use, transmission, provision, disclosure, and storage of information (e.g., user personal information and user-provided Q&A information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures have been taken to prevent unauthorized access to user personal information and user-provided Q&A information, and to safeguard the security of user personal information and user-provided Q&A information, as well as network security and national security.

[0063] In the embodiments of this disclosure, when information is to be displayed, the information to be displayed can be desensitized by methods including de-identification or anonymization to protect information security.

[0064] In the embodiments disclosed herein, user authorization or consent is obtained before acquiring or collecting user personal information and user-provided Q&A information.

[0065] Text generation methods are needed in many application areas. They can improve service capabilities, drive traffic to the server, and are a crucial supporting force for business development.

[0066] The response information generated by text generation methods is deterministic, meaning that only fixed response information can be generated, which affects the diversity of response information.

[0067] In view of the above, embodiments of this disclosure provide a question-answering method, apparatus, electronic device, storage medium, and program product. The question-answering method includes: determining a question text vector; determining N target word vectors, where N is an integer greater than 1; determining response information corresponding to the question text based on the N target word vectors; wherein determining the N target word vectors includes repeatedly performing the following operations until N target word vectors are obtained: when 1 < n ≤ N, determining a first candidate word vector set n from a preset word vector set based on the question text vector and the first n-1 target word vectors in the preset word vector set; determining a second candidate word vector set n from the first candidate word vector set n based on the first candidate word vector set n, the question text vector, and the first n-1 target word vectors in the preset word vector set; and determining the nth target word vector based on the second candidate word vector set n.

[0068] Figure 1 The illustrations depict application scenarios of question-and-answer methods, apparatuses, electronic devices, media, and program products according to embodiments of the present disclosure.

[0069] It is important to note that Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0070] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105.

[0071] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0072] Network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0073] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive replies or send questions. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platforms, etc. (these are just examples). All these communication client applications can engage in question-and-answer dialogues via network 104 to interact with server 105.

[0074] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). It can also be various cloud servers, without limitation here. Server 105 can analyze and process information such as received user requests, and feed back the processing results (such as web pages or information obtained or generated based on user question and answer requests) to the terminal devices.

[0075] It should be noted that the question-and-answer method provided in this embodiment can generally be executed by server 105. Correspondingly, the question-and-answer device provided in this embodiment can generally be located in server 105. The question-and-answer method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the question-and-answer device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0076] For example, a user can initiate a dialogue request through any one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 (or multiple devices simultaneously) (e.g., the first terminal device 101, but not limited to this). The first terminal device 101 responds to the dialogue request and determines the question text vector corresponding to the question text in the dialogue request; the operation is repeated until N target word vectors are obtained: when 1 < n ≤ N, based on the question text vector and the first n-1 target word vectors in the preset word vector set, the nth first candidate word vector set is determined from the preset word vector set; based on the nth first candidate word vector set, the question text vector, and the first n-1 target word vectors in the preset word vector set, the nth second candidate word vector set is determined from the nth first candidate word vector set; based on the nth second candidate word vector set, the nth target word vector is determined, where N is an integer greater than 1; based on the N target word vectors, the response information corresponding to the question text is determined.

[0077] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0078] The following will be based on Figure 1 The described scene, through Figures 2-4 The question-and-answer method of the disclosed embodiments will be described in detail.

[0079] Figure 2 A flowchart illustrating a question-and-answer method according to an embodiment of the present disclosure is shown schematically.

[0080] like Figure 2 As shown, the question and answer process in this embodiment includes operations S210 to S230.

[0081] In operation S210, the problem text vector of the problem text is determined.

[0082] In operation S220, N target word vectors are determined, where N is an integer greater than 1. Determining the N target word vectors includes repeatedly performing the following operations until N target word vectors are obtained: If 1 < n ≤ N, based on the question text vector and the first n-1 target word vectors in the preset word vector set, determine the nth first candidate word vector set from the preset word vector set. Randomly partition the nth first candidate word vector set to obtain multiple nth first candidate word vector subsets. Based on the nth first candidate word vector set, the question text vector, and the first n-1 target word vectors in the preset word vector set, determine the nth second candidate word vector set from the nth first candidate word vector set; based on the nth second candidate word vector set, determine the nth target word vector.

[0083] In operation S230, the response information corresponding to the question text is determined based on N target word vectors.

[0084] According to embodiments of this disclosure, the question text can be text obtained by processing dialogue information. The dialogue information can be obtained based on at least one of historical dialogue information and real-time dialogue information. Historical dialogue information can refer to dialogue information corresponding to a historical time period. Real-time dialogue information can refer to dialogue information corresponding to the current time period. Historical dialogue information can include historical domain dialogue information corresponding to at least one application domain. The forms of historical dialogue information and real-time dialogue information can include at least one of the following: images, audio, and text.

[0085] For example, in the application field of finance, historical financial dialogue information corresponding to the financial sector can be obtained. Based on this historical dialogue information, historical financial terminology is determined. Then, dialogue information is extracted from the historical financial dialogue information based on this terminology. This makes the pre-defined word vector set obtained based on the dialogue information more consistent with the actual situation in the financial field.

[0086] According to embodiments of this disclosure, a response text can also be obtained based on the dialogue information. Processing the response text can yield a preset word vector set, which includes multiple vectors representing the response text corresponding to the question text.

[0087] According to embodiments of this disclosure, feature extraction can be performed on the question text to obtain a question text vector, which includes a vector representing a query request. Semantic information corresponding to the question text vector can be obtained by analyzing the question text vector; semantic information corresponding to the first n-1 target word vectors in the preset word vector set can be obtained by analyzing the first n-1 target word vectors in the preset word vector set; and then, based on the semantic information of the question text vector and the first n-1 target word vectors in the preset word vector set, a first candidate word vector set (nth rank) is determined from the preset word vector set.

[0088] According to the embodiments of this disclosure, by processing the question text vector and the first n-1 target word vectors in the preset word vector set, the semantic correlation degree between each vector in the preset word vector set and the contextual semantic correlation degree between the question text vector and the first n-1 target word vectors in the preset word vector set is obtained, and the first candidate word vector set n is determined from the preset word vector set based on the corresponding semantic correlation degree.

[0089] According to embodiments of this disclosure, the nth first candidate word vector set is randomly divided. For example, the word vectors included in the nth first candidate word vector set can be randomly combined using a method similar to mathematical operations to obtain multiple nth first candidate word vector subsets.

[0090] According to the embodiments of this disclosure, the vectors included in the nth first candidate word vector set are closely related to the contextual semantics of the question text vector and the first n-1 target word vectors in the preset word vector set. By filtering the nth first candidate word vector set, the final answer information can be matched with the semantics of the question in terms of content.

[0091] According to the embodiments of this disclosure, after obtaining the nth first candidate word vector set, the nth second candidate word vector set can be determined from multiple randomly divided subsets of the nth first candidate word vector set based on the similarity relationship between the nth first candidate word vector set and the question text vector and the first n-1 target word vectors in the preset word vector set. By filtering the nth second candidate word vector set, the final nth target word vector is closely related to the contextual semantics of the question text vector and the first n-1 target word vectors in the preset word vector set, while maintaining a certain difference from the question text vector and the first n-1 target word vectors in the preset word vector set. This reduces the probability of word repetition in the response information. Through two filtering processes, the selectivity of the nth target word vector is increased, enhancing the diversity of the nth target word vector, thereby improving the interest, uniqueness, and diversity of the response information.

[0092] According to embodiments of this disclosure, since multiple subsets of the nth first candidate word vectors are obtained by randomly partitioning the nth first candidate word vector set, and the nth second candidate word vector set is determined from multiple subsets of the nth first candidate word vector set, the nth second candidate word vector set has multiple possibilities. Based on this, since the response information to the question text is determined based on N target word vectors, and the nth target word vector is determined based on the nth second candidate word vector set, the diversity of the response information is improved. Furthermore, since the nth target word vector set is obtained through two selections, the accuracy of the target word vectors is improved, thereby improving the accuracy of the response information.

[0093] According to an embodiment of this disclosure, when performing operation S210 to determine the problem text vector of the problem text, the following operations may be included.

[0094] The problem text is preprocessed to obtain the processed problem text. Feature extraction is then performed on the processed problem text to obtain the problem text vector.

[0095] According to embodiments of this disclosure, question text can be extracted from different types of dialogue information, such as audio, video, images, and text.

[0096] According to embodiments of this disclosure, after obtaining the question text, special characters can be removed to clean the question text. By cleaning the question text and removing unnecessary special characters, the remaining phrases within the question text are made to match the information in the training set of the natural language processing model as closely as possible without affecting semantics. This reduces the risk that the natural language processing model cannot obtain corresponding response information because the information in the question text is not included in the training set, i.e., it reduces the risk of out-of-vocabulary (OOV) words in the model. For example, when cleaning the question text, special characters such as "*" and "#" that do not affect readability and have no semantic meaning, but may not be in the training set of the natural language processing model, are removed, thus reducing the risk of out-of-vocabulary (OOV) words in the model.

[0097] According to embodiments of this disclosure, the natural language processing model has certain requirements on the format of the input question text, and can adaptively convert the format of the question text so that the natural language processing model can perform subsequent operations.

[0098] According to embodiments of this disclosure, the natural language processing model can be GPT-2 (Generative Pre-trained Transformer-2). The GPT-2 model performs format conversion on the cleaned question text. Each dialogue segment is obtained, which can consist of 5-6 lines of question-and-answer dialogue. This dialogue is then processed as follows: each segment begins with [cls], and adjacent sentences are separated by [sep]. Ultimately, each dialogue segment forms one input question text.

[0099] According to an embodiment of this disclosure, for example, the dialogue information before format conversion is: Are you feeling better today? \r\nIt's getting worse every day\r\nMedication isn't working, go get an injection. Don't delay. The dialogue information after format conversion is: [cls]Are you feeling better today? [sep]It's getting worse every day[sep]Medication isn't working, go get an injection[sep]Don't delay. This question text was input into GPT-2 for subsequent operations.

[0100] According to embodiments of this disclosure, after format conversion of the dialogue information, Chinese characters need to be converted into corresponding numbers. This can be done using the encoder built into the GPT-2 model, or using the BERT encoder. Given that GPT-2 encoding can mitigate the probability of OOV (Out of Context) errors, the GPT-2 encoder is used. The encoded dialogue information can then be batch-fed into the GPT-2 model to obtain question text vectors corresponding to the question texts.

[0101] According to an embodiment of this disclosure, when the first target word vector is determined based on the question text vector, a mapping can be performed on the question text vector to obtain a first related vector that is associated with the question text vector. For each preset word vector in the preset word vector set, the similarity between the preset word vector and the first related vector is determined. Based on the similarity between the preset word vector and the first related vector, the first target word vector determined by the question text vector is obtained.

[0102] According to an embodiment of this disclosure, after determining the first target word vector, the nth target word vector can be determined jointly based on the question text vector and the first target word vector.

[0103] According to an embodiment of this disclosure, when performing operation S220 to determine the nth first candidate word vector set from the preset word vector set based on the question text vector and the first n-1 target word vectors in the preset word vector set, the following operations may be included.

[0104] Based on the question text vector and the first n-1 target word vectors in the preset word vector set, determine the nth probability set, where the probability of the nth target word vector included in the nth probability set represents the probability that the preset word vectors included in the preset word vector set are determined as the nth target word vector; based on the nth probability set, determine the nth first candidate word vector set from the preset word vector set.

[0105] According to embodiments of this disclosure, the nth probability set includes the probabilities corresponding to preset word vectors. Based on the probabilities, the degree of contextual semantic association between the preset word vectors, the question text vectors, and the first n-1 target word vectors can be obtained.

[0106] According to the embodiments of this disclosure, by filtering the probabilities in the nth probability set, preset word vectors that are closely related to the contextual semantics of the question text vector and the first n-1 target word vectors are selected to form the nth first candidate word vector set.

[0107] According to the embodiments of this disclosure, the nth first candidate word vector set is determined from a preset word vector set based on the degree of contextual semantic association with the question text vector and the first n-1 target word vectors. This ensures that the nth target word vector is obtained from the nth first candidate word vector set with a high degree of contextual semantic association with the question text vector and the first n-1 target word vectors, thus guaranteeing the existence of a semantic correspondence between the response information and the question text.

[0108] According to an embodiment of this disclosure, when determining the nth probability set, the nth probability set can be obtained by decoding the question text vector and the first n-1 target word vectors in a preset word vector set.

[0109] According to embodiments of this disclosure, the question text vector and the first n-1 target word vectors in a preset word vector set can be concatenated before decoding, and the concatenated result can be used as a fused word vector for decoding.

[0110] According to the embodiments of this disclosure, the first n-1 target word vectors are arranged sequentially after the question text vectors according to the order in which they were obtained. If the overall length of the sorted question text vectors and the first n-1 target word vectors does not meet the preset condition, zero vectors are added after the n-1 target word vectors so that the sorted question text vectors and the first n-1 target word vectors reach the preset length, thereby obtaining the n-1th fused word vector.

[0111] According to the embodiments of this disclosure, decoding is performed by mapping based on the fusion vector to obtain a second related vector that is associated with the fusion word vector. The vector similarity between the second related vector associated with the fusion word vector and the preset word vectors included in the preset word vector set is compared. The greater the vector similarity between the preset word vector and the second related vector, the greater the probability that the preset word vectors included in the preset word vector set are determined as the nth target word vector.

[0112] According to embodiments of this disclosure, for each preset word vector in a preset word vector set, the similarity between the preset word vector and a second related vector is determined. Based on the similarity between the preset word vector and the second related vector, the probability of the nth target word vector corresponding to the preset word vector is obtained, thereby determining the nth probability set.

[0113] According to an embodiment of this disclosure, determining the nth first candidate word vector set from a preset word vector set based on the nth probability set may include the following operations.

[0114] The probabilities of at least one nth target word vector in the nth probability set are sorted in descending order to obtain sorting information. Based on the sorting information, the probabilities of the top M nth target word vectors in the nth probability set are determined, where M is an integer greater than 1. The word vectors corresponding to the probabilities of the top M nth target word vectors are determined as word vectors in the first candidate word vector set of the nth probability set.

[0115] According to embodiments of this disclosure, by quantifying or normalizing the probabilities of all nth target word vectors included in the nth probability set, the specific numerical values ​​of the probabilities of the corresponding nth target word vectors in the preset word vector set are obtained. The specific numerical values ​​of the probabilities of the nth target word vectors are then sorted from largest to smallest to obtain sorting information. Finally, based on the specific numerical values ​​of the probabilities of the nth target word vectors, the top M word vectors with the largest probability values ​​are selected to form the first candidate word vector set for the nth term.

[0116] According to the embodiments of this disclosure, by comparing the fusion vector obtained by the problem text vector and the first n-1 target word vectors in the preset word vector set with the similarity of the fusion vector to each preset word vector included in the preset word vector set, the first candidate word vector set with a higher probability of obtaining the nth target word vector, that is, a higher probability of being semantically related to the context of the fusion vector, is selected.

[0117] According to an embodiment of this disclosure, the operation S220, which determines the nth second candidate word vector set from the nth first candidate word vector set based on the nth first candidate word vector set, the question text vector, and the first n-1 target word vectors in the preset word vector set, may include the following operations.

[0118] The similarity between the nth candidate word vector set and the (n-1)th fused word vector is determined, resulting in multiple similarity scores. The (n-1)th fused word vector is determined based on the question text vector and the (n-1)th target word vector. Based on these multiple similarity scores, the nth candidate word vector set is determined from the nth candidate word vector set.

[0119] According to embodiments of this disclosure, a second candidate word vector set is determined from the first candidate word vector set n by comparing the similarity relationships between the first candidate word vector set n and the (n-1)th fused word vector. The vectors in the first candidate word vector set n are those with a relatively close semantic relationship to the question text vector and the first n-1 target word vectors, i.e., those with a relatively close semantic relationship to the (n-1)th fused word vector. Therefore, the word vectors in the second candidate word vector set n are simultaneously related to the semantic relationship and similarity between the second candidate word vector set n and the (n-1)th fused word vector.

[0120] According to embodiments of this disclosure, determining a second candidate word vector set from multiple first candidate word vector subsets based on multiple similarities may include the following operations.

[0121] A second candidate word vector set is determined from the multiple first candidate word vector subsets based on at least one similarity score corresponding to each of the multiple first candidate word vector subsets. The second candidate word vector set is the subset with the smallest number of word vectors among the multiple first candidate word vector subsets, and the sum of its similarities with the second candidate word vector set is greater than or equal to a preset similarity threshold. The sum of its similarities with the second candidate word vector set is determined based on at least one similarity score corresponding to each of the multiple first candidate word vector subsets.

[0122] According to the embodiments of this disclosure, since multiple subsets of the nth first candidate word vector set can be obtained by randomly dividing the nth first candidate word vector set, the obtained subset of the nth first candidate word vector set can include any number of word vectors, and the arbitrary number is not greater than the total number of word vectors included in the nth first candidate word vector set.

[0123] According to embodiments of this disclosure, based on the obtained nth probability set, the similarity or sum of similarities of the word vectors included in each nth first candidate word vector subset can be obtained.

[0124] According to embodiments of this disclosure, a second candidate word vector set can be determined from multiple first candidate word vector subsets based on the similarity or sum of similarity of the word vectors included in the nth first candidate word vector subset.

[0125] According to the embodiments of this disclosure, selecting the first candidate word vector subset of the nth generation that has a relatively close semantic relationship with the context of the (n-1)th fused word vector as the second candidate word vector set with the same similarity condition can make the similarity of the nth target word vector determined from the second candidate word vector set of the nth generation meet the preset conditions.

[0126] According to an embodiment of this disclosure, the process of determining the nth target word vector based on the nth second candidate word vector set in the execution of operation S220 may include the following operations.

[0127] Based on at least one similarity score corresponding to the nth second candidate word vector set from multiple similarity scores and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set from the nth probability set, at least one nth matching degree is determined with respect to the nth second candidate word vector set. Based on at least one nth matching degree with respect to the nth second candidate word vector set, the nth target word vector is determined from the nth second candidate word vector set.

[0128] According to embodiments of this disclosure, the nth matching degree of the word vectors included in the nth second candidate word vector set is determined jointly based on the similarity of the word vectors included in the nth second candidate word vector set and the probability of the nth target word vector. This adds the similarity criterion between the word vectors included in the nth second candidate word vector set and the (n-1)th fused word vector, allowing the matching degree to represent a multi-dimensional screening criterion for the word vectors included in the nth second candidate word vector set. In other words, similarity indirectly affects the selection of the nth target word vector.

[0129] According to embodiments of this disclosure, determining at least one nth matching degree corresponding to the nth second candidate word vector set based on at least one similarity among multiple similarities corresponding to the nth second candidate word vector set and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set may include the following operations.

[0130] For the second candidate word vector of the nth target word vector in the second candidate word vector set of the nth target word vector, determine the difference between the similarity to the second candidate word vector of the nth target word vector and the probability of the nth target word vector corresponding to the second candidate word vector of the nth target word vector, and obtain the difference to the second candidate word vector of the nth target word vector; determine the difference to the second candidate word vector of the nth target word vector as the matching degree to the second candidate word vector of the nth target word vector.

[0131] According to the embodiments of this disclosure, in the process of calculating the nth matching degree, when the probability of the nth target word vector corresponding to the nth second candidate word vector is similar, the greater the similarity to the nth second candidate word vector, the smaller the obtained nth matching degree.

[0132] According to the embodiments of this disclosure, the nth target word vector selected based on the nth matching degree is a word vector with a low similarity to the (n-1)th fused word vector among word vectors that have a relatively close semantic relationship with the context of the (n-1)th fused word vector. Thus, the similarity between the target word vectors constituting the response information is controlled, and a certain degree of difference is maintained between the target word vectors, reducing the possibility of repetition between the texts corresponding to the target word vectors. This achieves the suppression of content repetition in the texts corresponding to the target word vectors and solves the problem of phrase repetition that easily occurs in text generation technology.

[0133] Figure 3 A flowchart illustrating a question-answering method using a natural language processing model according to an embodiment of the present disclosure is shown.

[0134] like Figure 3 As shown, the question text vector can be input into GPT-2. The question text vector can be a vector obtained after preprocessing and feature extraction of the question text.

[0135] According to embodiments of this disclosure, the nth probability set is obtained by performing preliminary calculations on the text vector of the question through a pre-trained layer.

[0136] According to embodiments of this disclosure, the pre-training layer may include multiple extraction layers. Each extraction layer includes a multi-head attention (MHA) layer and a feedforward network (FFN) layer. The MHA layer can be used to extract features from the fused vector. The FFN layer can be used to perform linear transformations on the vectors extracted by the MHA layer and the corresponding residuals to obtain deeper features corresponding to the fused vector. These deeper features are then compared with word vectors in a preset word vector set to obtain the probability that a word vector in the preset word vector set is identified as the nth target word vector. A first normalization layer can be set before the MHA layer, and a second normalization layer can be set before the FFN layer. This can effectively mitigate the variance variation between the MHA layer and the FFN layer, thereby reducing the risk of low-gradient vanishing and gradient exploding.

[0137] According to embodiments of this disclosure, for question-and-answer needs in different real-world scenarios, the corresponding question-and-answer information can be preprocessed and feature extracted before being input into GPT-2. After multiple rounds of training, a fully trained GPT-2 model can be obtained.

[0138] According to embodiments of this disclosure, a training epoch threshold or a training loss threshold can be set to gradually adjust the model parameters to the current information content and task type. For example, training can be terminated after 50 epochs, and the model parameters of the pre-trained layer can be obtained based on the model parameters of the GPT-2 model at the 50th epoch. Alternatively, training can be terminated when the final training loss decreases to 2.0, and the model parameters of the pre-trained layer can be obtained based on the corresponding GPT-2 model parameters. The pre-trained layer model is saved, and the output of the last layer of the model is a probability distribution. This model predicts the next word vector based on the input sentence. It can predict the probability that each word vector in the preset word vector set at the current time step t is the nth target word vector by performing predictions on the fused vectors in the vocabulary.

[0139] According to an embodiment of this disclosure, the first candidate word vector set n is determined based on the probability that each word vector in the preset word vector set at the current time step t is the nth target word vector.

[0140] According to embodiments of this disclosure, determining the nth second candidate word vector set from the nth first candidate word vector set based on multiple similarities may include the following operations.

[0141] Multiple subsets of nth first candidate word vectors are determined from the nth first candidate word vector set. Based on at least one similarity score corresponding to each of the multiple nth first candidate word vector subsets, a second set of nth candidate word vectors is determined from the multiple nth first candidate word vector subsets. The second set of nth candidate word vectors is the subset with the smallest number of word vectors among the multiple nth first candidate word vector subsets, and the sum of its similarities with the second set of nth candidate word vectors is greater than or equal to a preset similarity threshold. The sum of its similarities with the second set of nth candidate word vectors is determined based on at least one similarity score corresponding to each of the multiple nth first candidate word vector subsets.

[0142] According to an embodiment of this disclosure, for the word vectors included in the nth first candidate word vector set, a similarity calculation is performed between them and the fused vector to obtain a similarity value, and the nth second candidate word vector set is determined based on the similarity value.

[0143] According to embodiments of this disclosure, the similarity value between the word vectors included in the nth first candidate word vector set and the fused vector can be obtained using the Pearson correlation algorithm.

[0144] According to embodiments of this disclosure, after calculating the similarity between each word vector in the nth first candidate word vector set and each word vector in the previously obtained fusion vector, instead of directly selecting the word vector corresponding to the maximum similarity for subsequent calculations, a kernel sampling algorithm is introduced to select the word vectors in the nth second candidate word vector set.

[0145] According to embodiments of this disclosure, by introducing a kernel sampling algorithm, multiple word vectors with similarity and meeting certain conditions are selected from the nth first candidate word vector set to form the nth second candidate word vector set. This avoids the problem in decoding algorithms where word vectors are only selected based on the maximum similarity value, resulting in the calculations only producing the same word vectors (i.e., the word vector corresponding to the maximum similarity value).

[0146] According to embodiments of this disclosure, a kernel sampling algorithm is introduced, which uses cumulative probability instead of a fixed number of high-probability words. This avoids the problem that different input information corresponds to different numbers of high-probability words, and using a fixed number of words is very likely to cover low-probability words or cause high-probability words to be lost. This indirectly affects the probability of the final candidate words and avoids the problem of word vector duplication.

[0147] According to embodiments of this disclosure, the input question text can be cleaned and format-converted before being fed into the GPT-2 model for prediction. Since it is a generative natural language processing model (GPT-2), decoding is required at each time step. After the cleaned and format-converted question text is input into the GPT-2 model, the output of the last layer is obtained to determine the nth probability set. The nth probability set includes the probability that all word vectors in a preset word vector set become the nth target word vector. After determining the nth probability set, the probabilities are sorted, and k high-probability words are obtained, corresponding to the nth first candidate word vector set.

[0148] According to the embodiments of this disclosure, for the nth first candidate word vector set, feature extraction is performed in the decoding layer of the fine-tuning layer. The feature dimension of the extracted word vector is the same as the feature dimension of the nth first candidate word vector set and the feature dimension of the fused vector. Therefore, the extracted word vector can be directly used to calculate the similarity with the fused vector.

[0149] According to an embodiment of this disclosure, the process of determining the nth target word vector based on the nth second candidate word vector set in the execution of operation S220 may include the following operations.

[0150] Based on at least one similarity to the nth second candidate word vector set from multiple similarity scores and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set, at least one nth matching degree is determined with the nth second candidate word vector set; based on at least one nth matching degree with the nth second candidate word vector set, the nth target word vector is determined from the nth second candidate word vector set.

[0151] According to an embodiment of this disclosure, after obtaining the nth second candidate word vector set, it is necessary to standardize the similarity calculation of the nth second candidate word vector set so that the sum of the similarity of the word vectors in the nth second candidate word vector set after standardization is equal to 1.

[0152] According to embodiments of this disclosure, after similarity calculation, the obtained similarity results are processed by the softmax function according to the row of the nth first candidate word vector set, and then the similarity is sorted. The sorted results are accumulated, and the accumulation stops when the accumulation exceeds a preset similarity threshold p. Then, the nth second candidate word vector set is obtained corresponding to the accumulated similarity. The nth matching degree is calculated on the word vectors of the nth second candidate word vector set, and finally, the nth target word vector is obtained based on the nth matching degree.

[0153] According to embodiments of this disclosure, determining at least one nth matching degree corresponding to the nth second candidate word vector set based on at least one similarity among multiple similarities corresponding to the nth second candidate word vector set and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set may include the following operations.

[0154] For the second candidate word vector of the nth target word vector in the second candidate word vector set, determine the difference between the similarity to the second candidate word vector of the nth target word vector and the probability of the nth target word vector corresponding to the second candidate word vector of the nth target word vector, and obtain the difference to the second candidate word vector of the nth target word vector; determine the difference to the second candidate word vector of the nth target word vector as the matching degree to the second candidate word vector of the nth target word vector.

[0155] It is important to note that when the similarity of the second candidate word vector set is standardized, the probability of the nth target word vector before standardization is still retained. The probability of the nth target word vector is used in the final matching degree calculation, while the standardized value is only used for screening.

[0156] According to an embodiment of this disclosure, the nth matching degree can be represented by the following formula (1).

[0157] (1)

[0158] in, Let n be the matching degree; This is the vector set of the second candidate word of the nth generation; To adjust the parameters; Let be the word vector in the second candidate word vector set at time step t; let be These are the k probability values ​​corresponding to the word vectors in the nth second candidate word vector set, where k is a positive integer; The similarity is the word vector corresponding to the second candidate word vector set of the nth generation. For the standardized output function, the sum of the similarities of the word vectors in the second candidate word vector set of the nth generation is equal to 1 after standardization. This is called nucleus sampling.

[0159] According to an embodiment of this disclosure, when performing a standardized output operation, the sum of the similarities of the word vectors in the nth second candidate word vector set after standardized output is equal to 1, and the position corresponding to each word vector is recorded after standardized output, with ids being the nth position record set.

[0160] According to embodiments of this disclosure, in subsequent calculations, the similarity to the word vectors in the nth second candidate word vector set and the probability of the corresponding nth target word vector can be obtained based on the position of the record in the nth position record set, thereby accelerating the information processing speed.

[0161] According to embodiments of this disclosure, after completing the standardized output operation, the nth second candidate word vector set is determined from the nth first candidate word vector set by kernel sampling.

[0162] According to embodiments of this disclosure, the nth first candidate word vector set is divided into subsets, and the sum of standardized similarity values ​​corresponding to word vectors included in any subset is obtained; for the sum of standardized similarity values ​​corresponding to word vectors included in any subset, the subsets whose sum of standardized similarity values ​​is greater than a preset similarity threshold are obtained. The smallest subset among the subsets that satisfy the preset similarity threshold is selected as the nth second candidate word vector set.

[0163] According to the embodiments of this disclosure, after the standardization output operation is completed, the similarity distribution probability corresponding to the word vectors in the nth first candidate word vector set will be more uniform. As a result, when the sum of the standardized similarity values ​​is greater than the preset similarity threshold of the subset, the probability of any word vector in the nth first candidate word vector set being selected will increase, instead of focusing only on one or a few word vectors with the highest similarity in the nth first candidate word vector set, thus increasing the diversity of word vectors.

[0164] According to embodiments of this disclosure, by adjusting a preset similarity threshold, a second candidate word vector set including different word vectors can be obtained. Therefore, in the process of calculating the nth matching degree for the vectors included in the second candidate word vector set, the nth matching degree of different word vectors is also different, and the final selected nth target word vector is also different. Thus, the diversity of response information can be achieved.

[0165] According to embodiments of this disclosure, the preset similarity threshold can be set to 0.8. The standardized values ​​are accumulated, and the smallest subset with an accumulated value greater than 0.8 is selected as the nth second candidate word vector set. The unstandardized similarity scores of the word vectors in the nth second candidate word vector set and the probability of the nth target word vector are obtained and used in the formula calculation to finally obtain the corresponding matching degree. The preset similarity threshold can also be adjusted based on the question-and-answer information in the actual scenario; this application embodiment does not limit this adjustment.

[0166] According to embodiments of this disclosure, a preset similarity threshold can be set such that the minimum subset includes 3-10 word vectors, i.e., the k value is generally selected as 3-10.

[0167] According to embodiments of this disclosure, the selection of the nth target word vector, based on the above method, is related to the degree of contextual semantic association between the word vector and the fused vector, as well as the similarity between the word vector and the fused vector. Among word vectors with high contextual semantic association with the fused vector, the higher the similarity, the lower the final nth matching degree. Therefore, the likelihood of the content corresponding to the selected nth target word vector repeating the content of the previous n-1 target word vectors is smaller. Furthermore, since the current target word vector influences the selection of subsequent target word vectors, and similarity indirectly affects the nth matching degree, multiple selection branches appear in the calculation, ultimately achieving diversity in the response information.

[0168] Based on the above question-and-answer method, this disclosure also provides a question-and-answer device. The following will be combined with... Figure 4 The device is described in detail.

[0169] Figure 4 A schematic block diagram of a question-and-answer device according to an embodiment of the present disclosure is shown.

[0170] like Figure 4 As shown, the question-and-answer device 400 of this embodiment may include a first determining module 410, a second determining module 420 and a third determining module 430.

[0171] The first determining module 410 is used to determine the question text vector of the question text. In one embodiment, the first determining module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0172] The second determining module 420 is used to determine N target word vectors, where N is an integer greater than 1. In one embodiment, the second determining module 420 can be used to perform the operation S220 described above, which will not be repeated here. Determining the N target word vectors includes repeatedly performing the following operations until N target word vectors are obtained: when 1 < n ≤ N, determining the nth first candidate word vector set from the preset word vector set based on the question text vector and the first n-1 target word vectors in the preset word vector set; determining the nth second candidate word vector set from the nth first candidate word vector set based on the nth first candidate word vector set, the question text vector, and the first n-1 target word vectors in the preset word vector set; and determining the nth target word vector based on the nth second candidate word vector set.

[0173] The third determining module 430 is used to determine the response information corresponding to the question text based on N target word vectors. In one embodiment, the third determining module 430 can be used to perform the operation S230 described above, which will not be repeated here.

[0174] According to embodiments of this disclosure, the second determining module 420 may include a first determining submodule and a second determining submodule.

[0175] The first determination submodule can be used to determine the nth probability set based on the question text vector and the first n-1 target word vectors in the preset word vector set. The probability of the nth target word vector included in the nth probability set represents the probability that the preset word vectors included in the preset word vector set are determined as the nth target word vector.

[0176] The second determining submodule can be used to determine the first candidate word vector set n from the preset word vector set based on the nth probability set.

[0177] According to embodiments of this disclosure, the second determining module 420 may further include a third determining submodule and a fourth determining submodule.

[0178] The third determination submodule can be used to determine the similarity between the nth first candidate word vector set and each of the n-1 fused word vectors, resulting in multiple similarity scores. The n-1th fused word vector is determined based on the question text vector and the n-1th target word vector.

[0179] The fourth determination submodule can be used to determine the nth second candidate word vector set from the nth first candidate word vector set based on multiple similarities.

[0180] According to embodiments of this disclosure, the fourth determining submodule may include a first determining subunit and a second determining subunit.

[0181] The first determining subunit can be used to determine multiple nth first candidate word vector subsets from the nth first candidate word vector set.

[0182] The second determining subunit can be used to determine the nth second candidate word vector set from the multiple nth first candidate word vector subsets based on at least one similarity to each of the multiple nth first candidate word vector subsets. The nth second candidate word vector set is the subset with the smallest number of word vectors included in the multiple nth first candidate word vector subsets, and the sum of similarities with the nth second candidate word vector set is greater than or equal to a preset similarity threshold. The sum of similarities with the nth second candidate word vector set is determined based on at least one similarity to each of the multiple nth first candidate word vector subsets.

[0183] According to embodiments of this disclosure, the third determining module 430 may include a fifth determining submodule and a sixth determining submodule.

[0184] The fifth determination submodule can be used to determine at least one nth matching degree corresponding to the nth second candidate word vector set based on at least one similarity degree corresponding to the nth second candidate word vector set in multiple similarity sets and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set.

[0185] The sixth determination submodule can be used to determine the nth target word vector from the nth second candidate word vector set based on at least one nth matching degree corresponding to the nth second candidate word vector set.

[0186] According to embodiments of this disclosure, the fifth determining submodule may include a third determining subunit and a fourth determining subunit.

[0187] The third determining subunit can be used to determine the difference between the similarity between the second candidate word vector corresponding to the nth target word vector and the probability of the nth target word vector corresponding to the second candidate word vector of the nth target word vector in the second candidate word vector set, and obtain the difference between the second candidate word vector corresponding to the nth target word vector.

[0188] The fourth determining subunit can be used to determine the difference between the second candidate word vector corresponding to the nth target word vector as the matching degree corresponding to the second candidate word vector corresponding to the nth target word vector.

[0189] According to embodiments of this disclosure, the second determining submodule may include a fifth determining subunit, a sixth determining subunit, and a seventh determining subunit.

[0190] The fifth determining subunit can be used to sort the probabilities of at least one nth target word vector included in the nth probability set in descending order to obtain sorting information.

[0191] The sixth determining subunit can be used to determine the probability of the top M nth target word vectors from the nth probability set based on the sorting information, where M is an integer greater than 1.

[0192] The seventh determining subunit can be used to determine the word vectors corresponding to the probabilities of the top M nth target word vectors as word vectors in the first candidate word vector set.

[0193] According to embodiments of this disclosure, the first determining submodule may include an eighth determining subunit.

[0194] The eighth determining subunit can be used to decode the question text vector and the first n-1 target word vectors in the preset word vector set to obtain the nth probability set.

[0195] According to embodiments of this disclosure, the first determining module 410 may include a seventh determining sub-module and an eighth sub-determining module.

[0196] The seventh determination submodule can be used to preprocess the problem text to obtain the processed problem text.

[0197] The eighth sub-determination module can be used to extract features from the problem text to obtain the problem text vector.

[0198] According to embodiments of this disclosure, any plurality of modules among the first determining module 410, the second determining module 420, and the third determining module 430 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules may be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the first determining module 410, the second determining module 420, and the third determining module 430 may be at least partially implemented as a hardware circuit, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented by any other reasonable means of integrating or packaging the circuit, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of these. Alternatively, at least one of the first determining module 410, the second determining module 420, and the third determining module 430 may be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.

[0199] Figure 5 A block diagram schematically illustrates an electronic device suitable for implementing a question-and-answer method according to an embodiment of the present disclosure.

[0200] like Figure 5 As shown, an electronic device 500 according to an embodiment of this disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage portion 505 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.

[0201] RAM 503 stores various programs and data required for the operation of electronic device 500. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 502 and / or RAM 503. It should be noted that programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in one or more memories.

[0202] According to embodiments of this disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device 500 may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 505 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 505 as needed.

[0203] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0204] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 502 and / or RAM 503 and / or one or more memories other than ROM 502 and RAM 503 described above.

[0205] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the item recommendation method provided in the embodiments of this disclosure.

[0206] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0207] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0208] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0209] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's 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 device 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), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0210] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0211] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0212] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A question-and-answer method, comprising: Determine the question text vector; Determine N target word vectors, where N is an integer greater than 1; and Based on the N target word vectors, determine the response information corresponding to the question text; The step of determining N target word vectors includes repeatedly performing the following operations until the N target word vectors are obtained: In the case that 1 < n ≤ N, Based on the question text vector and the (n-1)th target word vector in the preset word vector set, an nth probability set is determined. This determination includes: mapping the (n-1)th fused word vector to obtain a second related vector associated with the (n-1)th fused word vector; comparing the vector similarity between the second related vector associated with the (n-1)th fused word vector and the preset word vectors included in the preset word vector set; and obtaining the nth probability set. The probability of the nth target word vector included in the nth probability set represents the probability that the preset word vector included in the preset word vector set is determined to be the nth target word vector. Based on the nth probability set, the nth first candidate word vector set is determined from the preset word vector set; The nth first candidate word vector set is randomly divided to obtain multiple nth first candidate word vector subsets; The similarity between the nth candidate word vector set and the (n-1)th fused word vector is determined, resulting in multiple similarity scores. The (n-1)th fused word vector is determined based on the question text vector and the (n-1)th target word vector. Based on the multiple similarities, determine the nth second candidate word vector set from the multiple nth first candidate word vector subsets; and The nth target word vector is determined based on the nth second candidate word vector set.

2. The method according to claim 1, wherein, The step of determining the nth second candidate word vector set from the plurality of nth first candidate word vector subsets based on the plurality of similarities includes: Based on at least one similarity to each of the plurality of nth first candidate word vector subsets, the nth second candidate word vector set is determined from the plurality of nth first candidate word vector subsets; Wherein, the nth second candidate word vector set is the subset with the smallest number of word vectors included in the plurality of nth first candidate word vector subsets, and the similarity with the nth second candidate word vector set is greater than or equal to a preset similarity threshold; The similarity to the nth second candidate word vector set is determined based on at least one similarity to the plurality of nth first candidate word vector subsets.

3. The method according to claim 1, wherein, The step of determining the nth target word vector based on the nth second candidate word vector set includes: Based on at least one similarity among the plurality of similarities corresponding to the nth second candidate word vector set and the probability of at least one nth target word vector in the nth probability set corresponding to the nth second candidate word vector set, at least one nth matching degree corresponding to the nth second candidate word vector set is determined; and The nth target word vector is determined from the nth second candidate word vector set based on at least one nth matching degree corresponding to the nth second candidate word vector set.

4. The method according to claim 3, wherein, The step of determining at least one nth matching degree corresponding to the nth second candidate word vector set based on at least one similarity among the plurality of similarities corresponding to the nth second candidate word vector set and the probability of at least one nth target word vector corresponding to the nth second candidate word vector set in the nth probability set includes: For the second candidate word vector of the nth target word vector in the nth second candidate word vector set, determine the difference between the similarity to the second candidate word vector of the nth target word vector and the probability of the nth target word vector corresponding to the second candidate word vector of the nth target word vector, and obtain the difference corresponding to the second candidate word vector of the nth target word vector; and The difference between the second candidate word vector and the target word vector is determined as the matching degree between the second candidate word vector and the target word vector.

5. The method according to any one of claims 1 to 4, wherein, The step of determining the nth first candidate word vector set from the preset word vector set based on the nth probability set includes: The probabilities of at least one nth target word vector included in the nth probability set are sorted in descending order to obtain sorting information; Based on the sorting information, determine the probabilities of the top M nth target word vectors from the nth probability set, where M is an integer greater than 1; and The word vectors corresponding to the probabilities of the top M nth target word vectors are determined as the word vectors in the first candidate word vector set.

6. The method according to any one of claims 1 to 4, wherein, The problem text vector for determining the problem text includes: The problem text is preprocessed to obtain the processed problem text; and Feature extraction is performed on the problem text to obtain the problem text vector.

7. A question-and-answer device, comprising: The first determining module is used to determine the question text vector of the question text; The second determining module is used to determine N target word vectors, where N is an integer greater than 1; The third determining module is used to determine the response information corresponding to the question text based on the N target word vectors; The step of determining N target word vectors includes repeatedly performing the following operations until the N target word vectors are obtained: In the case that 1 < n ≤ N, Based on the question text vector and the (n-1)th target word vector in the preset word vector set, an nth probability set is determined. This determination includes: mapping the (n-1)th fused word vector to obtain a second related vector associated with the (n-1)th fused word vector; comparing the vector similarity between the second related vector associated with the (n-1)th fused word vector and the preset word vectors included in the preset word vector set; and obtaining the nth probability set. The probability of the nth target word vector included in the nth probability set represents the probability that the preset word vector included in the preset word vector set is determined to be the nth target word vector. Based on the nth probability set, the nth first candidate word vector set is determined from the preset word vector set; The nth first candidate word vector set is randomly divided to obtain multiple nth first candidate word vector subsets; The similarity between the nth candidate word vector set and the (n-1)th fused word vector is determined, resulting in multiple similarity scores. The (n-1)th fused word vector is determined based on the question text vector and the (n-1)th target word vector. Based on the multiple similarities, determine the nth second candidate word vector set from the multiple nth first candidate word vector subsets; and The nth target word vector is determined based on the nth second candidate word vector set.

8. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.