CN115292449A - Text processing method, device, equipment and medium - Google Patents

Text processing method, device, equipment and medium Download PDF

Info

Publication number
CN115292449A
CN115292449A CN202210882329.XA CN202210882329A CN115292449A CN 115292449 A CN115292449 A CN 115292449A CN 202210882329 A CN202210882329 A CN 202210882329A CN 115292449 A CN115292449 A CN 115292449A
Authority
CN
China
Prior art keywords
feature
text
target
vector
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210882329.XA
Other languages
Chinese (zh)
Inventor
钟岩
王炜
徐若易
解忠乾
赵新颜
王芳昕
谈书航
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Cloud Music Technology Co Ltd
Original Assignee
Hangzhou Netease Cloud Music Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Cloud Music Technology Co Ltd filed Critical Hangzhou Netease Cloud Music Technology Co Ltd
Priority to CN202210882329.XA priority Critical patent/CN115292449A/en
Publication of CN115292449A publication Critical patent/CN115292449A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Computing Systems (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a text processing method, apparatus, device, and medium, which are used to provide high-quality friend-making matching for a target user according to a friend-making requirement of the target user, and improve the friend-making experience of the user. According to the embodiment of the disclosure, a text matrix capable of representing the friend-making intention of the target user can be determined according to contents contained in each text in the dialog process of the target user and the dialog system, the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model, the target vector output by the recommendation model is obtained, finally, the action vector is determined according to the target vector and the text matrix, and the action corresponding to the maximum value of the component in the action vector is executed, so that high-quality friend-making matching can be effectively realized for the target user according to the friend-making requirement of the target user, and the friend-making experience of the target user is improved.

Description

Text processing method, device, equipment and medium
Technical Field
The present disclosure relates to the field of deep learning technologies, and in particular, to a text processing method, apparatus, device, and medium.
Background
In a friend making matching scene, recommending users of a mood instrument for target users to be made to chat based on a friend making application program so as to realize high-quality friend making matching, wherein the high-quality friend making matching can effectively improve the liveness and enthusiasm of the target users.
In the related art, online users close to a target user can be recommended to the target user based on the geographic position and the online state of each user; clustering the users into clusters according to information such as company demands, user interests and geographical positions of the users in historical access records of the users, and recommending the users in the target clusters to the target users according to the comprehensive similarity between the users in the target clusters and the target users; and linear weighting can be carried out on three attributes of interest similarity, distance and acquaintance corresponding to the target user, a friend-making preference factor of the target user is determined, and friend-making matching is carried out on the target user according to the friend-making preference factor. Therefore, in the friend making matching method in the related art, the friend making requirement and the matching tendency of the target user are not considered, and the quality of friend making matching and the friend making experience of the target user are influenced.
Disclosure of Invention
The disclosure provides a text processing method, a text processing device, text processing equipment and a text processing medium, which are used for solving the problems that in the prior art, friend making matching quality is low and friend making experience of a user is influenced.
The present disclosure provides a text processing method, the method comprising:
acquiring each interactive text in the conversation process of a target user and a conversation system; determining a text matrix according to the content contained in each text;
constructing an abnormal graph according to a pre-constructed corpus; inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model;
determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
The present disclosure provides a text processing apparatus, the apparatus including:
the determining module is used for obtaining each text interacted between the target user and the dialog system in the dialog process; determining a text matrix according to the content contained in each text;
the processing module is used for constructing a heteromorphic graph according to a pre-constructed corpus; inputting the abnormal picture into a recommendation model which is trained in advance, and acquiring a target vector output by the recommendation model; determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
The present disclosure provides an electronic device comprising at least a processor and a memory, the processor being adapted to implement the steps of the test method as described above, or to implement the steps of the test data playback method as described above, or to implement the steps of the text processing method as described above, when executing a computer program stored in the memory.
The present disclosure provides a computer-readable storage medium, which stores a computer program that, when being executed by a processor, carries out the steps of the test method as described above, or carries out the steps of the test data playback method as described above, or carries out the steps of the text processing method as described above.
In the embodiment of the disclosure, each text interacted during the dialog process between the target user and the dialog system is obtained, a text matrix is determined according to the content contained in each text, a heterogeneous graph is constructed according to a pre-constructed corpus, the heterogeneous graph is input into a pre-trained recommendation model, a target vector output by the recommendation model is obtained, an action vector is determined according to the target vector and the text matrix, and an action corresponding to the position of the maximum component in the action vector is executed. According to the embodiment of the disclosure, a text matrix capable of representing the friend-making intention of the target user can be determined according to contents contained in each text in the dialog process of the target user and the dialog system, the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model, the target vector output by the recommendation model is obtained, finally, the action vector is determined according to the target vector and the text matrix, and the action corresponding to the maximum value of the component in the action vector is executed, so that high-quality friend-making matching can be effectively realized for the target user according to the friend-making requirement of the target user, and the friend-making experience of the target user is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic diagram of a text processing process according to some embodiments of the disclosure;
fig. 2 is a schematic diagram of a process for determining an action to be performed based on a DQN model according to some embodiments of the present disclosure;
fig. 3 is a schematic diagram illustrating a display of all possible feature values corresponding to each feature of each user according to some embodiments of the present disclosure;
FIG. 4 is a schematic illustration of a display of various feature classes provided by some embodiments of the present disclosure;
fig. 5 is a schematic diagram illustrating a display of feature value ranges corresponding to target features included in each feature class according to some embodiments of the present disclosure;
FIG. 6 is a schematic structural diagram of a dialog system provided by the present disclosure;
FIG. 7 is a schematic diagram of a process for generating a dialog system according to some embodiments of the present disclosure;
FIG. 8 is a schematic illustration of a display of a complete dialog of a target user with the dialog system provided by some embodiments of the present disclosure;
FIG. 9 is a schematic diagram of a text processing apparatus according to some embodiments of the present disclosure;
fig. 10 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It should be noted that the reference to "a plurality or a plurality" in this document means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The terms "first," "second," and the like in the description and in the claims of the present disclosure and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein.
Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The data to which the present disclosure relates may be data that is authorized by a user or sufficiently authorized by parties.
In order to provide high-quality friend making matching for a target user according to friend making requirements of the target user and improve friend making experience of the user, the embodiment of the disclosure provides a text processing method, a text processing device, text processing equipment and a text processing medium.
In the embodiment of the disclosure, each text interacted in a dialog process between a target user and a dialog system is obtained, a text matrix is determined according to contents contained in each text, a heterogeneous graph is constructed according to a pre-constructed corpus, the heterogeneous graph is input into a pre-trained recommendation model, a target vector output by the recommendation model is obtained, an action vector is determined according to the target vector and the text matrix, and an action corresponding to the position of the maximum component value in the action vector is executed.
Fig. 1 is a schematic diagram of a text processing process according to some embodiments of the present disclosure, where the process includes the following steps:
s101: acquiring each interactive text in the conversation process of a target user and a conversation system; and determining a text matrix according to the content contained in each text.
The text processing method provided by the embodiment of the disclosure is applied to a Dialog System (Dialog System), which may be deployed on an electronic device, which may be an intelligent terminal, a PC, or a server, and the like, and specifically, the application scenario of the text processing method of the disclosure may be a scenario in which friend-making matching is performed based on the Dialog System, a scenario in which disease diagnosis is performed through the Dialog System in smart medical, a scenario in which a suitable brand of a commodity is recommended for a user based on the Dialog System, a scenario in which video recommendation is performed from a video website and a short video application program based on the Dialog System, and the like.
The dialogue system is a system for a machine to understand and process human language through a dialogue form, and the core of the system is to imitate and abstract a way of communication between people, abstract a dialogue into a dialogue process which can be modeled, and the system comprises a dialogue system based on a voice way and a dialogue system based on a text way.
In this disclosure, for convenience of description, an application scenario is taken as an example of a scenario for matching friends based on a dialog system, a friend-making application program may be installed in an electronic device deployed in the dialog system, and a user to be called a friend-making may input corresponding interactive content based on the friend-making application program, so that after receiving the interactive content, the dialog system outputs content to be output to the user to be called a friend-making based on the friend-making application program, where the user to be called a target user is a subsequent dialog system may determine friend-making requirements of the target user according to texts interacted in a dialog process, match friend-making objects of a recommender for the target user, and further implement high-quality friend-making matching.
In order to facilitate determining the friend-making requirement of the target user, in the embodiment of the disclosure, the dialog system and the target user may perform a dialog based on the friend-making application program, and then the dialog system obtains each text interacted during the dialog process of the target user and the dialog system. Each text comprises a text input by a user and a text output by the dialog system, and the text may or may not carry information of the friend-making requirement of the target user.
Specifically, the target user may have a conversation with the dialog system based on the friend-making application program in a text interaction manner, for example, the target user may have a chat with the dialog system based on a chat page of the friend-making application program, and at this time, the dialog system may obtain each text interacted in the dialog process; the target user can also directly carry out conversation with the conversation system based on the friend-making application program in a voice interaction mode, and at the moment, the conversation system can obtain voice conversation contents in a conversation process and convert the voice conversation contents into various conversation texts, namely various texts interacted in the conversation process of the target user and the conversation system.
After determining each text interacted between the target user and the dialog system in the dialog process, determining a text matrix according to the content contained in each text, wherein each row element or each column element in the text matrix is respectively each element in the feature vector corresponding to each text, the dimensions of the feature vectors corresponding to each text are the same, and the feature vector corresponding to which text corresponds to which row or which column in the text matrix is not limited herein.
For example, if three texts are interacted during the dialog process between the target user and the dialog system, the feature vector corresponding to the first text is (a) 1 ,a 2 ,a 3 ) The feature vector corresponding to the second text is (b) 1 ,b 2 ,b 3 ) The feature vector corresponding to the third text is (c) 1 ,c 2 ,c 3 ) Then the text matrix may be
Figure BDA0003764661330000041
Can also be made of
Figure BDA0003764661330000042
Can also be made of
Figure BDA0003764661330000043
And so on.
In order to determine the feature vector corresponding to each text, in the embodiment of the present disclosure, a vector determination model is trained in advance, and for each text, the text is input into the vector determination model, and the vector determination model outputs the feature vector corresponding to the text, where the vector determination model may be a word2vec model or the like.
The process of determining the feature vector corresponding to each text based on the vector determination model is the prior art, and is not described herein again.
S102: constructing an abnormal graph according to a pre-constructed corpus; and inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model.
In the embodiment of the disclosure, in order to facilitate the dialog system to determine the friend-making requirement of the target user, a corpus is pre-constructed, wherein a plurality of texts are pre-stored in the corpus, and an abnormal picture can be constructed according to the pre-constructed corpus.
Among them, heterogeneous diagrams are non-homogeneous diagrams, which is a concept in graph theory. In general, an undirected graph G refers to an ordered set of tuples < V, E >, where V is a non-empty finite set, called a set of vertices, whose elements are called vertices or nodes. E is a finite multiple subset of the unordered set V, called the set of edges, whose elements are called undirected edges, edges for short. The isomorphic graph refers to a graph in which the type of a node and the type of an edge are only one, and in contrast to the isomorphic graph, the isomorphic graph refers to a graph in which the type of a node or the type of an edge in the graph is more than one, so that the sum of the type of a node and the number of types of an edge in the isomorphic graph is greater than 2.
Specifically, a worker can look up all the interactive texts in the background data, manually screen and clean all the interactive texts, determine texts which can represent the friend-making tendency and the friend-making requirement of a user, help a dialog system to match and recommend the texts, and store the screened texts in a corpus. For example, the text contained in the corpus may be "i want to friend with sexually active girls, with independent ideas", "i like and love to play basketball, friend with sexually lively boys", "do girls with family in beijing", and so on.
In the embodiment of the present disclosure, a node corresponding to each text may be constructed in the abnormal picture in advance according to each text in the corpus, and for each text, the similarity between the feature vector corresponding to the text and the feature vectors corresponding to other texts in the abnormal picture is determined, a connection relationship is established between the node corresponding to the other texts, the similarity of which is greater than a preset similarity threshold, and the node corresponding to the text, and the similarity is determined as an edge weight corresponding to the connection relationship between the node corresponding to the other texts and the node corresponding to the text and stored.
In order to more accurately determine the friend-making requirement of the target user according to the constructed abnormal Graph so as to provide high-quality friend-making matching for the target user, in the embodiment of the disclosure, a recommendation model is trained in advance, wherein the recommendation model is used for learning the connection relationship and the association degree between each node in the corpus, and the recommendation model may be a Graph Convolutional neural Network (GCN).
The GCN model is a model capable of Deep Learning (DL) of Graph data, and in brief, the GCN is a Graph data (Graph) as a research object, and the research model is a convolutional neural network model, where Deep Learning is a research sub-direction in the field of Machine Learning (ML), and refers to an artificial neural network composed of many layers, where "Deep" refers to many layers, and the existence of the multiple layers enables the network to learn more abstract features, so that Deep Learning can learn the intrinsic rules and expression levels of sample data, and information obtained in these Learning processes is helpful to explain data such as characters, images, and sounds.
In order to facilitate learning of each node in the heterogeneous graph and the connection relationship and the association degree between the nodes, in the embodiment of the present disclosure, the heterogeneous graph may be input into the recommendation model, and a target vector output by the recommendation model is obtained, where the target vector is a data representation of information included in the heterogeneous graph.
S103: determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
In the embodiment of the disclosure, after determining the target vector and the text matrix, determining an action vector according to the target vector and the text matrix, where each component position in the action vector corresponds to an executable action, where the size of a component in the action vector represents an expected accumulated reward brought by executing the executable action corresponding to the component position, and the larger the component is, the more likely the executable action corresponding to the component position is executed.
Specifically, the motion vector may be determined by the following formula:
a r =Hs T
wherein, a r Is the motion vector, H is the target vector, s is the text matrix, s T Is a transposed matrix corresponding to the text matrix.
In order to determine the corresponding action of each component position in the action vector, on the basis of the above embodiments, in an embodiment of the present disclosure, the corresponding action of each component position in the action vector includes:
an act of asking a particular question to the target user or recommending an act of another user for the target user.
In the embodiment of the present disclosure, if the dialog system is already able to determine the friend making demand of the target user according to each text of interaction during the dialog process between the dialog system and the target user, the action corresponding to the position of the maximum value of the executed action vector may be an action of recommending other users to the target user, for example, if the dialog system determines that the friend making demand of the target user is "want and like to make friends with males" who like to travel, the action corresponding to the position of the maximum value of the action vector may be "recommending a male a who like to travel to the target user". If the dialog system cannot determine the friend-making requirement of the target user according to each text of interaction in the dialog process between the dialog system and the target user, in order to facilitate the subsequent guidance of the target user to input a text which is convenient for the dialog system to determine the friend-making requirement of the target user, the action corresponding to the position of the maximum value of the executed action vector can be an action which puts a specific question for the target user, and when the action of the specific question is beneficial to the subsequent interaction between the target user and the dialog system, the text which is beneficial to the dialog system to determine the friend-making requirement of the target user can be input.
For example, if the respective texts obtained by the dialog system during the dialog process between the target user and the dialog system include two texts, i.e., "how many you want to match a chat friend" and "i want to match a female friend", then the dialog system may perform an action of proposing a specific question, "which is how much you want to match the external and internal of the female friend".
In the disclosed embodiment, the processes of obtaining the text matrix, determining the target vector, and determining the motion vector may be implemented by one model, wherein the model may be a Deep Q-Network (DQN) model.
The Deep Q network model is one of the most classical Deep Reinforcement Learning (DRL) models, and is a brand new model that combines Deep Learning and Reinforcement Learning to realize End-to-End Learning from Perception (Perception) to Action (Action). The reinforcement learning, also called reinjection learning and evaluation learning, is a branch of the field of machine learning, and is used for describing and solving the problem that an agent (agent) achieves maximum return or achieves a specific target through a learning strategy in the interaction process with the environment.
Fig. 2 is a schematic diagram of a process for determining an action to be performed based on a DQN model according to some embodiments of the present disclosure, and is now described with reference to fig. 2.
The method comprises the steps that the size of a dialogue system action space is preset, wherein the size N = num _ rating + M + N of the dialogue system action space, wherein num _ rating is the total number of specific problems which can be proposed to a target user, M is the number of nodes corresponding to feature classes in an abnormal composition, N is the number of nodes corresponding to feature values in the abnormal composition, and the size of the dialogue system space is the same as the number of components contained in an action vector.
In the embodiment of the disclosure, in order to determine the action to be executed by the dialog system, each text interacted in the dialog process and a heterogeneous graph constructed according to a pre-constructed corpus are input into the DQN model, and an action vector a output by the DQN model is obtained r Wherein a is r =Q(s,G|θ),
Figure BDA0003764661330000072
The motion vector includes all executablesAnd each component position in the motion vector corresponds to an executable motion. Where θ is the network parameter of the DQN model, s refers to the current state, and each component in the motion vector means the expected cumulative reward brought by the motion corresponding to the position of the component in the current state s. The DQN model includes the GCN model and a Multi-Layer Perceptron (MLP), i.e., the pre-trained recommended model in this disclosure.
After each text interacted in the dialog process is input into the MLP, the MLP outputs a hidden layer representation s, namely a text matrix, wherein the structure of the MLP is a two-layer neural network. The GCN model is configured to learn a connection relationship and an association relationship between feature values and feature values in the heterogeneous map, and a connection relationship and an association relationship between feature classes and feature classes, and digitize information included in the heterogeneous map, and specifically, after the heterogeneous map is input into the GCN model, the GCN model outputs a target vector corresponding to the heterogeneous map.
Then, the DQN model performs dot product operation on the target vector and a transposed matrix corresponding to the text matrix to obtain an action vector, where each component in the action vector corresponds to an award value, each component position corresponds to an executable action, and the larger the award value, i.e., the larger the component is, the higher the possibility of executing the executable action corresponding to the component position is, specifically, the dialog system may execute the action corresponding to the maximum value of the component position in the action vector.
In order to provide high-quality friend-making matching for a target user based on a DQN model, in the embodiment of the present disclosure, a training sample set is configured in advance, a DQN model is trained based on the training sample set to obtain a high-precision DQN model, specifically, for any training sample included in the training sample set, the training sample includes a plurality of sample texts and a sample abnormal composition, a target sample motion vector corresponding to the training sample is labeled in advance, the training sample is input into the DQN model, a first sample motion vector is output from the DNQ model, a loss value is determined according to the target sample motion vector, the first sample motion vector, and a preset loss function, a loss value is determined according to the loss value, and the DQN model is trained according to the loss value, where the preset loss function is a Huber loss function. Specifically, the network parameters in the DQN model may be adjusted based on a gradient descent method, so as to optimize the performance of the DQN model.
The Huber loss function is a loss function in deep reinforcement learning, is used for measuring the difference between the distribution of a prediction result and the distribution of a real label, is sensitive to the fact that the abnormal point in data has no square error loss, and is essentially an absolute error which becomes a square error only when the error is small.
In the disclosed embodiment, the formula for determining the loss value according to the Huber loss function is as follows:
Figure BDA0003764661330000071
wherein, L is a loss value, y is a pre-labeled target sample motion vector, Q (s, a | θ) is a first sample motion vector output in the DNQ model, and α is a preset parameter.
In order to help the DQN model to learn how to obtain the maximum benefit and improve the accuracy of the DQN model, after the DQN model outputs a first sample action vector, the dialog system executes an action a corresponding to the maximum position of a component in the first sample action vector, if the executed action a is an action for raising a specific problem, the text of the raised specific problem is updated into a training sample, the updated training sample is input into the DQN model, and a second sample action vector, namely Q (s ', a' | θ), is output from the DNQ model target ) .., and from Q (s ', a' | θ.) target ) Determining a target reward, wherein the target reward is used to help the DQN model learn how to obtain the maximized benefit.
Specifically, the target reward corresponding to each two states can be determined according to a Bellman equation (Bellman) equation:
y=r+γmax a′ Q(s′,a′|θ target )
wherein y is the target reward corresponding to the state s and the state s ', the state s is the state before the action a is not executed, and the state s is changed into the state s' after the action a is executed, theta target And the network parameters representing the DQN model are updated in every D epsilon and N iterations, wherein gamma is a preset deduction rate, r represents the instant reward after the action a is executed, and in general, after the action is determined, the corresponding instant reward is determined.
The Bellman equation is called a dynamic programming equation, named by Richard Bellman and used for expressing the adjacent state relation in the dynamic programming problem. Some decision problems can be divided into a plurality of stages according to time or space, each stage makes a decision so as to enable the whole process to obtain the optimal multi-stage decision problem, and the multi-stage decision problem can be solved by a dynamic programming method. The problem of the optimal decision of a certain stage is converted into a sub-problem of the optimal decision of the next stage through a Bellman equation, so that the optimal decision of the initial state can be gradually and iteratively solved by the optimal decision problem of the final state. The Bellman equation in a certain form is a necessary condition for obtaining an optimal solution by a dynamic programming method, and most of problems which can be solved by an optimal control theory can be solved by constructing a proper Bellman equation.
To avoid overfitting the DQN model, in the embodiments of the present disclosure, when training the DQN model, an e-greedy exploration strategy can be used, specifically, it randomly selects an action with a probability e, and then passes argmax with a probability 1-e a Q (s, a | θ) performs this action.
The process of training the model based on the e-greedy exploration strategy is the prior art, and is not described herein in detail.
According to the embodiment of the disclosure, a text matrix capable of representing the friend-making intention of the target user can be determined according to contents contained in each text in the dialog process of the target user and the dialog system, the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model, the target vector output by the recommendation model is obtained, finally, the action vector is determined according to the target vector and the text matrix, and the action corresponding to the maximum value of the component in the action vector is executed, so that high-quality friend-making matching can be effectively realized for the target user according to the friend-making requirement of the target user, and the friend-making experience of the target user is improved.
For determining the text matrix, on the basis of the foregoing embodiments, in an embodiment of the present disclosure, the determining the text matrix according to the content included in each text includes:
for each text, identifying a first target characteristic value contained in the text; determining a feature vector corresponding to the text according to a feature value corresponding to a component of each position in a pre-stored empty vector and the first target feature value;
and determining the text matrix according to the feature vector corresponding to each text.
In order to determine the text matrix according to the content included in each text, in this embodiment of the present disclosure, first, for each text, a first target feature value included in the text may be identified, where the first target feature value included in the text may be 0,1, or multiple, and the first target feature value is an external feature capable of characterizing a friend-making requirement of a target user, a feature value corresponding to an internal feature, and the like, for example, the first target feature value may be lively in nature, high in income, beautiful in long stature, high in stature, and the like.
In order to determine the text matrix, a feature vector corresponding to each text is determined, specifically, a null vector may be stored in advance, where the null vector may be a row vector or a column vector, and a component of each position in the null vector corresponds to one feature value. And for each text, determining a feature vector corresponding to the text according to the feature value corresponding to the first target feature value contained in the text and the component of each position in the empty vector.
In a possible implementation manner, for each first target feature value included in the text, a word vector corresponding to the first target feature value may be determined, where a dimension of the word vector corresponding to the first target feature value needs to be the same as a dimension of the empty vector, and after the word vector corresponding to each first target feature value is determined, a mean value of the word vectors corresponding to each first target feature value is determined as the feature vector corresponding to the text. After determining the feature vector corresponding to each text, in the embodiment of the present disclosure, the text matrix may be determined according to the feature vector corresponding to each text.
In one possible implementation, the average feature vector corresponding to the feature vector corresponding to each text may be determined as a text matrix.
In another possible implementation manner, the feature vectors corresponding to each text may be further spliced to obtain a text matrix, and specifically, if the pre-stored empty vector is a row vector, the feature vectors corresponding to the texts may be spliced in a manner that each row corresponds to one feature vector corresponding to one text, where the feature vector corresponding to which row in the text matrix corresponds to which text is not limited; if the pre-stored empty vector is a column vector, the feature vectors corresponding to the texts can be spliced in a manner that each column corresponds to one feature vector corresponding to one text, wherein which column in the text matrix corresponds to which feature vector corresponding to which text is not limited.
In order to determine a feature vector corresponding to each text, on the basis of the foregoing embodiments, in an embodiment of the present disclosure, the determining a feature vector corresponding to each text according to a feature value corresponding to a component at each position in a pre-stored empty vector and the first target feature value includes:
and setting the component of the position corresponding to the first target characteristic value in the empty vector as a preset first numerical value, and setting other components in the empty vector as preset second numerical values to obtain the characteristic vector corresponding to the text.
In order to determine a feature vector corresponding to each text according to a feature value of a first target feature value contained in each text and a feature value corresponding to a component of each position in an empty vector, in the embodiment of the present disclosure, a component of a position in the empty vector corresponding to the first target feature may be set to a preset first numerical value for each text, where the preset first numerical value is 1. And setting the positions of other components in the empty vector as a preset second numerical value, wherein the preset second numerical value is 0, and finally obtaining the characteristics corresponding to the text.
For example, if the empty vector is a 5-dimensional row vector, the feature value corresponding to the component at the first position is high income, the feature value corresponding to the component at the second position is superior in growth phase, the feature value corresponding to the component at the third position is superior in stature, the feature value corresponding to the component at the fourth position is high in academic history, the feature value corresponding to the component at the fifth position is good in value, and the first target feature value included in the text a is superior in growth phase and good in value, then the feature vector corresponding to the text a is (0,1,0,0,1).
In order to accurately construct a heterogeneous graph, on the basis of the foregoing embodiments, in an embodiment of the present disclosure, the constructing a heterogeneous graph according to a pre-constructed corpus includes:
identifying all characteristic values contained in each text in the corpus, and constructing nodes corresponding to all the characteristic values in the abnormal graph;
and determining and storing the edge weight corresponding to the connection relationship between the nodes corresponding to the two characteristic values according to the times of the two characteristic values appearing in each text in the corpus simultaneously, the total number of the texts contained in the corpus and the times of the two characteristic values appearing in the corpus respectively.
In the embodiment of the present disclosure, in order to construct a heterogeneous graph, a plurality of feature values included in each text in a corpus may be identified, and nodes corresponding to the plurality of feature values are constructed in the heterogeneous graph, where one feature value corresponds to one node.
Because a certain association relationship may exist between the feature values and the association strength between two different feature values is different, for example, the association degree of the two feature values with high academic history and high income is stronger, and the association degree of the two feature values with high income and slim stature is not very high. Therefore, in order to improve high-quality friend-making matching for a target user, in the embodiment of the present disclosure, for any two nodes corresponding to feature values, a connection relationship between the nodes corresponding to the two feature values may be established, and an association relationship between the nodes corresponding to the two feature values may be determined, that is, an edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values is determined, where the greater the edge weight is, the greater the association degree is.
For any two nodes corresponding to feature values, in order to determine the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values, in this embodiment of the present disclosure, the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values may be determined according to the number of times that the two feature values simultaneously appear in each text in the corpus, the total number of texts included in the corpus, and the number of times that the two feature values respectively appear in the corpus, and the determined edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values may be stored.
In a possible implementation manner, a Point-wise Mutual Information (PMI) between the two characteristic values may be calculated to determine an edge weight corresponding to a connection relationship between nodes corresponding to the two characteristic values, where a specific formula is as follows:
Figure BDA0003764661330000101
wherein,
Figure BDA0003764661330000102
y is an edge weight corresponding to a connection relationship between nodes corresponding to the feature value i and the feature value j, PMI (i, j) is point mutual information between the feature value i and the feature value j, # C is a total number of texts contained in the corpus, # C (i, j) is a number of times that the feature value i and the feature value j appear in each text in the corpus at the same time, # C (i) is a number of times that the feature value i appears in the corpus, and # C (j) is a number of times that the feature value j appears in the corpus, wherein a higher PMI value indicates a higher association degree between the feature value i and the feature value j, and a negative PMI value indicates a small or no association degree between the feature value i and the feature value j.
In another possible implementation manner, the edge weight corresponding to the connection relationship between the nodes corresponding to the two eigenvalues may be determined by the following formula:
Figure BDA0003764661330000111
wherein,
Figure BDA0003764661330000112
y is an edge weight corresponding to a connection relationship between nodes corresponding to the feature value i and the feature value j, # C is a total number of texts included in the corpus, # C (i, j) is a number of times that the feature value i and the feature value j appear in each text in the corpus at the same time, # C (i) is a number of times that the feature value i is in the corpus, and # C (j) is a number of times that the feature value j is in the corpus.
In order to accurately construct a heterogeneous graph, on the basis of the above embodiments, in the embodiment of the present disclosure, nodes corresponding to preset feature classes are further constructed in the heterogeneous graph, a relationship between a node corresponding to a feature value and a node corresponding to a feature class is established, and an edge weight corresponding to a connection relationship between a node corresponding to a feature value and a node corresponding to a feature class is stored;
the process of determining the edge weight corresponding to the corresponding connection relationship between the node corresponding to the characteristic value and the node corresponding to the characteristic class comprises the following steps:
the method comprises the steps of determining a first number of users which are classified into the feature class and respectively contain the feature value aiming at each feature class and each feature value, determining a node corresponding to the feature value and an edge weight corresponding to a connection relation between the nodes corresponding to the feature class according to a second number corresponding to the users of the feature values except the feature value in the feature class, and specifically classifying each user pair into the corresponding feature class according to the second feature value corresponding to all features of each user.
Since the target user may be directly inclined to a user of a certain feature class when making friend matches, for example, boy a compares female friends inclined to a girl class, in the embodiment of the present disclosure, in addition to the nodes corresponding to each feature value, the heteromorphic graph may further construct nodes corresponding to each preset feature class, and establish a relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes, and store the edge rights corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes. The preset characteristic classes can include a young beauty class, a cause class, a defense class, a lovely class, an edge class, a gentle body paste class, a learning talent class, a sunshine class, a maturity and weight class, a family keeper class and the like. And for each characteristic class, a connection relation exists between the node corresponding to the characteristic class and the node corresponding to each characteristic value.
In order to determine the edge weight corresponding to the connection relationship between the node corresponding to each feature class and the node corresponding to each feature value, in this embodiment of the present disclosure, for each feature class and each feature value, a first number of users classified into the feature class and respectively including the feature value is determined, and according to a second number corresponding to users of feature values other than the feature value in the feature class, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class is determined.
In a possible implementation manner, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class may be determined by the following formula:
mt-a=mt(i,j)*a
Figure BDA0003764661330000113
wherein mt-a is the edge weight corresponding to the connection relationship between the node corresponding to the characteristic value i and the node corresponding to the characteristic class j, n ij For dividing into the feature classj contains a first number, n, of users of the characteristic value i kj The number of users classified into the feature class j containing the feature value k, wherein k is the feature value e, E, other than the feature value i k n kj And a is a preset parameter, and is a second number corresponding to users with other characteristic values except the characteristic value in the characteristic class.
In another possible implementation manner, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class may be determined by the following formula:
mt-a=mt(i,j)*a
Figure BDA0003764661330000121
wherein mt-a is the edge weight corresponding to the connection relationship between the node corresponding to the characteristic value i and the node corresponding to the characteristic class j, n ij For a first number, n, of users classified into the feature class j that contain the feature value i kj The number of users classified into the feature class j containing the feature value k, wherein k is the feature value e, E, other than the feature value i k n kj And a is a preset parameter, and is a second number corresponding to the users with the characteristic values except the characteristic value in the characteristic class.
In order to determine each user included in each preset feature class, on the basis of the foregoing embodiments, in this embodiment of the present disclosure, the classifying each user pair into a corresponding feature class according to the second feature value corresponding to all features of each user includes:
and aiming at each user and each feature class, determining whether any feature value range contains a second target feature value matched with the second target feature value or not according to second target feature values corresponding to all features of the user and feature value ranges corresponding to all target features contained in the feature class, and classifying the user into the feature class if the second target feature value is contained in any feature value range.
Clustering is used as an unsupervised learning method in the field of machine learning, samples can be divided into different clusters through characteristic information of the samples, wherein the samples in each cluster have some commonalities, and compared with the method for dividing users into different characteristic classes, the method can divide the users into different clusters through a clustering algorithm according to interests, advantages, concerns, character characteristics, self conditions and other characteristic information of the users, namely the users in each characteristic class have similar characteristics, wherein the self conditions comprise material conditions and other soft conditions.
In the embodiment of the present disclosure, in order to determine each user included in preset feature classes, in a possible implementation, each feature class may be preset, a class center feature vector corresponding to each feature class is preset, and a second target feature value corresponding to each user is determined according to each feature value corresponding to each user, that is, a second target feature value, where for each user, the second target feature value corresponding to the user may be determined according to information registered by the user at the time of registration, for example, may be determined according to a tag selected by the user for himself at the time of registration. After determining the feature vector corresponding to each user, for each user, determining a distance between the feature vector corresponding to the user and the class center feature vector corresponding to each feature class, where the distance may be a euclidean distance, and then classifying the user into the feature class corresponding to the minimum distance.
In another possible embodiment, a feature value range corresponding to each target feature included in the feature class may be pre-stored for each feature class, whether any feature value range includes a second target feature value matching the second target feature value may be determined according to pre-stored second target feature values corresponding to all features of the user and feature value ranges corresponding to target features included in the feature class, and if yes, the user may be classified into the feature class.
Fig. 3 is a schematic diagram illustrating a display of all possible feature values corresponding to each feature of each user according to some embodiments of the present disclosure, and is described with reference to fig. 3.
In the embodiment of the present disclosure, the features of the user may be divided into an extrinsic feature and an intrinsic feature, where the extrinsic feature includes: stature, age, distance, native place, work, income, etc., with intrinsic characteristics including: personality, hobbies, trio, academic calendar, skill, future planning, etc.
For the feature of stature, the corresponding feature values under the feature include: slim, plump, delicate, slightly fat, etc.
For the characteristic of age, the corresponding characteristic values under the characteristic include: under 22 years old, around 24 years old, around 26 years old, over 28 years old, and so on.
For the feature of distance, the corresponding feature values under the feature include: within 1km, within 5km, within 10km, over 100km, and the like.
For the characteristic, the corresponding characteristic values under the characteristic comprise: beijing, shanghai, guangzhou, jiangsu, zhejiang and the like.
For the feature of work, the corresponding feature values under the feature include: teachers, doctors, services, engineers, and the like.
For the feature of monthly income, the corresponding feature values under the feature comprise: 2k or less, 2k-5k, 5k-1w, 1w-2w, 2w or more, and the like.
For the feature of character, the corresponding feature values under the feature include: gentle, lively, calm, enthusiasm, inward, high cold, etc.
Aiming at the preference of the feature, the corresponding feature values under the feature comprise: wide, having a preference for many years, etc.
For the three-view feature, the corresponding feature values under the feature include: upper, special, marrying, etc.
For the feature of the academic calendar, the corresponding feature values under the feature comprise: middle school, major specialty, this family, graduate student, etc.
For the characteristic of the skill, the corresponding characteristic values under the characteristic comprise: can cook meals, singing and dancing, can manage money and the like.
For planning this feature in the future, the corresponding feature values under the feature include: planning is clear, not yet clear, related to marriage objects, and so on.
Fig. 4 is a schematic diagram showing various feature classes provided by some embodiments of the present disclosure, and is now described with reference to fig. 4.
The preset feature classes may include: young appearance class, career class, imperial class, lovely class, love classification, gentle body paste class, academic talent class, sunshine class, maturity class, family keeping class and the like.
Fig. 5 is a schematic diagram illustrating a display of feature value ranges corresponding to target features included in each feature class according to some embodiments of the present disclosure, and the description will be given with reference to fig. 5.
For the feature class of young beauty, the target features included in the feature class are age and stature, the feature value range corresponding to age is less than 22 years old, and the feature value range corresponding to stature is stature.
Aiming at the feature class of the cause class, each target feature contained in the feature class is income, three views and future planning, the feature value range corresponding to the income is more than 2 ten thousand per month, the feature value range corresponding to the three views is on three views, and the feature value range corresponding to the future planning is clear.
Aiming at the feature class of Yujie class, the target features contained in the feature class are stature and character, the feature value range corresponding to the stature is full, and the feature value range corresponding to the character is character high and cold.
For the feature class of the lovely class, the target features included in the feature class are stature and character, the feature value range corresponding to the stature is small, and the feature value range corresponding to the character is lively.
And classifying the feature class aiming at the edges, wherein each target feature contained in the feature class is distance, native place and hobby, the range of a feature value corresponding to the distance is within 8km, the range of a feature value corresponding to the native place is specific, and the range of a feature value corresponding to the hobby is wide.
Aiming at a feature class of a warm and soft body paste class, target features contained in the feature class are character, skill and three views, a feature value range corresponding to the character is warm and soft, a feature value range corresponding to the skill is capable of cooking, and a feature value range corresponding to the three views is exclusive to the three views.
Aiming at the feature class of the multi-talent class of the universities, the target features contained in the feature class are a scholarship and three views, the feature value range corresponding to the scholarship is more than that of a student, and the feature value range corresponding to the three views is on the three views.
Aiming at the characteristic class of sunshine, the target characteristics contained in the characteristic class are character and hobby, the characteristic value range corresponding to the character is lively, and the characteristic value range corresponding to the hobby is wide.
Aiming at the characteristic class of the mature and steady class, the target characteristics contained in the characteristic class are character and future planning, the characteristic value range corresponding to the character is character calmness, and the characteristic value range corresponding to the future planning is for marriage as a target and the planning is clear.
Aiming at the characteristic class of householders, the target characteristics contained in the characteristic class are skills and three views, the characteristic value range corresponding to the skills is used for cooking and managing wealth, and the characteristic value range corresponding to the three views is emotion-specific.
It should be noted that what target features each feature class corresponds to and what feature range each target feature under each feature class corresponds to may be set according to a requirement, and the corresponding target features in any two feature classes are allowed to have an intersection, for example, the lovely class in fig. 5 includes the target feature with liveness, and the sunlight class also includes the target feature with liveness.
In the embodiment of the present disclosure, for each feature value, in addition to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature value, the connection relationship may also exist between the node corresponding to the feature value and the node corresponding to the feature value, specifically, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature value is 1, the connection relationship also exists between the node corresponding to the feature class and the node corresponding to the feature class, and the edge weight corresponding to the connection relationship between the node corresponding to the feature class and the node corresponding to the feature class is 0.
Specifically, for any two nodes in the heteromorphic graph, the edge weight of the connection relationship between the two nodes is as follows:
Figure BDA0003764661330000141
it should be noted that, when determining the edge weight corresponding to the connection relationship between the node corresponding to the feature value i and the node corresponding to the feature class j, the preset parameter a may be determined according to the preset total number of feature classes and the total number of feature classes including the feature value i in the feature value range of the target feature corresponding to the feature class.
For example, as can be seen from fig. 5, since the number of preset feature classes is 10, the total number of preset feature classes is 10, and if the feature value i is in the third view, as can be seen from fig. 5, the feature class including the feature value i in the feature value range of the target feature corresponding to the feature class is the cause class and the boy-talent-mathematic class, and therefore, the total number of feature classes including the feature value i in the feature value range of the target feature corresponding to the feature class is 2.
Specifically, the preset parameter a is determined by the following formula:
Figure BDA0003764661330000151
wherein a is a preset parameter, D is the total number of preset feature classes, | j: s i ∈d j And | is the total number of the feature classes containing the feature value i in the feature value range of the corresponding target feature in the feature classes.
Specifically, when determining the edge weight corresponding to the connection relationship between the node corresponding to the feature value i and the node corresponding to the feature class j, the edge weight is determined according to the following formula:
mt-a=mt(i,j)*a
Figure BDA0003764661330000152
Figure BDA0003764661330000153
wherein mt-a is the edge weight corresponding to the connection relationship between the node corresponding to the characteristic value i and the node corresponding to the characteristic class j, n ij For a first number, n, of users classified into the feature class j that contain the feature value i kj The number of users classified into the feature class j containing the feature value k, wherein k is the feature value e, E, other than the feature value i k n kj The second number corresponding to the users with other characteristic values except the characteristic value in the characteristic class, D is the total number of the preset characteristic class, | j: s i ∈d j And | is the total number of the feature classes containing the feature value i in the feature value range of the corresponding target feature in the feature classes.
In order to obtain a target vector corresponding to a heterogeneous graph, on the basis of the foregoing embodiments, in an embodiment of the present disclosure, the inputting the heterogeneous graph into a recommendation model that is trained in advance, and obtaining the target vector output by the recommendation model includes:
based on the pre-trained recommendation model, determining an edge weight matrix according to the edge weight corresponding to each connection relation stored in the heterogeneous graph; determining the dimension of a unit matrix according to the number of each node in the heterogeneous graph; and determining the target vector according to the edge weight matrix, the identity matrix and a parameter matrix of the pre-stored recommendation model.
In this disclosure, after the heterogeneous graph is input into the pre-trained recommendation model, the recommendation model determines an edge weight matrix according to an edge weight corresponding to each connection relation stored in the heterogeneous graph, where each element in the edge weight matrix is an edge weight corresponding to each connection relation stored in the heterogeneous graph. If the heterogeneous graph includes N nodes, the edge weight matrix is an N × N matrix.
And then, determining the dimension of an identity matrix according to the number of each node in the heterogeneous graph, wherein if the heterogeneous graph comprises N nodes, the identity matrix is an N multiplied by N matrix.
And finally, determining a target vector according to the edge weight matrix, the identity matrix and a parameter matrix of the recommendation model which is stored in advance.
Specifically, the target vector may be determined by the following formula:
Figure BDA0003764661330000161
Figure BDA0003764661330000162
h is a target vector, X is an identity matrix, A is an edge weight matrix, D is a degree matrix, and W is a parameter matrix of the recommendation model.
Wherein, each element on the diagonal line in the degree matrix D can be determined according to the following formula:
Figure BDA0003764661330000163
wherein D is ii Is an element in the ith row and ith column of the degree matrix, A ij Is the element in the ith row and the jth column in the edge weight matrix.
Note that, elements at positions other than the diagonal line in the degree matrix are all 0.
Fig. 6 is a schematic structural diagram of a dialog system provided by the present disclosure, and the description is now made with reference to fig. 6.
The dialogue system includes: a natural language understanding component (NLU), a dialog manager component (DM), and a natural language generation component (NLG).
The NLU can determine the intention of each target user according to each text in the dialog process of each target user with the dialog system and represents the intention of the target user through Slot Filling (Slot Filling). DM is the brain of the dialog system that decides which target user's friend-making needs or matching propensity characteristics to query or diagnose. The NLG converts the execution actions of the dialog system into natural language.
For example, the NLG of the dialog system outputs "you make friends look more and look more outward or look more in" first, then the target user inputs "i look more and look out and want to take off orders and match with a young and beautiful girl" based on the text "you make friends look more and more" output by the dialog system, then the NLU in the dialog system can recognize that the target user is targeted to find objects and match with the inclined features: young, good stature, beautiful, etc., the DM in the dialog system may perform an action of "recommending a young beauty girl for the target user".
Fig. 7 is a schematic process diagram of a dialog generating system according to some embodiments of the present disclosure, and is described with reference to fig. 7.
And constructing a corpus, wherein the corpus comprises a plurality of texts which can represent the friend making tendency and friend making demand of the user and are beneficial to a dialog system to carry out matching recommendation.
And constructing a heterogeneous graph according to the corpus, wherein the heterogeneous graph comprises nodes corresponding to a plurality of characteristic values and nodes corresponding to characteristic classes, for each characteristic value, a connection relation exists between the node corresponding to the characteristic value and the nodes corresponding to other characteristic values, the edge weight corresponding to the connection relation is correspondingly stored, for each characteristic class, a connection relation exists between the node corresponding to the characteristic class and the node corresponding to each characteristic value, and the edge weight corresponding to the connection relation is correspondingly stored.
The abnormal figure is one of Knowledge graphs, and a Knowledge Graph (KG) is derived from Google next-generation intelligent semantic search engine technology, is based on the idea of semantic network essentially, and is a semantic Knowledge base with a directed graph structure, and is used for describing concepts and mutual relations in the physical world in a symbolic form. Specifically, the knowledge graph spectrum usually represents knowledge by (subject, predicate, object) triples, such as (world health organization, headquarters, switzerland geneva) representation that "the headquarters of the world health organization is set in switzerland geneva", the heterogeneous graph is constructed by the present disclosure in order to facilitate a dialog system to judge friend-making needs and matching tendencies of a target user from short several dialogues with the target user, and recommend the user suitable for the target user for the dialog system.
It should be noted that, in the present disclosure, by constructing a weighted heterogeneous graph instead of a conventional common heterogeneous graph, the weighted heterogeneous graph can better learn the connection relationship and the association between the feature values and the feature values, and the connection relationship and the association between the feature values and the feature classes from the structure information and the attribute information.
And training to complete a DQN model, and forming a whole set of scheme capable of carrying out friend-making matching recommendation through a dialogue system based on the constructed heterogeneous graph and the trained DQN model. The scheme can not only effectively match and recommend the opposite sex for the new registered user, but also adapt to the change of the matching tendency of the old user, and recommend the user which is most suitable for the target user at present for the target user according to the dialogue between the dialogue system and the target user and according to each interactive text, the heterogeneous graph and the trained DQN model in the dialogue process between the target user and the dialogue system.
Fig. 8 is a schematic diagram of a display of a complete dialog between a target user and a dialog system according to some embodiments of the present disclosure, and is now described with reference to fig. 8.
The dialog system may first output a text corresponding to the target user's call, which may be "handsome boy hello, do you want to match the opposite sex for oneself? "or the user actively enters the text of the call, which may be" hello, i want to find a girlfriend ".
Then the dialog system and the target user perform multiple rounds of dialog which help the dialog system to determine the friend making requirement of the target user, specifically, the dialog contents can be as follows:
the dialog system outputs "do you look more outside or inside, then the target user inputs" do me look more outside ", the dialog system outputs" what girl worsted one wants specifically to look for ", then the target user inputs" want girl friend look beautiful, good, younger in the future ", the dialog system outputs" do you focus more on outside? There is a request inherent to girls, the target user inputs 'i am externally and inherently sees a heavy look, and inherently likes a gentle bar in character', the dialog system outputs 'what girls want to find specifically', the target user inputs 'hope that girls will look beautiful, good in stature and younger', the dialog system outputs 'good, and recommends young and beautiful girls and gentle body paste type girls', and the target user inputs 'thank you'.
Finally, the dialogue system outputs a closing word, for example, the closing word and the help can be found at any time when the user needs help. "or" happy to talk to you ".
Based on the same technical concept, the present disclosure provides a text processing apparatus, and fig. 9 shows a schematic diagram of a text processing apparatus provided by some embodiments, as shown in fig. 9, the apparatus includes:
a determining module 901, configured to obtain each text interacted during a dialog process between a target user and a dialog system; determining a text matrix according to the content contained in each text;
a processing module 902, configured to construct an abnormal graph according to a pre-constructed corpus; inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model; determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
In some possible embodiments, the determining module 901 is specifically configured to, for each text, identify a first target feature value included in the text; determining a feature vector corresponding to the text according to a feature value corresponding to a component of each position in a pre-stored empty vector and the first target feature value; and determining the text matrix according to the feature vector corresponding to each text.
In some possible embodiments, the determining module 901 is specifically configured to set a component of a position corresponding to the first target feature value in the empty vector as a preset first numerical value, and set other components in the empty vector as preset second numerical values, so as to obtain the feature vector corresponding to the text.
In some possible embodiments, the processing module 902 is specifically configured to identify all feature values included in each text in the corpus, and construct nodes corresponding to all feature values in the abnormal graph; and determining and storing the edge weight corresponding to the connection relationship between the nodes corresponding to the two characteristic values according to the times of the two characteristic values appearing in each text in the corpus simultaneously, the total number of the texts contained in the corpus and the times of the two characteristic values appearing in the corpus respectively.
In some possible embodiments, the determining module 901 is further configured to, if a preset node corresponding to each feature class is further established in the heterogeneous graph, establish a relationship between a node corresponding to a feature value and a node corresponding to the feature class, store an edge weight corresponding to a connection relationship between a node corresponding to the feature value and a node corresponding to the feature class, determine, for each feature class and each feature value, a first number of users classified into the feature class and respectively including the feature value, determine, according to a second number corresponding to users of feature values other than the feature value in the feature class, an edge weight corresponding to a connection relationship between a node corresponding to the feature value and a node corresponding to the feature class, and specifically, classify, according to a second feature value corresponding to all features of each user, each user pair into a corresponding feature class.
In some possible embodiments, the determining module 901 is specifically configured to determine, for each user and each feature class, whether any feature value range includes a second target feature value that matches the second target feature value according to second target feature values that correspond to all features of the user and feature value ranges that correspond to target features included in the feature class, and if yes, classify the user into the feature class.
In some possible embodiments, the processing module 902 is specifically configured to determine, based on the pre-trained recommendation model, an edge weight matrix according to an edge weight corresponding to each connection relation stored in the heterogeneous graph; determining the dimension of an identity matrix according to the number of each node in the heterogeneous graph; and determining the target vector according to the edge weight matrix, the identity matrix and a parameter matrix of the pre-stored recommendation model.
Based on the same technical concept, the present disclosure also provides an electronic device, and fig. 10 shows a schematic structural diagram of an electronic device provided by some embodiments, as shown in fig. 10, including: the system comprises a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 are communicated with each other through the communication bus 1004;
the memory 1003 has stored therein a computer program which, when executed by the processor 1001, causes the processor 1001 to perform the steps of:
acquiring each interactive text in the conversation process of a target user and a conversation system; determining a text matrix according to the content contained in each text;
constructing an abnormal graph according to a pre-constructed corpus; inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model;
determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
In some possible embodiments, the processor 1001 is specifically configured to, for each text, identify a first target feature value included in the text; determining a feature vector corresponding to the text according to a feature value corresponding to a component of each position in a pre-stored empty vector and the first target feature value;
and determining the text matrix according to the feature vector corresponding to each text.
In some possible embodiments, the processor 1001 is specifically configured to set a component of a position corresponding to the first target feature value in the empty vector as a preset first numerical value, and set other components in the empty vector as preset second numerical values, so as to obtain the feature vector corresponding to the text.
In some possible embodiments, the processor 1001 is specifically configured to identify all feature values included in each text in the corpus, and construct nodes corresponding to all feature values in the abnormal graph; and determining and storing the edge weight corresponding to the connection relationship between the nodes corresponding to the two characteristic values according to the times of the two characteristic values appearing in each text in the corpus simultaneously, the total number of the texts contained in the corpus and the times of the two characteristic values appearing in the corpus respectively.
In some possible embodiments, the processor 1001 is further configured to, if a preset node corresponding to each feature class is further established in the heterogeneous graph, establish a relationship between a node corresponding to a feature value and a node corresponding to the feature class, store an edge weight corresponding to a connection relationship between a node corresponding to a feature value and a node corresponding to a feature class, determine, for each feature class and each feature value, a first number of users classified into the feature class and respectively including the feature value, determine, according to a second number corresponding to users of feature values other than the feature value in the feature class, an edge weight corresponding to a connection relationship between a node corresponding to the feature value and a node corresponding to the feature class, and specifically, classify, according to a second feature value corresponding to all features of each user, each user pair into a corresponding feature class.
In some possible embodiments, the processor 1001 is specifically configured to, for each user and each feature class, determine whether any feature value range includes a second target feature value that matches the second target feature value according to second target feature values that are pre-stored and correspond to all features of the user and feature value ranges that correspond to target features included in the feature class, and if so, classify the user into the feature class.
In some possible embodiments, the processor 1001 is specifically configured to determine, based on the pre-trained recommendation model, an edge weight matrix according to an edge weight corresponding to each connection relation stored in the heterogeneous graph; determining the dimension of an identity matrix according to the number of each node in the heterogeneous graph; and determining the target vector according to the edge weight matrix, the unit matrix and the parameter matrix of the recommendation model which is stored in advance.
Because the principle of the electronic device for solving the problem is similar to the text processing method, the implementation of the electronic device may refer to the implementation of the method, and repeated details are not repeated.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface 1002 is used for communication between the electronic apparatus and other apparatuses.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor.
The Processor may be a general-purpose Processor, including a central processing unit, a Network Processor (NP), and the like; but may also be a Digital instruction processor (DSP), an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
Based on the same technical concept, embodiments of the present disclosure provide a computer-readable storage medium having stored therein a computer program executable by an electronic device, the program, when executed on the electronic device, causing the electronic device to perform the following steps:
acquiring each interactive text in the conversation process of a target user and a conversation system; determining a text matrix according to the content contained in each text;
constructing an abnormal graph according to a pre-constructed corpus; inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model;
determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
In some possible embodiments, the determining a text matrix according to the content included in each text includes:
for each text, identifying a first target characteristic value contained in the text; determining a feature vector corresponding to the text according to a feature value corresponding to a component of each position in a pre-stored empty vector and the first target feature value;
and determining the text matrix according to the feature vector corresponding to each text.
In some possible embodiments, the determining, according to the feature value corresponding to the component of each position in the pre-stored empty vector and the first target feature value, the feature vector corresponding to the text includes:
and setting the component of the position corresponding to the first target characteristic value in the empty vector as a preset first numerical value, and setting other components in the empty vector as preset second numerical values to obtain the characteristic vector corresponding to the text.
In some possible embodiments, the constructing the heterogeneous map according to the pre-constructed corpus includes:
identifying all characteristic values contained in each text in the corpus, and constructing nodes corresponding to all the characteristic values in the abnormal graph;
and determining and storing the edge weight corresponding to the connection relationship between the nodes corresponding to the two characteristic values according to the times of the two characteristic values appearing in each text in the corpus simultaneously, the total number of the texts contained in the corpus and the times of the two characteristic values appearing in the corpus respectively.
In some possible embodiments, a preset node corresponding to each feature class is further constructed in the heteromorphic graph, a relationship between a node corresponding to the feature value and a node corresponding to the feature class is established, and an edge weight corresponding to a corresponding connection relationship between a node corresponding to the feature value and a node corresponding to the feature class is stored;
the process of determining the edge weight corresponding to the corresponding connection relationship between the node corresponding to the feature value and the node corresponding to the feature class includes:
the method comprises the steps of determining a first number of users which are classified into the feature class and respectively contain the feature value aiming at each feature class and each feature value, determining a node corresponding to the feature value and an edge weight corresponding to a connection relation between the nodes corresponding to the feature class according to a second number corresponding to the users of the feature values except the feature value in the feature class, and specifically classifying each user pair into the corresponding feature class according to the second feature value corresponding to all features of each user.
In some possible embodiments, the classifying each user pair into a corresponding feature class according to the second feature values corresponding to all features of each user includes:
and aiming at each user and each feature class, determining whether any feature value range contains a second target feature value matched with the second target feature value or not according to the second target feature value corresponding to all features of the user and the feature value range corresponding to each target feature contained in the feature class, and if yes, classifying the user into the feature class.
In some possible embodiments, the inputting the abnormal image into a recommendation model trained in advance, and the obtaining a target vector output by the recommendation model includes:
based on the pre-trained recommendation model, determining an edge weight matrix according to the edge weight corresponding to each connection relation stored in the heterogeneous graph; determining the dimension of an identity matrix according to the number of each node in the heterogeneous graph; and determining the target vector according to the edge weight matrix, the identity matrix and a parameter matrix of the pre-stored recommendation model.
In some possible embodiments, the actions corresponding to the respective component positions in the action vector include:
an act of asking a particular question to the target user or recommending other users for the target user.
Since the principle of solving the problem of the computer-readable storage medium is similar to that of the text processing method, the implementation of the computer-readable storage medium can refer to the implementation of the method, and repeated details are not repeated.
The computer readable storage medium may be any available medium or data storage device that can be accessed by a processor in an electronic device, including but not limited to magnetic memory such as floppy disks, hard disks, magnetic tape, magneto-optical disks (MO), etc., optical memory such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memory such as ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), solid State Disks (SSDs), etc.
According to the embodiment of the disclosure, a text matrix capable of representing the friend-making intention of the target user can be determined according to contents contained in each text in the dialog process between the target user and the dialog system, the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model, the target vector output by the recommendation model is obtained, finally, the action vector is determined according to the target vector and the text matrix, and the action corresponding to the maximum value of the components in the action vector is executed, so that high-quality friend-making matching can be effectively realized for the target user according to the friend-making requirement of the target user, and the friend-making experience of the target user is improved.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the present disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications can be made in the present disclosure without departing from the spirit and scope of the disclosure. Thus, if such modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include such modifications and variations as well.

