Text response method and device, computer equipment and storage medium

By using text similarity to extract target associated text from the first related text in the intelligent conversation system, the problem of inaccurate response of the generative pre-trained model when resource update is solved, and efficient response accuracy is achieved when film and television resources are updated.

CN120258003APending Publication Date: 2025-07-04TCL TECHNOLOGY GROUP CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311873990.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-30
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

When the resource information is frequently updated, the response results of the existing generative pre-trained model are not ideal enough, resulting in a decline in user experience. Especially when film and television resources are updated frequently, the model needs to be manually retrained to maintain accuracy.

Method used

By obtaining the similarity between the text to be answered and the first related text, extracting the target associated text from the first related text and inputting it to the response model, the first related text is updated to maintain the accuracy of the model without retraining the entire model.

Benefits of technology

When resources are frequently updated, updating only the first related text can ensure the accuracy of the response model, reducing labor costs and computing resources consumption, and improving the accuracy of the response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258003A_ABST
    Figure CN120258003A_ABST
Patent Text Reader

Abstract

The invention provides a text response method and device, computer equipment and a storage medium. The method comprises the steps of obtaining a to-be-responded text and a first related text corresponding to the to-be-responded text; according to the text similarity between the to-be-responded text and the first related text, extracting a target related text corresponding to the to-be-responded text from the first related text; and inputting the target associated text into a response model to obtain a response text of the to-be-responded text. According to the text response method provided by the embodiment of the invention, when the related resources are frequently updated, only the first related text needs to be updated, and the response model does not need to be trained again, so that the response accuracy of the response model is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent conversation technology, and particularly relates to a text response method, device, computer device, and storage medium. Background Art

[0002] With the development of technology, more and more manufacturers choose to integrate intelligent conversation into their own businesses. For example, taking a smart TV as an example, combined with speech recognition, using intelligent conversation can realize the dialogue between the TV and the user, so as to quickly process the user's information search and find the most satisfactory resources for the user. However, there are the following problems with this conversational video GPT. Usually, intelligent conversation is realized by relying on a generative pre-trained model pre-trained based on a large amount of data.

[0003] However, it is found in the actual application process that implementing intelligent conversation using a generative pre-trained model requires a large amount of computing resources and labor costs. Especially when the resource information is updated, it is often necessary to compile training corpora using the latest resource information and retrain. Otherwise, the generative pre-trained model is likely to give unreasonable response results, thus affecting the user experience. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a text response method, device, computer device, and storage medium to solve the technical problem that the response results of the generative pre-trained model are not ideal enough when the resource information is updated frequently in the existing text response methods.

[0005] In a first aspect, the present application provides a text response method, including:

[0006] Obtain a text to be responded to and a first related text corresponding to the text to be responded to;

[0007] Extract a target associated text corresponding to the text to be responded to from the first related text according to the text similarity between the text to be responded to and the first related text;

[0008] Input the target associated text into a response model to obtain a response text for the text to be responded to.

[0009] As a feasible embodiment of the present application, the step of extracting a target associated text corresponding to the text to be responded to from the first related text according to the text similarity between the text to be responded to and the first related text includes:

[0010] Obtain a first text similarity between the text to be responded to and several initial related texts in the first related text;

[0011] Determine the reference relevant text corresponding to the initial relevant text from the first relevant text according to the relevance between the initial relevant text and the first relevant text;

[0012] Adjust the initial relevant text according to the second text similarity and the first text similarity between the text to be answered and the reference relevant text, to obtain the adjusted initial relevant text;

[0013] Determine the adjusted initial relevant text as the target relevant text corresponding to the text to be answered.

[0014] As a feasible embodiment of the present application, the determining the named entities in the text to be answered according to the first feature information and the second feature information includes:

[0015] Based on the second feature information, determine the starting probability of each word in the text to be answered corresponding to a named entity;

[0016] Based on the first feature information and the second feature information, determine the ending probability of each word in the text to be answered corresponding to a named entity;

[0017] Based on the starting probability and the ending probability of each word in the text to be answered corresponding to a named entity, match the words in the text to be answered, to obtain the named entities in the text to be answered.

[0018] As a feasible embodiment of the present application, before the step of determining the adjusted initial relevant text as the target relevant text corresponding to the text to be answered, the method further includes:

[0019] Determine the adjusted reference relevant text corresponding to the adjusted initial relevant text according to the relevance between the adjusted initial relevant text and the first relevant text;

[0020] Adjust the adjusted initial relevant text according to the third text similarity and the second text similarity between the text to be answered and the adjusted reference relevant text;

[0021] Until the adjusted initial relevant text is the same as the initial relevant text before adjustment, execute the step of determining the adjusted initial relevant text as the target relevant text corresponding to the text to be answered.

[0022] As a feasible embodiment of the present application, before the step of determining the reference relevant text corresponding to the initial relevant text from the first relevant text according to the relevance between the initial relevant text and the first relevant text, the method further includes:

[0023] Construct an initial correlation degree among the first relevant texts based on several initial relevant texts in the first relevant text;

[0024] Update the initial correlation degree according to the distance between the remaining text in the first relevant text except the initial relevant text and the text to be answered, to obtain the correlation degree among the first relevant texts.

[0025] As a feasible embodiment of the present application, the text similarity between the text to be answered and the first relevant text is obtained by calculating the similarity between the feature information corresponding to the text to be answered and the feature information corresponding to the first relevant text, and the feature information corresponding to the first relevant text is determined by the following steps:

[0026] Perform word segmentation on the first relevant text to obtain several processed words;

[0027] Generate initial feature information of the first relevant text based on the occurrence frequencies of the first word and the second word in the words;

[0028] Sample the initial feature information to obtain target feature information integrating context information;

[0029] Perform singular value decomposition on the target feature information to obtain the feature information corresponding to the first relevant text.

[0030] As a feasible embodiment of the present application, the sampling of the initial feature information to obtain target feature information integrating context information includes:

[0031] Sample the initial feature information based on random weights to obtain target feature information integrating context information.

[0032] As a feasible embodiment of the present application, the inputting the target associated text into the answering model to obtain the answering text of the text to be answered includes:

[0033] Input the target associated text into the answering model to obtain the first answering text of the text to be answered;

[0034] Input the target associated text and the text to be answered into the answering model to obtain the second answering text of the text to be answered;

[0035] Determine the answering text of the text to be answered from the first answering text and the second answering text according to the similarity between the first answering text and the second answering text.

[0036] In a second aspect, the present application provides a text answering device, including:

[0037] An acquisition module, configured to acquire a text to be replied and a first related text corresponding to the text to be replied;

[0038] An extraction module, configured to extract a target associated text corresponding to the text to be replied from the first related text according to the text similarity between the text to be replied and the first related text;

[0039] A reply module, configured to input the target associated text into a reply model to obtain a reply text for the text to be replied.

[0040] In a third aspect, the present application further provides a computer device, which includes:

[0041] One or more processors;

[0042] A memory; and

[0043] One or more applications, where the one or more applications are stored in the memory and configured to be executed by the processor to perform the text reply method provided in any one of the above.

[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is loaded by a processor to execute the text reply method provided in any one of the above.

[0045] In the text reply method provided in the embodiments of the present application, after acquiring the text to be replied, the first related text corresponding to the text to be replied will be further acquired, and then the corresponding target associated text will be extracted using the text similarity as the conversation content and input into the reply model, for example, the final reply text can be obtained in a generative pre-trained model. When the relevant resources are updated frequently, only the first related text needs to be updated, and there is no need to retrain the reply model, ensuring the reply accuracy of the reply model. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0047] Figure 1 It is a schematic flowchart of the steps of a text reply method provided in an embodiment of the present application;

[0048] Figure 2 It is a schematic flowchart of the steps of extracting a target associated text from the first related text provided in an embodiment of the present application;

[0049] Figure 3 This is a schematic flowchart of steps for iteratively updating initial relevant text to obtain target associated text provided by an embodiment of the present application;

[0050] Figure 4 This is a schematic flowchart of steps for pre - constructing the association degree between first relevant texts provided by an embodiment of the present application;

[0051] Figure 5 This is a schematic flowchart of steps for determining the feature information of text to calculate similarity provided by an embodiment of the present application;

[0052] Figure 6 This is a schematic structural diagram of a text response device provided by an embodiment of the present application;

[0053] Figure 7 This is a schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0054] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of the present application.

[0055] In the description of the present application, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more, unless otherwise specifically defined.

[0056] In the description of the present application, the word "for example" is used to mean "used as an example, illustration, or explanation". Any embodiment described as "for example" in the present application is not necessarily construed as being more preferred or having more advantages than other embodiments. In order for any person skilled in the art to implement and use the present invention, the following description is given. In the following description, details are set forth for purposes of explanation. It should be understood that those of ordinary skill in the art can recognize that the present invention can be implemented without using these specific details. In other instances, well - known structures and processes are not elaborated in detail to avoid obscuring the description of the present invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope that conforms to the principles and features disclosed in the present application.

[0057] To facilitate the understanding of the text response method provided by the embodiments of the present application, the application scenarios of the text response method provided by the embodiments of the present application will be described first. Specifically, the text response method provided by the embodiments of the present application is mainly applied to the intelligent conversation system of an intelligent TV. Based on intelligent conversation, the intelligent TV can realize conversations with users, so as to quickly process users' information searches and find the most satisfactory resources for users. For example, more commonly, it can quickly find the most satisfactory film and television resources for users. At present, most intelligent conversations are realized based on the generative pre-trained model generated by a large amount of data, that is, a large amount of training corpus needs to be manually compiled to train the model to ensure that the model can understand the conversation intention of users and make corresponding responses.

[0058] However, it is found in the actual process that compared with other text response fields, due to the frequent update of film and television resource information, the generative pre-trained model cannot respond to the latest film and television resources in real time, and can only be trained and fine-tuned by manually constructing training corpus with updated film and television resource information. Otherwise, the generative pre-trained model is likely to provide unreasonable response results, thus affecting the user experience.

[0059] And it is precisely to solve the above problems that the present application provides a text response method, device, computer device and storage medium. By constructing the first relevant text, after obtaining the text to be responded, the target associated text closest to the text to be responded will be found using text similarity and input into the response model for processing to obtain the final response result. When the film and television resource information is updated frequently, only the first relevant text needs to be simply updated, and there is no need to retrain the model to ensure the accuracy of the response result. Specifically, the text response method is usually set on the text response device in the form of a computer program, and the text response device is usually set on a computer device (such as a remote server, etc.) in the form of a processor. The text response device in the computer device executes the computer program corresponding to the text response method to execute the text response method provided by the embodiments of the present application.

[0060] Specifically, as Figure 1 shown, Figure 1 is a schematic flowchart of the steps of a text response method provided by an embodiment of the present application, including steps S110 to S130:

[0061] S110, obtain the text to be responded and the first relevant text corresponding to the text to be responded.

[0062] In the embodiments of the present application, in combination with the application scenarios provided above, the text to be replied usually refers to the relevant content for seeking film and television resources input by the user into the intelligent reply system of the smart TV. For example, common ones include "Please recommend recently good-looking comedy movies" or "What is the plot of the movie XX", etc. It should be noted that in different specific application scenarios, the text to be replied can be the text information directly input by the user through terminals such as remote controls and mobile phones. Of course, it can also be the text information obtained by processing the voice information input by the user through speech-to-text technology. The embodiments of the present application do not elaborate on the implementation methods for obtaining the text to be replied here.

[0063] On this basis, the first relevant text corresponding to the text to be replied usually refers to the theme information related to various film and television resources collected through various network technology means, such as web crawler technology. Usually, it can include the film title, playing duration, release date, language, film type, film synopsis, and relevant user comments, etc. Usually, with the update of film and television resources, such as the latest release of a new movie, the first relevant text can usually be updated accordingly.

[0064] S120, extract the target associated text corresponding to the text to be replied from the first relevant text according to the text similarity between the text to be replied and the first relevant text.

[0065] In the embodiments of the present application, on the basis above, by comparing the text similarity between the text to be replied and the first relevant text, several target associated texts closest to the text to be replied can be found from these first relevant texts containing film and television resource information.

[0066] Among them, in the above process, the text similarity between the text to be replied and the first relevant text can be obtained by calculating the similarity between the feature information corresponding to the texts. Specifically, in the embodiments of the present application, the feature information usually exists in the form of text vectors, which can usually be obtained by representing the text. For ease of understanding, subsequent Figure 5 shows an implementation scheme for representing the text to obtain the feature information for calculating similarity, and specific reference can be made to the subsequent Figure 5 and its explanatory content.

[0067] In addition, in the process of extracting the target associated text corresponding to the text to be answered by using text similarity, considering that the content of the first relevant text is relatively large, it is inefficient to compare the text to be answered with the first relevant text one by one to screen the target associated text. Therefore, in order to improve the text answering efficiency, as a feasible embodiment of this application, there is also a pre-stored association degree among the first relevant texts. Thus, in the process of determining the target associated text by using the text similarity between the text to be answered and the first relevant text, the confirmation of the target associated text can be quickly achieved based on the association degree. The specific implementation solution can refer to the subsequent Figure 2 and its explanatory content.

[0068] S130. Input the target associated text into the answering model to obtain the answering text of the text to be answered.

[0069] In the embodiment of this application, after obtaining the target associated text related to the text to be answered based on the first relevant text, such as information related to film and television resources, inputting the target associated text into the answering model can obtain an answering text that is more in line with the text to be answered. Specifically, the answering model can be the aforementioned generative pre-training model. Of course, it is also feasible to use other models with text answering functions. The embodiment of this application does not make specific limitations on the answering model here.

[0070] Furthermore, as another optional embodiment of this application, in order to improve the accuracy of the obtained answering text, while inputting the target associated text into the answering model, the text to be answered will also be synchronously input into the answering model. Specifically, that is, input the target associated text and the text to be answered into the answering model to obtain the answering text of the text to be answered, so as to ensure the answering effect of the finally obtained answering text. Further, in the actual application process, it is also possible to compare the answering result of inputting the target associated text into the answering model with the answering result of inputting the target associated text and the text to be answered into the answering model. Specifically, it includes the following steps:

[0071] Input the target associated text into the answering model to obtain the first answering text;

[0072] Input the target associated text and the text to be answered into the answering model to obtain the second answering text;

[0073] Determine the answering text of the text to be answered from the first answering text and the second answering text according to the similarity between the first answering text and the second answering text.

[0074] Specifically, if the similarity between the first response text and the second response text is low, it indicates that after introducing the target associated text, the response model gives a relatively more accurate response result. At this time, the second response text can be determined as the response text of the text to be responded. On the contrary, if the similarity between the first response text and the second response text is high, it indicates that after introducing the target associated text, the response results given by the response model do not differ much. At this time, the first response text can be selected as the response text of the text to be responded to avoid the interference caused by the introduced target associated text and ensure the accuracy of the finally output response text as well.

[0075] The text response method provided by the embodiments of the present application, after obtaining the text to be responded, will further obtain the first relevant text corresponding to the text to be responded, and then use the similarity between texts to extract the corresponding target associated text as the conversation content and input it into the response model. For example, in a generative pre-training model, the final response text can be obtained. When the relevant resources are updated frequently, only the first relevant text needs to be updated, and there is no need to retrain the response model, ensuring the response accuracy of the response model.

[0076] As Figure 2 shown, Figure 2 It is a schematic flow chart of the steps for extracting the target associated text from the first relevant text provided by the embodiments of the present application. Specifically, it includes steps S210 to S240:

[0077] S210, obtain the first text similarity between the text to be responded and several initial relevant texts in the first relevant text.

[0078] To improve the efficiency of screening the target associated text from the first relevant text, in the embodiments of the present application, several initial relevant texts will be first selected from the first relevant text to enter the queue and calculate the first text similarity between the text to be responded and these several initial relevant texts that enter the queue.

[0079] S220, determine the reference relevant text corresponding to the initial relevant text from the first relevant text according to the correlation degree between the initial relevant text and the first relevant text.

[0080] On the basis of the foregoing, in order to implement the search for the first relevant text, the reference relevant text with a certain correlation degree with the initial relevant text will be further found based on the correlation degree between the first relevant texts.

[0081] Among them, it can be understood that the correlation degree between the first relevant texts describes whether there is a correlation degree between two first relevant texts, which can usually be obtained by pre-processing the first relevant texts. The specific implementation solution can refer to the following Figure 4And the content of its explanation.

[0082] S230. Adjust the initial relevant text according to the second text similarity between the text to be replied and the reference relevant text and the first text similarity, so as to obtain the adjusted initial relevant text.

[0083] In the embodiments of the present application, by calculating the second text similarity between the text to be replied and the reference relevant text, comparing it with the foregoing first text similarity, and sorting it in descending order, the text in the queue, that is, the foregoing initial relevant text, can be adjusted, so as to obtain the adjusted initial relevant text. Compared with the initial relevant text before adjustment, the text similarity between the adjusted initial relevant text and the text to be replied is higher.

[0084] S240. Determine the adjusted initial relevant text as the target associated text corresponding to the text to be replied.

[0085] In the embodiments of the present application, it can be understood that by using the association degree between the first relevant texts, the text entering the queue and the reference relevant text having an association degree with the text can be found. By further comparing the association degrees between the text to be replied and these texts and sorting them in descending order, the relevant text with a higher association degree with the text to be replied can be further screened out as the target associated text corresponding to the text to be replied, that is, the adjusted initial relevant text can be determined as the target associated text corresponding to the text to be replied.

[0086] Of course, in the actual application process, when determining the adjusted initial relevant text as the target associated text corresponding to the text to be replied, an iterative process of adjusting the initial relevant text in the queue several times is required. That is, after adjusting the initial relevant text to obtain the adjusted initial relevant text, the reference relevant text related to the adjusted initial relevant text will be determined again by using the association degree between the first relevant texts, and the initial relevant text in the queue will be updated again by using the similarity with the text to be replied. The specific implementation solution can refer to the following Figure 3 And the content of its explanation.

[0087] Such as Figure 3 shown, Figure 3 is a schematic flow chart of steps for iteratively updating the initial relevant text to obtain the target associated text provided by the embodiments of the present application. Specifically, it includes steps S310 to S330:

[0088] S310. Determine the adjusted reference relevant text corresponding to the adjusted initial relevant text according to the adjusted initial relevant text and the association degree between the first relevant texts.

[0089] In the embodiments of the present application, in combination with the foregoing description of iteratively updating the initial relevant text, when adjusting the initial relevant text in the queue to obtain the adjusted initial relevant text, and further determining the adjusted reference relevant text corresponding to the adjusted initial relevant text based on the correlation degree between the initial relevant text and the first relevant text.

[0090] It should be noted that the first relevant text for which the similarity has been calculated is not recalculated. For example, taking the case where there is a correlation between the first relevant text and the second relevant text, when initially using the first relevant text as the initial relevant text and the second relevant text as the reference relevant text corresponding to the initial relevant text of the first relevant text to complete the similarity calculation with the text to be answered, and determining that the similarity between the second relevant text and the text to be answered is higher than the similarity between the first relevant text and the text to be answered, and selecting the second relevant text as the adjusted initial answer text, at this time, when determining the reference relevant text corresponding to the adjusted initial answer text, since the first relevant text has participated in the calculation, therefore, the first relevant text is no longer regarded as the adjusted reference relevant text corresponding to the adjusted initial relevant text, but only other relevant texts having a correlation with the second relevant text, such as the third relevant text, are regarded as the adjusted reference relevant text.

[0091] S320. Adjust the adjusted initial relevant text according to the third text similarity between the text to be answered and the adjusted reference relevant text and the second text similarity.

[0092] In the embodiments of the present application, by further comparing the third text similarity between the text to be answered and the adjusted reference relevant text with the second text similarity and arranging them in descending order, the further adjustment of the initial relevant text in the queue can be completed. In this way, by iteratively executing steps S310 to S320 and continuously reintroducing new reference relevant texts based on the correlation degree between the first relevant texts, the update of the initial relevant text in the queue can be continuously completed, and the first relevant text with a higher similarity to the text to be answered can be continuously screened out.

[0093] S330. Until the adjusted initial relevant text is the same as the initial relevant text before adjustment, determine the adjusted initial relevant text as the target associated text corresponding to the text to be answered.

[0094] In the embodiments of the present application, in combination with the foregoing related descriptions, through the foregoing iterative process, the first relevant text with a higher similarity to the text to be answered can be continuously screened out as the initial relevant text until the initial relevant text after a certain adjustment is the same as the initial relevant text before the adjustment, that is, when there is no reference relevant text with a higher similarity to the text to be answered in the initial relevant text, it can be considered that the currently adjusted initial relevant text is the text with the highest similarity between the first relevant text and the text to be answered. Therefore, the currently adjusted initial relevant text can be determined as the target associated text corresponding to the text to be answered for subsequent input into the answering model to obtain the corresponding answering text.

[0095] Specifically, in the actual application process, for the convenience of computer program processing, the first relevant text and the association degree therebetween usually exist in the form of a correlation graph. Specifically, each first relevant text exists in the form of a node in the correlation graph, while the association degree between the first relevant texts exists in the form of an edge in the correlation graph. Specifically, if there is an association degree between two first relevant texts, there is a corresponding edge between these two nodes in the correlation graph. Conversely, if there is no association degree between two first relevant texts, there is no corresponding edge between these two nodes in the correlation graph. Based on the understanding of the above correlation graph, at this time, the specific implementation steps for screening the final target associated text from the first relevant text are roughly as follows:

[0096] (1) Obtain the text q to be answered, and the correlation graph G(S, E) composed of the first relevant text S and the association degree E between the first relevant texts;

[0097] (2) Initialize the priority queue C. Specifically, several initial relevant texts in the first relevant text can be selected, that is, the initial relevant texts corresponding to the preset entry node P are selected;

[0098] (3) Mark the entry node P as 1, and mark the nodes in S other than P as 0. (The 0, 1 marking is used to determine whether the similarity of this node, that is, the corresponding first relevant text, has been calculated);

[0099] (4) Calculate the similarity between the text q to be answered and the initial relevant texts in the queue C (the specific method for calculating the similarity can be obtained by using the cosine similarity between the feature vectors corresponding to the texts), and arrange them in descending order, and take the top m nodes as the new queue C (m is a preset value used to determine the number of the final target associated texts obtained);

[0100] (5) Check whether there is a node marked as 0 in the node set. If there is, it indicates that the retrieval of the first related text is not completed, and continue to execute the subsequent steps (6) to (8). If not, it indicates that the retrieval of the first related text is completed, and execute the subsequent step (9);

[0101] (6) Determine whether there is an edge (x, y) belonging to E, where node x belongs to C and the mark of node y is 0. If there is, add y to C and adjust its node mark to 1; that is, correspondingly, use the correlation degree between the first related texts to find other nodes y that have a correlation degree with node x in the queue, and add them to the queue for similarity calculation and comparison. If not, adjust to step (9);

[0102] (7) Calculate the similarity between the text q to be answered and the initial related texts in the new node queue C again, and sort them in descending order, and take the top m nodes as the new queue C;

[0103] (8) Jump to step (5)

[0104] (9) Output the queue C, which is the finally obtained target related text.

[0105] As Figure 4 shown, Figure 4 is a schematic flow chart of steps for pre - constructing the correlation degree between the first related texts provided by an embodiment of the present application. Specifically, it includes steps S410 to S420:

[0106] S410, construct the initial correlation degree between the first related texts according to several initial related texts in the first related texts.

[0107] In the embodiment of the present application, combined with the foregoing related descriptions, it can be seen that in the process of determining the final target related text from the first related texts, it is necessary to rely on the pre - determined correlation degree between the first related texts to improve the search efficiency. Among them, the correlation degree between the first related texts represents the magnitude of the correlation degree between the first related texts. Therefore, the initial correlation degree can be constructed first based on several initial related texts in the first related texts, that is, first confirm that there is a correlation degree between these initial related texts, and then further use the correlation degree between the remaining related texts and these initial related texts to adjust the correlation degree in the subsequent process.

[0108] S420, update the initial correlation degree according to the distance between the remaining texts in the first related texts except the initial related texts and the initial related texts, and obtain the correlation degree between the first related texts.

[0109] In the embodiments of the present application, specifically, the degree of association between these first related texts can be determined by calculating the distance between the remaining text in the first related text except the initial related text and the initial related text. Therefore, by updating the initial degree of association with the degree of association, the degree of association between the first related texts can be obtained.

[0110] Specifically, for the convenience of understanding the above process, taking the example that the degree of association between the aforementioned first related texts exists in the form of a correlation graph, the present application mainly provides the implementation steps of how to construct a correlation graph using the first related texts. Specifically, it generally includes the following steps:

[0111] (1) Optionally, first normalize each first related text (corresponding representation vector) S:

[0112]

[0113] where x i belongs to S, i = 1, 2, 3,..., n, n is the number of first related texts, and y i is the first related text (corresponding representation vector) after the corresponding normalization process;

[0114] (2) Construct a set where y0 = 0 ∈ S;

[0115] (3) Use a part of the nodes {y0, y1,..., y d-1} to initialize the correlation graph G, where the initialization is in a fully connected manner, that is, connect every two nodes in {y0, y1,..., y d-1};

[0116] (4) Sequentially update the graph G for the remaining nodes according to the following steps;

[0117] ① For each remaining node y i (where i = d,..., n,), regard it as a query node and initialize the priority queue C with the incoming node P = {0};

[0118] ② Initialize all nodes in the node set S1 of the correlation graph G to be marked as 0, and update the mark of the incoming node P to 1;

[0119] ③ Traverse the nodes y in S1 to update the queue C. Specifically: sequentially add the nodes in S1 to the queue C until a certain requirement is met, such as the length of the queue is greater than k, and then stop updating the queue C;

[0120] ④ Calculate each node element x i ∈ C in the queue C and the query node yi Euclidean distance;

[0121] ⑤ Queue C is sorted in descending order of relevance (i.e., in ascending order of Euclidean distance), and the top k nodes are selected as the candidate node queue C;

[0122] ⑥ Set the candidate neighbor node set N to be empty, calculate the Euclidean distance between each node in the candidate node set C and the incoming node P, and form the candidate set C2 in ascending order;

[0123] ⑦ By setting the counter m = 1, use the distance between the nodes in the candidate set C2 and the incoming node P and the distance between the node and the neighbor node set to update the neighbor node set N, including the following steps:

[0124] a) Check the number of nodes |N| in N and the counter m. If |N| ≤ d and m ≤ |C2|, then jump to b); otherwise, jump to e);

[0125] b) Traverse C2, calculate the Euclidean distance d C between the node y C ∈ C2 and the incoming node P, and find the minimum Euclidean distance d C between y min and the set N;

[0126] c) If d C ≤ d min , add y C to the set N;

[0127] d) Update the counter m = m + 1, and jump to a);

[0128] e) Output the candidate neighbor node set N;

[0129] ⑧ For each node in the candidate neighbor node set N, construct an edge (y i , z) and add it to the graph G as the association degree between the first relevant texts;

[0130] ⑨ Iteration process: That is, copy the selected neighbor set N as the set N1, traverse the set N1 to update the selected neighbor set N and the candidate node set C. Specifically, include taking the output nodes of the nodes z ∈ N in the graph G and y i to form a new candidate set C, update N according to the steps in ⑥ and ⑦ above, and then set the output nodes of the nodes in N as z to form new edges and add these edges to the graph G;

[0131] (5) After completing the update of the graph G by iterating the above steps, copy all the neighbor nodes of the {0} node to construct a new incoming node P;

[0132] (6) Remove the added {0} nodes in graph G to obtain a new graph G;

[0133] (7) Replace the vertices of the nodes in graph G with the first related information S;

[0134] (8) Output the incoming vertex P and graph G, which contain the association degree between the first related information and the first related information, for use in performing the foregoing determination of the relationship between the target associated texts by querying the similarity between the main body related information and the text to be queried.

[0135] As Figure 5 shown, Figure 5 FIG. is a schematic flow chart of steps for determining the feature information of a text to calculate the similarity provided by an embodiment of the present application, which is described in detail as follows.

[0136] Combined with the foregoing related descriptions, it can be seen that calculating the similarity between texts is usually obtained by calculating the cosine similarity between the feature vectors corresponding to the texts. Therefore, it is usually necessary to calculate the feature information corresponding to the texts, that is, the feature vectors. Considering that different forms of calculating the feature vectors obtained by processing the texts will affect the subsequent calculation results of the similarity, therefore, in the embodiments of the present application, an implementation scheme for fusing context semantic information to more accurately determine the feature information is proposed. Specifically, it includes steps S510 to S540:

[0137] S510, perform word segmentation on the first related text to obtain several processed words.

[0138] In the embodiments of the present application, by preprocessing the first related text, for example, deleting punctuation marks and stop words in the film and television resource information, and then performing word segmentation on the first related text, several processed words can be obtained.

[0139] S520, generate the initial feature information of the first related text based on the occurrence frequencies of the first word and the second word in the words.

[0140] In order to extract the initial feature information of the first related text, in the embodiments of the present application, an information matrix will be selected based on the occurrence frequencies of the first word and the second word as the initial feature information of the first related text. Specifically, the construction method of each element in the information matrix is as follows:

[0141]

[0142] Among them, p(c, w) is the co-occurrence frequency of word c and word w, that is, the number of times word c and word w appear simultaneously in a certain first related text, while p(c) is the occurrence frequency of word c, and p(w) is the occurrence frequency of word w.

[0143] S530. Sample the initial feature information to obtain target feature information that fuses context information.

[0144] In the embodiments of the present application, based on the information matrix obtained above, by performing l2 sampling on the initial feature information, that is, the information matrix obtained above, target feature information that fuses context information can be obtained. Specifically, the above steps can be processed by a sampling method based on random weights. Specifically, the initial feature information can be sampled based on random weights to obtain target feature information that fuses context information, which specifically includes the following steps:

[0145] 1) Given the number of samplings k and the information matrix n is the number of non-repeating words, and initialize the sampling number counter i;

[0146] 2) Construct the cumulative vector of the sum of squares of the rows of the information matrix according to the following formula:

[0147]

[0148] where, ‖M‖ F is the Hilbert-Schmidt norm, and r is the row vector of the information matrix M, that is:

[0149] r j = M j,* ;

[0150] 3) Judge whether i < k. If it holds, go to 4). Otherwise, jump to 6);

[0151] 4) Take a sampling probability s from the normal distribution and find the subscript i in SS that satisfies:

[0152] SS(M) i-1 ≤ s < SS(M) i ;

[0153] 5) Calculate the film and television context coefficient according to the following formula:

[0154]

[0155] 6) Output the final information matrix that fuses context

[0156] where, this information matrix is the target feature information that fuses context information.

[0157] S540. Perform singular value decomposition on the target feature information to obtain the feature information corresponding to the first related text.

[0158] In the embodiments of the present application, considering that where U is a singular vector, ∑ 2 is a singular value, and V is a text embedding vector. Therefore, by performing singular value decomposition on the target feature information, the feature information corresponding to the first relevant text can be further obtained:

[0159]

[0160] The feature information obtained through the above steps fully integrates the context information of the first text information, can better represent the content of the first text information, and can screen out the target associated text closer to the text to be answered when calculating the similarity subsequently, improving the effect of the subsequent answer.

[0161] To better implement the text answering method provided in the embodiments of the present application, based on the text answering method provided in the embodiments of the present application, a text answering device is further provided in the embodiments of the present application. As Figure 6 shown, the text answering device 600 includes:

[0162] An obtaining module 610, configured to obtain the text to be answered and the first relevant text corresponding to the text to be answered;

[0163] An extracting module 620, configured to extract the target associated text corresponding to the text to be answered from the first relevant text according to the text similarity between the text to be answered and the first relevant text;

[0164] A answering module 630, configured to input the target associated text into an answering model to obtain an answer text for the text to be answered.

[0165] Preferably, the extracting module extracts the target associated text corresponding to the text to be answered from the first relevant text according to the text similarity between the text to be answered and the first relevant text, including:

[0166] Obtaining a first text similarity between the text to be answered and several initial relevant texts in the first relevant text;

[0167] Determining a reference relevant text corresponding to the initial relevant text from the first relevant text according to the association degree between the initial relevant text and the first relevant text;

[0168] Adjusting the initial relevant text according to the second text similarity between the text to be answered and the reference relevant text and the first text similarity to obtain an adjusted initial relevant text;

[0169] Determining the adjusted initial relevant text as the target associated text corresponding to the text to be answered;

[0170] Preferably, before the extraction module determines the adjusted initial relevant text as the target associated text corresponding to the text to be replied, the extraction module is further configured to:

[0171] Determine an adjusted reference relevant text corresponding to the adjusted initial relevant text according to the association degree between the adjusted initial relevant text and the first relevant text;

[0172] Adjust the adjusted initial relevant text according to the third text similarity between the text to be replied and the adjusted reference relevant text and the second text similarity;

[0173] Until the adjusted initial relevant text is the same as the initial relevant text before adjustment, execute the step of determining the adjusted initial relevant text as the target associated text corresponding to the text to be replied;

[0174] Preferably, before the extraction module determines a reference relevant text corresponding to the initial relevant text from the first relevant text according to the association degree between the initial relevant text and the first relevant text, the extraction module is further configured to:

[0175] Construct an initial association degree between the first relevant texts according to several initial relevant texts in the first relevant text;

[0176] Update the initial association degree according to the distance between the remaining text in the first relevant text except the initial relevant text and the text to be replied to obtain the association degree between the first relevant texts;

[0177] Preferably, the text similarity between the text to be replied and the first relevant text is obtained by calculating the similarity between the feature information corresponding to the text to be replied and the feature information corresponding to the first relevant text, and the feature information corresponding to the first relevant text is determined by the acquisition module by performing the following steps:

[0178] Perform word segmentation on the first relevant text to obtain several processed words;

[0179] Generate initial feature information of the first relevant text based on the occurrence frequencies of the first word and the second word in the words;

[0180] Sample the initial feature information to obtain target feature information integrating context information;

[0181] Perform singular value decomposition on the target feature information to obtain the feature information corresponding to the first relevant text;

[0182] Preferably, the obtaining module samples the initial feature information to obtain target feature information integrating context information, including:

[0183] Sampling the initial feature information based on random weights to obtain target feature information integrating context information;

[0184] Preferably, the response module inputs the target associated text into a response model to obtain a response text for the text to be responded, including:

[0185] Inputting the target associated text into a response model to obtain a first response text for the text to be responded;

[0186] Inputting the target associated text and the text to be responded into the response model to obtain a second response text for the text to be responded;

[0187] Determining the response text for the text to be responded from the first response text and the second response text according to the similarity between the first response text and the second response text.

[0188] For specific limitations on the text response device, reference may be made to the limitations on the text response method in the foregoing. Details are not described herein again. Each module in the foregoing text response device may be implemented in whole or in part by software, hardware, and their combination. The foregoing modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the foregoing modules.

[0189] In some embodiments of the present application, the text response device 600 may be implemented in the form of a computer program, and the computer program may run on a computer device as shown in Figure 7 The memory of the computer device may store each program module constituting the text response device 600. For example, Figure 6 The obtaining module 610, the extraction module 620, and the response module 630 shown in. The computer program constituted by each program module enables the processor to execute the steps in the text response method of each embodiment of the present application described in this specification.

[0190] For example, Figure 7 The computer device shown in may be through as shown in Figure 6The acquisition module 610 in the text response device 600 shown executes step S110. The computer device can execute step S120 through the extraction module 620. The computer device can execute step S130 through the response module 630. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external computer device through a network connection. When the computer program is executed by the processor, it realizes a text response method.

[0191] Those skilled in the art can understand that Figure 6 the structure shown in is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0192] In some embodiments of the present application, a computer device is provided, including one or more processors; a memory; and one or more application programs, where one or more application programs are stored in the memory and configured to be executed by the processor to implement the following steps:

[0193] Obtain the text to be replied and the first related text corresponding to the text to be replied;

[0194] According to the text similarity between the text to be replied and the first related text, extract the target associated text corresponding to the text to be replied from the first related text;

[0195] Input the target associated text into the response model to obtain the response text of the text to be replied.

[0196] In some embodiments of the present application, a computer-readable storage medium is provided, storing a computer program, and the computer program is loaded by the processor, so that the processor executes the following steps:

[0197] Obtain the text to be replied and the first related text corresponding to the text to be replied;

[0198] According to the text similarity between the text to be replied and the first related text, extract the target associated text corresponding to the text to be replied from the first related text;

[0199] Input the target associated text into the response model to obtain the response text of the text to be responded to.

[0200] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Any reference to a memory, storage, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0201] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0202] The above has introduced in detail a text response method, device, computer device, and storage medium provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation on the present invention.

Claims

1. A text response method, characterized in that, Including: Obtain the text to be replied and the first relevant text corresponding to the text to be replied; Extract the target associated text corresponding to the text to be replied from the first relevant text according to the text similarity between the text to be replied and the first relevant text; Input the target associated text into the reply model to obtain the reply text of the text to be replied.

2. The text response method according to claim 1, wherein The step of extracting the target associated text corresponding to the text to be replied from the first relevant text according to the text similarity between the text to be replied and the first relevant text includes: Obtain the first text similarity between the text to be replied and several initial relevant texts in the first relevant text; Determine the reference relevant text corresponding to the initial relevant text from the first relevant text according to the association degree between the initial relevant text and the first relevant text; Adjust the initial relevant text according to the second text similarity between the text to be replied and the reference relevant text and the first text similarity to obtain the adjusted initial relevant text; Determine the adjusted initial relevant text as the target associated text corresponding to the text to be replied.

3. The text response method according to claim 2, characterized in that Before the step of determining the adjusted initial relevant text as the target associated text corresponding to the text to be replied, the method further includes: Determine the adjusted reference relevant text corresponding to the adjusted initial relevant text according to the association degree between the adjusted initial relevant text and the first relevant text; Adjust the adjusted initial relevant text according to the third text similarity between the text to be replied and the adjusted reference relevant text and the second text similarity; Until the adjusted initial relevant text is the same as the initial relevant text before adjustment, execute the step of determining the adjusted initial relevant text as the target associated text corresponding to the text to be replied.

4. The text response method according to claim 2, wherein Before the step of determining the reference relevant text corresponding to the initial relevant text from the first relevant text according to the association degree between the initial relevant text and the first relevant text, the method further includes: Construct the initial association degree between the first relevant texts according to several initial relevant texts in the first relevant text; Update the initial association degree according to the distance between the remaining text in the first relevant text except the initial relevant text and the text to be replied to obtain the association degree between the first relevant texts.

5. The text response method according to claim 1, wherein The text similarity between the text to be replied and the first relevant text is obtained by calculating the similarity between the feature information corresponding to the text to be replied and the feature information corresponding to the first relevant text, and the feature information corresponding to the first relevant text is determined by the following steps: Segment the first relevant text to obtain several processed words; Generate the initial feature information of the first relevant text based on the occurrence frequencies of the first word and the second word in the words; Sample the initial feature information to obtain the target feature information integrating context information; Perform singular value decomposition on the target feature information to obtain the feature information corresponding to the first relevant text.

6. The text response method according to claim 5, characterized in that The sampling of the initial feature information to obtain the target feature information that fuses context information includes: Sampling the initial feature information based on random weights to obtain the target feature information that fuses context information.

7. The text response device according to any one of claims 1 to 6, characterized in that The inputting of the target associated text into the response model to obtain the response text of the text to be responded to includes: Inputting the target associated text into the response model to obtain the first response text of the text to be responded to; Inputting the target associated text and the text to be responded to into the response model to obtain the second response text of the text to be responded to; Determining the response text of the text to be responded to from the first response text and the second response text according to the similarity between the first response text and the second response text.

8. A text response device, characterized in that, Includes: An acquisition module for acquiring the text to be responded to and the first relevant text corresponding to the text to be responded to; An extraction module for extracting the target associated text corresponding to the text to be responded to from the first relevant text according to the text similarity between the text to be responded to and the first relevant text; A response module for inputting the target associated text into the response model to obtain the response text of the text to be responded to; Preferably, the extraction module extracting the target associated text corresponding to the text to be responded to from the first relevant text according to the text similarity between the text to be responded to and the first relevant text includes: Obtaining the first text similarity between the text to be responded to and several initial relevant texts in the first relevant text; Determining the reference relevant text corresponding to the initial relevant text from the first relevant text according to the correlation degree between the initial relevant text and the first relevant text; Adjusting the initial relevant text according to the second text similarity between the text to be responded to and the reference relevant text and the first text similarity to obtain the adjusted initial relevant text; Determining the adjusted initial relevant text as the target associated text corresponding to the text to be responded to; Preferably, before the step in which the extraction module determines the adjusted initial relevant text as the target associated text corresponding to the text to be responded to, the extraction module is further used for: Determining the adjusted reference relevant text corresponding to the adjusted initial relevant text according to the correlation degree between the adjusted initial relevant text and the first relevant text; Adjusting the adjusted initial relevant text according to the third text similarity between the text to be responded to and the adjusted reference relevant text and the second text similarity; Until the adjusted initial relevant text is the same as the initial relevant text before adjustment, execute the step of determining the adjusted initial relevant text as the target associated text corresponding to the text to be responded to; Preferably, before the step that the extraction module determines the reference related text corresponding to the initial related text from the first related text according to the correlation degree between the initial related text and the first related text, the extraction module is further configured to: Construct an initial correlation degree between the first related texts according to several initial related texts in the first related text; Update the initial correlation degree according to the distance between the remaining text in the first related text except the initial related text and the text to be answered, so as to obtain the correlation degree between the first related texts; Preferably, the text similarity between the text to be answered and the first related text is obtained by calculating the similarity between the feature information corresponding to the text to be answered and the feature information corresponding to the first related text. The feature information corresponding to the first related text is determined by the acquisition module by performing the following steps: Perform word segmentation on the first related text to obtain several processed words; Generate initial feature information of the first related text based on the occurrence frequencies of the first word and the second word in the words; Sample the initial feature information to obtain target feature information integrating context information; Perform singular value decomposition on the target feature information to obtain the feature information corresponding to the first related text; Preferably, when the acquisition module samples the initial feature information to obtain target feature information integrating context information, it includes: Sample the initial feature information based on random weights to obtain target feature information integrating context information; Preferably, when the response module inputs the target related text into the response model to obtain the response text of the text to be answered, it includes: Input the target related text into the response model to obtain the first response text of the text to be answered; Input the target related text and the text to be answered into the response model to obtain the second response text of the text to be answered; Determine the response text of the text to be answered from the first response text and the second response text according to the similarity between the first response text and the second response text.

9. A computer device, characterized in that, The computer device includes: One or more processors; A memory; and One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor to implement the text response method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by the processor to execute the text response method according to any one of claims 1 to 7.