Dialogue response method and device, terminal equipment and storage medium

By using content replacement model and sorting algorithm in the dialogue language model to generate summary information, the problems of reduced response speed and increased resource consumption caused by long historical information are solved, and more efficient dialogue response is achieved.

CN119149688APending Publication Date: 2024-12-17SHENZHEN CLOUD INTEGRAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411157413.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

When existing dialogue language models process long historical information, the response speed is significantly reduced and resource consumption increases, resulting in inefficiency.

Method used

By obtaining target dialogue statements and historical dialogue statements, use the content replacement model to determine the target reference pronoun, and input the replaced object statements into the sorting algorithm to generate summary information. Finally, input the summary information into the dialogue language model to generate response information, avoiding the entire Semantic understanding of conversation scenarios.

Benefits of technology

It improves the response speed of the dialogue model, reduces resource consumption, and enhances the response accuracy and efficiency of dialogue scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149688A_ABST
    Figure CN119149688A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is suitable for the technical field of computers, and provides a dialogue response method and device, terminal equipment and a storage medium, and the method comprises the steps: responding to a to-be-responded target dialogue statement sent by a user, and obtaining all historical dialogue statements in a dialogue scene where the target dialogue statement is located; inputting the target dialogue statement and all the historical dialogue statements into a preset content replacement model, and determining target anonyms corresponding to a plurality of dialogue characters in the target dialogue statement; inputting the target object statement after the dialogue text is replaced by the target anonym into a preset sorting algorithm, and generating summary information of the dialogue scene; and inputting the summary information into a preset dialogue language model, and generating response information corresponding to the target dialogue statement. Through the embodiment of the invention, the dialogue language model can directly respond according to the summary information generated by the terminal equipment, so that the response speed of the dialogue language model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application belong to the field of computer technology, and in particular, relate to a method, apparatus, terminal device, and storage medium for answering a conversation. Background Art

[0002] A conversational language model is a machine learning model that aims to simulate and implement natural, fluent conversations between people. A conversational language model can understand and generate natural language text, that is, it can understand the content input by users in natural language and generate responses in natural language that are relevant to the user input and have clear meaning. When a user has multiple rounds of conversations with a conversational language model, the conversational language model often needs to combine all the conversation content in the current conversation to understand the intent of the current question in order to respond to the user more accurately.

[0003] In the prior art, the conversation language model generally directly understands the intention of the current question based on all the historical information in the current conversation process. Therefore, when the length of the historical information is long, the response speed of the language conversation model will be significantly reduced, and resource consumption will be greatly increased. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a method, apparatus, terminal device and storage medium for answering a conversation, so as to improve the response speed of the conversation model.

[0005] A first aspect of an embodiment of the present application provides a method for answering a conversation, including:

[0006] In response to a target dialogue sentence to be answered sent by a user, all historical dialogue sentences in the dialogue scene where the target dialogue sentence is located are obtained;

[0007] Inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine target pronouns corresponding to a number of dialogue words in the target dialogue sentence; the content replacement model is used to determine the target pronouns referred to by the dialogue words in all the historical dialogue sentences based on all the historical dialogue sentences;

[0008] Inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene;

[0009] The summary information is input into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

[0010] In a possible implementation manner of the first aspect, inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine target pronouns corresponding to a plurality of dialogue characters in the target dialogue sentence includes:

[0011] Inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model, determining a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns;

[0012] Determine the candidate pronouns whose pronoun probabilities are greater than a probability threshold as words to be replaced;

[0013] All the words to be replaced are screened based on all the historical dialogue sentences, and the words to be replaced that have appeared in all the historical dialogue sentences are determined as the target pronouns.

[0014] In a possible implementation manner of the first aspect, the content replacement model includes a coding layer and a fully connected layer;

[0015] Before inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model to determine a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns, the method further includes:

[0016] The target dialogue sentence and all the historical dialogue sentences are respectively input into a preset feature extraction algorithm to generate a first feature vector corresponding to the target dialogue sentence and a second feature vector corresponding to each of the historical dialogue sentences; the first feature vector is used to represent the text features and position features of each of the dialogue characters in the target dialogue sentence; the second feature vector is used to represent the text features and position features of each character in the historical dialogue sentences;

[0017] The step of inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model, and determining a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns, includes:

[0018] Inputting the first feature vector and the second feature vector into the encoding layer to encode the first feature vector and the second feature vector to generate encoding features;

[0019] The encoding features are input into the fully connected layer to determine the multiple candidate pronouns and the probabilities of pronouns corresponding to the candidate pronouns.

[0020] In a possible implementation of the first aspect, inputting the target object sentence after replacing the dialogue text with the target pronoun into a preset sorting algorithm to generate summary information of the dialogue scene includes:

[0021] Based on the order of each of the dialogue characters in the target dialogue sentence, all the target pronouns corresponding to the dialogue characters are input into the sorting algorithm one by one to generate a sorting result corresponding to the dialogue characters;

[0022] The summary information is generated based on the position of the dialogue text corresponding to each of the sorting results in the target dialogue sentence.

[0023] In a possible implementation of the first aspect, based on the order of each of the dialogue characters in the target dialogue sentence, inputting all of the target pronouns corresponding to the dialogue characters into the sorting algorithm one by one to generate sorting results corresponding to the dialogue characters includes:

[0024] For any of the dialogue texts, if the number of target pronouns corresponding to the dialogue text is 1, determining that the target pronoun is a ranking result corresponding to the dialogue text;

[0025] If the number of target pronouns corresponding to the dialogue text is greater than 1, the appearance position of each target pronoun in the dialogue scene is obtained, and all the target pronouns are sorted based on the appearance position to generate a sorting result corresponding to the dialogue text.

[0026] In a possible implementation manner of the first aspect, before inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model and determining target pronouns corresponding to a plurality of dialogue words in the target dialogue sentence, the method further includes:

[0027] Obtaining a model to be trained input by a user, and generating an initial result by inputting a training sample into the model to be trained for processing; the training sample includes a training vector matrix and an expected pronoun;

[0028] determining an error value of the initial result based on the initial result and the expected referent;