Claims (10)

1. A method of text processing, the method comprising:
acquiring each interactive text in the conversation process of a target user and a conversation system; determining a text matrix according to the content contained in each text;
constructing an abnormal graph according to a pre-constructed corpus; inputting the abnormal picture into a recommendation model which is trained in advance, and acquiring a target vector output by the recommendation model;
determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
2. The method according to claim 1, wherein the determining a text matrix according to the content contained in each text comprises:
for each text, identifying a first target characteristic value contained in the text; determining a feature vector corresponding to the text according to a feature value corresponding to a component of each position in a pre-stored empty vector and the first target feature value;
and determining the text matrix according to the feature vector corresponding to each text.
3. The method according to claim 2, wherein the determining the feature vector corresponding to the text according to the feature value corresponding to the component of each position in the pre-saved empty vector and the first target feature value comprises:
and setting the component of the position corresponding to the first target characteristic value in the empty vector as a preset first numerical value, and setting other components in the empty vector as preset second numerical values to obtain the characteristic vector corresponding to the text.
4. The method of claim 1, wherein constructing a heterogeneous graph from the pre-constructed corpus comprises:
identifying all characteristic values contained in each text in the corpus, and constructing nodes corresponding to all the characteristic values in the abnormal graph;
and determining and storing the edge weight corresponding to the connection relationship between the nodes corresponding to the two characteristic values according to the times of the two characteristic values appearing in each text in the corpus simultaneously, the total number of the texts contained in the corpus and the times of the two characteristic values appearing in the corpus respectively.
5. The method according to claim 4, wherein the abnormal graph further comprises nodes corresponding to preset feature classes, a relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is established, and edge weights corresponding to the corresponding connection relationships between the nodes corresponding to the feature values and the nodes corresponding to the feature classes are stored;
the process of determining the edge weight corresponding to the corresponding connection relationship between the node corresponding to the feature value and the node corresponding to the feature class includes:
and determining a first number of users which are classified into the feature classes and respectively contain the feature value according to the feature classes and second numbers corresponding to the users of the feature values except the feature value, determining a node corresponding to the feature value and an edge weight corresponding to a connection relation between the nodes corresponding to the feature classes, and specifically classifying each user pair into the corresponding feature classes according to the second feature values corresponding to all features of each user.
6. The method according to claim 5, wherein the classifying each user pair into a corresponding feature class according to the second feature values corresponding to all features of each user comprises:
and aiming at each user and each feature class, determining whether any feature value range contains a second target feature value matched with the second target feature value or not according to the second target feature value corresponding to all features of the user and the feature value range corresponding to each target feature contained in the feature class, and if yes, classifying the user into the feature class.
7. The method according to claim 1, wherein the inputting the abnormal image into a pre-trained recommendation model, and the obtaining of the target vector output by the recommendation model comprises:
based on the pre-trained recommendation model, determining an edge weight matrix according to the edge weight corresponding to each connection relation stored in the heterogeneous graph; determining the dimension of an identity matrix according to the number of each node in the heterogeneous graph; and determining the target vector according to the edge weight matrix, the identity matrix and a parameter matrix of the pre-stored recommendation model.
8. A text processing apparatus, characterized in that the apparatus comprises:
the determining module is used for obtaining each text interacted between the target user and the dialog system in the dialog process; determining a text matrix according to the content contained in each text;
the processing module is used for constructing an abnormal picture according to a pre-constructed corpus; inputting the abnormal composition picture into a pre-trained recommendation model to obtain a target vector output by the recommendation model; determining an action vector according to the target vector and the text matrix; and executing the action corresponding to the position of the maximum component in the action vector.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any of claims 1-7 are implemented when the program is executed by the processor.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program when executed by a processor implements the steps of the method of any one of claims 1 to 7.
CN202210882329.XA 2022-07-26 2022-07-26 Text processing method, device, equipment and medium Pending CN115292449A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210882329.XA CN115292449A (en) 2022-07-26 2022-07-26 Text processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210882329.XA CN115292449A (en) 2022-07-26 2022-07-26 Text processing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115292449A true CN115292449A (en) 2022-11-04

