Model training method, message prompting method, medium, device and computing device
By training a model based on graph data of historical messages, it can predict whether customer service responses are needed in business group chats, thus solving the problem of low customer service efficiency and achieving efficient message processing.
Patent Information
- Application Number
- CN202310351672.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-03-30
AI Technical Summary
In business group chats, customer service representatives need to read each message one by one to determine whether a reply is needed, which is inefficient and important messages are easily buried, resulting in a failure to reply in a timely manner.
By training a model and mining the features between historical messages and the target message based on graph data of historical messages, the model can predict whether a customer service response is needed and provide instructions to reduce manual judgment.
It improved the efficiency of customer service responses, reduced losses caused by delayed responses, and lowered the workload of customer service staff.
Smart Images

Figure CN116383651B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the field of communication technology, and more particularly, embodiments of the present disclosure relate to a model training method, a message prompting method, a medium, an apparatus and a computing device. BACKGROUND
[0002] This section is intended to provide background information to facilitate a better understanding of embodiments of the disclosure recited in the claims. The description herein does not constitute admission that the information provided herein is prior art to the present disclosure.
[0003] With the development of Internet technology, the popularization of instant messaging technology brings great convenience to users. Most instant messaging software supports group chat function, which avoids repeated transmission of information in 1-to-1 mode, and can establish a group chat when multiple people are needed to participate in discussion or receive messages. The role of chat group is to realize the interaction between users, which is manifested as the exchange of messages between users, that is, the reply of messages between users. In a commercial group chat, in addition to group members, there are usually professional customer service personnel. The task of these customer service personnel is to manage order and answer questions, and find opportunities for marketing. Usually, customer service personnel need to read messages in the group chat one by one to determine whether to intervene in reply. However, in fact, many messages do not need customer service personnel to intervene in reply, such as casual messages, and important messages that need to be replied to may be overwhelmed by the messages that follow, so the above method is low in efficiency. SUMMARY
[0004] The present disclosure provides a model training method, a message prompting method, a medium, an apparatus and a computing device. Based on the graph data corresponding to the historical messages, the features between the historical messages and between the historical messages and the target message are deeply mined, so as to accurately predict whether the customer service needs to reply to the target message, improve the accuracy of the output result, and save the time of manually reading chat records, thereby improving the efficiency.
[0005] In a first aspect of the embodiments of the present disclosure, a model training method is provided, and the method comprises:
[0006] obtaining a training data set, the training data set containing a target message and historical messages in a conversation, the target message corresponding to a target label indicating whether the target message needs customer service reply; the historical messages include at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last customer service sent message and before the target message;
[0007] determining graph data corresponding to the historical messages; the graph data includes user nodes, message nodes and word nodes;
[0008] obtaining an output result of the message prompt model based on the graph data corresponding to the historical messages and the target message, and adjusting parameters of the message prompt model according to the output result and the target label; the output result includes indication information indicating whether the target message needs a reply from the customer service in the conversation.
[0009] In a second aspect of the embodiments of the present disclosure, a message prompt method is provided, and the method comprises:
[0010] In response to receiving a target message, a corresponding historical message is determined; the historical message includes at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message;
[0011] Graph data corresponding to the historical message is determined; the graph data includes user nodes, message nodes, and word nodes;
[0012] The graph data corresponding to the historical message and the target message are input into a message prompt model to obtain indication information output by the message prompt model; the indication information indicates whether the target message needs a reply from the customer service in the conversation.
[0013] In a third aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium stores computer execution instructions; when a processor executes the computer execution instructions, the method provided in the first aspect or the second aspect is implemented.
[0014] In a fourth aspect of the embodiments of the present disclosure, a model training device is provided, and the device comprises:
[0015] A first obtaining module is configured to obtain a training data set, the training data set containing a target message and historical messages in a conversation, the target message corresponding to a target label indicating whether the target message needs a reply from a customer service; the historical messages include at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message;
[0016] A first determining module is configured to determine graph data corresponding to the historical messages; the graph data includes user nodes, message nodes, and word nodes;
[0017] A result obtaining module is configured to obtain an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message;
[0018] an adjusting module configured to adjust parameters of the message prompt model according to the output result and the target label; the output result includes indication information indicating whether the target message needs a reply from the customer service in the conversation.
[0019] In a fifth aspect of the embodiments of the present disclosure, a message prompt device is provided, and the device includes:
[0020] a second determining module configured to determine a corresponding historical message in response to receiving a target message; the historical message includes at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after a message sent by a customer service last time and before the target message;
[0021] a third determining module configured to determine graph data corresponding to the historical message; the graph data includes user nodes, message nodes, and word nodes;
[0022] a second obtaining module configured to input the graph data corresponding to the historical message and the target message into a message prompt model to obtain indication information output by the message prompt model; the indication information indicates whether the target message needs a reply from the customer service in the conversation.
[0023] In a sixth aspect of the embodiments of the present disclosure, a computing device is provided, and the device includes at least one processor and a memory; the memory stores computer-executable instructions; and the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method provided in the first aspect or the second aspect.
[0024] In the embodiments of the present disclosure, by obtaining a training data set, the training data set contains a target message and a historical message in a conversation, the target message corresponds to a target label indicating whether the target message needs a reply from a customer service; the historical message includes at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after a message sent by a customer service last time and before the target message; graph data corresponding to the historical message is determined; the graph data includes user nodes, message nodes, and word nodes; an output result of a message prompt model is obtained based on the graph data corresponding to the historical message and the target message; parameters of the message prompt model are adjusted according to the output result and the target label; the output result includes indication information indicating whether the target message needs a reply from the customer service in the conversation; by training the message prompt model based on the graph data of the historical message and the target message, the relationship between each node in the historical message and the relationship between the historical message and the target message can be deeply mined, the accuracy of the obtained output result is improved, manual judgment of whether a reply from the customer service is needed is not required, cost is reduced and efficiency is improved, and the work burden of the customer service is greatly reduced. BRIEF DESCRIPTION OF DRAWINGS
[0025] The above and other objects, features and advantages of the present disclosure exemplary embodiments will be more apparent from the following detailed description read in conjunction with the accompanying drawings, in which:
[0026] Figure 1 A schematic diagram of an application scenario provided according to an embodiment of the present disclosure is shown schematically;
[0027] Figure 2 A schematic diagram of a model training method provided according to an embodiment of the present disclosure is shown schematically;
[0028] Figure 3 A schematic diagram of another model training method provided according to an embodiment of the present disclosure is shown schematically;
[0029] Figure 4 A schematic diagram of graph data of a historical message provided according to an embodiment of the present disclosure is shown schematically;
[0030] Figure 5 A schematic diagram of calculating a weight between two message nodes provided according to an embodiment of the present disclosure is shown schematically;
[0031] Figure 6 A schematic diagram of judging whether to reply to a target message provided according to an embodiment of the present disclosure is shown schematically;
[0032] Figure 7 A schematic diagram of a message prompting method provided according to an embodiment of the present disclosure is shown schematically;
[0033] Figure 8 A schematic diagram of a computer readable storage medium provided according to an embodiment of the present disclosure is shown schematically;
[0034] Figure 9 A schematic diagram of a model training apparatus provided according to an embodiment of the present disclosure is shown schematically;
[0035] Figure 10 A schematic diagram of a message prompting apparatus provided according to an embodiment of the present disclosure is shown schematically;
[0036] Figure 11 A schematic diagram of a computing device provided according to an embodiment of the present disclosure is shown schematically.
[0037] In the drawings, the same or similar numerals indicate the same or similar parts. DETAILED DESCRIPTION
[0038] The principles and spirits of the present disclosure will be described below with reference to a number of exemplary embodiments. It should be understood that the embodiments are given only so that those skilled in the art can better understand and / or implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, the embodiments are intended to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0039] Those skilled in the art understand that the embodiments of the present disclosure can be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure can be embodied in the form of a complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0040] According to embodiments of the present disclosure, a model training method, a message prompting method, a medium, an apparatus and a computing device are provided.
[0041] In this document, it should be understood that the terms involved are only used for convenience and do not represent a limitation on the meaning. In addition, any number of elements in the drawings is used for example and not limitation, and any naming is only used for distinction and does not have any limiting meaning.
[0042] In addition, the data involved in the present disclosure can be data authorized by the user or fully authorized by all parties, and the collection, dissemination and use of data comply with the requirements of relevant national laws and regulations. The embodiments of the present disclosure can be combined with each other. SUMMARY
[0044] The present inventors find that in a commercial group chat, customer service needs to reply to some messages for marketing. However, many messages in the group chat often do not need manual customer service intervention to reply, and important messages that need to be replied to will be overwhelmed by the group messages that follow. How to determine that a message in the group chat needs manual reply is of great significance.
[0045] In the prior art, the above task is usually completed manually, and the manual customer service reads the messages in the group chat one by one to determine the messages that need to be replied by the manual customer service. However, one manual customer service often manages many group chats, which is inefficient and will neglect some things.
[0046] Based on the above problems, in the present scheme, a model training method and a message prompting method are proposed. Based on the graph data corresponding to the historical messages, the features between each pair of historical messages and between the historical messages and the target message are determined, and then the model is trained based on the features. The reply behavior of the artificial customer service can be learned, the importance of a message sent in a group to the customer service can be predicted, and a prompt can be given when the message needs to be replied by the artificial. Compared with the method of determining whether the customer service needs to reply by the artificial, the efficiency is improved, and the loss caused by the customer service not replying in time is reduced.
[0047] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure will be specifically introduced below.
[0048] OVERVIEW OF APPLICATION SCENARIOS
[0049] Firstly, referring to Figure 1 , Figure 1 , a schematic diagram of an application scenario provided according to an embodiment of the present disclosure is schematically shown. The method is applied to a computing device, such as a server or a terminal device. The terminal device can be a mobile phone, a computer, a tablet, etc. The computing device can first train a message prompting model according to a training data set with a target label, i.e., adjust the parameters of the message prompting model. When the message prompting model is trained, the target message and the corresponding historical message can be input into the trained message prompting model to output indication information of whether the customer service needs to reply to the target message in the conversation. The computing device can interact with the user, and the user can be a customer service. When it is determined that a message in a group chat needs to be replied by the customer service, the indication information is sent to the user.
[0050] Exemplary Method
[0051] Next, the method for model training according to an exemplary embodiment of the present disclosure will be described with reference to the application scenario of Figure 1 and Figures 2-6 . It should be noted that the above application scenario is only shown for the purpose of facilitating the understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0052] Referring to Figure 2 , Figure 2 , a flowchart of a model training method according to an embodiment of the present disclosure is schematically shown. As Figure 2 shown, the method comprises:
[0053] Step S201, obtaining a training data set, the training data set containing a target message and historical messages in a conversation, the target message corresponding to a target label indicating whether the target message needs to be replied by a customer service.
[0054] In one embodiment of the present disclosure, the historical messages include at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message.
[0055] When training the message prompt model, it can be implemented based on a training data set. The training data set is a pre-collected data set, and the data set can be obtained from the dialogue of the group chat in which the artificial customer service participates.
[0056] The data set contains multiple groups of data, each group of data contains a target message and historical messages, wherein the target message can be the current message in the group chat, that is, the latest message; the historical messages can be at least one latest message in a preset message pool, such as N messages, N is greater than or equal to 1. The messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message.
[0057] For example, there are messages 1 to 7 in the group chat in order, message 7 is the current message, and message 2 is the message sent by the customer service. The preset message pool is composed of messages 3, 4, 5, and 6.
[0058] Since it is a training data set, there is a target label for the target message. For example, for a target message, when the customer service replies, the label corresponding to the target message is that the customer service needs to reply, which can be represented by the value 1; for a target message, when the customer service does not reply, the label corresponding to the target message is that the customer service does not need to reply, which can be represented by the value 0.
[0059] Step S202, determine the graph data corresponding to the historical messages.
[0060] In one embodiment of the present disclosure, the graph data includes user nodes, message nodes, and word nodes.
[0061] For historical messages, a graph is used for modeling, that is, the graph data corresponding to the historical messages is obtained. There are three types of nodes in the graph data. By analyzing the three types of nodes, the weight between any two nodes is obtained, and the relationship between each historical message is further mined.
[0062] The user nodes include user information corresponding to each message in the historical messages; the message nodes include each message in the historical messages; and the word nodes include the words split from each message in the historical messages.
[0063] The format of the message in the group chat can be: message sequence number + user ID + message content. The graph data corresponding to the historical message based on the format includes three types of nodes: user nodes, message nodes and word nodes.
[0064] For example, when the dialogue content is as shown in the following table, the historical messages are message 1 to message 3, and the target message is message 4. The user nodes, message nodes and word nodes in the historical messages are described as follows.
[0065] 1 : [userl] I like natural language processing 2: [user2] I love math 3: [user3] I like games 4: [user4] What games do you usually play?
[0066] The user nodes are [user1, user2, user3], the message nodes are [“I like natural language processing”, “I love mathematics”, “I like games”], and the word nodes are [“I”, “like”, “nature”, “language, “processing”, “love”, “mathematics”, “games”]. The user nodes, message nodes and word nodes can also form a set V, V = [user1, user2, user3, “I like natural language processing”, “I love mathematics”, “I like games”, “I”, “like”, “nature”, “language, “processing”, “love”, “mathematics”, “games”]. The nodes contained in the set V are all the nodes of the graph data corresponding to the historical message.
[0067] In step S203, the output result of the message prompt model is obtained based on the graph data corresponding to the historical message and the target message, and the parameters of the message prompt model are adjusted according to the output result and the target label.
[0068] In an embodiment of the present disclosure, the output result includes indication information indicating whether the target message needs a customer service reply in the dialogue.
[0069] When the graph data corresponding to the historical message is obtained, the message prompt model can be trained based on the graph data of the historical message and the target message to obtain a trained message prompt model. The target message and the historical message are input into the trained message prompt model to obtain an output result, which is used to indicate whether the target message needs a customer service reply.
[0070] The training process of the message prompt model is as follows: an output result is obtained according to the graph data corresponding to the historical messages and the target message, and the output result is used to indicate the indication information of whether the customer service needs to reply in the dialogue. An error is obtained through the output result and the target label, the parameters of the message prompt model are adjusted based on the error, the output result is obtained again based on the adjusted parameters, the above process is repeated until the error of the output result of the message prompt model and the target label is less than a preset value, or the training times reaches a preset number.
[0071] The model training method provided by the embodiment of the present disclosure comprises the following steps: obtaining a training data set, the training data set comprising a target message and historical messages in a dialogue, and determining graph data corresponding to the historical messages; the graph data comprising a user node, a message node and a word node; obtaining an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message, and adjusting parameters of the message prompt model according to the output result and a target label; the output result comprising indication information of whether the customer service needs to reply in the dialogue for the target message. By training the message prompt model based on the graph data of the historical messages and the target message, the relationship between each node in the historical messages and the relationship between the historical messages and the target message can be deeply mined, the accuracy of the obtained output result can be improved, the judgment of whether the customer service needs to reply is not required, the cost is reduced and the efficiency is improved, and the work burden of the customer service is greatly reduced.
[0072] Figure 3 The flowchart of another model training method provided by an embodiment of the present disclosure is schematically shown as Figure 3 The method comprises the following steps:
[0073] In step S301, a training data set is obtained, the training data set comprising a target message and historical messages in a dialogue, and the target message corresponding to a target label indicating whether the customer service needs to reply.
[0074] In step S302, graph data corresponding to the historical messages is determined.
[0075] The steps S301 and S302 can refer to the steps S201 and S202 in the embodiment shown in Figure 2 The steps S201 and S202 in the embodiment shown in
[0076] In step S303, vector representations corresponding to the historical messages and the target message are determined according to the graph data.
[0077] For the historical message, which can be multiple messages or one message, a vector representation corresponding to the historical message needs to be determined. The historical message contains user nodes, word nodes and message nodes, and there is an association relationship between any two nodes. The features between any two nodes can be mined to improve the training accuracy of the model.
[0078] First, how to determine the vector representation of the historical message is described in detail below.
[0079] In an embodiment of the present disclosure, the vector representation corresponding to the historical message is determined according to the graph data, comprising:
[0080] Determine the weight between any two nodes in the graph data; and determine the vector representation corresponding to the historical message according to the weight between any two nodes.
[0081] For the nodes in the above set V, there is a connection between any two nodes. Due to the difference in node types, there are five types of connections between nodes: connection between word nodes, connection between word nodes and message nodes, connection between user nodes and message nodes, connection between user nodes, and connection between message nodes. The connection between two nodes can be considered as the edge of the graph data. For any connection, a numerical value can be used to measure the closeness between the two nodes. This numerical value can be called weight.
[0082] Among them, the weight between any two nodes in all nodes in the graph data can be represented by an adjacency matrix A. The adjacency matrix A contains three parts of information of nodes, edges and edge weights. Specifically, the element A i,j of the adjacency matrix A i,j indicates that there is an edge between node i and node j, and the numerical value of the weight of this edge is A i,j .
[0083] Figure 4 A schematic diagram of the graph data of a historical message according to an embodiment of the present disclosure is schematically shown. As can be seen from the diagram, there are weights between two word nodes, between a word node and a message node, between a user node and a message node, between two message nodes, and between two user nodes. Some weights in the diagram are not drawn, such as the weight between the two word nodes "nature" and "mathematics", the weight between the messages s1 and s3, the weight between the users 1 and 3, and so on. Reference Figure 4 The calculation process of each element of the adjacency matrix A is described.
[0084] Among them, when node i and node j are both word nodes, A i,jCosine(i, j) = Cosine(i, j); when one of node i and node j is a word node, the other is a message node, and the word node appears in the message node, then A i,j NTI(i, j) = NTI(i, j); when one of node i and node j is a user node, the other is a message node, and the message is sent by the user, then A i,j F(i, j) = F(i, j); when both node i and node j are user nodes, then A i,j U(i, j) = U(i, j); when both node i and node j are message nodes, then A i,j B(i, j) = B(i, j); when node i and node j are other cases, then A i,j = 0.
[0085] Therefore, when determining the vector representation corresponding to the historical message, the weight between any two nodes in the graph data can be determined first, such as the weight between the word nodes, the weight between the word nodes and the message nodes, the weight between the user nodes and the message nodes, the weight between the user nodes, and the weight between the message nodes.
[0086] When the weight between any two nodes is determined, the vector representation of the historical message can be determined. Specifically, when the adjacency matrix A i,j is determined, the adjacency matrix can be unfolded into a vector, and the unfolded vector is the vector representation of the historical message. In the above example, there are 14 nodes, and the adjacency matrix A i,j is a 14*14 matrix, and after unfolding, a vector with a length of 196 can be obtained.
[0087] Optionally, since the adjacency matrix is a square matrix, when determining the vector representation of the historical message, the matrix can also be de-duplicated, and the duplicate weights in the matrix are deleted, that is, only the upper triangular part of the adjacency matrix or the lower triangular part of the adjacency matrix is retained. The retained part is unfolded into a vector, and the unfolded vector is the vector representation corresponding to the historical message.
[0088] The weight can well measure the closeness between two nodes. By calculating the weight between any two nodes in the graph data and then determining the vector representation corresponding to the historical message, the features in the historical message can be better extracted to improve the training accuracy of the message prompt model.
[0089] The process of determining the weight between any two nodes in the graph data will be described in detail below.
[0090] First, the case where both nodes are word nodes is described.
[0091] In an embodiment of the present disclosure, the weight between any two nodes in the graph data is determined, comprising:
[0092] In response to both nodes being word nodes, vector representations corresponding to the two word nodes are determined; a cosine distance between the two word nodes is determined according to the vector representations corresponding to the two word nodes, and the cosine distance is determined as the weight between the two word nodes.
[0093] In determining the weight, the words can be encoded first. For example, the two word nodes can be represented in the form of vectors using word2vec or glove, and the cosine distance between the two vectors is taken as the weight between the two word nodes.
[0094] Specifically, the vector representations of the word node i and the word node j are respectively and The weight between the two word nodes is calculated according to the following formula:
[0095]
[0096] Specifically, in the above example, the vector representation of the word "like" is X 喜欢 =(2, 1, 3), and the vector representation of the word "nature" is X 自然 =(0, 5, 2). Then, the weight between the two words "like" and "nature" is:
[0097]
[0098] By calculating the cosine distance between the two vectors, the semantic similarity between the two word nodes can be measured.
[0099] The following describes the case where the two nodes are word nodes and message nodes.
[0100] In an embodiment of the present disclosure, determining the weight between any two nodes in the graph data comprises:
[0101] In response to one node being a word node and the other node being a message node, and the word node appearing in the message node, a first frequency of the word node appearing in the message node is determined, and a second frequency corresponding to the word node is determined, and a first product of the first frequency and the second frequency is calculated; the second frequency is positively correlated with the ratio of the total number of historical messages to the number of messages containing the word node.
[0102] For any other word node in the message node, a second product of the first frequency and the second frequency corresponding to the word node is calculated respectively, and a normalized first product is calculated according to the first product and the second product, so as to obtain the weight between the word node and the message node.
[0103] When one node is a word node and the other node is a message node, the weight between the two nodes can be determined. Based on this fact, if a word appears in a message more frequently and appears in other messages less frequently, the importance of the word to the message can be measured. That is, the weight determined based on the following method can measure the importance of the word node to the message node.
[0104] wherein, TF ij represents the frequency of the word i appearing in the message j, that is, the first frequency, which can be specifically represented as the following formula:
[0105]
[0106] wherein, the numerator n ij is the number of times of the word i appearing in the message j, and the denominator ∑ k n kj represents the sum of the number of all words in the message j.
[0107] In addition, IDF ij represents the second frequency, that is, the ratio of the total number of historical messages to the number of messages containing the word i, the numerator |D| represents the total number of historical messages, and the denominator |{j:i∈j| represents the number of messages j containing the word i. For a certain word, the smaller the number of messages containing the word, the larger the IDF value. The larger the ratio of the total number of historical messages to the number of messages containing the word node, the larger the IDF value.
[0108]
[0109] By calculating the product of the first frequency and the second frequency, the weight between the word node and the message node can be simply measured. However, directly determining the product of the first frequency and the second frequency as the weight between the word node and the message node may cause the weight to have a large value. Therefore, the calculated first product can be normalized so that the normalized value is between 0 and 1, avoiding too large or too small values, thereby improving the training effect of the model.
[0110] Specifically, the normalization process is as follows: the first frequency and the second frequency of the remaining words in the message node are calculated respectively to obtain the second product of the first frequency and the second frequency, and the normalized first product, that is, the weight between the word node and the message node, can be obtained according to the first product and the second product. Specifically, the calculation formula of NTI(i,j) is as follows:
[0111]
[0112] For example, when the word node is "like" and the message node is "I like games", the word node appears once in the message node, and there are 3 words in the message node, so the first frequency corresponding to the word node is:
[0113]
[0114] There are three messages in the historical message, which are "I like natural language processing", "I love mathematics" and "I like games", and there are two messages containing "like", so the second frequency corresponding to the word node is:
[0115]
[0116] The first frequencies corresponding to the other two word nodes "I" and "game" in the message node are:
[0117]
[0118] The historical message contains 3 messages containing the word "I" and 1 message containing the word "game", so the second frequencies corresponding to the word "I" and the word "game" are:
[0119]
[0120] Finally, the weight between the word node "like" and the message node "I like games" can be calculated as:
[0121]
[0122] Through the above method, the importance of the word node in the message node can be accurately measured, and through normalization, the calculated weight is between 0 and 1, which improves the training accuracy of the message prompt model.
[0123] Next, the case where two nodes are a user node and a message node is described.
[0124] In an embodiment of the present disclosure, determining the weight between any two nodes in the graph data comprises:
[0125] In response to one node being a user node, another node being a message node, and the message node being sent by the user node, a number of messages sent by the user node is determined;
[0126] A reciprocal of the number of messages is determined as a weight between the user node and the message node.
[0127] For a user node and a message node, and the message being sent by the user, a reciprocal of a number of messages sent by the user can be used as a weight between the user node and the message node, and a calculation formula is as follows:
[0128]
[0129] Exemplarily, when the message node is user1, the user has sent one message, and a weight between the user and the message "I like natural language processing" is as follows:
[0130]
[0131] Based on the weight, an importance degree of the message to the user can be measured, and the calculated weight can be between 0 and 1.
[0132] The following describes a case where both nodes are user nodes.
[0133] In an embodiment of the present disclosure, a weight between any two nodes in the graph data is determined, including:
[0134] In response to both nodes being user nodes, a first coefficient between the two user nodes is determined; the first coefficient represents a frequency of interaction between the two user nodes; a set of words corresponding to the two user nodes is respectively determined, a second coefficient between the two user nodes is determined according to the set of words; the set of words is a set of words in historical messages sent by the user nodes; the second coefficient represents a correlation degree between message contents respectively corresponding to the two user nodes; and a product of the first coefficient and the second coefficient is determined as the weight between the two user nodes.
[0135] In order to accurately define the weight between the two user nodes, the first coefficient and the second coefficient can be used for measurement. Exemplarily, when chatting, if the same word is contained in messages sent by the two users, it is indicated that the two users are discussing the same topic. Or, when no same word is contained, such as when a brief reply is made, it is also indicated that the two users can be discussing the same topic.
[0136] Based on the above facts, when the first user node is i and the second user node is j, the first coefficient C(i,j) can be used to measure the frequency of interaction from the distance of the location of the messages sent by the two user nodes; the second coefficient W(i,j) is used to measure the frequency of interaction from the relevance of the content of the messages sent by the two user nodes. Then the product of the first coefficient and the second coefficient is determined as the weight U(i,j) between the two user nodes, so that the finally determined weight can be determined from the content and location of the messages respectively. Specifically, the formula is as follows:
[0137] U(i,j)=C(i,j)×W(i,j)
[0138] The weight between the two user nodes determined by the above method can comprehensively and accurately measure whether the interaction between the two users is frequent, thereby improving the accuracy of the determined weight between the user nodes.
[0139] Optionally, when determining the first coefficient, a plurality of sliding windows can be obtained for the historical messages, and the first coefficient can be determined according to the user nodes corresponding to each sliding window.
[0140] In an embodiment of the present disclosure, the two user nodes are a first user node and a second user node; and the first coefficient between the two user nodes is determined, including:
[0141] The total number of sliding windows is determined according to the historical messages; each sliding window contains N adjacent messages; the sliding window is related to the size of the sliding window and the sliding step; and the sliding step is related to the computing power of the system and the number of the historical messages;
[0142] The number of first sliding windows containing both the first user node and the second user node, the number of second sliding windows containing the first user node, and the number of third sliding windows containing the second user node are determined;
[0143] The first ratio of the number of first sliding windows to the total number of sliding windows, the second ratio of the number of second sliding windows to the total number of sliding windows, and the third ratio of the number of third sliding windows to the total number of sliding windows are calculated;
[0144] The first addition result of the first ratio and a first preset value is calculated, the multiplication result of the second ratio and the third ratio is calculated, the fourth ratio of the first addition result and the multiplication result is calculated, and the logarithm of the fourth ratio is taken to obtain the first coefficient between the two user nodes.
[0145] In determining the first coefficient, the historical messages can be divided into a plurality of sliding windows to obtain a total number of sliding windows Q. The sliding window refers to arranging the historical messages into a vector according to the sending order of the messages, such as [message 1, message 2, message 3, message 4, message 5, message 6], when the size of the sliding window is 3 and the sliding step is 1, then the sliding windows obtained are: [message 1, message 2, message 3], [message 2, message 3, message 4], [message 3, message 4, message 5], [message 4, message 5, message 6], therefore, the total number of sliding windows is 4.
[0146] The size of the sliding window represents the number of messages in each sliding window, and the size of the sliding window and the sliding step can be set according to actual conditions. When the size of the sliding window and / or the sliding step changes, the sliding window changes, and therefore the total number of sliding windows also changes. When the sliding step is larger, the total number of sliding windows becomes smaller, which can be determined according to the number of historical messages and the computing power of the system. When the number of historical messages is larger and the computing power of the system is stronger, a larger sliding step can be set.
[0147] After determining the sliding window, the first sliding window number containing both the first user node and the second user node can be determined, for example, the first user node is i and the second user node is j, then Q(i,j) represents the number of sliding windows containing both user i and user j in the sliding window, that is, the first sliding window number. The second sliding window number containing the first user node needs to be determined, which can be represented by Q(i), and the third sliding window number containing the second user node can be represented by Q(j). The first coefficient C(i,j) can be calculated using the following formula: where since the case that no sliding window contains both user i and user j may occur, that is, Q(i,j)=0, then p(i,j)=0 at this time, resulting in C(i,j)=log(0)→(-∞), in order to avoid this extreme case, we add a first preset value to the numerator, that is, a very small positive number ε, such as ε=0.001.
[0148]
[0149]
[0150]
[0151] In the above example, the number of historical messages is three, and when the size of the sliding window is 2, there are two sliding windows, i.e., [message 1, message 2] and [message 2, message 3], and the user sequences corresponding to the two sliding windows are: [user 1, user 2] and [user 2, user 3]. The number of sliding windows containing both user 1 and user 2 is 1; the number of sliding windows containing user 1 is 1, and the number of sliding windows containing user 2 is 2, so the first coefficient can be calculated as follows:
[0152]
[0153]
[0154]
[0155]
[0156] By determining the sliding window and the information of the users contained in the same sliding window, whether two user nodes interact can be measured based on the positions of the messages sent by the users, and the accuracy of determining the first coefficient is improved.
[0157] Optionally, when determining the second coefficient, the correlation of the words in the messages corresponding to the two users can be determined to determine whether the two users are discussing related content.
[0158] In an embodiment of the present disclosure, determining the second coefficient between the two user nodes according to the word set includes:
[0159] determining a first number of same words in the word sets corresponding to the two user nodes, respectively;
[0160] determining a second number of the sum of the number of words in the word sets corresponding to the two user nodes, respectively;
[0161] calculating a second addition result of the first number and a second preset numerical value, and determining the quotient of the second addition result and the second number as the second coefficient.
[0162] When determining the second coefficient, the degree of similarity of the words in the messages sent by the two user nodes is mainly used to measure whether the two users frequently interact. Specifically, N(i) can be used to represent a set of words in all messages sent by user i, and N(j) can be used to represent a set of words in all messages sent by user j, and the calculation formula of the second coefficient is:
[0163]
[0164] Wherein, |N(i)∩N(j)| represents the number of same words used by user i and user j in the process of sending messages; ε in the numerator is a second preset value, which is any very small positive number, and it ensures that W(i,j) is not 0; the denominator |N(i)+N(j)| represents the number of all words used by user i and user j in the process of sending messages.
[0165] In the above example, N(user1)={I, like, nature, language, processing}, N(user2)={I, love, netease}, it can be seen that the same word used by them is only one "I", the sum of the number of words of the two users is 8, when ε=0.001, the calculation formula of the second coefficient is:
[0166]
[0167] When the first coefficient and the second coefficient are obtained, the weight between the two user nodes is equal to:
[0168]
[0169] Through the above method of calculating the second coefficient, the frequency of interaction between two users can be measured from the correlation degree of the content of the messages sent by the two users, and the accuracy of determining the second coefficient is improved.
[0170] The case that both nodes are message nodes is described below.
[0171] In an embodiment of the present disclosure, determining the weight between any two nodes in the graph data comprises:
[0172] In response to both nodes being message nodes, determining the vector representation corresponding to each of the two message nodes; determining the difference between the vector representations corresponding to the two message nodes, and calculating the absolute value of the difference; determining the weight between the two message nodes according to the vector representations corresponding to the two message nodes and the absolute value of the difference.
[0173] When both nodes are message nodes, the weight between the message nodes can be calculated. Specifically, the vector representation corresponding to each of the two messages can be determined first, and then the absolute value of the difference between the two vector representations can be calculated, wherein the absolute value of the difference can represent the difference in the corresponding positions, and the weight between the two message nodes can be determined based on the vector representations of the two message nodes and the absolute value of the difference.
[0174] Figure 5 A schematic diagram for calculating the weight between two message nodes according to an embodiment of the present disclosure is schematically shown; as Figure 5As shown, the open source model Sentence-BERT can be used to determine the weight, first pass the two messages through the first structure and the second structure of the model respectively, the first structure can be a bert structure, and the second structure can be a pooling structure, to obtain vector representation u and vector representation v respectively, so as to obtain the absolute value of the difference |u-v|, and (u,v,|u-v|) can be obtained by connecting u, v and |u-v| together, and then sent to the softmax classifier of the model, so as to output a number between 0 and 1, and the output number is the weight between the two message nodes. When the output number is larger, it means that the two messages are more similar.
[0175] By calculating the absolute value of the difference between the two vectors, the difference between the two vectors can be obtained, so as to improve the accuracy of determining the weight between the two message nodes.
[0176] Based on the above method, the weight between any two nodes in the graph data can be determined, so as to determine the vector representation corresponding to the historical message.
[0177] The determination method of the vector representation corresponding to the target message will be described in detail below.
[0178] In an embodiment of the present disclosure, the vector representation corresponding to the target message is determined, comprising:
[0179] determining a first vector representation corresponding to the content of the target message; determining a second vector representation corresponding to the user of the target message; wherein if the user of the target message exists in each user corresponding to the historical message, the second vector representation is determined as a first numerical value; otherwise, the second vector representation is determined as a second numerical value; and determining the vector representation corresponding to the target message according to the first vector representation and the second vector representation.
[0180] The target message contains the content of the target message, and also contains the user corresponding to the target message, so the content of the target message and the corresponding user can be modeled respectively.
[0181] When modeling the content of the target message, the content of the target message can be directly converted into a vector. For example, the content of the target message can be converted into a vector using a convolutional neural network or a bert model, that is, a first vector representation.
[0182] When modeling the user corresponding to the target message, a vector with a length of 1, that is, a number, can be directly obtained, that is, a second vector representation. For example, if the user appears in the historical message, the value of the number is a first numerical value, such as 1, otherwise, the value of the number is a second numerical value, such as 0.
[0183] When the first vector representation and the second vector representation are determined, the vector representation corresponding to the target message can be obtained. For example, the first vector representation and the second vector representation can be concatenated into a long vector, and the long vector is the vector representation corresponding to the target message.
[0184] By modeling the content of the target message and the corresponding user respectively, the relationship between the sender of the target message and the sender of the historical message is determined, so as to mine the features between the target message and the historical message, and improve the accuracy of the message prompt model training.
[0185] In step S304, the vector representation corresponding to the historical message and the vector representation corresponding to the target message are input into the message prompt model to obtain an output result of the message prompt model.
[0186] When the vector representation corresponding to the historical message and the vector representation corresponding to the target message are obtained, the two vector representations can be concatenated to obtain a long vector, which contains all the information and can be input into a softmax classifier. The softmax will output a number between 0 and 1, that is, the output result. When the value of the output result is larger, the probability that the customer service personnel needs to reply to the current message is larger.
[0187] Figure 6 An illustrative diagram for determining whether to reply to a target message according to an embodiment of the present disclosure is shown. Figure 6 As shown, by constructing the vector representation (2, 5, 6, 1, 3, 6, 8, 4) of the historical message and the vector representation (9, 3, 2, 4, 7, 1, 7, 0) of the target message respectively, and inputting the two vector representations into a softmax classifier, the probability that the customer service personnel needs to reply to the current message is obtained.
[0188] In step S305, the parameters of the message prompt model are adjusted according to the output result and the target label.
[0189] When the parameters of the message prompt model are adjusted, the adjustment can be realized based on the output result and the target label. Initially, the message prompt model has not been trained, and the output result and the target label are quite different. According to the difference between the output result and the target label, the parameters of the message prompt model can be adjusted, so that the output result gradually approaches the target label, so as to obtain a trained message prompt model.
[0190] The vector representation determined based on the graph data and the vector representation corresponding to the target message are input into the message prompt model, so as to realize better training of the message prompt model.
[0191] Figure 7A flowchart of a message prompting method according to an embodiment of the present disclosure is shown schematically as shown in Figure 7 The method includes the following steps:
[0192] In step S701, in response to receiving a target message, a corresponding historical message is determined. The historical message includes at least one latest message in a preset message pool. The messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message.
[0193] In step S702, graph data corresponding to the historical message is determined. The graph data includes user nodes, message nodes and word nodes.
[0194] In step S703, the graph data corresponding to the historical message and the target message are input into a message prompting model to obtain indication information output by the message prompting model. The indication information indicates whether the customer service needs to reply in the conversation for the target message.
[0195] The steps S701 to S703 are the use process of the message prompting model. When the target message is obtained in the group chat each time, the historical message is determined, the graph data corresponding to the historical message and the target message are input into the message prompting model. At this time, the message prompting model is a trained model, which can output the indication information according to the input target message and historical message. At the same time, a threshold value can be set. When the output result of the classifier is greater than the threshold value, the customer service is prompted for manual reply. When the output result of the classifier is less than the threshold value, the customer service is prompted not to manually reply, or the customer service is not prompted.
[0196] The threshold value can be adjusted according to the number of customer services. When the number of customer services is large, a lower threshold value can be set. When the number of customer services is small, a higher value can be set.
[0197] The message prompting method provided by the embodiment of the present disclosure determines the corresponding historical message in response to receiving the target message, determines the graph data corresponding to the historical message, inputs the graph data corresponding to the historical message and the target message into the message prompting model, and obtains the indication information output by the message prompting model. The message prompting model is trained based on the graph data of the historical message and the target message, which can deeply mine the relationship between each node in the historical message and the relationship between the historical message and the target message, improve the accuracy of the output result, and reduce the work burden of the customer service without manual judgment of whether the customer service needs to reply.
[0198] Exemplary Medium
[0199] After introducing the method of the exemplary embodiment of the present disclosure, next, reference is made to Figure 8A storage medium of an exemplary embodiment of the present disclosure is described.
[0200] Reference is made to Figure 8 As shown, the storage medium 80 stores therein a program product for implementing the above method according to an embodiment of the present disclosure, which can take a portable compact disc read-only memory (CD-ROM) and include program code for causing a computing device to execute the model training method or the message prompting method provided by the present disclosure. However, the program product of the present disclosure is not limited thereto.
[0201] The program product can take any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0202] The readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the program code is carried. Such propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The readable signal medium can also be any readable medium other than the readable storage medium.
[0203] The program code for executing the operations disclosed by the present disclosure can be written in any combination of one or more programming languages, including an object-oriented programming language, such as Java, C++, and the like, and a conventional procedural programming language, such as the "C" language or a similar programming language. The program code can be executed entirely on a user computing device, partially on a user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN).
[0204] Exemplary Apparatus
[0205] After introducing the medium of the exemplary embodiment of the present disclosure, next, reference is made to Figure 9The model training apparatus of the exemplary embodiments of the present disclosure is described, which is used to implement the method in any of the above model training method embodiments, and has similar implementation principles and technical effects, which will not be described here.
[0206] The model training apparatus 90 provided by the present disclosure comprises:
[0207] The first obtaining module 901 is configured to obtain a training data set, wherein the training data set comprises a target message and historical messages in a dialogue, the target message corresponds to a target label indicating whether the target message needs a customer service reply, the historical messages comprise at least one latest message in a preset message pool, and the messages in the preset message pool are composed of messages after a message sent by the customer service last time and before the target message.
[0208] The first determining module 902 is configured to determine graph data corresponding to the historical messages, wherein the graph data comprises user nodes, message nodes and word nodes.
[0209] The result obtaining module 903 is configured to obtain an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message.
[0210] The adjusting module 904 is configured to adjust parameters of the message prompt model according to the output result and the target label, and the output result comprises indication information for whether the customer service needs to reply in the dialogue.
[0211] In an embodiment of the present disclosure, the user nodes comprise user information corresponding to each message in the historical messages, the message nodes comprise each message in the historical messages, and the word nodes comprise words split from each message in the historical messages.
[0212] In an embodiment of the present disclosure, the result obtaining module 903 comprises:
[0213] The vector representation determining unit is configured to determine a vector representation corresponding to the historical messages according to the graph data, and determine a vector representation corresponding to the target message.
[0214] The input unit is configured to input the vector representation corresponding to the historical messages and the vector representation corresponding to the target message into the message prompt model to obtain an output result of the message prompt model.
[0215] In an embodiment of the present disclosure, when determining the vector representation corresponding to the historical messages according to the graph data, the vector representation determining unit is specifically configured to:
[0216] Determine a weight between any two nodes in the graph data.
[0217] The vector representation corresponding to the historical message is determined according to the weight between any two nodes.
[0218] In one embodiment of the present disclosure, when determining the weight between any two nodes in the graph data, the vector representation determining unit is specifically configured to:
[0219] In response to both nodes being word nodes, vector representations corresponding to the two word nodes are determined respectively;
[0220] A cosine distance between the two word nodes is determined according to the vector representations corresponding to the two word nodes respectively, and the cosine distance is determined as the weight between the two word nodes.
[0221] In one embodiment of the present disclosure, when determining the weight between any two nodes in the graph data, the vector representation determining unit is specifically configured to:
[0222] In response to one node being a word node and the other node being a message node, and the word node appearing in the message node, a first frequency of the word node appearing in the message node is determined, and a second frequency corresponding to the word node is determined, and a first product of the first frequency and the second frequency is calculated; the second frequency is positively correlated with a ratio of a total number of the historical messages to a number of messages containing the word node;
[0223] For any other word node in the message node, a second product of a first frequency and a second frequency corresponding to the word node is calculated respectively, and a normalized first product is calculated according to the first product and the second product, so as to obtain the weight between the word node and the message node.
[0224] In one embodiment of the present disclosure, when determining the weight between any two nodes in the graph data, the vector representation determining unit is specifically configured to:
[0225] In response to one node being a user node and the other node being a message node, and the message node being sent by the user node, a number of messages sent by the user node is determined;
[0226] An inverse of the number of messages is determined as the weight between the user node and the message node.
[0227] In one embodiment of the present disclosure, when determining the weight between any two nodes in the graph data, the vector representation determining unit is specifically configured to:
[0228] In response to both nodes being user nodes, a first coefficient between the two user nodes is determined; the first coefficient represents a frequency of interaction between the two user nodes;
[0229] determining a second coefficient between the two user nodes according to the word set; the word set is a set of words in historical messages sent by the user nodes; and the second coefficient represents a correlation degree between message contents corresponding to the two user nodes respectively;
[0230] determining a product of the first coefficient and the second coefficient as a weight between the two user nodes.
[0231] In an embodiment of the present disclosure, the two user nodes are a first user node and a second user node; and the vector representation determining unit, when determining the first coefficient between the two user nodes, is specifically configured to:
[0232] determining a total number of sliding windows according to the historical messages; each sliding window contains N adjacent messages; the sliding window is related to a sliding window size and a sliding step; and the sliding step is related to a computing power of the system and a number of the historical messages;
[0233] determining a first number of first sliding windows containing both the first user node and the second user node, a second number of second sliding windows containing the first user node, and a third number of third sliding windows containing the second user node;
[0234] calculating a first ratio of the first number of the first sliding windows to the total number of the sliding windows, a second ratio of the second number of the second sliding windows to the total number of the sliding windows, and a third ratio of the third number of the third sliding windows to the total number of the sliding windows;
[0235] calculating a first addition result of the first ratio and a first preset value, calculating a multiplication result of the second ratio and the third ratio, calculating a fourth ratio of the first addition result and the multiplication result, and taking a logarithm of the fourth ratio to obtain the first coefficient between the two user nodes.
[0236] In an embodiment of the present disclosure, the vector representation determining unit, when determining the second coefficient between the two user nodes according to the word set, is specifically configured to:
[0237] determining a first number of same words in the word sets corresponding to the two user nodes respectively;
[0238] determining a second number of a sum of word numbers in the word sets corresponding to the two user nodes respectively;
[0239] calculating a second addition result of the first number and a second preset value, and determining a quotient of the second addition result and the second number as the second coefficient.
[0240] In an embodiment of the present disclosure, the vector representation determining unit, when determining the weight between any two nodes in the graph data, is specifically configured to:
[0241] In response to both nodes being message nodes, determining vector representations corresponding to the two message nodes respectively;
[0242] Determining a difference value of the vector representations corresponding to the two message nodes respectively, and calculating an absolute value of the difference value;
[0243] Determining the weight between the two message nodes according to the vector representations corresponding to the two message nodes respectively and the absolute value of the difference value.
[0244] In an embodiment of the present disclosure, the vector representation determining unit, when determining the vector representation corresponding to the target message, is specifically configured to:
[0245] Determining a first vector representation corresponding to the content of the target message;
[0246] Determining a second vector representation corresponding to the user of the target message; if the user of the target message exists in each user corresponding to the historical message, determining the second vector representation as a first numerical value; otherwise, determining the second vector representation as a second numerical value;
[0247] Determining the vector representation corresponding to the target message according to the first vector representation and the second vector representation.
[0248] Next, refer to Figure 10 The message prompting device of the exemplary embodiments of the present disclosure is described, which is used to implement the method in the message prompting method embodiments, and has similar implementation principles and technical effects, which will not be described here.
[0249] The message prompting device 100 provided by the present disclosure comprises:
[0250] The second determining module 1001 is configured to, in response to receiving a target message, determine a corresponding historical message; the historical message comprises at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last customer service sent message and before the target message;
[0251] The third determining module 1002 is configured to determine graph data corresponding to the historical message; the graph data comprises user nodes, message nodes and word nodes;
[0252] The second obtaining module 1003 is configured to input the graph data corresponding to the historical message and the target message into a message prompting model, and obtain indication information output by the message prompting model; the indication information indicates whether the target message needs to be replied by the customer service in the conversation.
[0253] Exemplary Computing Device
[0254] Having introduced the method, medium and apparatus of the exemplary embodiments of the present disclosure, next, reference will be made to Figure 11 The computing device of the exemplary embodiments of the present disclosure is described.
[0255] Figure 11 The computing device 110 shown is only one example of a computing device and should not be taken in a limiting sense, but is meant to provide an example of the types of devices that can implement the embodiments of the present disclosure.
[0256] As Figure 11 shown, the computing device 110 is in the form of a general-purpose computing device. The components of the computing device 110 can include, but are not limited to, at least one processing unit 1101, at least one storage unit 1102, and a bus 1103 that connects the different system components including the processing unit 1101 and the storage unit 1102. The at least one storage unit 1102 stores computer-executable instructions; and the at least one processing unit 1101 includes a processor that executes the computer-executable instructions to implement the methods described above.
[0257] The bus 1103 includes a data bus, a control bus, and an address bus.
[0258] The storage unit 1102 can include a readable medium in the form of volatile memory, such as a random access memory (RAM) 11021 and / or a cache memory 11022, and can further include a readable medium in the form of non-volatile memory, such as read-only memory (ROM) 11023.
[0259] The storage unit 1102 can also include a program / utility 11025 having a set of program modules 11024, including but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which can include an implementation of a networking environment, or a combination thereof.
[0260] The computing device 110 can also communicate with one or more external devices 1104 such as a keyboard or a pointing device, through an input / output (I / O) interface 1105. And, the computing device 110 can further communicate with one or more networks, such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet, through a network adapter 1106. As Figure 11As shown, network adapter 1106 communicates with other modules of the computing device 110 over bus 1103. It should be appreciated that although not shown, other hardware and / or software modules could be used in conjunction with the computing device 110. These include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0261] It should be noted that although the model training apparatus and the several units / modules or sub-units / modules of the model training apparatus, and the message prompting apparatus and the several units / modules or sub-units / modules of the message prompting apparatus are mentioned in the foregoing detailed description, such division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into embodied by multiple units / modules.
[0262] Further, although operations of the methods of the present disclosure are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in that particular order, or that all of the illustrated operations must be performed to achieve desirable results. Additionally or alternatively, certain steps can be omitted, combined into a single step, and / or separated into multiple steps.
[0263] While the spirit and principles of the present disclosure have been described with reference to several specific embodiments, it is to be understood that the present disclosure is not limited to the specific embodiments disclosed and that the division of aspects is not meant to imply that features from these aspects cannot be combined to benefit from the disclosure, but is merely for ease of presentation. The present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A model training method, characterized in that, The method comprises: obtaining a training data set, the training data set comprising a target message and historical messages in a dialogue, the target message corresponding to a target label indicating whether the target message needs a customer service reply; the historical messages including at least one latest message in a preset message pool; the messages in the preset message pool being composed of messages after the last customer service sent message and before the target message; determining graph data corresponding to the historical messages; the graph data comprising user nodes, message nodes and word nodes; obtaining an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message, adjusting parameters of the message prompt model according to the output result and the target label; the output result comprising indication information for whether the target message needs a customer service reply in the dialogue.
2. The method of claim 1, wherein, The user nodes comprise user information corresponding to each message in the historical messages; the message nodes comprise each message in the historical messages; and the word nodes comprise words split from each message in the historical messages.
3. The method of claim 1, wherein, Obtaining an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message comprises: determining vector representations corresponding to the historical messages according to the graph data, and determining a vector representation corresponding to the target message; inputting the vector representations corresponding to the historical messages and the vector representation corresponding to the target message into the message prompt model to obtain the output result of the message prompt model.
4. The method of claim 3, wherein, Determining vector representations corresponding to the historical messages according to the graph data comprises: determining weights between any two nodes in the graph data; determining the vector representations corresponding to the historical messages according to the weights between any two nodes.
5. The method of claim 4, wherein, Determining weights between any two nodes in the graph data comprises: in response to both nodes being word nodes, determining vector representations corresponding to the two word nodes respectively; determining a cosine distance between the two word nodes according to the vector representations corresponding to the two word nodes respectively, and determining the cosine distance as the weight between the two word nodes.
6. The method of claim 4, wherein, Determining weights between any two nodes in the graph data comprises: in response to one node being a word node and the other node being a message node, and the word node appearing in the message node, determining a first frequency of the word node appearing in the message node, and a second frequency corresponding to the word node, and calculating a first product of the first frequency and the second frequency; the second frequency being positively correlated with a ratio of a total number of the historical messages to a number of messages containing the word node; for any other word node in the message node, calculating a second product of a first frequency corresponding to the word node and a second frequency corresponding to the word node respectively, and calculating a normalized first product according to the first product and the second product to obtain the weight between the word node and the message node.
7. The method of claim 4, wherein, Determining weights between any two nodes in the graph data comprises: In response to one node being a user node, another node being a message node, and the message node being sent by the user node, determining a number of messages sent by the user node; Determining a reciprocal of the number of messages as a weight between the user node and the message node.
8. The method of claim 4, wherein, Determining a weight between any two nodes in the graph data comprises: In response to both nodes being user nodes, determining a first coefficient between the two user nodes; the first coefficient representing a frequency of interaction between the two user nodes; Respectively determining a word set corresponding to the two user nodes, and determining a second coefficient between the two user nodes according to the word set; the word set being a set of words in historical messages sent by the user nodes; the second coefficient representing a correlation between message contents corresponding to the two user nodes respectively; Determining a product of the first coefficient and the second coefficient as the weight between the two user nodes.
9. The method of claim 8, wherein, The two user nodes are a first user node and a second user node; determining a first coefficient between the two user nodes comprises: Determining a total number of sliding windows according to the historical messages; each sliding window containing N adjacent messages; the sliding window being related to a sliding window size and a sliding step; the sliding step being related to a computing power of the system and a number of the historical messages; Determining a first number of first sliding windows containing both the first user node and the second user node, a second number of second sliding windows containing the first user node, and a third number of third sliding windows containing the second user node; Calculating a first ratio of the first number of first sliding windows to the total number of sliding windows, a second ratio of the second number of second sliding windows to the total number of sliding windows, and a third ratio of the third number of third sliding windows to the total number of sliding windows; Calculating a first addition result of the first ratio and a first preset value, calculating a multiplication result of the second ratio and the third ratio; calculating a fourth ratio of the first addition result and the multiplication result; taking a logarithm of the fourth ratio to obtain the first coefficient between the two user nodes.
10. The method of claim 8, wherein, Determining a second coefficient between the two user nodes according to the word set comprises: Determining a first number of same words in the word sets corresponding to the two user nodes respectively; Determining a second number of a sum of word numbers in the word sets corresponding to the two user nodes respectively; Calculating a second addition result of the first number and a second preset value, and determining a quotient of the second addition result and the second number as the second coefficient.
11. The method of claim 4, wherein, Determining a weight between any two nodes in the graph data comprises: In response to both nodes being message nodes, determining vector representations corresponding to the two message nodes respectively; Determining a difference between the vector representations corresponding to the two message nodes respectively, and calculating an absolute value of the difference; Determining a weight between the two message nodes according to the vector representations corresponding to the two message nodes respectively and the absolute value of the difference.
12. The method according to any one of claims 3-11, characterized in that, Determining a vector representation corresponding to the target message comprises: Determining a first vector representation corresponding to a content of the target message; determining a second vector representation corresponding to a user of the target message; wherein if the user of the target message exists in each user corresponding to the historical messages, the second vector representation is determined as a first numerical value; otherwise, the second vector representation is determined as a second numerical value; determining a vector representation corresponding to the target message according to the first vector representation and the second vector representation.
13. A message alerting method characterized by, The method comprises: in response to receiving a target message, determining a corresponding historical message; the historical message comprises at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message; determining graph data corresponding to the historical message; the graph data comprises user nodes, message nodes and word nodes; inputting the graph data corresponding to the historical message and the target message into a message prompt model to obtain indication information output by the message prompt model; the indication information indicates whether the customer service needs to reply in the conversation for the target message.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the method in any one of claims 1 to 13 is implemented.
15. A model training apparatus, comprising: The device comprises: a first obtaining module configured to obtain a training data set, the training data set containing a target message and historical messages in a conversation, the target message corresponding to a target label indicating whether the target message needs a customer service reply; the historical messages comprise at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after the last message sent by the customer service and before the target message; a first determining module configured to determine graph data corresponding to the historical messages; the graph data comprises user nodes, message nodes and word nodes; a result obtaining module configured to obtain an output result of a message prompt model based on the graph data corresponding to the historical messages and the target message; an adjusting module configured to adjust parameters of the message prompt model according to the output result and the target label; the output result comprises indication information indicating whether the customer service needs to reply in the conversation for the target message.
16. The apparatus of claim 15, wherein, The user nodes comprise user information corresponding to each message in the historical messages; the message nodes comprise each message in the historical messages; and the word nodes comprise words split from each message in the historical messages.
17. The apparatus of claim 15, wherein, The result obtaining module comprises: a vector representation determining unit configured to determine a vector representation corresponding to the historical messages and a vector representation corresponding to the target message according to the graph data; an input unit configured to input the vector representation corresponding to the historical messages and the vector representation corresponding to the target message into the message prompt model to obtain an output result of the message prompt model.
18. The apparatus of claim 17, wherein, When determining the vector representation corresponding to the historical messages according to the graph data, the vector representation determining unit is specifically configured to: determine a weight between any two nodes in the graph data; determine the vector representation corresponding to the historical messages according to the weight between any two nodes.
19. The apparatus of claim 18, wherein, The vector representation determination unit, when determining the weight between any two nodes in the graph data, is specifically used for: in response to both nodes being word nodes, determining vector representations corresponding to the two word nodes respectively; determining a cosine distance between the two word nodes according to the vector representations corresponding to the two word nodes respectively, and determining the cosine distance as the weight between the two word nodes.
20. The apparatus of claim 18, wherein, The vector representation determination unit, when determining the weight between any two nodes in the graph data, is specifically used for: in response to one node being a word node and the other node being a message node, and the word node appearing in the message node, determining a first frequency of the word node appearing in the message node, and a second frequency corresponding to the word node, and calculating a first product of the first frequency and the second frequency; the second frequency is positively correlated with a ratio of a total number of the historical messages to a number of messages containing the word node; for any other word node in the message node, calculating a second product of a first frequency and a second frequency corresponding to the word node respectively, and calculating a normalized first product according to the first product and the second product to obtain a weight between the word node and the message node.
21. The apparatus of claim 18, wherein, The vector representation determination unit, when determining the weight between any two nodes in the graph data, is specifically used for: in response to one node being a user node and the other node being a message node, and the message node being sent by the user node, determining a number of messages sent by the user node; determining an inverse of the number of messages as the weight between the user node and the message node.
22. The apparatus of claim 18, wherein, The vector representation determination unit, when determining the weight between any two nodes in the graph data, is specifically used for: in response to both nodes being user nodes, determining a first coefficient between the two user nodes; the first coefficient representing a frequency of interaction between the two user nodes; determining a word set corresponding to each of the two user nodes respectively, and determining a second coefficient between the two user nodes according to the word sets; the word set being a set of words in historical messages sent by the user node; the second coefficient representing a correlation degree between message contents corresponding to the two user nodes respectively; determining a product of the first coefficient and the second coefficient as the weight between the two user nodes.
23. The apparatus of claim 22, wherein, The two user nodes are a first user node and a second user node; the vector representation determination unit, when determining the first coefficient between the two user nodes, is specifically used for: determining a total number of sliding windows according to the historical messages; each sliding window containing N adjacent messages; the sliding window being related to a sliding window size and a sliding step; the sliding step being related to a computing power of a system and a number of the historical messages; determining a first number of sliding windows containing both the first user node and the second user node, a second number of sliding windows containing the first user node, and a third number of sliding windows containing the second user node; calculate a first ratio of the first number of sliding windows to the total number of sliding windows, a second ratio of the second number of sliding windows to the total number of sliding windows, and a third ratio of the third number of sliding windows to the total number of sliding windows; calculate a first addition result of the first ratio and a first preset value, calculate a multiplication result of the second ratio and the third ratio, and calculate a fourth ratio of the first addition result and the multiplication result; take a logarithm of the fourth ratio to obtain a first coefficient between the two user nodes.
24. The apparatus of claim 22, wherein, In a process of determining a second coefficient between the two user nodes according to the set of words, the vector representation determination unit is specifically configured to: determine a first number of same words existing in the set of words corresponding to the two user nodes respectively; determine a second number of a sum of the number of words in the set of words corresponding to the two user nodes respectively; calculate a second addition result of the first number and a second preset value, and determine a quotient of the second addition result and the second number as the second coefficient.
25. The apparatus of claim 18, wherein, In a process of determining the weight between any two nodes in the graph data, the vector representation determination unit is specifically configured to: in response to both nodes being message nodes, determine a difference value of the vector representations corresponding to the two message nodes respectively, and calculate an absolute value of the difference value; determine the weight between the two message nodes according to the vector representations corresponding to the two message nodes respectively and the absolute value of the difference value.
26. The apparatus of any one of claims 17-25, wherein, In a process of determining the vector representation corresponding to the target message, the vector representation determination unit is specifically configured to: determine a first vector representation corresponding to the content of the target message; determine a second vector representation corresponding to the user of the target message; if the user of the target message exists in each user corresponding to the historical message, the second vector representation is determined as a first value; otherwise, the second vector representation is determined as a second value; determine the vector representation corresponding to the target message according to the first vector representation and the second vector representation.
27. A message alerting device, characterized by The apparatus comprises: a second determination module configured to, in response to receiving a target message, determine a corresponding historical message; the historical message comprises at least one latest message in a preset message pool; the messages in the preset message pool are composed of messages after a message sent by a customer service last time and before the target message; a third determination module configured to determine graph data corresponding to the historical message; the graph data comprises user nodes, message nodes and word nodes; a second acquisition module configured to input the graph data corresponding to the historical message and the target message into a message prompt model, and acquire indication information output by the message prompt model; the indication information indicates whether the customer service needs to reply in a conversation for the target message.
28. A computing device, comprising: comprise: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method in any one of claims 1 to 13.
Citation Information
Patent Citations
Message processing method, device and equipment and storage medium
CN111917878A
Message reply relation judgment system based on graph model representation learning
CN113343041A