[0029] The model to be trained is updated based on the error value until the error value satisfies a preset training stop condition, and the model to be trained corresponding to when the error value satisfies the training stop condition is used as the content replacement model.

[0030] A second aspect of an embodiment of the present application provides a conversation answering device, including:

[0031] A historical sentence acquisition module, configured to respond to a target dialogue sentence to be answered sent by a user and acquire all historical dialogue sentences in the dialogue scenario where the target dialogue sentence is located;

[0032] a pronoun determination module, configured to input the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model, and determine target pronouns corresponding to a plurality of dialogue words in the target dialogue sentence; the content replacement model is configured to determine the target pronouns to which the dialogue words refer in all the historical dialogue sentences based on all the historical dialogue sentences;

[0033] A summary generation module, used for inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene;

[0034] The response information generation module is used to input the summary information into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

[0035] A third aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for answering a conversation as described in the first aspect above is implemented.

[0036] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for answering a conversation as described in the first aspect above is implemented.

[0037] A fifth aspect of the embodiments of the present application provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the method for answering a conversation described in the first aspect.

[0038] Compared with the prior art, the embodiments of the present application have the following advantages:

[0039] In an embodiment of the present application, the terminal device can respond to the target dialogue sentence to be answered sent by the user, and obtain all historical dialogue sentences in the dialogue scene where the target dialogue sentence is located; after obtaining all historical dialogue sentences in the dialogue scene, the terminal device can input the target dialogue sentence and all historical dialogue sentences into the content replacement model pre-set by the developer; the terminal device can determine the target pronouns corresponding to several dialogue texts in the target dialogue sentence through the content replacement model; wherein the content replacement model can be used to determine the target pronouns referred to by each dialogue text in all historical dialogue sentences based on all input historical dialogue sentences; after determining the target pronouns corresponding to each dialogue text, the terminal device can replace the dialogue text in the target object sentence with the target pronoun, and input the target object sentence after the dialogue text is replaced by the target pronoun into the sorting algorithm pre-set by the developer; the terminal device can generate summary information corresponding to the dialogue scene through the sorting algorithm; finally, the terminal device can input the generated summary information into the dialogue language model pre-set by the developer to generate response information corresponding to the target dialogue sentence through the dialogue language model. In an embodiment of the present application, the terminal device can determine the target referents referred to by each dialogue text in the target dialogue sentence in the historical dialogue sentence through the content replacement model, and generate summary information according to the target referents corresponding to each dialogue text. Through the method provided by this embodiment, the dialogue language model does not need to semantically understand all dialogue sentences in the dialogue scene, but can directly respond according to the summary information generated by the terminal device. Therefore, the method provided by this embodiment can improve the response speed of the terminal device when conducting a dialogue with the user, and effectively reduce the resource consumption of the dialogue language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 It is a schematic diagram of a method for answering a conversation provided in an embodiment of the present application;

[0042] Figure 2 This is a schematic diagram of a continuous conversation scenario provided by an embodiment of the present application;

[0043] Figure 3 It is a structural diagram of a content replacement model provided in an embodiment of the present application;

[0044] Figure 4is a schematic diagram of another method for answering a conversation provided in an embodiment of the present application;

[0045] Figure 5 It is a schematic diagram of a conversation answering device provided in an embodiment of the present application;

[0046] Figure 6 It is a schematic diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In the following description, specific details such as specific system structures, technologies, etc. are proposed for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from hindering the description of the present application.

[0048] The technical solution of the present application is described below through specific embodiments.

[0049] Reference Figure 1 , shows a schematic diagram of a method for answering a conversation provided in an embodiment of the present application, which can be applied to a terminal device. The terminal device can be an electronic device such as a computer, a tablet computer, a smart phone, etc. The above method can specifically include the following steps:

[0050] S101. In response to a target dialogue sentence to be answered sent by a user, all historical dialogue sentences in the dialogue scenario where the target dialogue sentence is located are obtained.

[0051] In this embodiment, when a user needs to conduct a human-computer dialogue with a terminal device, or needs to use the automatic answering function of the terminal device, the user can send a target dialogue sentence to be answered to the terminal device. After receiving the target dialogue sentence sent by the user, the terminal device can respond to the received target dialogue sentence and obtain all historical dialogue sentences in the dialogue scene where the target dialogue sentence is located. Figure 2 , shows a schematic diagram of a continuous conversation scenario provided by an embodiment of the present application. Figure 2 In the dialogue scenario shown, the most recent sentence sent by the user can be the target dialogue sentence in the dialogue scenario, that is, "How much is the ticket?" sent by the user can be the target dialogue sentence in the dialogue scenario. In the dialogue scenario, all sentences that appear earlier than the target dialogue sentence can be the historical dialogue sentences in the dialogue scenario, that is, "My family is traveling in Suzhou, and we want to find a medium-priced attraction in Gusu District." sent by the user and "I recommend you to go to the Humble Administrator's Garden." replied by the system can both be the historical dialogue sentences in the dialogue scenario.

[0052] S102, inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine target pronouns corresponding to a number of dialogue texts in the target dialogue sentence; the content replacement model is used to determine the target pronouns referred to by the dialogue texts in all the historical dialogue sentences based on all the historical dialogue sentences.

[0053] In this embodiment, after the terminal device obtains all the historical dialogue sentences in the dialogue scenario, it can input all the historical dialogue sentences obtained and the target dialogue sentence input by the user into the content replacement model preset by the developer. Among them, the target dialogue sentence can be composed of multiple dialogue characters. The content replacement model can be used to determine the target pronouns referred to by each dialogue character in the target dialogue sentence in all the historical dialogue sentences based on all the historical dialogue sentences input by the terminal device. The terminal device can determine the target pronouns corresponding to each dialogue character in the target dialogue sentence through the content replacement model.

[0054] In one possible implementation, see Figure 3 , shows a schematic diagram of the structure of a content replacement model provided by an embodiment of the present application. Figure 3 As shown, the content replacement model may include an encoding layer and a fully connected layer. Among them, the encoding layer may be composed of an input structure, a semantic encoder and a position encoder. After the terminal device obtains the target dialogue sentence and all the historical dialogue sentences in the dialogue scene, it can input the target dialogue sentence and all the historical dialogue sentences into the feature extraction algorithm pre-set by the developer. Among them, the feature extraction algorithm can be used to generate text features and position features corresponding to each character in the target dialogue sentence and the historical dialogue sentence. It should be noted that the feature extraction algorithm in the embodiment of the present application can be any algorithm known to those skilled in the art such as the Word2Vec algorithm and the Glove algorithm that can generate feature vectors of characters. The embodiment of the present application is not used to specifically limit the feature extraction algorithm. The terminal device can generate a first feature vector corresponding to the target dialogue sentence and a second feature vector corresponding to the historical dialogue sentence through the feature extraction algorithm. Among them, the first feature vector can be used to represent the text features and position features corresponding to each dialogue character in the target dialogue sentence. The second feature vector can be used to represent the text features and position features corresponding to each character in the historical dialogue sentence.

[0055] After the terminal device obtains the first feature vector corresponding to the target dialogue sentence and the second feature vector corresponding to each historical dialogue sentence through the feature extraction algorithm, the first feature vector and the second feature vector can be input into the content replacement model. The terminal device can first input the first feature vector and the second feature vector into the encoding layer of the content replacement model. After the encoding layer receives the first feature vector and the second feature vector through the input structure, the text features in the first feature vector and the second feature vector can be encoded through the text encoder, and the position features in the first feature vector and the second feature vector can be encoded through the position encoder to generate encoding features. Then, the terminal device can input the encoding features into the fully connected layer of the content replacement model to generate multiple candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to each candidate pronoun through the fully connected layer.

[0056] like Figure 3 As shown, after obtaining the target dialogue sentence and all historical dialogue sentences in the current dialogue scenario, the terminal device can input the target dialogue sentence and all historical dialogue sentences into the feature extraction algorithm to obtain the text features and position features of the input sentences through the feature extraction algorithm. After obtaining the first feature vector of the target dialogue sentence and the second feature vector of the historical dialogue sentence, the terminal device can input the first feature vector and the second feature vector into the content replacement model to generate the target pronoun corresponding to each dialogue word in the target dialogue sentence through the content replacement model.

[0057] Among them, the content replacement model may include a coding layer and a fully connected layer. The coding layer can be used to encode the first feature vector and the second feature vector to generate coding features, and the fully connected layer can be used to map the coding features output by the coding layer to corresponding classification dimensions and calculate the probability values ​​of the features in each classification dimension. Specifically, in this embodiment, the classification dimensions in the fully connected layer may include candidate pronoun dimensions and non-candidate pronoun dimensions. Therefore, by inputting the coding features into the fully connected layer, the terminal device can determine the candidate pronouns corresponding to each dialogue text and the probabilities of each candidate pronoun.

[0058] In this embodiment, since the content replacement model is only composed of an encoding layer and a fully connected layer, the model structure of the content replacement model is simpler than the complex network structure of the dialogue language model. Therefore, compared with directly determining the target pronoun through the dialogue language model, using the content replacement model to determine the target pronoun can significantly reduce the memory required for the terminal device to respond to the dialogue. In addition, since the content replacement model can calculate the target pronoun corresponding to each dialogue text in parallel according to the input first feature vector and second feature vector, the method provided in this embodiment can increase the generation speed of the target pronoun.

[0059] In a possible implementation, after the terminal device generates multiple candidate pronouns corresponding to the dialogue text and the pronoun probabilities corresponding to each candidate pronoun through the content replacement model, it can determine whether the pronoun probabilities corresponding to each candidate pronoun are greater than the probability threshold value preset by the developer. The terminal device can select the to-be-replaced word corresponding to the dialogue text from multiple candidate pronouns by determining whether the pronoun probabilities are greater than the probability threshold value. If the pronoun probabilities corresponding to a candidate pronoun are greater than the probability threshold value, the terminal device can determine that the candidate pronoun is the to-be-replaced word of the dialogue text corresponding to it. If the pronoun probabilities corresponding to a candidate pronoun are less than or equal to the probability threshold value, the terminal device can determine that the current candidate pronoun is not the to-be-replaced word of the dialogue text corresponding to it, and the terminal device can delete the candidate pronoun. After the terminal device selects the to-be-replaced word corresponding to the dialogue text through the pronoun probabilities, it can further select the to-be-replaced word through all the historical dialogue sentences and the target dialogue sentences in the current dialogue scene to determine the target pronoun corresponding to the dialogue text. Specifically, for any to-be-replaced word, the terminal device can determine whether it has appeared in the historical dialogue sentences and / or the target dialogue sentences. If the word to be replaced corresponding to a certain dialogue text has appeared in any one or more historical dialogue sentences and / or target dialogue sentences, the terminal device can determine that the word to be replaced is the target pronoun of the corresponding dialogue text. If the word to be replaced corresponding to a certain dialogue text has not appeared in any historical dialogue sentence and / or target dialogue sentence, the terminal device can determine that the word to be replaced is not the target pronoun of the corresponding dialogue text, and the terminal device can delete the word to be replaced.

[0060] For example, in Figure 2 In the dialogue scenario shown, the candidate pronouns corresponding to "ticket" generated by the content replacement model may include but are not limited to "ticket", "door", "price", "document", "paper", etc. Among them, the reference probability of "ticket" can be 0.98, the reference probability of "door" can be 0.80, the reference probability of "price" can be 0.80, the reference probability of "document" can be 0.30, and the reference probability of "paper" can be 0.35. When the probability threshold set by the developer is 0.75, the words to be replaced corresponding to "ticket" can include "ticket", "door", and "price". Then, the terminal device can further screen all the words to be replaced through all historical dialogue sentences and target dialogue sentences in the current dialogue scenario. Among them, since "price" has not appeared in the dialogue scenario, the terminal device can delete "price". Since the two words "ticket" and "door" have both appeared in the dialogue scenario, the terminal device can determine that the two words "ticket" and "door" are the target pronouns corresponding to "ticket".