Family

ID=83823391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210882329.XA Pending CN115292449A (en) 2022-07-26 2022-07-26 Text processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115292449A (en)

Similar Documents

Publication Publication Date Title
CN111602147B (en) Machine learning model based on non-local neural network
CN110555112B (en) Interest point recommendation method based on user positive and negative preference learning
US11334628B2 (en) Dressing recommendation method and dressing recommendation apparatus
US10318534B2 (en) Recommendations in a computing advice facility
Van Otterlo A machine learning view on profiling
US20200104670A1 (en) Electronic device and method of obtaining emotion information
CN110796190A (en) Exponential modeling with deep learning features
CN109978812A (en) Camera system, learning device, photographic device and learning method
US11055668B2 (en) Machine-learning-based application for improving digital content delivery
Lasmar et al. Rsrs: Ridesharing recommendation system based on social networks to improve the user’s qoe
CN115917535A (en) Recommendation model training method, recommendation device and computer readable medium
US11276127B1 (en) Recommending matches using machine learning
Mallard Modelling cognitively bounded rationality: An evaluative taxonomy
US11790897B2 (en) Response generation for conversational computing interface
US20190286978A1 (en) Using natural language processing and deep learning for mapping any schema data to a hierarchical standard data model (xdm)
CN111309887A (en) Method and system for training text key content extraction model
Dow Formalism, rationality, and evidence: the case of behavioural economics
CN110427564A (en) Deep learning is integrated into broad sense additivity melange effect (GAME) frame
WO2021127225A1 (en) Methods and systems for defining emotional machines
Doering et al. Neural-network-based memory for a social robot: Learning a memory model of human behavior from data
Hawkins et al. Generalizing meanings from partners to populations: Hierarchical inference supports convention formation on networks
CN117708428A (en) Recommendation information prediction method and device and electronic equipment
Gadegaonkar et al. Job recommendation system using machine learning
CN112131884A (en) Method and device for entity classification and method and device for entity presentation
CN114443916B (en) Supply and demand matching method and system for test data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination