Text reply method and device, electronic equipment and storage medium
By obtaining user portraits and combining session text to generate personalized text auxiliary information, the problem of not being able to provide personalized replies to different users in intelligent customer service conversations is solved, and a higher user experience is achieved.
Patent Information
- Application Number
- CN202311667634.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-06-10
AI Technical Summary
The existing technology is difficult to provide personalized replies to different users in intelligent customer service conversations, and cannot meet users' needs and preferences.
By receiving user's session messages, extracting user identification and session text, obtaining user portraits, and generating text auxiliary information based on user identification and user portraits, inputting the language model with session text and text auxiliary information to generate personalized reply text.
It realizes personalized responses to users, meets users' needs and preferences, and improves user experience.
Smart Images

Figure CN120123461A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing technology, and in particular to a method, device, electronic device and storage medium for text reply. Background Art
[0002] In scenarios such as intelligent customer service conversations, it is usually necessary to automatically generate a reply text based on the user's inquiry content and send the reply text to the user.
[0003] In the prior art, a language model is usually used to generate a reply text based on the user's inquiry content, and the reply text is sent to the user. For example, the language model may be a large language model (LLM).
[0004] However, this approach cannot provide personalized responses to different users, making it difficult to meet the needs and preferences of different users. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for text reply, so as to provide a personalized reply to the user when making a text reply.
[0006] On the one hand, an embodiment of the present application provides a method for text reply, the method comprising:
[0007] Receive a session message of a target user sent by a session client;
[0008] Extract the target user's user ID and conversation text according to the conversation message;
[0009] Obtain the target user portrait corresponding to the user ID;
[0010] Generate text auxiliary information based on user identification and target user portrait;
[0011] Input the conversation text and text auxiliary information into the language model to generate the target reply text;
[0012] Returns the target reply text to the session client.
[0013] In one implementation, generating text auxiliary information according to the user identifier and the target user portrait includes:
[0014] Get the text prompt information corresponding to the user ID;
[0015] In the knowledge base, a preliminary search is performed based on the conversation text to obtain knowledge search results;
[0016] Generate text auxiliary information based on text prompt information, target user portrait and knowledge search results.
[0017] In one implementation, the text auxiliary information further includes at least one of the following information:
[0018] The history of the conversation message, and the language style of the target reply text;
[0019] The historical session messages are obtained by querying the user ID;
[0020] The language style is determined based on the user profile.
[0021] In one implementation, a preliminary search is performed in the knowledge base based on the conversation text to obtain knowledge search results, including:
[0022] Match the conversation text with the text-related questions in the knowledge base to obtain matching questions;
[0023] Get the target text segment that matches the setting of the question;
[0024] The target text fragment and its associated context information are determined as knowledge search results.
[0025] In one embodiment, the method further comprises:
[0026] Acquire network operation behavior information and user identification of at least one user; at least one user includes a target user;
[0027] Generating a user profile for each user based on the network operation behavior information of at least one user;
[0028] A corresponding relationship between the user identification and the user portrait is established according to the user portrait and the user identification respectively corresponding to at least one user.
[0029] In one embodiment, the method further comprises:
[0030] When it is determined that there is an update file that has not been downloaded, download the update file;
[0031] Extract text knowledge information from update files;
[0032] Performing text segmentation on the text knowledge information to obtain at least one text segment;
[0033] Corresponding text association questions are respectively set for at least one text segment.
[0034] On the one hand, an embodiment of the present application provides a device for text reply, including:
[0035] A receiving unit, used for receiving a session message of a target user sent by a session client;
[0036] An extraction unit, used to extract a user ID of a target user and a conversation text according to the conversation message;
[0037] An acquisition unit, used to acquire a target user portrait corresponding to the user identifier;
[0038] A generating unit, used for generating text auxiliary information according to the user identifier and the target user portrait;
[0039] The input unit is used to input the conversation text and text auxiliary information into the language model to generate the target reply text
[0040] The return unit is used to return the target reply text to the session client.
[0041] In one implementation, the generating unit is used to: obtain text prompt information corresponding to the user identification;
[0042] In the knowledge base, a preliminary search is performed based on the conversation text to obtain knowledge search results;
[0043] Generate text auxiliary information based on text prompt information, target user portrait and knowledge search results.
[0044] In one implementation, the text auxiliary information further includes at least one of the following information:
[0045] The history of the conversation message, and the language style of the target reply text;
[0046] The historical session messages are obtained by querying the user ID;
[0047] The language style is determined based on the user profile.
[0048] In one implementation, the generating unit is used to:
[0049] Match the conversation text with the text-related questions in the knowledge base to obtain matching questions;
[0050] Get the target text segment that matches the setting of the question;
[0051] The target text fragment and its associated context information are determined as knowledge search results.
[0052] In one implementation, the generating unit is further configured to:
[0053] Acquire network operation behavior information and user identification of at least one user; at least one user includes a target user;
[0054] Generating a user profile for each user according to the network operation behavior information of at least one user;
[0055] A corresponding relationship between the user identification and the user portrait is established according to the user portrait and the user identification respectively corresponding to at least one user.
[0056] In one implementation, the generating unit is further configured to:
[0057] When it is determined that there is an update file that has not been downloaded, download the update file;
[0058] Extract text knowledge information from update files;
[0059] Performing text segmentation on the text knowledge information to obtain at least one text segment;
[0060] Corresponding text association questions are respectively set for at least one text segment.
[0061] On the one hand, an embodiment of the present application provides an electronic device, including:
[0062] Processor; and
[0063] A memory stores computer instructions, wherein the computer instructions are used to cause a processor to execute the steps of the method provided in any of the various optional implementations of any of the above-mentioned text replies.
[0064] On the one hand, an embodiment of the present application provides a storage medium storing computer instructions, which are used to enable a computer to execute the steps of the method provided in any of the various optional implementations of any of the above-mentioned text replies.
[0065] The text reply method in the embodiment of the present application includes receiving a conversation message of a target user sent by a conversation client; extracting a user ID and a conversation text of the target user according to the conversation message; obtaining a target user portrait corresponding to the user ID; generating text auxiliary information according to the user ID and the target user portrait; inputting the conversation text and the text auxiliary information into a language model to generate a target reply text; and returning the target reply text to the conversation client. In this way, the target reply text of the user is generated in combination with the user portrait, so as to realize a personalized reply to the user, thereby meeting the needs and preferences of the user and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0067] Figure 1 It is a flowchart of a text reply method in an embodiment of the present application.
[0068] Figure 2 This is an example diagram of a method for obtaining a user portrait in an embodiment of the present application.
[0069] Figure 3 It is a schematic diagram of a method for generating text auxiliary information in an embodiment of the present application.
[0070] Figure 4 This is an example diagram of a target reply text generation principle in an embodiment of the present application.
[0071] Figure 5 This is an example diagram of a text reply scenario in an embodiment of the present application.
[0072] Figure 6 It is a structural block diagram of a text reply device in an embodiment of the present application.
[0073] Figure 7 It is a structural schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0074] The technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described implementation methods are part of the implementation methods of the present application, rather than all of the implementation methods. Based on the implementation methods in the present application, all other implementation methods obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, the technical features involved in the different implementation methods of the present application described below can be combined with each other as long as they do not conflict with each other.
[0075] First, some terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0076] Terminal device: can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system device, a personal navigation device, a personal digital assistant, an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of interface for the user (such as a wearable device), etc.
[0077] Server: It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0078] LLM model: is an artificial intelligence model designed to understand and generate human language.
[0079] In scenarios such as intelligent customer service conversations, it is usually necessary to automatically generate a reply text based on the user's inquiry content and send the reply text to the user. Under traditional technology, the LLM model is usually used to generate a reply text based on the user's inquiry content and send the reply text to the user.
[0080] However, the LLM model does not target users' responses. Therefore, the generated response text has poor accuracy and cannot provide personalized responses to different users. It is difficult to meet the needs and preferences of different users, resulting in a poor user experience.
[0081] Based on the defects of the above-mentioned related technologies, a method, device, electronic device and storage medium for text reply are provided in the embodiments of the present application, aiming to provide personalized replies to users when making text replies.
[0082] A text reply method is provided in an embodiment of the present application, which can be applied to electronic devices. The present application does not limit the type of electronic device, which can be any type of device suitable for implementation, such as a terminal device and a server, etc. The present application will not go into details about this.
[0083] Combine the following Figure 1 This method is described. Figure 1 This is a flowchart of a text reply method in an embodiment of the present application. The specific implementation process of the method is as follows:
[0084] Step 100: Receive a session message of a target user sent by a session client.
[0085] In one implementation, the conversation message includes a user identifier and a conversation text, or includes information for determining the user identifier and the conversation text.
[0086] As an example, a user issues a voice command to a smart speaker, and the conversation client in the smart speaker converts the voice command into text, obtains the voice text (i.e., conversation text), obtains the user ID, generates a conversation message including the user ID and the voice text, and sends it to the server in the server. The server receives the conversation message sent by the user through the conversation client.
[0087] Optionally, the user identifier can be stored locally on the user terminal (e.g., smart speaker), or obtained by performing voiceprint recognition on the user's voice. Specifically, voiceprint recognition is performed on the user's voice to obtain a voiceprint recognition result containing the user identifier.
[0088] As another example, the user inputs shopping consultation information (i.e., session text) through a shopping application (i.e., session client) in the smartphone. The shopping application obtains the user account (i.e., user identifier), generates a session message based on the user account and the shopping consultation information, and sends the session message to the session client. The server receives the session message sent by the session client.
[0089] Step 101: Extract the user identifier of the target user and the session text according to the session message.
[0090] Among them, the user identifier is information used to uniquely identify the user, such as the user's identity number or user account.
[0091] In one implementation, when obtaining the user identifier, the following method can be used:
[0092] Method 1: If the session message contains the user identifier, obtain the user identifier contained in the session message.
[0093] Method 2: If the session message contains user identifier association information for determining the user identifier, obtain the user identifier association information, and obtain the user identifier set corresponding to the user identifier association information.
[0094] Optionally, the user identifier association information can be message identifier information, device identifier information, user voiceprint information, user account information, etc.
[0095] For example, if the user identifier association information is message identifier information, the user identifier associated with the storage of the message identifier information can be obtained.
[0096] In one implementation, when obtaining the session text, the following method can be used:
[0097] Method 1: If the session message contains the session text, obtain the session text contained in the user session message.
[0098] Method 2: If the session message contains text association information for determining the session text (e.g., text number), obtain the text association information contained in the session message, and obtain the session text set corresponding to the text association information.
[0099] For example, a text set containing multiple texts can be preset, and text numbers corresponding to each text can be set. If the received session text is included in the text set, the target text number of the session text can be obtained, and a session message containing the target text number and the user identifier can be generated and sent to the server. The server obtains the corresponding session text according to the target text number in the session message.
[0100] In this way, the user identity of the current session message and the question raised by the user (i.e., the session text) can be determined.
[0101] Step 102: Obtain the target user profile corresponding to the user identifier.
[0102] In one implementation, corresponding user profiles are respectively generated for multiple users in advance, and a correspondence relationship is established between the user identifier and the user profile, so that the user profile corresponding to the target user can be obtained according to this correspondence relationship and the user identifier of the target user.
[0103] In one implementation, when establishing the correspondence relationship between the user identifier and the user profile, the following steps can be adopted:
[0104] S1021: Obtain the network operation behavior information and user identifier of at least one user; the at least one user includes the target user.
[0105] Among them, the network operation behavior information is the information used to determine the user profile. Specifically, it can be information related to user attributes, user behaviors, and interest preferences. For example, the user's accessed web pages, favorite web pages, and click-through rates, etc.
[0106] S1022: Respectively generate the user profile of each user according to the network operation behavior information of at least one user.
[0107] S1023: Establish a correspondence relationship between the user identifier and the user profile according to the user profiles and user identifiers respectively corresponding to at least one user.
[0108] The method for obtaining the user profile will be described below with an example. Figure 2 It is an example diagram of a method for obtaining a user profile.
[0109] In one implementation, through web crawler technology, obtain the network operation behavior information publicly authorized by the user, and perform data preprocessing on the network operation behavior information, such as data cleaning, to eliminate redundant, invalid, and extreme information, and generate multiple user portraits based on the cleaned data to obtain a set of user portraits, establish the correspondence between user identifiers and user portraits, and store the correspondence in a database (such as a Mongdb database). The server can retrieve the corresponding user portrait from the database according to the user identifier.
[0110] In this way, the corresponding user portrait can be retrieved according to the user identifier to determine the user's preferences.
[0111] Step 103: Generate text auxiliary information according to the user identifier and the target user portrait.
[0112] In one implementation, when performing step 103, the following steps can be adopted:
[0113] S1031: Obtain the text prompt information set corresponding to the user identifier.
[0114] Among them, the text prompt information is the information used to provide reference or correction when generating the target response text.
[0115] Optionally, the text prompt information can be set by the service provider for different user groups, can also be generated according to the user's historical conversation messages, can also be set according to information such as the user's location and user tags, and can also be the keywords in the conversation text and the text prompt information set corresponding to the user identifier.
[0116] S1032: Perform a preliminary search in the knowledge base according to the conversation text to obtain a knowledge search result.
[0117] In one implementation, when performing S1032, the following steps can be adopted:
[0118] S1032-1: Match the conversation text with the text-related questions in the knowledge base respectively to obtain matching questions.
[0119] In one implementation, based on the conversation text, generate a corresponding target text vector, obtain the question vectors of each text-related question, determine the matching degree between the target text vector and each question vector, and screen out the matching questions corresponding to the target text vector from each text-related question according to the matching degree. For example, screen out the text-related questions corresponding to the first specified number (such as 5) of question vectors in descending order of the matching degree as the matching questions.
[0120] Optionally, the matching degree between the target text vector and each problem vector can be determined by an online text retrieval model (FlagModel) using the cosine matching algorithm.
[0121] Furthermore, the matching degree can be adjusted according to the text update time.
[0122] In one implementation, according to the order of the above matching degrees from high to low, the second specified number (e.g., 10) of problem vectors are screened out, and the text-related problems corresponding to the screened problem vectors are obtained. Then, according to the order of the text update times corresponding to the screened text-related problems from near to far, the first specified number of text-related problems with the latest text update time are screened out as the matching problems.
[0123] In practical applications, both the first specified number (e.g., 5) and the second specified number (e.g., 10) can be set according to the actual application scenario and are not limited here.
[0124] Furthermore, the knowledge base can be continuously updated. In one implementation, when updating the knowledge base, the following steps can be adopted:
[0125] When it is determined that there is an update file in other devices such as the cloud that has not been downloaded to the knowledge base, download the update file; extract the text knowledge information from the update file; perform text segmentation on the text knowledge information to obtain at least one text segment; set corresponding text-related problems for at least one text segment.
[0126] In one implementation, when determining whether there is an update file, the following method can be adopted:
[0127] Update checks can be performed in real time or periodically (such as weekly or daily, etc.) to detect whether there is an update file, and it can also be determined whether there is an update file according to whether an update notification sent by other devices is received.
[0128] In one implementation, for the convenience of text query, index information of each problem vector can also be generated and stored for subsequent problem matching.
[0129] As an example, based on the Langchain framework + GPT-4.0, problem vectors and index information can be generated and stored. Specifically, an embedding layer can be used to extract features from text-related problems to obtain problem vectors, and a retriever can be used to generate and store index information of each problem vector. Then, the index information can be matched with the target text vector to quickly determine the matching problems.
[0130] Further, to ensure the accuracy of information, before generating and storing the question vectors and index information, information calibration can also be performed on them first.
[0131] Further, if the updated file is a non-text file, the updated text is converted into text to obtain the converted text, and text knowledge information is obtained through the converted text.
[0132] In one implementation, when it is determined that there is an updated file in the cloud that is not included in the knowledge base, an Unstructured Loader is used to download and convert the updated file.
[0133] This is because the updated file is usually a multi-modal file, such as text, image, audio, and video, etc. If the updated file is a non-text file, for the convenience of subsequent text retrieval and the generation of response texts, the downloaded non-text file is converted into text, such as converting audio into text, extracting text from pictures, etc.
[0134] S1032-2: Obtain the target text segment set for the matching question.
[0135] S1032-3: Determine the target text segment and its associated context information as the knowledge search result.
[0136] S1032-4: Generate text auxiliary information according to the text prompt information, the target user profile, and the knowledge search result.
[0137] Further, text auxiliary information that only includes text prompt information and knowledge search results can also be generated. The following combines Figure 3 to illustrate the principle of generating text auxiliary information. Figure 3 It is a schematic diagram of a method for generating text auxiliary information. The text knowledge information of each file stored in the knowledge base is segmented into text to obtain multiple text segments and their corresponding text-related questions, and in a similarity matching manner, the matching question and target text segment corresponding to the conversation text are determined, and the context information of the target text segment is obtained, and the target text segment and its associated context information are determined as the knowledge search result, and based on the knowledge search result and text prompt information, text auxiliary information is generated.
[0138] Further, the text auxiliary information also includes at least one of the following information: the historical conversation messages of the conversation message, and the language style of the target response text, such as a cute second-generation language style and a more formal and serious workplace language style.
[0139] Among them, the historical conversation messages can be obtained by querying according to the user identification; the language style can be determined according to the user profile.
[0140] Step 104: Input the conversation text and text auxiliary information into the language model to generate the target response text.
[0141] Among them, the text auxiliary information is used to assist in correcting the target response text so that the generated target response text can meet the personalized needs of the user and conform to the user's preferences.
[0142] In one implementation, according to the set model input template, the conversation text and text auxiliary information are concatenated, and the concatenated content is input into the language model to generate the target response text.
[0143] As an example, the set model input template can be a prompt template set according to the data input format of the LLM model.
[0144] Optionally, the text auxiliary information may not include text prompt information and historical conversation information.
[0145] The following combines Figure 4 to illustrate the generation principle of the target response text by way of example. Figure 4 It is an example diagram of the generation principle of a target response text. Figure 4 In this example, network operation behavior information of multiple users is obtained through web crawler technology, and multiple user portraits are generated based on the network operation behavior information, and the user portrait set is obtained and stored. According to the conversation message of the target user, the user identification (Identification, ID) and conversation text are determined, and the target user portrait set corresponding to the user ID is obtained from the user portrait set, and in the knowledge base, a query is made based on the conversation text to obtain the corresponding knowledge search result, and according to the user portrait and the knowledge search result, text auxiliary information is generated, and the text auxiliary information and the conversation text are input into the LLM model to obtain the target response text.
[0146] It should be noted that there may be a situation where no corresponding knowledge search result is found.
[0147] If it is determined that there is a knowledge search result, the LLM model can re-screen the knowledge search result according to the conversation text and text auxiliary information, and use the screened content as the target response text. If it is determined that there is no knowledge search result, the LLM model can directly generate the target response text according to the conversation text and text auxiliary information. If the text auxiliary information contains a language style, the target response text is adjusted according to the language style to obtain the target response text that conforms to the language style.
[0148] Step 105: Return the target response text to the conversation client.
[0149] It should be noted that the conversation client, the database, and the LLM model can be located on the same device or on different devices. The knowledge base, the user profile, and the historical conversation information can be stored in the same database or in different databases.
[0150] The following is an illustration in combination with a scenario of text reply. Figure 5 It is a schematic diagram of a scenario example for text reply.
[0151] Figure 5 In [the figure], both the conversation client and the data including the knowledge base, the user profile, and the historical conversation information are located on the user device, and the LLM model is located on the server for providing services. The knowledge base is stored in a file database, and the user profile and the historical conversation information are stored in a Mongdb database.
[0152] In the embodiments of the present application, the user profile is combined with the conversation text to generate a target reply text, so that a target reply text that meets the user's needs and preferences can be obtained, improving the accuracy of the reply text, meeting the personalized customization requirements of the reply text, and further determining the language style according to the user profile and generating a target reply text that conforms to the user's language style, further meeting the user's interests and hobbies and improving the user experience. It can meet artificial intelligence communication scenarios with high requirements for user information such as live streaming, goods promotion, and product consultation, greatly enhancing the user's interaction experience. Also, the text files in the knowledge base are continuously updated, and the matching degree is corrected according to the text update time of the text files, ensuring the timeliness of the reply text. First, the knowledge base is preliminarily screened based on the user's conversation text, and then the screened content is further refined through the LLM model, greatly reducing the inference content of the LLM model and improving the response speed and the accuracy of the reply text. Moreover, if both the database and the conversation client are located on the same user device, text auxiliary information is generated based on the knowledge search results preliminarily screened from the knowledge base and sent to the server, which avoids the problem of sending a large amount of content to the server in the traditional technology, reduces the strings (tokens) occupied during the transmission process. Further, there is no need to modify the LLM model, and the text auxiliary information can be dynamically adjusted according to different users, reducing the cost and system resources consumed.
[0153] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for the user to choose to authorize or refuse.
[0154] Based on the same inventive concept, an embodiment of the present application further provides a text reply device. Since the principles of the above device and equipment for solving problems are similar to those of a text reply method, therefore, for the implementation of the above device, reference may be made to the implementation of the method, and repeated parts will not be elaborated. This device can be applied to an electronic device. The present application does not limit the type of the electronic device, and it can be any device type suitable for implementation, such as a terminal device and a server, etc. The present application will not elaborate on this anymore.
[0155] Refer to Figure 6 As shown, it is a structural block diagram of a text reply device in an embodiment of the present application. In some embodiments, the text reply device exemplified in the present application includes:
[0156] A receiving unit 601, configured to receive a session message of a target user sent by a session client;
[0157] An extraction unit 602, configured to extract the user identifier and session text of the target user according to the session message;
[0158] An acquisition unit 603, configured to acquire a target user profile corresponding to the user identifier;
[0159] A generation unit 604, configured to generate text auxiliary information according to the user identifier and the target user profile;
[0160] An input unit 605, configured to input the session text and the text auxiliary information into a language model to generate a target reply text;
[0161] A return unit 606, configured to return the target reply text to the session client.
[0162] In one embodiment, the generation unit 604 is configured to:
[0163] Acquire text prompt information set corresponding to the user identifier;
[0164] In a knowledge base, perform a preliminary search according to the session text to obtain a knowledge search result;
[0165] Generate text auxiliary information according to the text prompt information, the target user profile, and the knowledge search result.
[0166] In one embodiment, the text auxiliary information further includes at least one of the following information:
[0167] The historical session messages of the session message, and the language style of the target reply text;
[0168] The historical session messages are obtained by querying according to the user identifier;
[0169] The language style is determined according to the user profile.
[0170] In one implementation, the generating unit 604 is configured to:
[0171] Match the conversation text with the text association problems in the knowledge base respectively to obtain the matching problems;
[0172] Obtain the target text segments set corresponding to the matching problems;
[0173] Determine the target text segments and their associated context information as the knowledge search results.
[0174] In one implementation, the generating unit 604 is further configured to:
[0175] Obtain the network operation behavior information and user identifiers of at least one user; the at least one user includes the target user;
[0176] Generate a user profile for each user respectively according to the network operation behavior information of at least one user;
[0177] Establish a corresponding relationship between the user identifier and the user profile according to the user profiles and user identifiers corresponding to at least one user respectively.
[0178] In one implementation, the generating unit 604 is further configured to:
[0179] When it is determined that there is an update file that has not been downloaded, download the update file;
[0180] Extract text knowledge information from the update file;
[0181] Perform text segmentation on the text knowledge information to obtain at least one text segment;
[0182] Set corresponding text association problems for at least one text segment respectively.
[0183] The method for text reply in the embodiments of the present application includes receiving the conversation message of the target user sent by the conversation client; extracting the user identifier and conversation text of the target user according to the conversation message; obtaining the target user profile corresponding to the user identifier; generating text auxiliary information according to the user identifier and the target user profile; inputting the conversation text and the text auxiliary information into a language model to generate a target reply text; and returning the target reply text to the conversation client. In this way, by generating the target reply text of the user in combination with the user profile, personalized reply to the user is realized, so that the needs and preferences of the user can be met and the user experience is improved.
[0184] In the embodiments of the present application, an electronic device is provided, including:
[0185] A processor; and
[0186] A memory stores computer instructions for causing a processor to execute the method according to any of the above embodiments.
[0187] In an embodiment of the present application, a storage medium stores computer instructions for causing a computer to execute the method according to any of the above embodiments. Figure 7 A schematic structural diagram of an electronic device 7000 is shown. Refer to Figure 7 As shown, the electronic device 7000 includes a processor 7010 and a memory 7020. Optionally, it may further include a power supply 7030, a display unit 7040, and an input unit 7050.
[0188] The processor 7010 is the control center of the electronic device 7000, connecting each component through various interfaces and lines, and executing various functions of the electronic device 7000 by running or executing software programs and / or data stored in the memory 7020, thereby monitoring the electronic device 7000 as a whole.
[0189] In an embodiment of the present application, when the processor 7010 calls the computer program stored in the memory 7020, it executes each step in the above embodiment.
[0190] Optionally, the processor 7010 may include one or more processing units; preferably, the processor 7010 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, applications, etc., and the modem processor mainly processes wireless communication. It can be understood that the above modem processor may not be integrated into the processor 7010. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be separately implemented on independent chips.
[0191] The memory 7020 may mainly include a program storage area and a data storage area. Among them, the program storage area may store the operating system, various applications, etc.; the data storage area may store data created according to the use of the electronic device 7000, etc. In addition, the memory 7020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices, etc.
[0192] The electronic device 7000 further includes a power supply 7030 (such as a battery) for supplying power to each component. The power supply may be logically connected to the processor 7010 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption through the power management system.
[0193] The display unit 7040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 7000. In the embodiments of the present application, it is mainly used to display the display interfaces of various applications in the electronic device 7000 and objects such as text and pictures displayed in the display interfaces. The display unit 7040 may include a display panel 7041. The display panel 7041 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0194] The input unit 7050 can be used to receive information such as numbers or characters input by the user. The input unit 7050 may include a touch panel 7051 and other input devices 7052. Among them, the touch panel 7051, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 7051).
[0195] Specifically, the touch panel 7051 can detect the touch operation of the user, detect the signals brought by the touch operation, convert these signals into contact coordinates, send them to the processor 7010, and receive and execute the commands sent by the processor 7010. In addition, the touch panel 7051 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave. The other input devices 7052 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0196] Of course, the touch panel 7051 can cover the display panel 7041. After the touch panel 7051 detects a touch operation on or near it, it is transmitted to the processor 7010 to determine the type of touch event. Subsequently, the processor 7010 provides a corresponding visual output on the display panel 7041 according to the type of touch event. Although in Figure 7 the touch panel 7051 and the display panel 7041 are implemented as two independent components to realize the input and output functions of the electronic device 7000, in some embodiments, the touch panel 7051 and the display panel 7041 can be integrated to realize the input and output functions of the electronic device 7000.
[0197] The electronic device 7000 may further include one or more sensors, such as a pressure sensor, a gravitational acceleration sensor, a proximity light sensor, etc. Of course, according to the needs in specific applications, the above-mentioned electronic device 7000 may further include other components such as a camera. Since these components are not the key components used in the embodiments of the present application, therefore, in Figure 7It is not shown in [the figure] and will not be elaborated further.
[0198] Those skilled in the art can understand that Figure 7 [The figure] is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than those shown in the figure, or combine certain components, or different components.
[0199] For the convenience of description, the above parts are divided into respective modules (or units) according to their functions and described separately. Of course, when implementing the present application, the functions of the respective modules (or units) can be implemented in the same or multiple software or hardware.
[0200] Obviously, the above embodiments are merely examples given for clear illustration and are not limitations on the embodiments. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to enumerate all the embodiments here. And the obvious changes or modifications derived therefrom are still within the protection scope of the present invention.
Claims
1. A method for text reply, characterized in that, the method includes: Receiving a session message of a target user sent by a session client; Extracting the user identification and session text of the target user according to the session message; Obtaining a target user profile corresponding to the user identification; Generating text auxiliary information according to the user identification and the target user profile; Inputting the session text and the text auxiliary information into a language model to generate the target reply text; Returning the target reply text to the session client.
2. The method according to claim 1, characterized in that, the generating text auxiliary information according to the user identification and the target user profile includes: Obtaining text prompt information set corresponding to the user identification; Performing a preliminary search in a knowledge base according to the session text to obtain a knowledge search result; Generating the text auxiliary information according to the text prompt information, the target user profile and the knowledge search result.
3. The method according to claim 2, characterized in that, the text auxiliary information further includes at least one of the following information: The historical session messages of the session message and the language style of the target reply text; The historical session messages are obtained by querying according to the user identification; The language style is determined according to the user profile.
4. The method according to claim 2 or 3, characterized in that, the performing a preliminary search in a knowledge base according to the session text to obtain a knowledge search result includes: Matching the session text with text-related questions in the knowledge base respectively to obtain matching questions; Obtaining a target text segment set corresponding to the matching question; Determining the target text segment and its associated context information as the knowledge search result.
5. The method according to claim 1 or 2, characterized in that, the method further includes: Obtaining network operation behavior information and user identification of at least one user; the at least one user includes the target user; Generating a user profile for each user according to the network operation behavior information of the at least one user; Establishing a corresponding relationship between the user identification and the user profile according to the user profiles and user identifications respectively corresponding to the at least one user.
6. The method according to claim 4, characterized in that, the method further includes: When it is determined that there is an update file that has not been downloaded, downloading the update file; Extracting text knowledge information from the update file; Performing text segmentation on the text knowledge information to obtain at least one text segment; Setting corresponding text-related questions for the at least one text segment respectively.
7. A text reply device, characterized in that, the device includes: A receiving unit, configured to receive a session message of a target user sent by a session client; An extraction unit, configured to extract the user identification and session text of the target user according to the session message; An obtaining unit, configured to obtain a target user profile corresponding to the user identification; A generation unit, configured to generate text auxiliary information according to the user identifier and the target user profile; An input unit, configured to input the session text and the text auxiliary information into a language model to generate the target response text A return unit, configured to return the target response text to the session client.
8. An electronic device, characterized in that, it includes: a processor; and a memory storing computer instructions for causing the processor to execute the method according to any one of claims 1 to 6.
9. A storage medium, characterized in that, it stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 6.