[0061] In this embodiment, after the terminal device determines multiple candidate pronouns and probabilities corresponding to the dialogue text through the content replacement model, it can further screen the multiple candidate pronouns determined through the probability threshold and the historical dialogue sentences to determine the target pronouns of each dialogue text in the current dialogue scene. Therefore, the method provided by this embodiment can ensure that the generated target pronouns conform to the original semantics of the current dialogue scene, thereby improving the accuracy of the target pronouns.

[0062] S103, inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene.

[0063] In this embodiment, after determining the target referent corresponding to each dialogue text, the terminal device can replace the corresponding dialogue text in the target dialogue sentence with the target referent. The terminal device can input the target object sentence after the dialogue text is replaced by the target referent into the sorting algorithm pre-set by the developer, so as to generate summary information of the target dialogue sentence in the current dialogue scenario through the sorting algorithm. The sorting algorithm can sort each target referent according to the position of the dialogue text in the target dialogue sentence and the appearance position of the target referent corresponding to the dialogue text in all historical dialogue sentences.

[0064] In a possible implementation, after determining the target pronouns corresponding to each dialogue text in the target dialogue sentence, the terminal device can input all the target pronouns corresponding to the dialogue text into a sorting algorithm preset by the developer one by one according to the order of each dialogue text in the target dialogue sentence, so as to generate sorting results corresponding to each dialogue text through the sorting algorithm. The sorting algorithm can sort all the target pronouns corresponding to a certain dialogue text according to the position of each target pronoun in all historical dialogue sentences. After generating the sorting results, the terminal device can generate summary information of the dialogue scene according to all the sorting results and the position of the dialogue text corresponding to each sorting result in the target sentence.

[0065] For example, in Figure 2In the shown dialogue scenario, the target pronouns corresponding to the character "它" in the target dialogue statement may include "拙", "政", "园", the target pronoun corresponding to "的" may be "的", the target pronouns corresponding to "门" may be "门", "票", the target pronouns corresponding to "票" may be "门", "票", the target pronoun corresponding to "是" may be "是", the target pronoun corresponding to "多" may be "多", and the target pronoun corresponding to "少" may be "少". The terminal device may input all the target pronouns corresponding to these dialogue texts into the sorting algorithm in sequence according to the order of "它", "的", "门", "票", "是", "多", "少" for sorting.

[0066] In this embodiment, after the terminal device determines the target pronouns of each dialogue text, it may re-sort the target pronouns of each dialogue text according to the sorting algorithm to generate summary information. Therefore, the method provided in this embodiment ensures that the summary information generated by the terminal device can accurately express the content in the historical dialogue statement and guarantees the semantic accuracy of the summary information.

[0067] In a possible implementation manner, the specific calculation process of the sorting algorithm in the terminal device may be described as follows. For all the target pronouns of any dialogue text, the terminal device may first obtain the number of all the target pronouns corresponding to this dialogue text. If the number of all the target pronouns corresponding to a certain dialogue text is less than 1, the terminal device may output a first prompt message. The first prompt message may be used to indicate that an error has occurred in the content replacement model. If the number of all the target pronouns corresponding to a certain dialogue text is equal to 1, the terminal device may directly determine this target pronoun as the sorting result corresponding to this dialogue text. If the number of all the target pronouns corresponding to a certain dialogue text is greater than 1, the terminal device may query the occurrence positions of each target pronoun corresponding to this dialogue text in the dialogue scenario through a position search function. The occurrence position of a certain target pronoun in the dialogue scenario may include the position of this target pronoun in a certain historical dialogue statement or the position of this target pronoun in the target dialogue statement.

[0068] Specifically, for a target referential that appears more than once in a dialogue scenario, the terminal device can calculate the distances between the positions where the target referential appears in the dialogue scenario and the corresponding dialogue texts, and use the position closest to the dialogue text in the dialogue scenario as the appearance position corresponding to the target referential. For a target referential that appears only once in the dialogue scenario, the terminal device can use the unique position where the target referential appears in the dialogue scenario as the appearance position corresponding to the target referential. After the terminal device obtains the appearance positions of all target referentials in the dialogue scenario, it can sort all the target referentials corresponding to the dialogue text according to the appearance positions to generate a sorting result corresponding to the dialogue text. Specifically, the terminal device can sort all the target referentials corresponding to the dialogue text from front to back according to the appearance positions to generate a sorting result corresponding to the dialogue text. After the terminal device generates the sorting results corresponding to all the dialogue texts in the target dialogue statement, it can splice the sorting results of all the dialogue texts according to the order in which the dialogue texts appear in the target dialogue statement to generate summary information of the target dialogue statement in the current dialogue scenario.

[0069] Exemplarily, in Figure 2 the shown dialogue scenario, the target referentials corresponding to the word "it" in the target dialogue statement include "Zhuo", "Zheng", and "Garden". Since the number of target referentials corresponding to the word "it" is greater than 1, the terminal device can respectively obtain the appearance positions of the three target referentials "Zhuo", "Zheng", and "Garden" in the dialogue scenario and sort them according to their respective corresponding appearance positions. Therefore, the sorting result corresponding to the word "it" can be "Zhuozheng Garden". The target referential corresponding to "of" is "of". Since the number of target referentials corresponding to the word "of" is equal to 1, the terminal device can determine that the sorting result corresponding to "of" is "of".

[0070] As shown below is a program code example of a sorting algorithm provided by an embodiment of the present application.

[0071] Define the function find_w_index(w, text):

[0072] Initialize an empty list ls

[0073] Construct a regular expression pattern pattern to match the word w

[0074] Traverse the words w matched in the full text text and add their indexes to ls

[0075] Return ls

[0076] Define the function find_near_w(last_w, cur_text, text):

[0077] Call the find_w_index function to get the index list last_index of the word last_w in the full text text

[0078] Build the target set cur_index, traverse the words in the target set cur_text, call the find_w_index function to obtain its index in the full text text, and add it to cur_index

[0079] Construct the dictionary final, record the distance between the word last_w and the word in the target set

[0080] Find the index j of the closest word and return the index of the word in the full text text

[0081] Initializes an empty string str1

[0082] Traverse the text list in the model prediction result res

[0083] If it is the first word, assign it to last_w

[0084] If there is only one word, add it directly to str1 and update last_w

[0085] If there are multiple words, the loop will find the nearest word according to the find_near_w function, add it to str1, and update last_w

[0086] Returns the rearranged string str1

[0087] In this embodiment, after obtaining the target pronouns of each dialogue text, the terminal device can re-sort the target pronouns of the dialogue text according to the appearance position of the target pronoun in the dialogue scene. Therefore, the method provided in this embodiment can not only enhance the readability of the summary information generated by the terminal device, but also ensure that the generated summary information conforms to the original semantics of the dialogue scene, thereby ensuring the response accuracy of the dialogue language model.

[0088] S104: Input the summary information into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

[0089] In this embodiment, after generating summary information, the terminal device can input the generated summary information into the dialogue language model preset by the developer to generate response information corresponding to the target dialogue sentence through the dialogue language model. After the dialogue language model generates the response information, the terminal device can display the generated response information through the display screen, or play the generated response information through the audio device to realize the dialogue between the terminal device and the user. It should be noted that in the embodiment of the present application, the dialogue language model can be any conversational language model known to those skilled in the art, such as the GPT-3 model, the BERT model, the LaMDA model, etc., and the embodiment of the present application is not used to specifically limit the dialogue language model.

[0090] In this embodiment, after the user inputs the target dialogue sentence, the dialogue language model in the terminal device can generate response information corresponding to the target dialogue sentence according to the summary information corresponding to the dialogue scene, that is, when generating the response information, the dialogue language model does not need to perform semantic understanding of all historical dialogue sentences in the dialogue scene, but can directly respond according to the summary information with fewer words. Therefore, the method provided in this embodiment can improve the response speed of the dialogue language model. Since the dialogue language model does not need to perform semantic understanding of all historical dialogue sentences, the method provided in this embodiment can also reduce the resource consumption of the dialogue language model.

[0091] Figure 4 The specific implementation flow chart of a method S102 for answering a conversation provided in the second embodiment of the present application is shown. Figure 4 , compared to Figure 1 In the embodiment, the method for answering a conversation provided in this embodiment includes S102: S401 to S403, which are described in detail as follows:

[0092] S401, obtaining a model to be trained input by a user, and generating an initial result by inputting a training sample into the model to be trained for processing; the training sample includes a training vector matrix and an expected pronoun.

[0093] In this embodiment, before the terminal device determines the target pronouns of each dialogue word in the target dialogue sentence through the content replacement model, it can first perform model training on the model to be trained to determine the content replacement model. The terminal device can obtain the model to be trained and the training sample input by the user, and process the training sample input value in the model to be trained to generate an initial result corresponding to the training sample through the model to be trained. The training sample input by the user can include a training vector matrix and an expected pronoun.

[0094] In a possible implementation, the training vector matrix in the training sample can be formed by the terminal device performing data processing on the training dialogue sentences, training history sentences and expected summary information. Before the user trains the model to be trained through the training sample, the user can first input the training dialogue sentences, training history sentences and expected pronouns into the terminal device, and perform data processing on the training dialogue sentences, training history sentences and expected summary information through the terminal device to determine the training vector matrix required by the model to be trained and the expected pronouns corresponding to each word in the training dialogue sentences. The terminal device can obtain the training dialogue sentences, training history sentences and expected summary information input by the user.

[0095] Then, the terminal device may input the training dialogue sentence and the expected summary information into a common substring search algorithm preset by the user, so as to determine the common substring between the training dialogue sentence and the expected summary information through the common substring search algorithm. The common substring search algorithm may respectively compare each character string in the training dialogue sentence and the expected summary information, and calculate the similarity between each character string in the training dialogue sentence and the expected summary information. For two character strings whose similarity is greater than or equal to a similarity threshold, the terminal device may determine them as common substrings between the dialogue sentence and the expected summary information. Exemplarily, the common substring search algorithm in the terminal device may be a SequenceMatcher algorithm. After the terminal device determines multiple common substrings between the dialogue sentence and the expected summary information through the common substring search algorithm, it may write all the determined common substrings into a list to generate a common substring list between the training dialogue sentence and the expected summary information.

[0096] In order to further improve the training effect of the model to be trained, after determining all common substrings between the training dialogue sentence and the expected summary information, the terminal device can segment the training dialogue sentence and the expected summary information according to all common substrings in the common substring list, and generate a first segmentation result corresponding to the training dialogue sentence and a second segmentation result corresponding to the expected summary information. Then, the terminal device can compare each character string in the first segmentation result and the second segmentation result one by one, and re-segment and sort them to align the text in the training dialogue sentence with the text in the expected summary information, so as to determine the expected pronouns corresponding to each character in the training dialogue sentence.

[0097] The terminal device may sequentially obtain each character in the first segmentation result and compare each character string in the second segmentation result one by one, until it is determined that a character in the second segmentation result is consistent with the currently compared character, then the terminal device may add all characters before the consistent character in the second segmentation result to the segmentation list, and obtain the next character in the first segmentation result and compare it with the next character in the second segmentation result, until all characters are added to the segmentation list. The terminal device may determine the first rearrangement result corresponding to the training dialogue sentence and the second rearrangement result corresponding to the expected summary information according to the segmentation list, and determine the expected pronoun corresponding to each character in the training dialogue sentence according to the first rearrangement result and the second rearrangement result.

[0098] For example, in a certain dialogue scenario, the training dialogue question is, what is the phone number? The expected pronoun is, what is the phone number of Humble Administrator's Garden? The common substrings between the training dialogue sentence and the expected summary information in this scenario may include phone number and how much. Therefore, the first segmentation result in this dialogue scenario may be [empty, phone number, how much], and the second segmentation result may be [Humble Administrator's Garden, phone number, how much]. Then, the terminal device may compare each string in the first segmentation result and the second segmentation result one by one.

