Generative response method and related methods, apparatuses, devices, and media
By obtaining the correlation between the semantic expression string of the user input statement and the candidate vocabulary, and deleting words with low correlation, the problem of low response rate and slow speed of existing text-based response systems is solved, and more efficient responses are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-13
- Publication Date
- 2026-03-27
AI Technical Summary
Existing text-based response systems have low response rates, insufficient response speed, and response texts that do not meet users' actual expectations.
The response string is determined by receiving the semantic expression string of the user input statement, obtaining the relevance with the candidate vocabulary, and deleting words with a relevance less than a predetermined threshold.
It improved response speed and reply rate, and ensured that the response text better met user expectations.
Smart Images

Figure CN113254606B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence, and more specifically, to a robot generative response method, a text dialogue device, and a medium. Background Technology
[0002] Text-based responses refer to automated answers to user-submitted questions. They are currently widely used in the field of artificial intelligence. However, current text-based responses suffer from drawbacks such as low response rates, slow response speed, and responses that do not accurately reflect user expectations. Summary of the Invention
[0003] In view of this, one objective of this disclosure is to improve the speed of text-based responses.
[0004] According to one aspect of this disclosure, a generative response method is provided, comprising:
[0005] Receive user input;
[0006] Obtain the semantic representation string of the user input statement;
[0007] Based on the semantic expression string of the user input statement, obtain the correlation between the user input statement and the words in the candidate vocabulary;
[0008] Words with a relevance score lower than a predetermined relevance score threshold are removed from the candidate vocabulary list;
[0009] The response string to the user input statement is determined based on the semantic expression string of the user input statement and the candidate vocabulary list after deletion.
[0010] Optionally, after receiving the user input statement, the method further includes: obtaining the sentiment expression string of the user input statement; obtaining the correlation between the user input statement and words in the candidate vocabulary based on the semantic expression string of the user input statement includes: obtaining the correlation between the user input statement and words in the candidate vocabulary based on the semantic expression string and the sentiment expression string of the user input statement; and determining the response string for the user input statement based on the semantic expression string of the user input statement and the deleted candidate vocabulary includes: determining the response string for the user input statement based on the semantic expression string, the sentiment expression string, and the deleted candidate vocabulary.
[0011] Optionally, determining the response string for the user input statement based on the semantic expression string, the sentiment expression string, and the deleted candidate vocabulary includes:
[0012] Based on the semantic expression string and the sentiment expression string, determine the first word of the response string;
[0013] Based on the first word determined from the semantic expression string, the sentiment expression string, and the response string, the second word in the response string is determined;
[0014] The determined subsequent word is sequentially appended to the determined preceding word to form the response string.
[0015] Optionally, determining the first word of the response string based on the semantic expression string and the sentiment expression string includes:
[0016] Based on the semantic expression string and the sentiment expression string, determine the first word vector of the response string;
[0017] Determine the similarity between the determined word vectors and the word vectors of each word in the candidate vocabulary;
[0018] The word with the highest similarity in the candidate vocabulary is selected as the first word to be determined.
[0019] Optionally, determining the next word in the response string based on the preceding word determined from the semantic expression string, the sentiment expression string, and the response string includes:
[0020] Based on the word vector of the preceding word determined from the semantic expression string, the sentiment expression string, and the response string, the word vector of the following word in the response string is determined.
[0021] Determine the similarity between the determined word vector and the word vectors of each word in the candidate vocabulary;
[0022] The word with the highest similarity in the candidate vocabulary is determined as the next word to be determined.
[0023] Optionally, obtaining the correlation between the user input statement and words in the candidate vocabulary based on the semantic and sentiment expression strings of the user input statement includes: obtaining the correlation between the user input statement and content words in the candidate vocabulary based on the semantic and sentiment expression strings of the user input statement; deleting words with correlation less than a predetermined correlation threshold from the candidate vocabulary includes: deleting content words with correlation less than the predetermined correlation threshold from the candidate vocabulary.
[0024] Optionally, obtaining the semantic expression string of the user input statement includes:
[0025] Obtain the word vectors of each word in the user input statement;
[0026] The word vectors are concatenated in word order to obtain the semantic expression string of the user input statement.
[0027] Optionally, obtaining the sentiment expression string of the user input statement includes: inputting the user input statement into a sentiment classification model to obtain a user sentiment vector, which is used as the sentiment expression string of the user input statement.
[0028] Optionally, determining the first word vector of the response string based on the semantic expression string and the sentiment expression string includes: inputting the semantic expression string and the sentiment expression string into a first response word vector prediction model, and having the first response word vector prediction model provide the determined first word vector.
[0029] Optionally, determining the next word vector in the response string based on the word vector of the preceding word determined from the semantic expression string, the sentiment expression string, and the response string includes:
[0030] The semantic expression string and the word vector of the determined preceding word are input into the attention model to obtain the attention output, which indicates the importance of each word in the user input statement.
[0031] The attention output, the word vector of the determined preceding word, and the sentiment expression string are input into the second response word vector prediction model, which then provides the determined following word vector.
[0032] Optionally, obtaining the correlation between the user input statement and the words in the candidate vocabulary based on the semantic expression string and sentiment expression string of the user input statement includes: inputting the semantic expression string, sentiment expression string of the user input statement and each word in the candidate vocabulary into a correlation evaluation model to obtain the correlation between the user input statement and each word in the candidate vocabulary.
[0033] Optionally, after determining the response string to the user input statement, the method further includes: outputting the determined response string.
[0034] According to one aspect of this disclosure, a method for generating a second statement that matches a first statement is provided, comprising:
[0035] Receive the first statement;
[0036] Obtain the semantic representation string of the first statement;
[0037] Based on the semantic expression string of the first statement, obtain the correlation between the first statement and the words in the candidate vocabulary;
[0038] Words with a relevance score lower than a predetermined relevance score threshold are removed from the candidate vocabulary list;
[0039] Based on the semantic expression string of the first statement and the candidate vocabulary after deletion, determine the second statement that matches the first statement.
[0040] According to one aspect of this disclosure, a method for training a correlation evaluation model is provided, comprising:
[0041] Obtain the input training sample set, wherein each training sample in the training sample set includes a pair consisting of a preset semantic expression string and a preset word, and a correlation label pre-attached to the preset semantic expression string and the preset word;
[0042] The pairs in each training sample of the training sample set are input into the correlation evaluation model to obtain the correlation between the preset semantic expression string and the preset word in the pair as determined by the correlation evaluation model.
[0043] Determine whether the correlation degree determined by the correlation degree evaluation model matches the corresponding correlation degree label;
[0044] If the proportion of matched samples in the training sample set does not reach a predetermined proportion, the coefficients in the input correlation evaluation model are adjusted until the proportion of matched samples in the training sample set reaches the predetermined proportion.
[0045] Optionally, if the proportion of matched samples in the training sample set does not reach a predetermined proportion, the coefficients in the input correlation evaluation model are adjusted until the proportion of matched samples in the training sample set reaches the predetermined proportion. The method further includes:
[0046] Obtain the input test sample set, wherein each test sample in the test sample set includes a pair consisting of a preset semantic expression string and a preset word, and a correlation label pre-attached to the preset semantic expression string and the preset word;
[0047] Input the pairs in each test sample of the test sample set into the correlation evaluation model to obtain the correlation between the preset semantic expression string and the preset word in the pair as determined by the correlation evaluation model;
[0048] Determine whether the correlation degree determined by the correlation degree evaluation model matches the corresponding correlation degree label;
[0049] If the proportion of matched samples in the test sample set reaches a predetermined proportion, the correlation evaluation model is determined to have been successfully trained; otherwise, the process is repeated starting from the step of obtaining the input training sample set.
[0050] According to one aspect of this disclosure, a generative response method is provided, comprising:
[0051] Receive user input;
[0052] Obtain the semantic expression string and sentiment expression string of the user input statement;
[0053] Based on the semantic and emotional expression strings of the user input statement, determine the first word of the response string to the user input statement;
[0054] Based on the word preceding the determined response string, the semantic expression string and the sentiment expression string of the user input statement, the word following the response string is determined.
[0055] According to one aspect of this disclosure, a generative response apparatus is provided, comprising:
[0056] User input statement receiving unit, used to receive user input statements;
[0057] A semantic expression string acquisition unit is used to acquire the semantic expression string of the user input statement;
[0058] The relevance acquisition unit is used to acquire the relevance between the user input statement and the words in the candidate vocabulary based on the semantic expression string of the user input statement;
[0059] The deletion unit is used to delete words whose relevance is less than a predetermined relevance threshold from the candidate vocabulary list;
[0060] The response string determination unit is used to determine the response string to the user input statement based on the semantic expression string of the user input statement and the candidate vocabulary list after deletion.
[0061] According to one aspect of this disclosure, an apparatus for generating a second statement that matches a first statement is provided, comprising:
[0062] The first statement receiving unit is used to receive the first statement;
[0063] A semantic expression string acquisition unit is used to acquire the semantic expression string of the first statement;
[0064] The relevance acquisition unit is used to acquire the relevance between the first statement and the words in the candidate vocabulary based on the semantic expression string of the first statement;
[0065] The deletion unit is used to delete words whose relevance is less than a predetermined relevance threshold from the candidate vocabulary list;
[0066] The second statement determination unit is used to determine a second statement that matches the first statement based on the semantic expression string of the first statement and the candidate vocabulary after deletion.
[0067] According to one aspect of this disclosure, a training apparatus for a correlation evaluation model is provided, comprising:
[0068] The training sample set acquisition unit is used to acquire the input training sample set. Each training sample in the training sample set includes a pair consisting of a preset semantic expression string and a preset word, as well as a correlation label that has been pre-attached to the preset semantic expression string and the preset word.
[0069] The correlation evaluation model input unit is used to input the pair in each training sample of the training sample set into the correlation evaluation model to obtain the correlation between the preset semantic expression string and the preset word in the pair as determined by the correlation evaluation model.
[0070] The determination unit is used to determine whether the correlation degree determined by the correlation degree evaluation model matches the corresponding correlation degree label;
[0071] An adjustment unit is used to adjust the coefficients in the input correlation evaluation model if the proportion of matched samples in the training sample set does not reach a predetermined proportion, until the proportion of matched samples in the training sample set reaches the predetermined proportion.
[0072] According to one aspect of this disclosure, a generative response apparatus is provided, comprising:
[0073] User input statement receiving unit, used to receive user input statements;
[0074] The semantic and sentiment expression string acquisition unit is used to acquire the semantic expression string and sentiment expression string of the user input statement;
[0075] The first word determination unit is used to determine the first word of the response string to the user input statement based on the semantic expression string and the sentiment expression string of the user input statement;
[0076] The subsequent word determination unit is used to determine the next word in the response string based on the preceding word of the determined response string, the semantic expression string and the sentiment expression string of the user input statement.
[0077] According to one aspect of this disclosure, a generative response device is provided, comprising:
[0078] Memory, used to store computer-readable instructions;
[0079] A processor is configured to execute computer-readable instructions stored in storage to perform: receiving a user input statement; obtaining a semantic expression string of the user input statement; obtaining the relevance between the user input statement and words in a candidate vocabulary based on the semantic expression string of the user input statement; deleting words with a relevance less than a predetermined relevance threshold from the candidate vocabulary; and determining a response string to the user input statement in the deleted candidate vocabulary based on the semantic expression string of the user input statement.
[0080] According to one aspect of this disclosure, an apparatus for generating a second statement that matches a first statement is provided, comprising:
[0081] Memory, used to store computer-readable instructions;
[0082] A processor is configured to execute computer-readable instructions stored in storage to perform: receiving a first statement; obtaining a semantic expression string of the first statement; obtaining the correlation degree between the first statement and words in a candidate vocabulary based on the semantic expression string of the first statement; deleting words with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary; and determining a second statement that matches the first statement based on the semantic expression string of the first statement and the deleted candidate vocabulary.
[0083] According to one aspect of this disclosure, a training device for a correlation evaluation model is provided, comprising:
[0084] Memory, used to store computer-readable instructions;
[0085] A processor is configured to execute computer-readable instructions stored in memory to perform the following: acquiring an input training sample set, each training sample in the training sample set including a pair consisting of a preset semantic expression string and a preset word, and a correlation label pre-attached to the preset semantic expression string and the preset word; inputting the pair in each training sample of the training sample set into a correlation evaluation model to obtain the correlation degree of the preset semantic expression string and the preset word in the pair as determined by the correlation evaluation model; determining whether the correlation degree determined by the correlation evaluation model matches the corresponding correlation label; if the proportion of matching samples in the training sample set does not reach a predetermined proportion, adjusting the coefficients in the input correlation evaluation model until the proportion of matching samples in the training sample set reaches the predetermined proportion.
[0086] According to one aspect of this disclosure, a generative response device is provided, comprising:
[0087] Memory, used to store computer-readable instructions;
[0088] A processor is configured to execute computer-readable instructions stored in storage to perform: receiving a user input statement; acquiring a semantic expression string and a sentiment expression string of the user input statement; determining the first word of a response string to the user input statement based on the semantic expression string and the sentiment expression string of the user input statement; and determining the next word of the response string based on the word preceding the determined response string, the semantic expression string and the sentiment expression string of the user input statement.
[0089] According to one aspect of this disclosure, a computer-readable medium is provided, the computer-readable medium storing computer instructions executable by a terminal device, wherein when the computer instructions are executed, the following are implemented: receiving a user input statement; obtaining a semantic expression string of the user input statement; obtaining, based on the semantic expression string of the user input statement, the relevance between the user input statement and words in a candidate vocabulary; deleting words whose relevance is less than a predetermined relevance threshold from the candidate vocabulary; and determining a response string to the user input statement in the deleted candidate vocabulary based on the semantic expression string of the user input statement.
[0090] According to one aspect of this disclosure, a computer-readable medium is provided, the computer-readable medium storing computer instructions executable by a terminal device, wherein when the computer instructions are executed, the following are implemented: receiving a first statement; obtaining a semantic expression string of the first statement; obtaining, based on the semantic expression string of the first statement, the relevance degree between the first statement and words in a candidate vocabulary; deleting words whose relevance degree is less than a predetermined relevance degree threshold from the candidate vocabulary; and determining a second statement matching the first statement based on the semantic expression string of the first statement and the deleted candidate vocabulary.
[0091] According to one aspect of this disclosure, a computer-readable medium is provided, the computer-readable medium storing computer instructions executable by a terminal device, wherein when the computer instructions are executed, the following are implemented: acquiring an input training sample set, each training sample in the training sample set including a pair consisting of a preset semantic expression string and a preset word, and a correlation label pre-attached to the preset semantic expression string and the preset word; inputting the pair in each training sample of the training sample set into a correlation evaluation model to obtain the correlation degree of the preset semantic expression string and the preset word in the pair as determined by the correlation evaluation model; determining whether the correlation degree determined by the correlation evaluation model matches the corresponding correlation label; if the proportion of matching samples in the training sample set does not reach a predetermined proportion, adjusting the coefficients in the input correlation evaluation model until the proportion of matching samples in the training sample set reaches the predetermined proportion.
[0092] According to one aspect of this disclosure, a computer-readable medium is provided, the computer-readable medium storing computer instructions executable by a terminal device, the computer instructions, when executed, performing the following: receiving a user input statement; obtaining a semantic expression string and a sentiment expression string of the user input statement; determining the first word of a response string to the user input statement based on the semantic expression string and the sentiment expression string of the user input statement; and determining the next word of the response string based on the word preceding the determined response string, the semantic expression string and the sentiment expression string of the user input statement.
[0093] In this embodiment, based on the semantic expression string of the user input statement, the relevance between the user input statement and words in the candidate vocabulary is obtained. Words with a relevance less than a predetermined relevance threshold are deleted from the candidate vocabulary. This filters out a large number of words from the candidate vocabulary that are unlikely to be used in the current response before the response is generated. Since the words in the generated response string are selected from the candidate vocabulary, the smaller the candidate vocabulary, the faster the response string is generated, thus greatly improving the response speed. Attached Figure Description
[0094] The above and 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:
[0095] Figure 1A -C illustrates an application scenario diagram of the generative response method according to an embodiment of the present disclosure, which sequentially shows the interface changes of the terminal in this scenario.
[0096] Figure 2 A schematic block diagram of a generative response device according to an embodiment of the present disclosure is shown;
[0097] Figure 3 The combination is shown Figure 2 A schematic diagram of a specific prediction process;
[0098] Figure 4 A flowchart of a generative response method according to an embodiment of the present disclosure is shown;
[0099] Figure 5 A flowchart illustrating a method for generating a second statement that matches a first statement according to an embodiment of the present disclosure is shown.
[0100] Figure 6 A flowchart illustrating a method for training a correlation evaluation model according to an embodiment of the present disclosure is shown;
[0101] Figure 7 A flowchart of a generative response method according to another embodiment of the present disclosure is shown;
[0102] Figure 8 A block diagram of a generative response apparatus according to an embodiment of the present disclosure is shown;
[0103] Figure 9 A block diagram of an apparatus for generating a second statement that matches a first statement, according to an embodiment of the present disclosure, is shown.
[0104] Figure 10 A block diagram of a training apparatus for a correlation evaluation model according to an embodiment of the present disclosure is shown;
[0105] Figure 11 A block diagram of a generative response apparatus according to another embodiment of the present disclosure is shown;
[0106] Figure 12 An internal structural diagram of a generative response device, a device for generating a second statement that matches a first statement, or a training device for a correlation evaluation model, according to an embodiment of the present disclosure, is shown. Detailed Implementation
[0107] The present disclosure is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present disclosure below, certain specific details are described in detail. Those skilled in the art will fully understand the present disclosure even without these details. To avoid obscuring the substance of the present disclosure, well-known methods, processes, and procedures are not described in detail. Furthermore, the accompanying drawings are not necessarily drawn to scale.
[0108] Current text-based responses mostly rely on pre-configured standard responses for various text statements by AI trainers. This means that if the user's input doesn't fall into the pre-configured categories, no response may be generated, resulting in a low response rate. Therefore, generative responses have emerged. Generative responses utilize generative models to provide responses to user text statements; each response is generated in real-time by the algorithm, improving the robot's response rate.
[0109] This generative model primarily predicts possible responses based on the semantics of the user-input text. Each word in the predicted possible responses is selected from a large candidate vocabulary, resulting in slow processing speed.
[0110] To address the issue of slow processing speed, this embodiment of the disclosure obtains the semantic expression string of the user input statement. Based on the semantic expression string, it calculates the relevance between the user input statement and words in a candidate vocabulary. Words with a relevance score lower than a predetermined relevance threshold are removed from the candidate vocabulary. This filters out a large number of words from the candidate vocabulary that are unlikely to be used in the current response before the response is generated. Since the words in the generated response string are selected from the candidate vocabulary, the smaller the candidate vocabulary, the faster the response string is generated, thus significantly improving the response speed.
[0111] Before describing the solutions of the embodiments of this disclosure in detail, a brief introduction will be given to the application scenarios of the embodiments of this disclosure.
[0112] Figure 1A -C illustrates an application scenario diagram of the generative response method according to an embodiment of the present disclosure, which sequentially shows the interface changes of the terminal in this scenario.
[0113] In this scenario, user terminal 101 is connected to microphone 102. User terminal 101 can be a dedicated human-computer interaction terminal, a regular computer terminal with a human-computer interaction application installed, or a regular computer terminal remotely connected to a server (not shown) via the internet. In the first two cases, user terminal 101 itself has the function of responding to user 103's questions; therefore, the generative response method of this embodiment is mainly implemented on user terminal 101. In the latter case, user terminal 101 itself does not have the function of responding to user 103's questions; user terminal 101 sends user 103's questions to the server, and the server provides a generative response and sends it back to user terminal 101. In this case, the generative response method of this embodiment is mainly implemented on the server.
[0114] It should be understood that, although in Figure 1A In -C, the user terminal 101 is in the form of a desktop computer, but it can also take the form of a portable computer, mobile phone, personal digital assistant (PDA), in-vehicle device, or other forms.
[0115] like Figure 1A As shown, before user 103 has uttered the question, the question input position 105 on the user terminal 101 interface is blank. At this time, the candidate word count display position 104 on the interface shows that there are currently 102,463 candidate words participating in the response word filtering, which is a lot.
[0116] like Figure 1B As shown, after user 103 utters their question, microphone 102 collects the user's voice input into user terminal 101. A speech conversion device (not shown) inside user terminal 101 converts the user's speech into text, which is then displayed at question input position 105 on the interface. Figure 1B In this embodiment, the converted user question text is "What day of the week is today?". The relevance between the user question text and words in the candidate vocabulary list is obtained, and words with a relevance score less than a predetermined threshold are deleted from the candidate vocabulary list. This removes all candidate words unrelated to "today," "week," or "day of the week" from the candidate vocabulary list. Position 104 on the interface displays 513 candidate words currently participating in the response word selection. Since the words in the generated response string are selected from the candidate vocabulary list, the fewer words in the candidate vocabulary list, the faster the response string is generated, thus greatly improving the response speed. Therefore, in Figure 1C In the middle, the text response "Today is Friday" is quickly displayed in the response display position 106 on the user terminal 101 interface.
[0117] Although user 103 speaks the question in the above scenario, those skilled in the art should understand that user 103 can also input the question on user terminal 101 via a keyboard or touchscreen (not shown). In this case, microphone 102 is not used. Additionally, for deaf-mute user 103, a camera (not shown) can be installed on user terminal 101. Deaf-mute user 103 makes a gesture in front of user terminal 101 to indicate the question. The camera captures the user 103's gesture video and outputs it to a connected sign language recognition device (not shown). The sign language recognition device recognizes the text of the user's question and displays it at question input position 105 on the interface.
[0118] Although the above scenario involves displaying the response at response display position 106 on the interface to answer the user's question, other methods can also be used. For example, the response text can be converted into speech using a speech conversion device (not shown) on the user terminal 101, and then played through the speaker (not shown) of the user terminal 101. For deaf users 103, the response text can also be converted into sign language video using a sign language conversion device (not shown) and played on the display screen of the user terminal 101.
[0119] like Figure 4 As shown, according to one embodiment of this disclosure, a generative response method is provided. When the user terminal 101 is a dedicated human-computer interaction terminal or a regular terminal with a human-computer interaction application installed, the generative response method is executed by the user terminal 101. When the user terminal 101 itself does not have session processor functionality and is connected to a remote server (not shown) for session processing, the generative response method is executed by the remote server.
[0120] Generative responses utilize generative models to provide responses to user text statements, rather than having answers pre-configured by an AI trainer. A generative model is a machine learning model that predicts the answer to a statement based on its content. It may include more than one model; for example, in this embodiment of the disclosure, it includes models such as... Figure 2 The models include sentiment classification model 220, attention model 230, first response word vector prediction model 241, second response word vector prediction model 242, and relevance evaluation model 261. The training and use of these four models will be described in detail later.
[0121] like Figure 4As shown, a generative response method according to an embodiment of this disclosure includes: step 410, receiving a user input statement; step 420, obtaining a semantic expression string of the user input statement; step 430, obtaining the relevance between the user input statement and words in a candidate vocabulary based on the semantic expression string of the user input statement; step 440, deleting words with a relevance less than a predetermined relevance threshold from the candidate vocabulary; and step 450, determining a response string for the user input statement based on the semantic expression string of the user input statement and the deleted candidate vocabulary.
[0122] The steps described above are described in detail below.
[0123] In step 410, user input is received.
[0124] The user input statements here refer to the text of sentences entered by user 103 into user terminal 101 through various means, including user questions and general conversations. Combined with the above... Figure 1A The scenario description in -C primarily discusses the situation where user 103 poses a question, and user terminal 101 provides a response. In reality, the statement entered by user 103 doesn't necessarily have to be a question, but rather a general conversation. Then, user terminal 101 can continue the conversation based on the content of user 103's speech, just like a normal person conversing with user 103. For example, user 103 might say, "It's really cold in here," and after recognizing this conversation content, user terminal 101 might respond with something like, "You can turn on the air conditioner."
[0125] User input statements can be received in various ways. When the generative response method of this embodiment is executed by the user terminal 101, in the case of voice input, the microphone 102 can capture the user's speech, which is then recognized as text by the speech recognition device inside the user terminal 101 to obtain the user input statement. When the user directly inputs a sentence on the interface via a keyboard or touchscreen, the user input statement can be received directly via the keyboard or touchscreen. When a deaf or mute user inputs via sign language, the camera built into the user terminal 101 can capture the user's gesture video, and the sign language recognition device inside the user terminal 101 can recognize the meaning of the gesture video, thereby forming the textual user input statement. When the generative response method of this embodiment is executed by a server connected to the user terminal 101 via the Internet, the user input statement sent by the user terminal 101 can be received via the Internet. The method by which the user terminal 101 obtains the user input statement is the same as described above.
[0126] In step 420, the semantic expression string of the user input statement is obtained.
[0127] A semantic expression string is a sequence of characters that represents the meaning of a user input statement. These characters include letters, numbers, symbols, etc. User input statements with the same meaning will have the same semantic expression string.
[0128] This step is by Figure 2 This is accomplished by the semantic encoder 210. In short, the semantic encoder 210 is a device that encodes textual statements, and the encoded code represents the meaning of the statement. If two statements have the same meaning, their encoded codes will also be the same. The encoded code can be in vector form.
[0129] In one embodiment, step 420 includes: obtaining the word vectors of each word in the user input statement; concatenating the word vectors in the order of the words to obtain the semantic expression string of the user input statement.
[0130] First, the user input sentence is segmented using word segmentation technology. For example... Figure 3 In the semantic encoder 210, the user input statement "I got an offer from Stanford" is broken down into words such as I, got, an, offer, from, and Stanford. The semantic encoder 210 includes several word encoders 211, each encoding a word, that is, converting the word into a code. Here, a code refers to a unique character used to indicate the meaning of a word. Words with the same meaning are converted into the same code. The encoding method can be to look up a dictionary of word codes, converting each word into its corresponding code. Since word encoders are existing technology, they will not be described in detail here.
[0131] In one embodiment, the code can take the form of word vectors, i.e., (a1, a2, a3, ..., an), where n is a natural number. There are several ways to obtain the word vector. One way is to look up a pre-defined word vector dictionary, which stores the word vectors for various words. Another way is through a word vector model. This word vector model is also a machine learning model, such as a fully connected neural network.
[0132] Neural networks are a typical type of machine learning model, inspired by biological neural networks. Research into the biological mechanisms of the brain has revealed that its basic unit is the neuron. Each neuron receives input signals from upstream neurons via dendrites, processes them, and then transmits the output signal to downstream neurons via axons. When the sum of the input signals to a neuron reaches a certain intensity, an output signal is activated; otherwise, there is no output signal. Inspired by biological neural networks, a unit capable of simple logical processing is considered as a neuron, and these units are connected to form a hierarchical structure called a fully connected neural network. A fully connected neural network consists of an input layer, an output layer, and one or more hidden layers. The input layer includes multiple input nodes, the output layer includes multiple output nodes, and each hidden layer contains multiple hidden nodes. Each hidden node performs a weighted sum of the outputs from the nodes in the previous layer, applies it to a non-linear activation function, and outputs it to the next layer. The output layer typically uses a simple linear function, or further uses a softmax function to transform the output into a probabilistic form.
[0133] The word vector model is trained as follows: A sample set consisting of a large number of training word samples can be constructed, where each training word sample is pre-labeled with a word vector. Each training word sample in the sample set is input into the word vector model, which outputs the learned word vector. This word vector is compared with the label word vector. If, for at least a predetermined proportion (e.g., more than 95%) of the training word samples in the sample set, the output results are consistent with the label word vectors, then the word vector model is considered successfully trained. Otherwise, the parameters of each hidden node in each hidden layer of the word vector model are adjusted so that the output results of at least a predetermined proportion (e.g., more than 95%) of the training word samples are consistent with the label word vectors.
[0134] Once a word vector model is successfully trained, it typically undergoes a testing process before being officially deployed. During testing, a test word sample set can be constructed, consisting of a large number of test word samples, each pre-labeled with a word vector. Each test word sample in the set is input into the word vector model, which outputs a learned word vector. This word vector is then compared to the labeled word vectors. If the proportion of matching word samples in the test word sample set reaches a predetermined percentage, the word vector model is considered successfully trained; otherwise, the training process is repeated.
[0135] like Figure 3 As shown, the word vectors converted from I, got, an, offer, from, and Stanford are h1-h6 respectively.
[0136] Based on the word vectors of each word in the user input statement, a semantic vector of the user input statement can be generated. One way to generate the semantic vector of the user input statement is to concatenate the word vectors of each word in the user input statement in word order, such as... Figure 3 The semantic vectors of user input statements can also be formed by interleaving the word vectors of each word. For example, the first component of the word vector of each word in the user input statement is concatenated in word order to form a first string, the second component of the word vector of each word in the user input statement is concatenated in word order to form a second string, and so on, until the first string, the second string, and so on are concatenated in sequence.
[0137] In step 430, the correlation between the user input statement and the words in the candidate vocabulary is obtained based on the semantic expression string of the user input statement.
[0138] Relevance is a measure of how closely related the words in the candidate vocabulary are to the user's input. The higher the value of this measure, the more relevant the words in the candidate vocabulary are to the user's input.
[0139] One way to obtain the relevance is to input the semantic expression string of the user input statement and each word in the candidate vocabulary into the relevance evaluation model to obtain the relevance between the user input statement and each word in the candidate vocabulary.
[0140] Similar to the word vector model described above, the relevance evaluation model can also be a machine learning model, such as a fully connected neural network model. Since a brief introduction to fully connected neural network models has already been given above, it will not be repeated here.
[0141] The training method for the relevance evaluation model is as follows: A training sample set consisting of a large number of training samples can be constructed. Each training sample in the training sample set includes a pair consisting of a preset semantic expression string and a preset word, as well as a relevance label pre-assigned to the preset semantic expression string and the preset word. Each pair from the training sample set is input into the relevance evaluation model to obtain the relevance of the preset semantic expression string and the preset word in the pair as determined by the relevance evaluation model. Then, it is determined whether the relevance determined by the relevance evaluation model matches the corresponding relevance label. If the proportion of matching samples in the training sample set does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the relevance evaluation model are adjusted until the proportion of matching samples in the training sample set reaches the predetermined proportion. Once this is achieved, the training is considered successful.
[0142] After the correlation evaluation model is successfully trained, it generally undergoes a testing process. During testing, a test sample set composed of a large number of test samples is constructed. Each test sample in the test sample set includes a pair composed of a preset semantic expression string and a preset word, as well as a correlation label previously attached to the preset semantic expression string and the preset word. Then, each pair in the test sample set is input into the correlation evaluation model respectively, and the correlation between the preset semantic expression string and the preset word in the pair determined by the correlation evaluation model is obtained. It is determined whether the correlation determined by the correlation evaluation model matches the corresponding correlation label. If the proportion of matching samples in the test sample set reaches a predetermined ratio (such as 95%), it is determined that the correlation evaluation model is successfully trained; otherwise, the above training process is repeated.
[0143] In a further embodiment, the candidate vocabulary includes function words and content words. Function words are words that play a role of reference and connection in a sentence, such as the, I, you, are, of in English, and "的", "地", "得" in Chinese. These words are not the key words expressing the meaning of the sentence, but are words that must be used in each sentence. Content words are words that express the meaning that the entity wants to express in a sentence. Function words cannot be filtered out from the candidate vocabulary because these words may be used in almost every sentence. Therefore, in this embodiment, only step 430 is performed on content words, that is, according to the semantic expression string of the user input sentence, the correlation between the user input sentence and the content words in the candidate vocabulary is obtained. For function words, they cannot be filtered out and can be considered to have a correlation of 1 forever. Since only the correlation with content words is obtained, the generative response speed is improved.
[0144] In step 440, the words with a correlation less than the predetermined correlation threshold are deleted from the candidate vocabulary.
[0145] Step 440 can be implemented by Figure 2 the screening unit 262. For example, the predetermined correlation threshold is set to 0.8, and the words with a correlation less than 0.8 obtained in step 430 are completely filtered out from the candidate vocabulary, so that only the part of the words with a correlation not less than 0.8 is provided to the word prediction unit 250.
[0146] In the case where the candidate vocabulary is divided into function words and content words as described above, in step 440, only the words with a correlation less than the predetermined correlation threshold are deleted from the candidate vocabulary. That is to say, for function words, no filtering is performed. Figure 3As shown, the relevance scores 263 for all functional words are set to 1. Only all content words are input into the relevance evaluation model 261 to obtain the relevance scores 264 for each content word. Assume the predetermined relevance threshold is 0.7. After filtering by the filtering unit 262, all functional words pass, and the content words with a relevance score 265 higher than 0.7 pass. All passing words are provided to the word prediction unit 250 for prediction.
[0147] By dividing the candidate vocabulary into function words and content words and adopting different approaches, the function words that are likely to be used in almost every sentence are not filtered out, thus improving the prediction effect.
[0148] A major problem with existing technologies is that when generating responses to user sessions, the selection of each word in the response is based on a full comparison of the entire candidate vocabulary. If the candidate vocabulary is large, the response speed becomes very slow. This disclosure employs a dynamic candidate vocabulary, filtering out a large number of words that are unlikely to be used in the current response generation task at the initial stage. This reduces the candidate vocabulary to a subset of the previous one, significantly improving response speed. Since the filtered words are unlikely to be used during response generation, the quality of the response is not affected. In fact, the filtering of some irrelevant words may even improve the quality of the response.
[0149] The predetermined relevance threshold can be selected based on the required response generation speed. If a rapid response is required, the predetermined relevance threshold can be set very high, thus providing fewer words to the word prediction unit 250 and improving prediction speed. Experimental results show that even reducing the candidate vocabulary to 1 / 10 of its original size does not significantly affect the response performance. If a rapid response is not required, but high prediction accuracy is demanded, the predetermined relevance threshold can be set lower, thus providing more words to the word prediction unit 250 and improving prediction accuracy.
[0150] By adjusting the filtering intensity of the candidate vocabulary, a balance between "speed" and "effectiveness" can be achieved, and different specific requirements for speed and effectiveness in different business scenarios can be met. This makes the implementation of the embodiments of this disclosure more customized and significantly reduces the demand for computing resources (such as EAS computing platform resources).
[0151] In step 450, a response string to the user input statement is determined based on the semantic expression string of the user input statement and the deleted candidate vocabulary.
[0152] A response string is a string that responds to a user's input. The characters in this string include text (Chinese or other languages), letters, numbers, symbols, etc. For example, if the user inputs "What is today's date?", the response string could be "Today is August 25th".
[0153] The response string to the user input statement can be determined by the following methods based on the semantic expression string and the candidate vocabulary list after deletion: determining the first word of the response string based on the semantic expression string; determining the next word of the response string based on the semantic expression string and the previous word determined in the response string; and concatenating the determined next word after the determined previous word to form the response string.
[0154] For example, if a user inputs the statement "What is today's date?", the response string is "Today is August 25th". The word "today" is determined based on the semantic expression string converted from "What is today's date?", "is" is determined based on the semantic expression string converted from the word "today" and "What is today's date?", "August" is determined based on the semantic expression string converted from the word "is" and "What is today's date?", and "25th" is determined based on the semantic expression string converted from the word "August" and "What is today's date?".
[0155] The first word of the response string can be determined based on the semantic expression string in the following way: determine the first word vector of the response string based on the semantic expression string; determine the similarity between the determined word vector and the word vectors of each word in the candidate vocabulary; determine the word with the highest similarity in the candidate vocabulary as the first word to be determined.
[0156] Based on the semantic expression string, the first word vector of the response string can be determined by the first response word vector prediction model 241.
[0157] Similar to the word vector model described above, the first response word vector prediction model 241 can also be a machine learning model, such as a fully connected neural network model. Since the fully connected neural network model has already been briefly introduced above, it will not be repeated here.
[0158] The training method of the first response word vector prediction model 241 is as follows: A training sample set consisting of a large number of semantic expression string training samples can be constructed. Each semantic expression string training sample in the training sample set is pre-labeled with a first word vector. Each training sample in the training sample set is input into the first response word vector prediction model 241 to obtain the first word vector determined by the first response word vector prediction model 241, which is then compared with the labeled first word vector. If the proportion of training samples in the training sample set whose first word vector matches the first word vector label does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the first response word vector prediction model 241 are adjusted until the proportion of matching training samples in the training sample set reaches the predetermined proportion. Once this proportion is reached, the training is considered successful.
[0159] After the first response word vector prediction model 241 is successfully trained, it typically undergoes a testing process. During testing, a test sample set is constructed, consisting of a large number of semantic expression string test samples. Each semantic expression string test sample in the test sample set is labeled with its first word vector. Then, each semantic expression string test sample in the test sample set is input into the first response word vector prediction model 241 to obtain the first word vector determined by the first response word vector prediction model 241. It is then determined whether the first word vector determined by the first response word vector prediction model 241 matches the first word vector label. If the proportion of matching semantic expression string test samples in the test sample set reaches a predetermined percentage (e.g., 95%), the first response word vector prediction model 241 is considered successfully trained; otherwise, the above training process is repeated.
[0160] After the first response word vector prediction model 241 is successfully trained and tested, the semantic expression string obtained in step 420 can be input into the first response word vector prediction model 241, which determines the first word vector of the response string. Next, the similarity between the determined word vector and the word vectors of each word in the candidate vocabulary is determined. The word vectors of each word in the candidate vocabulary are known in advance, or can be determined by looking up a word vector dictionary. Similarity refers to the degree of similarity between word vectors. The greater the difference in meaning between words, the smaller the similarity between their word vectors. Conversely, the smaller the difference in meaning between words, the greater the similarity between their word vectors. Determining the similarity between two word vectors can be achieved using existing methods, so it will not be elaborated upon. Then, the word with the highest similarity in the candidate vocabulary is determined as the first determined word.
[0161] To determine the next word in the response string based on the preceding word identified in the semantic expression string and the response string, the following method can be used: Input the semantic expression string and the word vector of the preceding word into an attention model to obtain an attention output, which indicates the importance of each word in the user's input statement; Input the attention output, the word vector of the preceding word, and the sentiment expression string into a second response word vector prediction model, which then provides the determined next word vector.
[0162] Attention output refers to a quantity representing the importance of each word in a sentence. When people hear a sentence, their attention to each word in the sentence varies, and the importance of each word in the sentence also varies. Because the importance of each word in the user input sentence varies, the dependence on each word in the response also varies. Therefore, when determining the response string to the user input sentence, the importance of each word in the user input sentence, i.e., its weight, must also be considered. Attention output can be represented as a vector, where each element of the vector represents the importance or weight of a corresponding word in the user input sentence. Attention output is obtained through attention model 230. Attention model 230 is a machine learning model, such as a fully connected neural network. The training and use of attention model 230 are described below.
[0163] The training method for attention model 230 is as follows: A training sample set consisting of a large number of training samples can be constructed. Each training sample in this set includes a semantic expression string and the word vector of the preceding word in the response string. Each training sample is pre-labeled with an attention output label. Each training sample in the training sample set is input into attention model 230 to obtain an attention output, which is then compared with the labeled attention output. If the proportion of matching attention outputs with corresponding attention output labels in the training sample set does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in attention model 230 are adjusted until the proportion of matching training samples in the training sample set reaches the predetermined proportion. Once this proportion is reached, the training is considered successful.
[0164] After the attention model 230 is successfully trained, it typically undergoes a testing process. During testing, a test sample set is constructed, where each test sample includes a semantic expression string and the vector of the preceding word in the response string. An attention output label is assigned to each test sample in the test sample set. Then, each test sample in the test sample set is input into the attention model 230 to obtain the attention output. It is then determined whether the attention output of the attention model 230 matches the attention output label. If the proportion of matching test samples in the test sample set reaches a predetermined percentage (e.g., 95%), the attention model 230 is considered successfully trained; otherwise, the above training process is repeated.
[0165] After the attention model 230 is successfully trained and tested, the semantic expression string and the word vector of the determined previous word can be input into the attention model 230 to obtain the attention output.
[0166] The second response word vector prediction model 242 is also a machine learning model, such as a fully connected neural network. The training and use of the second response word vector prediction model 242 are described below.
[0167] The training method for the second response word vector prediction model 242 is as follows: A training sample set consisting of a large number of training samples can be constructed. Each training sample in this set includes an attention output and a word vector. Each training sample is pre-labeled with the word vector label of the next word corresponding to that word vector. Each training sample in the training sample set is input into the second response word vector prediction model 242 to obtain the next word vector determined by the second response word vector prediction model 242, which is then compared with the labeled next word vector. If the proportion of training samples in the training sample set whose next word vector matches the next word vector label does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the second response word vector prediction model 242 are adjusted until the proportion of matching training samples in the training sample set reaches the predetermined proportion. Once this proportion is reached, the training is considered successful.
[0168] After the second response word vector prediction model 242 is successfully trained, it typically undergoes a testing process. During testing, a test sample set consisting of a large number of test samples is constructed. Each test sample in the set includes an attention output and a word vector. Each training sample is pre-labeled with the word vector label of the next word corresponding to that word vector. Then, each test sample in the test sample set is input into the second response word vector prediction model 242 to obtain the next word vector determined by the second response word vector prediction model 242. It is then determined whether the next word vector determined by the second response word vector prediction model 242 matches the next word vector label. If the proportion of matching test samples in the test sample set reaches a predetermined percentage (e.g., 95%), the second response word vector prediction model 242 is considered successfully trained; otherwise, the above training process is repeated.
[0169] After the second response word vector prediction model 242 is successfully trained and tested, the attention output provided by the attention model and the word vector of the determined previous word can be input into the second response word vector prediction model 242. The second response word vector prediction model 242 determines the next word vector of the response string. Next, the similarity between the determined next word vector and the word vectors of each word in the candidate vocabulary is determined. Then, the word with the highest similarity in the candidate vocabulary is determined as the next word.
[0170] Then, each determined word is sequentially appended to the end of the determined preceding word to form the response string. That is, the determined second word is appended to the determined first word, the determined third word is appended to the determined second word, and so on, thus forming the response string to the user's input statement.
[0171] After step 450, the method may include: outputting a determined response string.
[0172] The response string can be output in several ways. When the generative response method is executed by the user terminal 101, the response string can be output by displaying it on the user terminal 101's display interface, or by converting the response text into speech using the user terminal 101's speech converter (not shown), and playing it through the user terminal 101's speaker (not shown). Alternatively, the response text can be converted into sign language video using a sign language converter (not shown) and played on the user terminal 101's display screen for deaf and mute users to provide responses. When the generative response method is executed by a server connected to the user terminal 101 via the Internet, the server can output a definite response string by sending it to the user terminal 101 via the Internet.
[0173] Furthermore, a significant drawback of existing generative response technologies is that they can only determine the possible response based on the semantics of the user's input text. However, users often utter the same sentence, but due to differences in tone or emphasis, the meaning can vary, resulting in responses from existing technologies that do not meet user expectations.
[0174] To address this issue, embodiments of this disclosure acquire not only the semantic expression string of the user input statement but also the emotional expression string of the user input statement. Furthermore, when determining the correlation between the user input statement and candidate words, and when determining the response string, both the semantic expression string and the emotional expression string are considered. This ensures that the response given to the user takes into account the user's emotions and better meets the user's expectations.
[0175] Therefore, in this embodiment, after step 410, the method may include: obtaining the sentiment expression string of the user input statement.
[0176] User sentiment expression strings refer to strings representing the user's emotions (such as happiness, sadness, or confusion) revealed in the user's input. These characters can include text, numbers, letters, symbols, etc. They can be represented as user sentiment vectors. Each emotion can be represented as a unique vector.
[0177] The sentiment expression string of user input can be obtained through the sentiment classification model 220.
[0178] Sentiment classification model 220 can also be a machine learning model, such as a fully connected neural network model. Since a brief introduction to fully connected neural network models has already been given above, it will not be repeated here.
[0179] The training method for the sentiment classification model 220 is as follows: A training sample set consisting of a large number of user input sentences can be constructed. Each user input sentence in the training sample set is pre-labeled with a sentiment expression string. Each user input sentence in the training sample set is then input into the sentiment classification model 220 to obtain the sentiment expression string determined by the model. Next, it is determined whether the sentiment expression string determined by the model matches the corresponding sentiment expression string label. If the proportion of matching samples in the training sample set does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the sentiment classification model 220 are adjusted until the proportion of matching samples in the training sample set reaches the predetermined proportion. Once this proportion is reached, the training is considered successful.
[0180] After the sentiment classification model 220 is successfully trained, it typically undergoes a testing process. During testing, a test sample set is constructed, consisting of a large number of user input statements. Each user input statement in the test sample set is pre-labeled with a sentiment category. Then, each user input statement is input into the sentiment classification model to determine the sentiment category. It is then determined whether the sentiment category determined by the sentiment classification model 220 matches the corresponding sentiment category label. If the percentage of matching user input statements in the test sample set reaches a predetermined proportion (e.g., 95%), the sentiment classification model 220 is considered successfully trained; otherwise, the training process is repeated.
[0181] Once the sentiment classification model 220 is successfully trained and tested, the user input statement received in step 410 is input into the sentiment classification model 220 to obtain the sentiment expression string of the user input statement. Because of the sentiment expression string, when determining the relevance between the user input statement and the words in the candidate vocabulary in step 430, it is not necessary to consider not only the semantic expression string of the user input statement but also the sentiment expression string of the user input statement.
[0182] As mentioned above, the relevance is determined using a relevance evaluation model. Therefore, in this case, the semantic expression string and sentiment expression string of the user input statement, along with each word in the candidate vocabulary, can be input into the relevance evaluation model to obtain the relevance between the user input statement and each word in the candidate vocabulary. When the candidate vocabulary includes function words and content words, the semantic expression string and sentiment expression string of the user input statement, along with each content word in the candidate vocabulary, can be input into the relevance evaluation model to obtain the relevance between the user input statement and each content word in the candidate vocabulary. For function words, since they are not filtered out, the relevance is set to 1.
[0183] In this case, due to the presence of sentiment expression strings, the training method for the relevance evaluation model differs slightly from the previous approach. First, a training sample set consisting of a large number of training samples can be constructed. Each training sample in the set includes a group composed of a preset semantic expression string, a preset sentiment expression string, and preset words, as well as a relevance label pre-assigned to that group. Each group from the training sample set is then input into the relevance evaluation model to obtain the relevance score determined by the model. Next, it is determined whether the relevance score determined by the model matches the corresponding relevance label. If the proportion of matching samples in the training sample set does not reach a predetermined percentage (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the relevance evaluation model are adjusted until the proportion of matching samples in the training sample set reaches the predetermined percentage; once this is achieved, the training is considered successful.
[0184] In the testing phase after the relevance evaluation model has been successfully trained, a test sample set consisting of a large number of test samples is constructed. Each test sample in the set includes a group composed of a preset semantic expression string, a preset sentiment expression string, and preset words, as well as a relevance label pre-assigned to that group. Then, each group in the test sample set is input into the relevance evaluation model to obtain the relevance score determined by the model. It is then determined whether the relevance score determined by the model matches the corresponding relevance label. If the proportion of matching samples in the test sample set reaches a predetermined percentage (e.g., 95%), the relevance evaluation model is considered successfully trained; otherwise, the training process is repeated.
[0185] In this context, when determining the response string for the user input statement in step 450, both the semantic expression string and the sentiment expression string of the user input statement must be considered. That is, the response string for the user input statement is determined based on the semantic expression string, the sentiment expression string, and the deleted candidate vocabulary.
[0186] Specifically, the first word of the response string can be determined based on the semantic expression string and the sentiment expression string. The next word in the response string is determined based on the preceding word identified in the semantic expression string, the sentiment expression string, and the response string. The next word is then sequentially appended to the preceding word to form the response string.
[0187] Based on the semantic expression string and the sentiment expression string, the first word vector of the response string can be determined using the first response word vector prediction model 241 as described above. The first response word vector prediction model 241 is, for example, a fully connected neural network model. Its training method differs slightly from the case without a sentiment expression string.
[0188] When there is an emotional expression string, the training method of the first response word vector prediction model 241 is as follows: A training sample set consisting of a large number of training samples can be constructed. Each training sample includes a semantic expression string and an emotional expression string of a certain sentence. Each training sample in the training sample set is pre-labeled with a first word vector. Each training sample in the training sample set is input into the first response word vector prediction model 241 to obtain the first word vector determined by the first response word vector prediction model 241, which is then compared with the labeled first word vector. If the proportion of training samples in the training sample set whose predicted first word vector matches the first word vector label does not reach a predetermined proportion (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the first response word vector prediction model 241 are adjusted until the proportion of matching training samples in the training sample set reaches the predetermined proportion. Once this proportion is reached, the training is considered successful.
[0189] In the testing phase following the successful training of the first response word vector prediction model 241, a test sample set consisting of a large number of test samples is constructed. Each test sample includes a semantic expression string and a sentiment expression string of a certain sentence. Each test sample in the test sample set is labeled with a first word vector. Then, each test sample in the test sample set is input into the first response word vector prediction model 241 to obtain the first word vector determined by the first response word vector prediction model 241. It is then determined whether the first word vector determined by the first response word vector prediction model 241 matches the first word vector label. If the proportion of test samples with matching semantic expression strings in the test sample set reaches a predetermined percentage (e.g., 95%), the first response word vector prediction model 241 is considered successfully trained; otherwise, the above training process is repeated.
[0190] After the first response word vector prediction model 241 is successfully trained and tested, the semantic and sentiment expression strings of the user's input sentence can be input into the first response word vector prediction model 241, which determines the first word vector of the response string. Next, the similarity between the determined word vector and the word vectors of each word in the candidate vocabulary is determined. Determining the similarity between two word vectors can be achieved using existing methods. Then, the word with the highest similarity in the candidate vocabulary is selected as the first determined word.
[0191] To determine the next word in the response string based on the preceding word identified in the semantic expression string, sentiment expression string, and response string, the following method can be used: Input the semantic expression string and the word vector of the identified preceding word into an attention model to obtain an attention output, which indicates the importance of each word in the user's input statement; input the attention output, the word vector of the identified preceding word, and the sentiment expression string into a second response word vector prediction model, which then provides the determined next word vector.
[0192] Because of the presence of sentiment expression strings, the training method for the second response word vector prediction model 242 differs slightly from that described above. A training sample set consisting of a large number of training samples can be constructed. Each training sample in this set includes an attention output, a word vector, and a sentiment expression string. Each training sample is pre-labeled with the word vector label of the next word corresponding to that word vector. Each training sample in the training sample set is then input into the second response word vector prediction model 242 to obtain the next word vector determined by the second response word vector prediction model 242, which is then compared with the labeled next word vector. If the percentage of training samples in the training sample set whose next word vector matches the next word vector label does not reach a predetermined percentage (e.g., 95%), the parameters in the hidden nodes of each hidden layer in the second response word vector prediction model 242 are adjusted until the percentage of matching training samples in the training sample set reaches the predetermined percentage. Once this percentage is reached, the training is considered successful.
[0193] After the second response word vector prediction model 242 is successfully trained, it typically undergoes a testing process. During testing, a test sample set consisting of a large number of test samples is constructed. Each test sample in the set includes an attention output, a word vector, and a sentiment expression string. Each training sample is pre-labeled with the word vector label of the next word corresponding to its word vector. Then, each test sample in the test sample set is input into the second response word vector prediction model 242 to obtain the next word vector determined by the second response word vector prediction model 242. It is then determined whether the next word vector determined by the second response word vector prediction model 242 matches the next word vector label. If the proportion of matching test samples in the test sample set reaches a predetermined percentage (e.g., 95%), the second response word vector prediction model 242 is considered successfully trained; otherwise, the above training process is repeated.
[0194] After the second response word vector prediction model 242 is successfully trained and tested, the attention output given by the attention model, the word vector of the determined previous word, and the sentiment expression string can be input into the second response word vector prediction model 242. The second response word vector prediction model 242 determines the next word vector of the response string. Next, the similarity between the determined next word vector and the word vectors of each word in the candidate vocabulary is determined. Then, the word with the highest similarity in the candidate vocabulary is determined as the next word.
[0195] As a further embodiment of this disclosure, it can be applied not only to generative responses but also to the generation of other sentence materials. For example, in the field of online content creation, another sentence can be generated to match each sentence in a target article, thus producing another article. In this other article, each sentence has a matching relationship with the corresponding sentence in the target article, but they are not the same, making the entire article look different. Embodiments of this disclosure can also be used to generate a corresponding abridged version based on an article.
[0196] In this embodiment, such as Figure 5 As shown, according to an embodiment of this disclosure, a method for generating a second statement that matches a first statement is provided. This method is executed by a user terminal 101 or a server connected to the user server 101 via the Internet. The method includes: step 510, receiving a first statement; step 520, obtaining a semantic expression string of the first statement; step 530, obtaining the relevance between the first statement and words in a candidate vocabulary based on the semantic expression string of the first statement; step 540, deleting words with a relevance less than a predetermined relevance threshold from the candidate vocabulary; and step 550, determining a second statement that matches the first statement based on the semantic expression string of the first statement and the deleted candidate vocabulary.
[0197] The first statement here refers to the statement to be matched, such as a statement in the target article during online content creation. The second statement refers to the generated statement that matches the first statement. Matching here can mean having the same meaning as a statement in the target article but using a different wording, or it can refer to a shortened version of a statement in the target article, etc. Since this embodiment is entirely... Figure 4 The generalization of the generative response method embodiment shown, the execution of each step and Figure 4 The steps are basically similar, and their implementation process will not be elaborated further. The aforementioned combination... Figure 4 The implementation details described also apply to this embodiment.
[0198] like Figure 6As shown, according to an embodiment of this disclosure, a method for training a relevance evaluation model is provided. This method is executed by a user terminal 101 or a server connected to the user terminal 101 via the Internet. The method includes: Step 610, obtaining an input training sample set, where each training sample in the training sample set includes a pair consisting of a preset semantic expression string and a preset word, and a relevance label pre-assigned to the preset semantic expression string and the preset word; Step 620, inputting each pair from each training sample in the training sample set into the relevance evaluation model to obtain the relevance of the preset semantic expression string and the preset word in the pair as determined by the relevance evaluation model; Step 630, determining whether the relevance determined by the relevance evaluation model matches the corresponding relevance label; Step 640, if the proportion of matched samples in the training sample set does not reach a predetermined proportion, adjusting the coefficients input into the relevance evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion.
[0199] The acquisition of correlation degree in step 430 above has been described in detail in this embodiment. Here, we only extract the training method of the correlation degree evaluation model and will not repeat it. The implementation details can be referred to the description of step 430 above.
[0200] like Figure 7 As shown, according to an embodiment of this disclosure, a generative response method is provided. The method is executed by a user terminal 101 or a server connected to the user terminal 101 via the Internet. The method includes: step 710, receiving a user input statement; step 720, obtaining a semantic expression string and a sentiment expression string of the user input statement; step 730, determining the first word of a response string to the user input statement based on the semantic expression string and the sentiment expression string; and step 740, determining the next word of the response string based on the preceding word of the determined response string, the semantic expression string of the user input statement, and the sentiment expression string.
[0201] In addition to obtaining the semantic expression string of the user input statement, this embodiment also obtains the emotional expression string of the user input statement. Furthermore, when determining the relevance between the user input statement and candidate words, and when determining the response string, it considers not only the semantic expression string but also the emotional expression string. This makes the response to the user take into account the user's emotions, which is more in line with the user's expectations. This overcomes the problem that the generative response method of the prior art only responds based on the text of the user input statement itself, ignoring the user's emotions, resulting in a response that does not meet the user's expectations.
[0202] This embodiment is combined with the above. Figure 4 The description already covers this, but the technical solution has been re-summarized from the perspective of considering user emotions and improving response satisfaction. The implementation details can still be found by referring to the above. Figure 4 The description is already provided, so I will not elaborate further.
[0203] like Figure 8 As shown, according to one embodiment of this disclosure, a generative response apparatus 800 is provided, including: a user input statement receiving unit 810 for receiving user input statements; a semantic expression string acquisition unit 820 for acquiring the semantic expression string of the user input statement; a relevance acquisition unit 830 for acquiring the relevance between the user input statement and words in a candidate vocabulary based on the semantic expression string of the user input statement; a deletion unit 840 for deleting words with a relevance less than a predetermined relevance threshold from the candidate vocabulary; and a response string determination unit 850 for determining a response string to the user input statement based on the semantic expression string of the user input statement and the deleted candidate vocabulary.
[0204] Optionally, the generative response device 800 further includes: an emotion expression string acquisition unit (not shown), used to acquire the emotion expression string of the user input statement after receiving the user input statement;
[0205] Optionally, the relevance acquisition unit 830 is further configured to: acquire the relevance between the user input statement and the words in the candidate vocabulary based on the semantic expression string and sentiment expression string of the user input statement. The response string determination unit 850 is further configured to: determine the response string to the user input statement based on the semantic expression string, sentiment expression string, and the deleted candidate vocabulary.
[0206] Optionally, a response string is determined based on the semantic expression string, the sentiment expression string, and the deleted candidate vocabulary of the user input statement, including: determining the first word of the response string based on the semantic expression string and the sentiment expression string; determining the next word in the response string based on the preceding word determined in the semantic expression string, the sentiment expression string, and the response string; and sequentially concatenating the determined next word after the determined preceding word to form the response string.
[0207] Optionally, the first word of the response string is determined based on the semantic expression string and the sentiment expression string, including: determining the first word vector of the response string based on the semantic expression string and the sentiment expression string; determining the similarity between the determined word vector and the word vectors of each word in the candidate vocabulary; and determining the word with the highest similarity in the candidate vocabulary as the determined first word.
[0208] Optionally, based on the preceding word identified in the semantic expression string, sentiment expression string, and response string, the following steps are taken: based on the word vector of the preceding word identified in the semantic expression string, sentiment expression string, and response string, the following steps are taken: ...
[0209] Optionally, the relevance between the user input statement and the words in the candidate vocabulary is obtained based on the semantic expression string and the sentiment expression string of the user input statement, including: obtaining the relevance between the user input statement and the content words in the candidate vocabulary based on the semantic expression string and the sentiment expression string of the user input statement; the deletion unit 840 is further used to: delete content words with a relevance less than a predetermined relevance threshold from the candidate vocabulary.
[0210] Optionally, the semantic expression string acquisition unit 820 is further configured to: acquire the word vectors of each word in the user input statement; and concatenate the word vectors in the order of the words to obtain the semantic expression string of the user input statement.
[0211] Optionally, the sentiment expression string acquisition unit is further used to: input the user input statement into the sentiment classification model to obtain the user sentiment vector, which serves as the sentiment expression string of the user input statement.
[0212] Optionally, determining the first word vector of the response string based on the semantic expression string and the sentiment expression string includes: inputting the semantic expression string and the sentiment expression string into the first response word vector prediction model, and having the first response word vector prediction model provide the determined first word vector.
[0213] Optionally, based on the word vector of the preceding word determined in the semantic expression string, sentiment expression string, and response string, the word vector of the following word in the response string is determined, including: inputting the semantic expression string and the word vector of the preceding word into an attention model to obtain an attention output, wherein the attention output indicates the importance of each word in the user input statement; inputting the attention output, the word vector of the preceding word, and the sentiment expression string into a second response word vector prediction model, wherein the second response word vector prediction model provides the determined word vector of the following word.
[0214] Optionally, based on the semantic expression string and sentiment expression string of the user input statement, the correlation between the user input statement and the words in the candidate vocabulary is obtained, including: inputting the semantic expression string, sentiment expression string and each word in the candidate vocabulary into the correlation evaluation model to obtain the correlation between the user input statement and each word in the candidate vocabulary.
[0215] Optionally, the generative response apparatus 800 further includes a response string output unit (not shown) for outputting a determined response string after determining the response string to the user input statement.
[0216] The implementation details of the generative response device 809 have been previously discussed. Figure 4 The method embodiments are fully described in the discussion above, therefore, reference can be made to the above-described combination. Figure 4The details of the generative response device 809 will be understood through a discussion of the method embodiments.
[0217] like Figure 9 As shown, according to an embodiment of this disclosure, an apparatus 900 for generating a second statement matching a first statement is provided, comprising: a first statement receiving unit 910 for receiving a first statement; a semantic expression string acquisition unit 920 for acquiring a semantic expression string of the first statement; a relevance acquisition unit 930 for acquiring the relevance between the first statement and words in a candidate vocabulary based on the semantic expression string of the first statement; a deletion unit 940 for deleting words with a relevance less than a predetermined relevance threshold from the candidate vocabulary; and a second statement determination unit 950 for determining a second statement matching the first statement based on the semantic expression string of the first statement and the deleted candidate vocabulary.
[0218] The device 900 that generates a second statement that matches the first statement is Figure 8 This extends the generative response device 809. It can be applied to the generation of other sentence materials. For example, in the field of online content creation, it can generate another sentence that matches each sentence in a target article, thus creating another article. In this new article, each sentence has a matching relationship with the corresponding sentence in the target article, but they are not identical, making the entire article appear different. The device 900 can also be used to generate a corresponding abridged version of an article. Here, the first sentence refers to the sentence to be matched, such as a sentence in the target article in online content creation, and the second sentence refers to the generated sentence that matches the first sentence. The matching here can mean that the meaning is the same as the sentence in the target article, but the wording is different, or it can refer to a abridged version of a sentence in the target article, etc.
[0219] Because this embodiment is completely Figure 8 The embodiment of the generative response device 800 shown is extended, and the execution of the functions of each unit is as follows: Figure 8 The execution of each unit's function is similar, and its implementation process will not be described in detail.
[0220] like Figure 10As shown, according to an embodiment of this disclosure, a training device 1000 for a correlation evaluation model is provided, comprising: a training sample set acquisition unit 1010, configured to acquire an input training sample set, wherein each training sample in the training sample set includes a pair consisting of a preset semantic expression string and a preset word, and a correlation label pre-attached to the preset semantic expression string and the preset word; a correlation evaluation model input unit 1020, configured to input the pairs in each training sample of the training sample set into the correlation evaluation model respectively, and obtain the correlation degree of the preset semantic expression string and the preset word in the pair determined by the correlation evaluation model; a determination unit 1030, configured to determine whether the correlation degree determined by the correlation evaluation model matches the corresponding correlation label; and an adjustment unit 1040, configured to adjust the coefficients input into the correlation evaluation model if the proportion of matched samples in the training sample set does not reach a predetermined proportion, until the proportion of matched samples in the training sample set reaches the predetermined proportion.
[0221] Since the functions of each unit of the training device 1000 for the correlation evaluation model are combined above... Figure 4 The method embodiments have been described in detail in the discussion, so they will not be repeated here. For details, please refer to the relevant sections. Figure 4 Discussion of method implementation examples.
[0222] like Figure 11 As shown, according to an embodiment of this disclosure, a generative response apparatus 1100 is provided, including: a user input statement receiving unit 1110, for receiving user input statements; a semantic and sentiment expression string acquisition unit 1120, for acquiring the semantic expression string and sentiment expression string of the user input statement; a first word determination unit 1130, for determining the first word of the response string to the user input statement based on the semantic expression string and sentiment expression string of the user input statement; and a subsequent word determination unit 1140, for determining the next word of the response string based on the determined preceding word of the response string, the semantic expression string and sentiment expression string of the user input statement.
[0223] right Figure 11 The functions of each unit of the generative response device 1100 are described above. Figure 4 The method embodiments have been described in detail in the discussion, so they will not be repeated here. For details, please refer to the relevant sections. Figure 4 Discussion of method implementation examples.
[0224] The following reference Figure 12This section describes the hardware structure of a generative response device, a device for generating a second statement matching a first statement, or a training device 1200 for a relevance evaluation model according to embodiments of this disclosure. When the user terminal 101 itself has a generative response function, the generative response device, the device for generating a second statement matching the first statement, or the training device 1200 for the relevance evaluation model is the user terminal 101. When the user terminal 101 itself does not have a generative response function, but needs to communicate with a server that has a generative response function via the Internet, the generative response device, the device for generating a second statement matching the first statement, or the training device 1200 for the relevance evaluation model is the server.
[0225] Figure 12 The generative response device, the device for generating a second statement that matches the first statement, or the training device 1200 for the correlation evaluation model shown are merely examples and should not impose any limitations on the functionality and scope of use of the embodiments of this disclosure.
[0226] like Figure 6 As shown, the generative response device, the device for generating a second statement that matches the first statement, or the training device 1200 for the relevance evaluation model are represented in the form of a general-purpose computing device. Components of the generative response device, the device for generating a second statement that matches the first statement, or the training device 1200 for the relevance evaluation model may include, but are not limited to: at least one processing unit 1210, at least one storage unit 1220, and a bus 1230 connecting different system components (including storage unit 1220 and processing unit 1210).
[0227] The storage unit stores program code, which can be executed by the processing unit 1210, causing the processing unit 1210 to perform the above-mentioned combined... Figure 4-7 The methods and steps described.
[0228] Storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 12201 and / or cache memory 12202, and may further include a read-only memory (ROM) 12203.
[0229] Storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0230] Bus 1230 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0231] The generative response device, the device that generates a second statement matching the first statement, or the training device for the correlation evaluation model 1200 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with the generative response device, the device that generates a second statement matching the first statement, or the training device for the correlation evaluation model 1200, and / or with any device that enables the generative response device, the device that generates a second statement matching the first statement, or the training device for the correlation evaluation model 1200 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 1250. Furthermore, the generative response device, the device that generates a second statement matching the first statement, or the training device for the correlation evaluation model 1200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via the network adapter 1260. As shown in the figure, network adapter 1260 communicates via bus 1230 with the generative response device, the device for generating a second statement matching the first statement, or other modules of the training device 1200 for the correlation evaluation model. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the generative response device, the device for generating a second statement matching the first statement, or the training device 1200 for the correlation evaluation model, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0232] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0233] In an exemplary embodiment of this disclosure, a computer program medium is also provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the aforementioned combined... Figure 4-7 The methods described.
[0234] According to one embodiment of this disclosure, a program product for implementing the methods in the above-described method embodiments is also provided. This product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of this disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0235] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0236] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0237] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0238] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0239] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0240] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0241] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0242] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A method for generating an answer, comprising: receiving a user input sentence; obtaining a semantic expression string of the user input sentence; obtaining a degree of association between the user input sentence and a word in a candidate vocabulary according to the semantic expression string of the user input sentence, including: inputting the semantic expression string of the user input sentence and each word in the candidate vocabulary into an evaluation model of the degree of association to obtain the degree of association between the user input sentence and the word; deleting the word with a degree of association less than a predetermined threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; and deleting the word with a degree of association less than the predetermined threshold from the content words in the candidate vocabulary; determining an answer string to the user input sentence according to the semantic expression string of the user input sentence and the candidate vocabulary after the deletion.
2. The method of claim 1, wherein, After receiving the user input sentence, the method further comprises: obtaining an emotional expression string of the user input sentence; the obtaining of the degree of association between the user input sentence and the word in the candidate vocabulary according to the semantic expression string of the user input sentence includes: obtaining the degree of association between the user input sentence and the word in the candidate vocabulary according to the semantic expression string and the emotional expression string of the user input sentence; and the determining of the answer string to the user input sentence according to the semantic expression string of the user input sentence, the emotional expression string and the candidate vocabulary after the deletion includes: determining the answer string to the user input sentence according to the semantic expression string, the emotional expression string and the candidate vocabulary after the deletion.
3. The method of claim 2, wherein, the determining of the answer string to the user input sentence according to the semantic expression string, the emotional expression string and the candidate vocabulary after the deletion includes: determining a first word of the answer string based on the semantic expression string and the emotional expression string; determining a next word of the answer string based on the semantic expression string, the emotional expression string and the previous word determined in the answer string; connecting the next word determined in sequence after the previous word determined to form the answer string.
4. The method of claim 3, wherein, the determining of the first word of the answer string based on the semantic expression string and the emotional expression string includes: determining a first word vector of the answer string based on the semantic expression string and the emotional expression string; determining a similarity between the determined word vector and a word vector of each word in the candidate vocabulary; determining the word with the maximum similarity in the candidate vocabulary as the determined first word.
5. The method of claim 3, wherein, the determining of the next word of the answer string based on the semantic expression string, the emotional expression string and the previous word determined in the answer string includes: determining a next word vector of the answer string based on a word vector of the previous word determined in the answer string; determining a similarity between the determined word vector and a word vector of each word in the candidate vocabulary; determining the word with the maximum similarity in the candidate vocabulary as the determined next word.
6. The method of claim 2, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
7. The method of claim 1, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
8. The method of claim 2, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
9. The method of claim 4, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
10. The method of claim 5, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
11. The method of claim 2, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence.
12. The method of claim 1, wherein, The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the user input sentence. The method further includes: obtaining the semantic expression string of the user input sentence, including: obtaining the word vector of each word in the user input sentence; and connecting the word vectors in the order of the words to obtain the semantic expression string of the According to the semantic expression string of the first sentence and the candidate vocabulary after deletion, a second sentence matching the first sentence is determined.
14. A training method of a relevance evaluation model, the relevance evaluation model being applied to the generative response method of any one of claims 1-12, comprising: obtaining an input training sample set, each training sample of the training sample set comprising a pair composed of a preset semantic expression string and a preset word, and a relevance label previously attached to the preset semantic expression string and the preset word; inputting the pair in each training sample of the training sample set into a relevance evaluation model respectively, to obtain a relevance of the preset semantic expression string and the preset word in the pair determined by the relevance evaluation model; determining whether the relevance determined by the relevance evaluation model matches the corresponding relevance label; if a proportion of matched samples in the training sample set fails to reach a predetermined proportion, adjusting coefficients in the relevance evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion.
15. The method of claim 14, wherein, After if a proportion of matched samples in the training sample set fails to reach a predetermined proportion, adjusting coefficients in the relevance evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion, the method further comprises: obtaining an input test sample set, each test sample of the test sample set comprising a pair composed of a preset semantic expression string and a preset word, and a relevance label previously attached to the preset semantic expression string and the preset word; inputting the pair in each test sample of the test sample set into a relevance evaluation model respectively, to obtain a relevance of the preset semantic expression string and the preset word in the pair determined by the relevance evaluation model; determining whether the relevance determined by the relevance evaluation model matches the corresponding relevance label; if a proportion of matched samples in the test sample set reaches the predetermined proportion, determining that the relevance evaluation model is successfully trained, otherwise, repeating the step of obtaining an input training sample set.
16. A generative response method, comprising: receiving a user input sentence; obtaining a semantic expression string and an emotional expression string of the user input sentence; obtaining a relevance of the user input sentence and a word in a candidate vocabulary according to the semantic expression string and the emotional expression string, comprising: inputting the semantic expression string, the emotional expression string of the user input sentence, and each word in the candidate vocabulary into a relevance evaluation model, to obtain the relevance of the user input sentence and each word in the candidate vocabulary; deleting a word with a relevance less than a predetermined threshold from the candidate vocabulary, comprising: dividing the candidate vocabulary into functional words and content words; and deleting a word with a relevance less than a predetermined relevance threshold from the content words from the candidate vocabulary; determining a first word of a response string to the user input sentence in the candidate vocabulary based on the semantic expression string and the emotional expression string of the user input sentence; and generating the response string to the user input sentence based on the first word. determine a last word of the response string based on the determined first word of the response string, the semantic expression string and the sentiment expression string of the user input sentence.
17. A generative response device, comprising: a user input sentence receiving unit configured to receive a user input sentence; a semantic expression string obtaining unit configured to obtain a semantic expression string of the user input sentence; a correlation degree obtaining unit configured to obtain a correlation degree between the user input sentence and words in a candidate vocabulary based on the semantic expression string of the user input sentence, including inputting the semantic expression string of the user input sentence and each word in the candidate vocabulary into a correlation degree evaluation model to obtain the correlation degree between the user input sentence and the each word; a deleting unit configured to delete words with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary, including dividing the candidate vocabulary into functional words and content words, and deleting words with a correlation degree less than the predetermined correlation degree threshold from the content words in the candidate vocabulary; a response string determining unit configured to determine a response string to the user input sentence based on the semantic expression string of the user input sentence and the candidate vocabulary after deletion.
18. A device for generating a second sentence matching a first sentence, comprising: a first sentence receiving unit configured to receive a first sentence; a semantic expression string obtaining unit configured to obtain a semantic expression string of the first sentence; a correlation degree obtaining unit configured to obtain a correlation degree between the first sentence and words in a candidate vocabulary based on the semantic expression string of the first sentence, including inputting the semantic expression string of the first sentence and each word in the candidate vocabulary into a correlation degree evaluation model to obtain the correlation degree between the first sentence and each word in the candidate vocabulary; a deleting unit configured to delete words with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary, including dividing the candidate vocabulary into functional words and content words, and deleting words with a correlation degree less than the predetermined correlation degree threshold from the content words in the candidate vocabulary; a second sentence determining unit configured to determine a second sentence matching the first sentence based on the semantic expression string of the first sentence and the candidate vocabulary after deletion.
19. A training device for a correlation degree evaluation model, the correlation degree evaluation model being applied to the generative response method of any one of claims 1-12, comprising: a training sample set obtaining unit configured to obtain an input training sample set, each training sample of the training sample set including a pair composed of a preset semantic expression string and a preset word, and a correlation degree label previously attached to the preset semantic expression string and the preset word; a correlation degree evaluation model input unit configured to input the pair in each training sample of the training sample set into a correlation degree evaluation model respectively to obtain a correlation degree of the preset semantic expression string and the preset word in the pair determined by the correlation degree evaluation model; a determining unit configured to determine whether the correlation degree determined by the correlation degree evaluation model matches the corresponding correlation degree label. An adjusting unit is configured to adjust coefficients in the input correlation evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion, if the proportion of matched samples in the training sample set does not reach the predetermined proportion.
20. A generative response device, comprising: a user input sentence receiving unit configured to receive a user input sentence; a semantic and sentiment expression string obtaining unit configured to obtain a semantic expression string and a sentiment expression string of the user input sentence; a first word determining unit configured to obtain a correlation degree between the user input sentence and each word in a candidate vocabulary according to the semantic expression string and the sentiment expression string, including: inputting the semantic expression string, the sentiment expression string, and each word in the candidate vocabulary into an correlation evaluation model to obtain the correlation degree between the user input sentence and each word in the candidate vocabulary; deleting a word with a correlation degree less than a predetermined threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; deleting a word with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary; and determining a first word of a response string to the user input sentence in the candidate vocabulary based on the semantic expression string and the sentiment expression string of the user input sentence; a subsequent word determining unit configured to determine a subsequent word of the response string in the candidate vocabulary based on the determined first word of the response string, the semantic expression string, and the sentiment expression string of the user input sentence.
21. A generative response device, comprising: a memory configured to store computer readable instructions; a processor configured to execute the computer readable instructions stored in the memory to perform: receiving a user input sentence; obtaining a semantic expression string of the user input sentence; obtaining a correlation degree between the user input sentence and each word in a candidate vocabulary according to the semantic expression string of the user input sentence, including: inputting the semantic expression string of the user input sentence and each word in the candidate vocabulary into an correlation evaluation model to obtain the correlation degree between the user input sentence and each word; deleting a word with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; deleting a word with a correlation degree less than a predetermined correlation degree threshold from the candidate vocabulary; and determining a response string to the user input sentence in the candidate vocabulary after deletion based on the semantic expression string of the user input sentence.
22. A device for generating a second sentence matching a first sentence, comprising: a memory configured to store computer readable instructions; a processor configured to execute the computer readable instructions stored in the memory to perform: receiving a first sentence; obtaining a semantic expression string of the first sentence; According to the semantic expression string of the first sentence, the association degree of the first sentence and each word in the candidate vocabulary is obtained, including: inputting the semantic expression string of the first sentence and each word in the candidate vocabulary into an association degree evaluation model to obtain the association degree of the first sentence and each word in the candidate vocabulary; deleting the word with an association degree less than a predetermined association degree threshold from the candidate vocabulary, and dividing the candidate vocabulary into functional words and content words; deleting the word with an association degree less than a predetermined association degree threshold from the content words in the candidate vocabulary; and determining the second sentence matched with the first sentence according to the semantic expression string of the first sentence and the candidate vocabulary after deletion.
23. A training device for an association degree evaluation model, the association degree evaluation model being applied to the generative response method of any one of claims 1-12, comprising: a memory for storing computer readable instructions; a processor for executing the computer readable instructions stored in the memory to perform: obtaining an input training sample set, each training sample in the training sample set comprising a pair consisting of a preset semantic expression string and a preset word, and an association degree label previously attached to the preset semantic expression string and the preset word; inputting the pair in each training sample in the training sample set into an association degree evaluation model to obtain the association degree of the preset semantic expression string and the preset word in the pair determined by the association degree evaluation model; determining whether the association degree determined by the association degree evaluation model matches the corresponding association degree label; and if the proportion of matched samples in the training sample set does not reach a predetermined proportion, adjusting the coefficients in the input association degree evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion.
24. A generative response device, comprising: a memory for storing computer readable instructions; a processor for executing the computer readable instructions stored in the memory to perform: receiving a user input sentence; obtaining a semantic expression string and an emotional expression string of the user input sentence; According to the semantic expression string and the emotional expression string, the association degree of the user input sentence and each word in the candidate vocabulary is obtained, including: inputting the semantic expression string, the emotional expression string of the user input sentence and each word in the candidate vocabulary into an association degree evaluation model to obtain the association degree of the user input sentence and each word in the candidate vocabulary; deleting the word with an association degree less than a predetermined threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; deleting the word with an association degree less than a predetermined association degree threshold from the content words in the candidate vocabulary; Based on the semantic expression string and the emotional expression string of the user input sentence, the first word of the response string to the user input sentence is determined in the candidate vocabulary; based on the determined previous word of the response string, the semantic expression string and the emotional expression string of the user input sentence, the next word of the response string is determined in the candidate vocabulary.
25. A computer readable medium, wherein, The computer readable medium stores computer instructions executable by a terminal device, and the computer instructions, when executed, implement: receiving a user input sentence; obtaining a semantic expression string of the user input sentence; obtaining an association degree between the user input sentence and a word in a candidate vocabulary according to the semantic expression string of the user input sentence, including: inputting the semantic expression string of the user input sentence and each word in the candidate vocabulary into an association degree evaluation model to obtain the association degree between the user input sentence and the each word; deleting a word with an association degree less than a predetermined association degree threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; deleting a word with an association degree less than a predetermined association degree threshold from the content words; and determining a response string to the user input sentence in the candidate vocabulary after the deletion according to the semantic expression string of the user input sentence.
26. A computer readable medium, wherein, The computer readable medium stores computer instructions executable by a terminal device, and the computer instructions, when executed, implement: receiving a first sentence; obtaining a semantic expression string of the first sentence; obtaining an association degree between the first sentence and a word in a candidate vocabulary according to the semantic expression string of the first sentence, including: inputting the semantic expression string of the first sentence and each word in the candidate vocabulary into an association degree evaluation model to obtain the association degree between the first sentence and each word in the candidate vocabulary; deleting a word with an association degree less than a predetermined association degree threshold from the candidate vocabulary, dividing the candidate vocabulary into functional words and content words; deleting a word with an association degree less than a predetermined association degree threshold from the content words; and determining a second sentence matched with the first sentence according to the semantic expression string of the first sentence and the candidate vocabulary after the deletion.
27. A computer readable medium, wherein, The computer readable medium stores computer instructions executable by a terminal device, and the computer instructions, when executed, implement: obtaining an input training sample set, each training sample in the training sample set including a pair composed of a preset semantic expression string and a preset word, and an association degree label previously attached to the preset semantic expression string and the preset word; inputting the pair in each training sample in the training sample set into an association degree evaluation model to obtain an association degree between the preset semantic expression string and the preset word in the pair determined by the association degree evaluation model, the association degree evaluation model being applied to the generative response method in any one of claims 1-12; determining whether the association degree determined by the association degree evaluation model matches the corresponding association degree label; and if a proportion of matched samples in the training sample set fails to reach a predetermined proportion, adjusting a coefficient in the input association degree evaluation model until the proportion of matched samples in the training sample set reaches the predetermined proportion.
28. A computer readable medium, wherein, The computer readable medium stores computer instructions executable by a terminal device, and the computer instructions, when executed, implement: receiving a user input sentence; obtaining a semantic expression string and an emotional expression string of the user input sentence; According to the semantic expression string and the emotional expression string, the relevance of the user input sentence and each word in the candidate vocabulary is obtained, including: inputting the semantic expression string and the emotional expression string of the user input sentence and each word in the candidate vocabulary into a relevance evaluation model to obtain the relevance of the user input sentence and each word in the candidate vocabulary; deleting the word with a relevance less than a predetermined threshold from the candidate vocabulary, including: dividing the candidate vocabulary into functional words and content words; deleting the word with a relevance less than a predetermined relevance threshold from the candidate vocabulary; determining the first word of the response string of the user input sentence in the candidate vocabulary based on the semantic expression string and the emotional expression string of the user input sentence; determining the next word of the response string in the candidate vocabulary based on the determined previous word of the response string, the semantic expression string and the emotional expression string of the user input sentence.
Citation Information
Patent Citations
Automatic chatting method, device and electronic device
CN108920510A
An intelligent dialogue method and device
CN109829040A
Automatic question and answer method and device
CN110597966A
Candidate answer statement generation and natural language selection method and system
CN110727768A