[0099] For example, since the first character string in the first cutting result is an empty string, the terminal device can take the "electricity" in the first cutting result and compare it one by one with the characters in the second cutting result. Since the third character "electricity" in the second cutting result is the same as the "electricity" in the first cutting result, the terminal device can add the three characters "Humble Administrator's Garden Electricity" to the cutting list. The terminal device can continue to take the "words" in the first cutting result and compare it one by one with the characters after "electricity" in the second cutting result. Since the "words" in the first cutting result is consistent with the fourth character "words" in the second cutting result, the terminal device can add "words" to the cutting list. The terminal device can continue to take the "how much" in the first cutting result and compare it one by one with the characters after "words" in the second cutting result. Finally, the terminal device can determine that the first rearrangement result of the training dialogue sentence is: [electricity, words, how much]; the second rearrangement result of the expected summary information is: [Humble Administrator's Garden Electricity, Words, How Much]. Therefore, the expected pronoun for "electricity" in the training dialogue sentences is "Zhuozhengyuandian", the expected pronoun for "talk" is "talk", and the expected pronoun for "how much" is "how much".

[0100] In a possible implementation, after determining the expected referent corresponding to each character in the training dialogue sentence, the terminal device can determine the position of each character in the training history sentence in the conversion word list through the conversion word list pre-set by the developer, and determine the first text feature corresponding to the training history sentence according to the position of each character in the training history sentence in the conversion word list. The terminal device can also determine the position of each character in the training dialogue sentence in the conversion word list through the conversion word list, and determine the second text feature corresponding to the training dialogue sentence according to the position of each character in the training dialogue sentence in the conversion word list. Among them, the first text feature and the second text feature can be composed of multiple one-dimensional text vector matrices. Among them, each character in the training dialogue sentence and the training history sentence can correspond to a text vector matrix. Specifically, after determining the corresponding position of a certain character in the training dialogue sentence and the training history sentence in the conversion word list, the terminal device can mark the corresponding position in the one-dimensional vector word list as 1 to generate a mask vector matrix corresponding to the character.

[0101] After generating the first text feature corresponding to the training history sentence and the second text feature corresponding to the training dialogue sentence, the terminal device can directly determine the mask vector pre-set by the developer as the historical position feature corresponding to the training history sentence. The terminal device can also input the training dialogue sentence and the expected pronoun into the position feature algorithm pre-set by the developer to generate the training position feature corresponding to the training dialogue sentence through the position feature algorithm. Among them, the training position feature can be composed of multiple one-dimensional position vector matrices, and each character in the training dialogue sentence can correspond to the first position vector matrix. The process of the terminal device generating the training position feature through the position feature algorithm can be specifically described as follows.

[0102] The terminal device can determine one by one whether each character in the training dialogue sentence is consistent with its corresponding expected referent. If a character in the training dialogue sentence is consistent with its corresponding expected referent, the terminal device can generate a position vector matrix corresponding to the character based on the position of the character in the training dialogue sentence. If a character in the training dialogue sentence is inconsistent with its corresponding expected referent, the terminal device can generate a position vector matrix corresponding to the character based on the position of the expected referent corresponding to the character in the training history sentence. After determining the position vector matrix of each character in the training dialogue sentence, the terminal device can splice the corresponding position vector matrix of each character according to the order in which the characters appear in the training dialogue sentence to generate a training position feature corresponding to the training dialogue sentence.

[0103] Exemplarily, in a certain dialogue scenario, the training historical statement is: [User] Our family comes to Suzhou for tourism. We want to find a scenic spot with medium consumption level in Gusu District to visit. [System] I recommend Humble Administrator's Garden to you. The training dialogue statement is: What's the phone number of this scenic spot? The expected pronouns are: Humble Administrator's Garden, phone number, what's. Among them, for the training dialogue statement, the expected pronoun corresponding to "this scenic spot" is "Humble Administrator's Garden", the expected pronoun corresponding to "phone number" is "phone number", and the expected pronoun corresponding to "what's" is "what's".

[0104] For the training historical statement, the terminal device can directly determine the mask vector preset by the developer as the historical position feature corresponding to the training historical statement. For example, for the character "拙" in the training historical statement, the terminal device can determine that its corresponding position vector matrix is a vector of (total number of words + 1, 100), that is, the position vector matrix of "拙" is a vector of (47, 100).

[0105] For the training dialogue statement, the terminal device can judge one by one whether each character in the training dialogue statement is consistent with its corresponding expected pronoun. For example, for the character "景" in the training dialogue statement, since it is not consistent with its corresponding expected pronoun "Humble Administrator's Garden", the terminal device can generate the position vector matrix corresponding to "景" according to the position of "Humble Administrator's Garden" in the training historical statement, that is, the position vector matrix of "景" can be the mask vector + the position index of "Humble Administrator's Garden". For the character "电" in the training dialogue statement, since it is consistent with its corresponding expected pronoun "电", the terminal device can generate the position vector matrix corresponding to this character according to the position of "电" in the training dialogue statement, that is, the position vector matrix of "电" can be the mask vector + the position index of "电".

[0106] After the terminal device determines the second text feature and training position feature corresponding to the training dialogue statement, and the first text feature and historical position feature corresponding to the training historical statement, it can directly splice the determined second text feature, first text feature, historical position feature, and training position feature together to generate a training vector matrix for training the model to be trained.

[0107] S402. Determine the error value of the initial result based on the initial result and the expected pronoun.

[0108] In this embodiment, after the terminal device generates the initial result through the model to be trained, it can input the initial result and the expected pronoun into the loss function preset by the developer to calculate the error value of the initial result through the loss function. Exemplarily, the loss function in the terminal device can be a binary cross-entropy function. Among them, the loss function can be any loss function well-known to those skilled in the art, and the embodiments of the present application do not specifically limit the loss function.

[0109] S403, updating the model to be trained based on the error value until the error value satisfies a preset training stop condition, and using the model to be trained corresponding to when the error value satisfies the training stop condition as the content replacement model.

[0110] In this embodiment, after the terminal device calculates the error value, the model to be trained can be updated according to the error value corresponding to each training sample, and the training sample can be processed by the updated model to be trained to generate a new error value. The terminal device can continuously perform the above-mentioned S301 to S303 training process until the error value generated by the model to be trained meets the training stop condition preset by the user. When the error value meets the training stop condition, the terminal device can stop training the model to be trained, and use the model to be trained corresponding to the error value meeting the training stop condition as the content replacement model.

[0111] In one possible implementation, after the terminal device generates an error value through the model to be trained, it can determine whether the error value meets the training stop condition by judging whether the error value is less than the error threshold value preset by the developer. If the terminal device determines that the error value is less than the error threshold value, the receiver can determine that the error value meets the training stop condition, and the terminal device can stop training the model to be trained and use the current model to be trained as the content replacement model. If the terminal device determines that the error value is greater than or equal to the error threshold value, the terminal device can determine that the error value does not meet the training stop condition, and the terminal device can update the parameters in the model to be trained according to the error value, and process the training samples through the updated model to be trained to generate a new error value.

[0112] In this embodiment, the content replacement model in the terminal device is generated by training the model to be trained according to the training stop condition, so the accuracy of the target pronoun generated by the content replacement model can be guaranteed.

[0113] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0114] Reference Figure 5 , shows a schematic diagram of a dialogue answering device provided in an embodiment of the present application, which may specifically include a history sentence acquisition module 501, a pronoun generation and determination module 502, a summary generation module 503 and a response information generation module 504, wherein:

[0115] A historical sentence acquisition module 501 is used to respond to a target dialogue sentence to be answered sent by a user and acquire all historical dialogue sentences in the dialogue scene where the target dialogue sentence is located;

[0116] The pronoun determination module 502 is used to input the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine the target pronouns corresponding to the dialogue texts in the target dialogue sentence; the content replacement model is used to determine the target pronouns referred to by the dialogue texts in all the historical dialogue sentences based on the all the historical dialogue sentences;

[0117] A summary generation module 503 is used to input the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene;

[0118] The response information generating module 504 is used to input the summary information into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

[0119] The pronoun determination module can also be used to input the target dialogue sentence and all the historical dialogue sentences into the content replacement model, determine multiple candidate pronouns corresponding to the dialogue text and the pronoun probabilities corresponding to each of the candidate pronouns; determine the candidate pronouns whose probabilities are greater than a probability threshold as words to be replaced; screen all the words to be replaced based on all the historical dialogue sentences, and determine the words to be replaced that have appeared in all the historical dialogue sentences as the target pronouns.

[0120] The pronoun determination module can also be used to input the target dialogue sentence and all the historical dialogue sentences into a preset feature extraction algorithm respectively, generate a first feature vector corresponding to the target dialogue sentence and a second feature vector corresponding to each of the historical dialogue sentences; the first feature vector is used to represent the text features and position features of each of the dialogue characters in the target dialogue sentence; the second feature vector is used to represent the text features and position features of each character in the historical dialogue sentence; the first feature vector and the second feature vector are input into the encoding layer to encode the first feature vector and the second feature vector to generate encoding features; the encoding features are input into the fully connected layer to determine the multiple candidate pronouns and the probabilities of reference corresponding to each of the candidate pronouns.

[0121] The summary generation module can also be used to input all the target pronouns corresponding to the dialogue text into the sorting algorithm one by one based on the order of each dialogue text in the target dialogue sentence, so as to generate the sorting results corresponding to the dialogue text; and generate the summary information based on the position of the dialogue text corresponding to each sorting result in the target dialogue sentence.

[0122] The summary generation module can also be used for determining, for any of the dialogue texts, that the target pronouns corresponding to the dialogue texts are 1, the target pronouns are the sorting results corresponding to the dialogue texts; if the number of target pronouns corresponding to the dialogue texts is greater than 1, the appearance positions of the target pronouns in the dialogue scene are obtained, and all the target pronouns are sorted based on the appearance positions to generate the sorting results corresponding to the dialogue texts.

[0123] The pronoun determination module can also be used to obtain the model to be trained input by the user, and generate an initial result by inputting a training sample into the model to be trained for processing; the training sample includes a training vector matrix and an expected pronoun; the error value of the initial result is determined based on the initial result and the expected pronoun; the model to be trained is updated based on the error value until the error value meets a preset training stop condition, and the model to be trained corresponding to the error value meeting the training stop condition is used as the content replacement model.

[0124] The pronoun determination module can also be used to obtain training dialogue sentences and training history sentences input by the user; generate a first text feature corresponding to the training history sentence and a second text feature corresponding to the training dialogue sentence based on a preset conversion word table; input the training dialogue sentence and the expected pronoun into a preset position feature algorithm to generate a training position feature corresponding to the training dialogue sentence; and generate the training vector matrix based on the first text feature, the second text feature and the position feature.

[0125] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0126] Reference Figure 6 , shows a schematic diagram of a terminal device provided by an embodiment of the present application. Figure 6 As shown, the terminal device 600 in the embodiment of the present application includes: a processor 610, a memory 620, and a computer program 621 stored in the memory 620 and executable on the processor 610. When the processor 610 executes the computer program 621, the steps in each embodiment of the above-mentioned dialogue answering method are implemented, for example Figure 1Alternatively, when the processor 610 executes the computer program 621, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 5 Functions of modules 501 to 504 are shown.

[0127] Exemplarily, the computer program 621 may be divided into one or more modules / units, which are stored in the memory 620 and executed by the processor 610 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which may be used to describe the execution process of the computer program 621 in the terminal device 600. For example, the computer program 621 may be divided into a historical sentence acquisition module, a pronoun determination module, a summary generation module, and a response information generation module, and the specific functions of each module are as follows:

[0128] A historical sentence acquisition module, configured to respond to a target dialogue sentence to be answered sent by a user and acquire all historical dialogue sentences in the dialogue scenario where the target dialogue sentence is located;

[0129] a pronoun determination module, configured to input the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model, and determine target pronouns corresponding to a plurality of dialogue words in the target dialogue sentence; the content replacement model is configured to determine the target pronouns to which the dialogue words refer in all the historical dialogue sentences based on all the historical dialogue sentences;

[0130] A summary generation module, used for inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene;

[0131] The response information generation module is used to input the summary information into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

[0132] The terminal device 600 may include, but is not limited to, a processor 610 and a memory 620. Those skilled in the art will appreciate that Figure 6 It is only an example of the terminal device 600 and does not constitute a limitation of the terminal device 600. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device 600 may also include input and output devices, network access devices, buses, etc.

[0133] The processor 610 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0134] The memory 620 may be an internal storage unit of the terminal device 600, such as a hard disk or memory of the terminal device 600. The memory 620 may also be an external storage device of the terminal device 600, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 600. Further, the memory 620 may also include both an internal storage unit of the terminal device 600 and an external storage device. The memory 620 is used to store the computer program 621 and other programs and data required by the terminal device 600. The memory 620 may also be used to temporarily store data that has been output or is to be output.

[0135] An embodiment of the present application also discloses a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for answering a conversation as described in the aforementioned embodiments is implemented.

[0136] The embodiments of the present application further disclose a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for answering a conversation as described in the aforementioned embodiments is implemented.

[0137] The embodiment of the present application further discloses a computer program product. When the computer program product is executed on a computer, the computer is enabled to execute the method for answering a conversation described in the above-mentioned embodiments.

[0138] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method for answering a conversation, characterized in that: include: In response to a target dialogue sentence to be answered sent by a user, all historical dialogue sentences in the dialogue scene where the target dialogue sentence is located are obtained; Inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine target pronouns corresponding to a number of dialogue words in the target dialogue sentence; The content replacement model is used to determine the target pronoun referred to by the dialogue text in all the historical dialogue sentences according to the all the historical dialogue sentences; Inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene; The summary information is input into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

2. The method according to claim 1, characterized in that The step of inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model to determine target pronouns corresponding to a plurality of dialogue words in the target dialogue sentence includes: Inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model, determining a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns; Determine the candidate pronouns whose pronoun probabilities are greater than a probability threshold as words to be replaced; All the words to be replaced are screened based on all the historical dialogue sentences, and the words to be replaced that have appeared in all the historical dialogue sentences are determined as the target pronouns.

3. The method according to claim 2, characterized in that The content replacement model includes an encoding layer and a fully connected layer; Before inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model to determine a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns, the method further includes: The target dialogue sentence and all the historical dialogue sentences are respectively input into a preset feature extraction algorithm to generate a first feature vector corresponding to the target dialogue sentence and a second feature vector corresponding to each of the historical dialogue sentences; the first feature vector is used to represent the text features and position features of each of the dialogue characters in the target dialogue sentence; the second feature vector is used to represent the text features and position features of each character in the historical dialogue sentences; The step of inputting the target dialogue sentence and all the historical dialogue sentences into the content replacement model, and determining a plurality of candidate pronouns corresponding to the dialogue text and the probabilities of pronouns corresponding to the candidate pronouns, includes: Inputting the first feature vector and the second feature vector into the encoding layer to encode the first feature vector and the second feature vector to generate encoding features; The encoding features are input into the fully connected layer to determine the multiple candidate pronouns and the probabilities of pronouns corresponding to the candidate pronouns.

4. The method according to claim 1, characterized in that: The target object sentence after replacing the dialogue text with the target pronoun is input into a preset sorting algorithm to generate summary information of the dialogue scene, including: Based on the order of each of the dialogue characters in the target dialogue sentence, all the target pronouns corresponding to the dialogue characters are input into the sorting algorithm one by one to generate a sorting result corresponding to the dialogue characters; The summary information is generated based on the position of the dialogue text corresponding to each of the sorting results in the target dialogue sentence.

5. The method according to claim 4, characterized in that Based on the order of each of the dialogue characters in the target dialogue sentence, all the target pronouns corresponding to the dialogue characters are input into the sorting algorithm one by one to generate the sorting results corresponding to the dialogue characters, including: For any of the dialogue texts, if the number of target pronouns corresponding to the dialogue text is 1, determining that the target pronoun is a ranking result corresponding to the dialogue text; If the number of target pronouns corresponding to the dialogue text is greater than 1, the appearance position of each target pronoun in the dialogue scene is obtained, and all the target pronouns are sorted based on the appearance position to generate a sorting result corresponding to the dialogue text.

6. The method according to any one of claims 1 to 5, characterized in that: Before inputting the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model and determining target pronouns corresponding to a plurality of dialogue words in the target dialogue sentence, the method further includes: Obtaining a model to be trained input by a user, and generating an initial result by inputting a training sample into the model to be trained for processing; the training sample includes a training vector matrix and an expected pronoun; determining an error value of the initial result based on the initial result and the expected referent; The model to be trained is updated based on the error value until the error value satisfies a preset training stop condition, and the model to be trained corresponding to when the error value satisfies the training stop condition is used as the content replacement model.

7. The method according to claim 6, characterized in that Before obtaining the model to be trained input by the user and inputting the training sample into the model to be trained for processing to generate the initial result, the method further includes: Obtain training dialogue sentences and training history sentences input by the user; Generating a first text feature corresponding to the training history sentence and a second text feature corresponding to the training dialogue sentence based on a preset conversion vocabulary; Inputting the training dialogue sentence and the expected pronoun into a preset position feature algorithm to generate a training position feature corresponding to the training dialogue sentence; The training vector matrix is ​​generated based on the first text feature, the second text feature and the position feature.

8. A conversation answering device, characterized in that: include: A historical sentence acquisition module, configured to respond to a target dialogue sentence to be answered sent by a user and acquire all historical dialogue sentences in the dialogue scenario where the target dialogue sentence is located; A pronoun determination module, used to input the target dialogue sentence and all the historical dialogue sentences into a preset content replacement model, and determine target pronouns corresponding to a number of dialogue words in the target dialogue sentence; The content replacement model is used to determine the target pronoun referred to by the dialogue text in all the historical dialogue sentences according to the all the historical dialogue sentences; A summary generation module, used for inputting the target object sentence after the target pronoun replaces the dialogue text into a preset sorting algorithm to generate summary information of the dialogue scene; The response information generation module is used to input the summary information into a preset dialogue language model to generate response information corresponding to the target dialogue sentence.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for answering a conversation as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for answering a conversation as described in any one of claims 1 to 7 is implemented.