A text processing method, apparatus, device and medium

By constructing a text matrix and heterogeneous graph in the dating matching system and using a recommendation model to determine action vectors, the problem of low dating matching quality is solved, and the user's dating experience is improved.

CN115292449BActive Publication Date: 2026-01-02HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210882329.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2026-01-02
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

The quality of matchmaking in existing technologies is low, which affects the user's dating experience.

Method used

By obtaining the text of the dialogue between the target user and the dialogue system, a text matrix and a heterogeneous graph are constructed. A pre-trained recommendation model is used to determine the target vector and action vector, and the action corresponding to the maximum value of the component in the action vector is executed to achieve high-quality matchmaking.

Benefits of technology

It effectively improved the dating experience for target users and achieved high-quality dating matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115292449B_ABST
    Figure CN115292449B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text processing method, device, equipment and medium, to provide high-quality friend matching for a target user according to the friend-making needs of the target user, and improve the friend-making experience of the user. In the embodiments of the present disclosure, the text matrix capable of representing the friend-making intention of the target user can be determined according to the content contained in each text in the conversation process between the target user and the dialogue system, and the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model to obtain the target vector output by the recommendation model. 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, which can effectively realize high-quality friend matching for the target user according to the friend-making needs of the target user, and improve the friend-making experience of the target user.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of deep learning, and particularly relates to a text processing method, device, equipment and medium. BACKGROUND

[0002] In the scenario of friend matching, it is crucial to recommend a user that a target user is interested in for chatting based on a friend application, so as to achieve high-quality friend matching, which can effectively improve the activity and positivity of the target user.

[0003] In the related art, an online user close to a target user can be recommended to the target user based on the geographical position and online state of each user; each user can be clustered into each cluster according to the information such as the demand for companionship, user interest and geographical position in the historical access record of each user, and a user in a target cluster can be recommended to the target user according to the comprehensive similarity between each user in the target cluster and the target user; the three attributes of interest similarity, distance and familiarity corresponding to the target user can be linearly weighted to determine a friend preference factor of the target user, and friend matching can be performed for the target user according to the friend preference factor. As can be seen, the friend matching method in the related art often does not consider the friend demand and matching tendency of the target user, which affects the quality of friend matching and the friend experience of the target user. SUMMARY

[0004] The present disclosure provides a text processing method, device, equipment and medium, to solve the problem of low quality of friend matching in the prior art, which affects the user friend experience.

[0005] The present disclosure provides a text processing method, which comprises:

[0006] obtaining each text interacted in a conversation process between a target user and a conversation system; and determining a text matrix according to the content contained in the each text;

[0007] constructing a heterogeneous graph according to a pre-constructed corpus; inputting the heterogeneous graph into a pre-trained recommendation model to obtain a target vector output by the recommendation model;

[0008] determining an action vector according to the target vector and the text matrix; and performing an action corresponding to the position of the maximum value in the action vector.

[0009] The present disclosure provides a text processing device, which comprises:

[0010] A determining module is configured to obtain each text interacted in a conversation process between a target user and a conversation system; and determine a text matrix according to the content contained in the each text;

[0011] a processing module configured to construct a heterogeneous graph according to a pre-constructed corpus, input the heterogeneous graph into a pre-trained recommendation model, obtain a target vector output by the recommendation model, determine an action vector according to the target vector and the text matrix, and perform an action corresponding to a position of a maximum value in the action vector.

[0012] The present disclosure provides an electronic device comprising at least a processor and a memory, wherein the processor is configured to implement the steps of the test method as described above, or implement the steps of the test data playback method as described above, or implement the steps of the text processing method as described above when executing a computer program stored in the memory.

[0013] The present disclosure provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to implement the steps of the test method as described above, or implement the steps of the test data playback method as described above, or implement the steps of the text processing method as described above when executed by a processor.

[0014] In the embodiments of the present disclosure, each text interacted in a conversation process between a target user and a dialogue system is obtained, and a text matrix is determined according to 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 a position of a maximum value in the action vector is performed. In the embodiments of the present disclosure, a text matrix capable of representing a friendship intention of a target user can be determined according to content contained in each text interacted in a conversation process between the target user and a dialogue system, a heterogeneous graph constructed according to a pre-constructed corpus is input into a pre-trained recommendation model, a target vector output by the recommendation model is obtained, finally an action vector is determined according to the target vector and the text matrix, and an action corresponding to a maximum value in the action vector is performed, which can effectively realize high-quality friendship matching for a target user according to a friendship requirement of the target user, and improve a friendship experience of the target user. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor.

[0016] Figure 1 A text processing process schematic diagram provided for some embodiments of the present disclosure;

[0017] Figure 2 A process diagram for determining an action to be performed based on a DQN model according to some embodiments of the present disclosure;

[0018] Figure 3 A display diagram of all possible feature values corresponding to each user under each feature according to some embodiments of the present disclosure;

[0019] Figure 4 A display diagram of each feature category according to some embodiments of the present disclosure;

[0020] Figure 5 A display diagram of the feature value range corresponding to each target feature included in each feature category according to some embodiments of the present disclosure;

[0021] Figure 6 A structural diagram of a dialogue system according to the present disclosure;

[0022] Figure 7 A process diagram for generating a dialogue system according to some embodiments of the present disclosure;

[0023] Figure 8 A display diagram of a complete dialogue between a target user and a dialogue system according to some embodiments of the present disclosure;

[0024] Figure 9 A structural diagram of a text processing device according to some embodiments of the present disclosure;

[0025] Figure 10 A structural diagram of an electronic device according to some embodiments of the present disclosure. DETAILED DESCRIPTION

[0026] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only some of the embodiments of the present disclosure, but not all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present disclosure.

[0027] It should be noted that the "multiple or several" mentioned in the present disclosure refers to two or more than two. The "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the front and rear associated objects.

[0028] The terms "first", "second", and the like in the description and in the claims of the present disclosure and above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in other than the order illustrated or described herein.

[0029] In addition, the terms "include" and "have" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a list of steps or units does not necessarily have to include only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to such processes, methods, products, or devices. The data involved in the present disclosure can be data authorized by a user or sufficiently authorized by parties.

[0030] In order to provide high-quality friend matching for target users according to their friend-making needs, and improve the friend-making experience of users, the embodiments of the present disclosure provide a text processing method, device, equipment and medium.

[0031] In the embodiments of the present disclosure, each text interacted in the conversation process between the target user and the dialog system is obtained, and 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 value in the action vector is executed.

[0032] Figure 1 A text processing process schematic diagram provided by some embodiments of the present disclosure includes the following steps:

[0033] S101: obtaining each text interacted in the conversation process between the target user and the dialog system; and determining a text matrix according to the content contained in each text.

[0034] The text processing method provided by the embodiments of the present disclosure is applied to a dialog system (Dialog System), which can be deployed on an electronic device, such as a smart terminal, a PC, or a server, etc. Specifically, the application scenarios of the text processing method of the present disclosure can be a scenario of friend matching based on a dialog system, a scenario of disease diagnosis through a dialog system in intelligent medical treatment, a scenario of recommending suitable commodity brands for users based on a dialog system, or a scenario of video recommendation from a video website and a short video application program based on a dialog system, etc.

[0035] The so-called dialogue system refers to a system that allows a machine to understand and process human language in the form of dialogue. The core of the dialogue system is to simulate and abstract the way people communicate with each other, abstract the dialogue into a dialogue process that can be modeled, and include dialogue systems based on voice and dialogue systems based on text.

[0036] In the embodiments of the present disclosure, in order to facilitate description, the application scenario is taken as an example for describing the scenario of matching friends based on a dialogue system. The electronic device in which the dialogue system is deployed can be installed with a friend application program. The user to be friends can input corresponding interaction content based on the friend application program, so that the dialogue system receives the interaction content and outputs the content to be output to the user to be friends based on the friend application program. The so-called user to be friends is also the target user, so that the dialogue system can determine the friend demand of the target user according to the text of each interaction in the dialogue process, recommend the friend object that the target user likes, and then realize high-quality friend matching.

[0037] In order to facilitate the determination of the friend demand of the target user, in the embodiments of the present disclosure, the dialogue system and the target user can dialogue based on the friend application program, and then the dialogue system obtains the text of each interaction in the dialogue process between the target user and the dialogue system. The text includes the text input by the user and the text output by the dialogue system, and the text can carry the information of the friend demand of the target user or can not carry the information of the friend demand of the target user.

[0038] Specifically, the target user can dialogue with the dialogue system based on the friend application program through text interaction, for example, the target user can chat with the dialogue system based on the chat page of the friend application program, and the dialogue system obtains the text of each interaction in the dialogue process. The target user can also dialogue with the dialogue system based on the friend application program through voice interaction, and the dialogue system obtains the voice dialogue content in the dialogue process and converts the voice dialogue content into dialogue text, that is, the text of each interaction in the dialogue process between the target user and the dialogue system.

[0039] After determining the text of each interaction in the dialogue process between the target user and the dialogue system, the text matrix is determined according to the content contained in each text. Each row element or each column element in the text matrix is each element in the feature vector corresponding to each text, the dimension of the feature vector corresponding to each text is the same, and which row or which column in the text matrix corresponds to the feature vector corresponding to which text is not limited.

[0040] For example, if the target user interacts with the dialogue system in the dialogue process for three texts, the feature vector corresponding to the first text is (a1, a2, a3), the feature vector corresponding to the second text is (b1, b2, b3), and the feature vector corresponding to the third text is (c1, c2, c3), the text matrix can be It can also be It can also be and so on.

[0041] In order to determine the feature vector corresponding to each text, in the embodiment of the present disclosure, the vector determination model is pre-trained, 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, wherein the vector determination model can be a word2vec model and the like.

[0042] Wherein, the process of determining the feature vector corresponding to each text based on the vector determination model is prior art, which will not be repeated here.

[0043] S102: According to the pre-constructed corpus, construct a heterogeneous graph; input the heterogeneous graph into the pre-trained recommendation model to obtain the target vector output by the recommendation model.

[0044] In the embodiment of the present disclosure, in order to facilitate the dialogue system to determine the friendship demand of the target user, a corpus is pre-constructed, wherein the corpus pre-stores a plurality of texts, and a heterogeneous graph can be constructed according to the pre-constructed corpus.

[0045] Wherein, the heterogeneous graph is a non-homogeneous graph, which is a concept in graph theory. Generally, an undirected graph G is an ordered pair <V, E>, where V is a non-empty infinite set, called the vertex set, and its elements are called vertices or nodes. E is a finite multiple subset of the unordered set VxV, called the edge set, and its elements are called undirected edges, simply edges. The isomorphic graph refers to the graph with only one type of node and edge. In contrast, the heterogeneous graph refers to the graph with more than one type of node or edge in the graph. Therefore, in the heterogeneous graph, the sum of the number of types of nodes and edges is greater than 2.

[0046] The plurality of texts contained in the corpus can be filtered from all interaction texts collected from the background data of the friend-making application. Specifically, the staff can review all interaction texts in the background data, and manually filter and clean all interaction texts to determine texts that can represent the user's friendship-making tendency and friendship-making demand, and that are helpful for the matching recommendation of the dialogue system, and save the filtered texts in the corpus. For example, the texts contained in the corpus can be "I want to make friends with a lively girl with independent thinking", "I like to make friends with a boy who loves basketball and has a stable personality", "Do you have a girl from Beijing?", and the like.

[0047] In the embodiments of the present disclosure, for each text in the corpus, a node corresponding to the text can be constructed in the heterogeneous graph, and for each text, a similarity between a feature vector corresponding to the text and a feature vector corresponding to another text in the heterogeneous graph can be determined, a connection relationship between the node corresponding to the other text and the node corresponding to the text can be established when the similarity is greater than a preset similarity threshold, and the similarity can be determined as an edge weight corresponding to the connection relationship between the node corresponding to the other text and the node corresponding to the text and saved.

[0048] In order to more accurately determine the friendship-making demand of the target user according to the constructed heterogeneous graph, so as to provide high-quality friendship-making matching for the target user, in the embodiments of the present disclosure, a recommendation model is pre-trained, wherein the recommendation model is used to learn the connection relationship and the association degree between the nodes in the corpus, and the recommendation model can be a graph convolutional neural network model (GCN).

[0049] The GCN model is a model capable of deep learning (DL) on graph data. In simple terms, the GCN is a graph data (Graph) as its research object, and a convolutional neural network model as its research model. Deep learning is a research subfield in the field of machine learning (ML), which refers to an artificial neural network composed of many layers. The "depth" refers to the large number of layers, and the existence of multiple layers enables the network to learn more abstract features. Therefore, deep learning can learn the internal rules and representation levels of sample data, and the information obtained in the learning process is very helpful for the interpretation of data such as text, images and sound.

[0050] In order to facilitate learning of the nodes in the heterogeneous graph and the connection relationship and the association degree between the nodes, in the embodiments of the present disclosure, the heterogeneous graph can be input into the recommendation model to obtain a target vector output by the recommendation model, wherein the target vector is a data representation of the information contained in the heterogeneous graph.

[0051] S103: determining an action vector according to the target vector and the text matrix; and performing an action corresponding to a position of a maximum value of a component in the action vector.

[0052] In the embodiments of the present disclosure, after the target vector and the text matrix are determined, an action vector is determined according to the target vector and the text matrix, wherein each component position in the action vector corresponds to an executable action, and the size of the component in the action vector represents an expected cumulative reward brought by the executable action corresponding to the component position. The greater the size of the component is, the greater the possibility of performing the executable action corresponding to the component position is.

[0053] Specifically, the action vector can be determined by the following formula:

[0054] a r =Hs T

[0055] wherein a r is the action vector, H is the target vector, s is the text matrix, and s T is the transposed matrix corresponding to the text matrix.

[0056] In order to determine the action corresponding to each component position in the action vector, in the embodiments described above, in the embodiments of the present disclosure, the action corresponding to each component position in the action vector includes:

[0057] an action of asking the target user a specific question or an action of recommending other users to the target user.

[0058] In the embodiments of the present disclosure, if the friendship demand of the target user has been determined by the dialogue system according to each text of the interaction between the dialogue system and the target user in the dialogue process, the action corresponding to the position of the maximum value of the action vector performed can be the action of recommending other users to the target user. For example, if the dialogue system determines that the friendship demand of the target user is “want to make friends with a male who likes traveling”, the action corresponding to the position of the maximum value of the action vector can be “recommending a male A who likes traveling to the target user”. If the friendship demand of the target user cannot be determined by the dialogue system according to each text of the interaction between the dialogue system and the target user in the dialogue process, in order to facilitate the target user to input the text that is helpful for the dialogue system to determine the friendship demand of the target user in the subsequent interaction, the action corresponding to the position of the maximum value of the action vector performed can be the action of asking the target user a specific question, which is helpful for the target user to input the text that is helpful for the dialogue system to determine the friendship demand of the target user in the subsequent interaction with the dialogue system.

[0059] For example, if the texts obtained by the dialogue system in the process of interaction between the target user and the dialogue system include "Hello, what kind of chat friend do you want to match?" and "I want to match a female friend", the dialogue system can perform the action of asking the specific question "What requirements do you have for the external and internal of the matched female friend?"

[0060] In the embodiments of the present disclosure, the process of obtaining the text matrix, determining the target vector, and determining the action vector can be implemented by a model, which can be a Deep Q-Network (DQN) model.

[0061] The deep Q-network model is one of the most classic models of deep reinforcement learning (DRL), which is a brand-new model that combines deep learning and reinforcement learning to realize end-to-end learning from perception to action. Reinforcement learning, also known as evaluation learning, is a branch of machine learning, which is used to describe and solve the problem of learning a strategy by an agent in the process of interaction with the environment to maximize the reward or achieve a specific goal. Generally, the agent learns how to achieve the highest score in the target environment by constantly interacting with the environment and accumulating experience.

[0062] Figure 2 A process diagram for determining the action to be performed based on the DQN model is provided for some embodiments of the present disclosure, which will be described in detail with reference to Figure 2 .

[0063] The size of the dialogue system action space is set in advance, where the size of the dialogue system action space n=num_greeting+M+N, where num_greeting is the total number of specific questions that can be asked to the target user, M is the number of nodes corresponding to the feature class in the heterogeneous graph, and N is the number of nodes corresponding to the feature value in the heterogeneous graph. The size of the dialogue system space is the same as the number of components contained in the action vector.

[0064] In the embodiments of the present disclosure, in order to determine the action to be performed by the dialogue system, the texts interacted in the dialogue process and the heterogeneous graph constructed according to the pre-constructed corpus are input into the DQN model, and the action vector a r output by the DQN model is obtained. r = Q(s, G | θ), The action vector contains all executable actions, and each component position in the action vector corresponds to an executable action. Where θ is the network parameter of the DQN model, s refers to the current state, and each component in the action vector means the expected cumulative reward brought by the action corresponding to the component position to the current state s. The DQN model contains the GCN model and a multi-layer perceptron (MLP), and the GCN model is the pre-trained recommendation model in the present disclosure.

[0065] Where each text input in the conversation process is input into the MLP, and the MLP outputs a hidden layer representation s, that is, a text matrix. The structure of the MLP is a two-layer neural network. The GCN model is used to learn the connection and association between feature values and feature values, and the connection and association between feature classes and feature classes in the heterogeneous graph, and to digitize the information contained in the heterogeneous graph. Specifically, after the heterogeneous graph is input into the GCN model, the GCN model outputs a target vector corresponding to the heterogeneous graph.

[0066] Then the DQN model performs dot product operation on the target vector and the transposed matrix corresponding to the text matrix to obtain an action vector, where each component in the action vector corresponds to a reward value, and each component position corresponds to an executable action. The larger the reward value, that is, the larger the component, the greater the possibility of executing the executable action corresponding to the component position. Specifically, the dialog system can execute the action corresponding to the maximum value in the action vector.

[0067] In order to provide high-quality friend matching for target users based on the DQN model, in the embodiments of the present disclosure, a training sample set is pre-configured, and the DQN model is trained based on the training sample set to obtain a high-precision DQN model. Specifically, for any training sample in the training sample set, the training sample contains multiple sample texts and a sample heterogeneous graph, and the target sample action vector corresponding to the training sample is pre-labeled. The training sample is input into the DQN model, and the DQN model outputs a first sample action vector. According to the target sample action vector, the first sample action vector, and a pre-set loss function, a loss value is determined, and the DQN model is trained according to the loss value, where the pre-set loss function is a Huber loss function. Specifically, the network parameters in the DQN model can be adjusted based on the gradient descent method to optimize the performance of the DQN model.

[0068] Wherein, the Huber loss function is a loss function in deep reinforcement learning, used to measure the difference between the predicted result distribution and the real label distribution, and is not as sensitive to outliers in data as the square error loss. Essentially, the Huber loss is the absolute error, but when the error is very small, it becomes a square error.

[0069] In the embodiments of the present disclosure, according to the Huber loss function, the formula for determining the loss value is as follows:

[0070]

[0071] Wherein, L is the loss value, y is the pre-labeled target sample action vector, Q(s, a|θ) is the first sample action vector output in the DNQ model, and a is a preset parameter.

[0072] In order to help the DQN model learn how to obtain the maximum benefit, so as to improve the accuracy of the DQN model, after the DQN model outputs the first sample action vector, the dialog system executes the action a corresponding to the maximum position of the component in the first sample action component. If the executed action a is an action of asking a specific question, the text of the asked specific question is updated to the training sample, and the updated training sample is input into the DQN model, and the DNQ model outputs a second sample action vector, that is, Q(s', a'|θ target )......, and determines the target reward according to the Q(s', a'|θ target ), wherein the target reward is used to help the DQN model learn how to obtain the maximum benefit.

[0073] Specifically, the target reward corresponding to each two states can be determined according to the Bellman equation:

[0074] y=r+γmax a′ Q(s', a'|θ target )

[0075] 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 executed, and the state s becomes the state s' after the action a is executed, θ target represents the network parameters of the DQN model, which is updated in each iteration D∈N, wherein γ is a preset discount rate, and r represents the immediate reward after the action a is executed. Generally, after the action is executed, the corresponding immediate reward is determined.

[0076] Among them, Bellman equation is also called dynamic programming equation, which is named after Richard Bellman, and represents the equation of the relationship between adjacent states in the dynamic programming problem. Some decision problems can be divided into multiple stages according to time or space, and each stage makes a decision to make the whole process optimal. The multi-stage decision problem can be solved by dynamic programming method. The problem of optimal decision of a stage is transformed into the sub-problem of optimal decision of the next stage through Bellman equation, so that the optimal decision of the initial state can be solved by iteratively solving the optimal decision problem of the terminal state. The existence of Bellman equation in some form is a necessary condition for the dynamic programming method to obtain the optimal solution, and most problems that can be solved by optimal control theory can be solved by constructing a suitable Bellman equation.

[0077] In order to avoid overfitting of the DQN model, in the embodiment of the present disclosure, when the DQN model is trained, an e-greedy exploration strategy can be used. Specifically, it randomly selects an action with a probability e, and then performs the action by argmax a Q(s,a|θ) with a probability of 1-e.

[0078] Among them, based on the e-greedy exploration strategy, the process of training the model is prior art, which will not be repeated here.

[0079] In the embodiment of the present disclosure, the text matrix representing the target user's friendship intention can be determined according to the content contained in each text in the conversation process between the target user and the dialogue system, and the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model to obtain the target vector output by the recommendation model. Finally, according to the target vector and the text matrix, the action vector is determined, and the action corresponding to the maximum value of the components in the action vector is executed, which can effectively realize high-quality friendship matching for the target user according to the target user's friendship demand, and improve the target user's friendship experience.

[0080] In order to determine the text matrix, on the basis of the above embodiments, in the embodiment of the present disclosure, the text matrix is determined according to the content contained in each text, which includes:

[0081] For each text, identify the first target feature value contained in the text; according to the feature value corresponding to each position of the pre-saved empty vector and the first target feature value, determine the feature vector corresponding to the text;

[0082] According to the feature vector corresponding to each text, the text matrix is determined.

[0083] In order to determine the text matrix according to the content contained in each text, in the embodiments of the present disclosure, first, for each text, a first target feature value contained in the text can be identified, wherein the first target feature value contained in the text can be 0, can be 1, or can be multiple, and the first target feature value is a feature value corresponding to an external feature and an internal feature capable of representing the target user's friendship demand, etc. For example, the first target feature value can be lively personality, high income, beautiful appearance, and tall and slim body, etc.

[0084] In order to determine the text matrix, first, the feature vector corresponding to each text is determined. Specifically, an empty vector can be pre-stored, wherein the component at each position in the empty vector corresponds to a feature value, and the empty vector can be a row vector or a column vector. For each text, according to the first target feature value contained in the text and the feature value corresponding to the component at each position in the empty vector, the feature vector corresponding to the text is determined.

[0085] In a possible implementation, for each first target feature value contained in the text, a word vector corresponding to the first target feature value can be determined, wherein the dimension of the word vector corresponding to the first target feature value needs to be the same as the dimension of the empty vector, and after determining the word vector corresponding to each first target feature value, the average of the word vector 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 embodiments of the present disclosure, the text matrix can be determined according to the feature vector corresponding to each text.

[0086] In a possible implementation, the average feature vector corresponding to the feature vector corresponding to each text can be determined as the text matrix.

[0087] In another possible implementation, the feature vectors corresponding to each text can also be spliced to obtain the text matrix. Specifically, if the pre-stored empty vector is a row vector, the feature vectors corresponding to each text can be spliced in a manner that each row corresponds to the feature vector corresponding to a text, wherein which row in the text matrix corresponds to the feature vector corresponding to which text is not limited; if the pre-stored empty vector is a column vector, the feature vectors corresponding to each text can be spliced in a manner that each column corresponds to the feature vector corresponding to a text, wherein which column in the text matrix corresponds to the feature vector corresponding to which text is not limited.

[0088] In order to determine the feature vector corresponding to each text, on the basis of the above embodiments, in the embodiments of the present disclosure, the feature vector corresponding to the text is determined according to the feature value corresponding to the component at each position in the pre-stored empty vector and the first target feature value, comprising:

[0089] set the component of the null vector corresponding to the first target feature value to a preset first value, and set other components of the null vector to a preset second value, to obtain the feature vector corresponding to the text.

[0090] To determine the feature vector corresponding to each text according to the feature value corresponding to the component of each position in the null vector and the first target feature value contained in each text, in the embodiments of the present disclosure, for each text, the component of the null vector corresponding to the first target feature value can be set to a preset first value, where the preset first value is 1. Other components of the null vector are set to a preset second value, where the preset second value is 0. Finally, the feature corresponding to the text is obtained.

[0091] For example, if the null vector is a 5-dimensional row vector, the component corresponding to the first position has a feature value of high income, the component corresponding to the second position has a feature value of superior appearance, the component corresponding to the third position has a feature value of superior physique, the component corresponding to the fourth position has a feature value of high education, and the component corresponding to the fifth position has a feature value of good values. The first target feature value contained in text A is superior appearance and good values. Therefore, the feature vector corresponding to text A is (0, 1, 0, 0, 1).

[0092] To accurately construct the heterogeneous graph, on the basis of the above embodiments, in the embodiments of the present disclosure, the construction of the heterogeneous graph according to the pre-constructed corpus includes:

[0093] Identify all feature values contained in each text in the corpus, and construct nodes corresponding to all feature values in the heterogeneous graph;

[0094] For any two nodes corresponding to feature values, establish a connection relationship between the two nodes, determine the edge weight corresponding to the connection relationship between the two nodes according to the number of times the two feature values appear simultaneously in each text in the corpus, the total number of texts contained in the corpus, and the number of times the two feature values appear in the corpus, and save the edge weight.

[0095] In the embodiments of the present disclosure, to construct the heterogeneous graph, the plurality of feature values contained in each text in the corpus can be identified first, and nodes corresponding to the plurality of feature values in the heterogeneous graph are constructed, where one feature value corresponds to one node.

[0096] Since there can be a certain correlation between each feature value, and the correlation strength between different two feature values is different, for example, the correlation degree of the two feature values of high education and high income is relatively strong, and the correlation degree of the two feature values of high income and slim figure is not high. Therefore, in order to facilitate improving high-quality friend matching for the target user, in the embodiment of the present disclosure, for any two nodes corresponding to feature values, the connection relationship between the nodes corresponding to the two feature values can be established, and the correlation between the nodes corresponding to the two feature values is determined, that is, the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values is determined, wherein the greater the edge weight, the greater the correlation degree.

[0097] 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 the embodiment of the present disclosure, the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values can be determined according to the number of times that the two feature values appear in each text in the corpus, the total number of texts contained in the corpus, and the number of times that the two feature values appear in the corpus, and the determined edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values is saved.

[0098] In a possible implementation, the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values can be determined by calculating the point-wise mutual information (PMI) between the two feature values, and the specific formula is as follows:

[0099] wherein,

[0100] wherein, Y is the edge weight corresponding to the connection relationship between the nodes corresponding to feature value i and feature value j, PMI(i,j) is the point-wise mutual information between feature value i and feature value j, #C is the total number of texts contained in the corpus, #C(i,j) is the number of times that feature value i and feature value j appear in each text in the corpus, #C(i) is the number of times that feature value i appears in the corpus, #C(j) is the number of times that feature value j appears in the corpus, wherein the higher the PMI value, the higher the correlation degree between feature value i and feature value j, and the negative PMI value indicates that the correlation degree between feature value i and feature value j is small or has no correlation degree.

[0101] In another possible implementation, the edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values can be determined by the following formula:

[0102] wherein,

[0103] wherein Y is the edge weight corresponding to the connection relationship between the nodes corresponding to the feature value i and the feature value j, #C is the total number of texts contained in the corpus, #C(i,j) is the number of times that the feature value i and the feature value j appear simultaneously in each text in the corpus, #C(i) is the number of times that the feature value i appears in the corpus, and #C(j) is the number of times that the feature value j appears in the corpus.

[0104] In order to accurately construct the heterogeneous graph, on the basis of the above embodiments, in the embodiments of the present disclosure, nodes corresponding to each feature class that are preset are also constructed in the heterogeneous graph, the relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is established, and the edge weight corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is saved.

[0105] The process of determining the edge weight corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes includes:

[0106] For each feature class and each feature value, a first number of users containing the feature value that are divided into the feature class is determined, and 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 according to a second number of users corresponding to other feature values than the feature value in the feature class. Specifically, each user is divided into the corresponding feature class according to the second feature value corresponding to all features of each user.

[0107] Since the target user may directly prefer users of a certain feature class when making a friend match, for example, the male user A prefers female friends of the lady-like class, therefore, in the embodiments of the present disclosure, in addition to constructing the nodes corresponding to each feature value, the nodes corresponding to each feature class that are preset can also be constructed, the relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is established, and the edge weight corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is saved. The preset feature classes can include the young and beautiful class, the career class, the lady-like class, the lovely class, the fate class, the gentle and considerate class, the erudite and versatile class, the sunny class, the mature and steady class, and the housekeeping class, etc. One feature class corresponds to one node, and for each feature class, the node corresponding to the feature class and each node corresponding to the feature value have a connection relationship.

[0108] 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 the embodiment of the present disclosure, for each feature class and each feature value, a first quantity of users containing the feature value and divided into the feature class is determined, and according to a second quantity of users corresponding to other feature values than the feature value in the feature class, an 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.

[0109] In a possible implementation, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class can be determined by the following formula:

[0110] mt-a = mt(i,j) * a

[0111]

[0112] wherein mt-a is 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, n ij is the first quantity of users containing the feature value i and divided into the feature class j, n kj is the quantity of users containing the feature value k and divided into the feature class j, wherein the k is other feature values than the feature value i in the feature class, ∑ k n kj is the second quantity of users corresponding to other feature values than the feature value in the feature class, and a is a preset parameter.

[0113] In another possible implementation, the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class can be determined by the following formula:

[0114] mt-a = mt(i,j) * a

[0115]

[0116] wherein mt-a is 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, n ij is the first quantity of users containing the feature value i and divided into the feature class j, n kj is the quantity of users containing the feature value k and divided into the feature class j, wherein the k is other feature values than the feature value i in the feature class, ∑ k n kj is the second quantity of users corresponding to other feature values than the feature value in the feature class, and a is a preset parameter.

[0117] In order to determine the users included in each of the preset feature classes, based on the above embodiments, in the embodiments of the present disclosure, the second feature values corresponding to all the features of each user are used to divide each user into a corresponding feature class, which includes:

[0118] For each user and each feature class, whether the second target feature value matches any of the feature value ranges corresponding to the target features included in the feature class is determined according to the second target feature values corresponding to all the features of the user and the feature value ranges corresponding to the target features included in the feature class, and if so, the user is divided into the feature class.

[0119] As an unsupervised learning method in the field of machine learning, clustering can divide samples into different clusters according to the feature information of the samples, and each sample in each cluster has some commonalities. In the present disclosure, users are divided into different feature classes according to the interests, hobbies, focuses, personality characteristics, self conditions and other feature information of the users, that is, the users in each feature class have similar features, and the self conditions include material conditions and other soft conditions.

[0120] In the embodiments of the present disclosure, in order to determine the users included in each of the preset feature classes, in one possible implementation, each feature class can be preset, and a class center feature vector corresponding to each feature class can be preset, and the second target feature value corresponding to each user is determined according to the feature values corresponding to each user, that is, the second target feature value. For each user, the second target feature value corresponding to the user can be determined according to the information registered by the user when registering, for example, can be determined according to the label selected by the user for himself when registering. After determining the feature vector corresponding to each user, for each user, the distance between the feature vector corresponding to the user and the class center feature vector corresponding to each feature class is determined, and the distance can be the Euclidean distance, and then the user is divided into the feature class corresponding to the minimum distance.

[0121] In another possible implementation, the feature value ranges corresponding to the target features included in each feature class can also be pre-stored, and whether the second target feature value matches any of the feature value ranges corresponding to the target features included in the feature class is determined according to the second target feature values corresponding to all the features of the user and the feature value ranges corresponding to the target features included in the feature class, and if so, the user is divided into the feature class.

[0122] Figure 3 A display schematic diagram of all possible feature values corresponding to each user under each feature is provided for some embodiments of the present disclosure, and the following will be described forFigure 3 The description is made.

[0123] In the embodiments of the present disclosure, the characteristics of the user can be divided into external characteristics and internal characteristics, wherein the external characteristics include body shape, age, distance, hometown, work, income, etc., and the internal characteristics include personality, hobby, world view, education, skill, future planning, etc.

[0124] For the characteristic of body shape, the corresponding characteristic values under this characteristic include slim, plump, small, slightly fat, etc.

[0125] For the characteristic of age, the corresponding characteristic values under this characteristic include 22 years old or below, about 24 years old, about 26 years old, 28 years old or above, etc.

[0126] For the characteristic of distance, the corresponding characteristic values under this characteristic include within 1 km, within 5 km, within 10 km, above 100 km, etc.

[0127] For the characteristic of hometown, the corresponding characteristic values under this characteristic include Beijing, Shanghai, Guangzhou, Jiangsu, Zhejiang, etc.

[0128] For the characteristic of work, the corresponding characteristic values under this characteristic include teacher, doctor, service industry, engineer, etc.

[0129] For the characteristic of monthly income, the corresponding characteristic values under this characteristic include 2k or below, 2k-5k, 5k-1w, 1w-2w, 2w or above, etc.

[0130] For the characteristic of personality, the corresponding characteristic values under this characteristic include gentle, lively, quiet, passionate, introverted, high and cold, etc.

[0131] For the characteristic of hobby, the corresponding characteristic values under this characteristic include extensive, having a hobby for many years, etc.

[0132] For the characteristic of world view, the corresponding characteristic values under this characteristic include upward, single-minded, for the purpose of marriage, etc.

[0133] For the characteristic of education, the corresponding characteristic values under this characteristic include middle school, junior college, undergraduate, graduate, etc.

[0134] For the characteristic of skill, the corresponding characteristic values under this characteristic include cooking, singing and dancing, financial management, etc.

[0135] For the characteristic of future planning, the corresponding characteristic values under this characteristic include clear planning, not yet clear, related to the marriage object, etc.

[0136] Figure 4A display diagram of various feature categories provided by some embodiments of the present disclosure will now be described with reference to Figure 4 .

[0137] The preset feature categories can include: young and beautiful, career type, mature and stable, and housekeeping.

[0138] Figure 5 A display diagram of feature value ranges corresponding to various target features included in various feature categories provided by some embodiments of the present disclosure will now be described with reference to Figure 5 .

[0139] For the young and beautiful feature category, the target features included in the feature category are age and body shape, and the feature value range corresponding to the age is less than 22 years old, and the feature value range corresponding to the body shape is slim.

[0140] For the career feature category, the target features included in the feature category are income, outlook on life, and future planning, and the feature value range corresponding to the income is more than 20,000 yuan per month, the feature value range corresponding to the outlook on life is progressive, and the feature value range corresponding to the future planning is clear.

[0141] For the mature and stable feature category, the target features included in the feature category are age, body shape, and personality, and the feature value range corresponding to the age is more than 30 years old, the feature value range corresponding to the body shape is plump, and the feature value range corresponding to the personality is mature.

[0142] For the housekeeping feature category, the target features included in the feature category are age, body shape, and personality, and the feature value range corresponding to the age is less than 30 years old, the feature value range corresponding to the body shape is slim, and the feature value range corresponding to the personality is mature.

[0143] For the love feature category, the target features included in the feature category are distance, hometown, and hobby, and the feature value range corresponding to the distance is within 8 km, the feature value range corresponding to the hometown is specific, and the feature value range corresponding to the hobby is extensive.

[0144] For the gentle and considerate feature category, the target features included in the feature category are personality, skill, and outlook on life, and the feature value range corresponding to the personality is gentle, the feature value range corresponding to the skill is cooking, and the feature value range corresponding to the outlook on life is single-minded.

[0145] For the versatile feature category, the target features included in the feature category are education and outlook on life, and the feature value range corresponding to the education is postgraduate or above, and the feature value range corresponding to the outlook on life is progressive.

[0146] For the sunshine type, the target features included in the feature class are personality and hobby, and the feature value range corresponding to the personality is lively, and the feature value range corresponding to the hobby is extensive.

[0147] For the mature and stable type, the target features included in the feature class are personality and future planning, and the feature value range corresponding to the personality is quiet, and the feature value range corresponding to the future planning is for the purpose of marriage and clear planning.

[0148] For the housekeeping type, the target features included in the feature class are skills and three views, and the feature value range corresponding to the skills is cooking and financial management, and the feature value range corresponding to the three views is emotional monogamy.

[0149] It should be noted that which target features each feature class corresponds to, and what the feature range of each target feature under each feature class is, can be set according to requirements, and the target features corresponding to any two feature classes are allowed to have an intersection, for example, Figure 5 The lovable type in the sunshine type includes the target feature of lively personality, and the sunshine type also includes the target feature of lively personality.

[0150] 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 other feature values, there can also be a connection relationship 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, and there is also a connection relationship between the node corresponding to the feature class and the node corresponding to the feature class. 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.

[0151] Specifically, for any two nodes in the heterogeneous graph, the edge weight of the connection relationship between the two nodes is:

[0152]

[0153] 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 can be determined according to the total number of feature classes and the total number of feature classes in the feature value range of the target feature corresponding to the feature class containing the feature value i.

[0154] For example, according to Figure 5 It can be known that the preset feature class is 10, so the total number of feature classes is 10, and if the feature value i is progressive in three views, according to Figure 5It can be seen that the characteristic class corresponding to the characteristic value range of the target characteristic in the characteristic class contains the characteristic value i, and the characteristic class is the career class and the multi-talented class, so the total number of characteristic classes corresponding to the characteristic value range of the target characteristic in the characteristic class containing the characteristic value i is 2.

[0155] Specifically, the preset parameter a is determined by the following formula:

[0156]

[0157] Wherein, the a is a preset parameter, D is a total number of characteristic classes set in advance, |j:s i ∈d j | is the total number of characteristic classes corresponding to the characteristic value range of the target characteristic in the characteristic class containing the characteristic value i.

[0158] Specifically, when determining 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, the following formula is used:

[0159] mt-a=mt(i,j)*a

[0160]

[0161]

[0162] 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 is the first number of users containing the characteristic value i divided into the characteristic class j, n kj is the number of users containing the characteristic value k divided into the characteristic class j, wherein the k is other characteristic values in the characteristic class except the characteristic value i, ∑ k n kj is the second number of users corresponding to other characteristic values in the characteristic class except the characteristic value, D is a total number of characteristic classes set in advance, |j:s i ∈d j | is the total number of characteristic classes corresponding to the characteristic value range of the target characteristic in the characteristic class containing the characteristic value i.

[0163] In order to obtain the target vector corresponding to the heterogeneous graph, on the basis of the above embodiments, in the embodiments of the present disclosure, the method for inputting the heterogeneous graph into the pre-trained recommendation model to obtain the target vector output by the recommendation model comprises:

[0164] Based on the pre-trained recommendation model, an edge weight matrix is determined according to an edge weight corresponding to each connection relationship saved in the heterogeneous graph; a dimension of an identity matrix is determined according to a number of each node in the heterogeneous graph; and the target vector is determined according to the edge weight matrix, the identity matrix, and a parameter matrix of the pre-saved recommendation model.

[0165] In the embodiments of the present 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 relationship saved in the heterogeneous graph, where each element in the edge weight matrix is the edge weight corresponding to each connection relationship saved in the heterogeneous graph. If the heterogeneous graph contains N nodes, the edge weight matrix is an N*N matrix.

[0166] Then, the dimension of an identity matrix is determined according to the number of each node in the heterogeneous graph. If the heterogeneous graph contains N nodes, the identity matrix is an N*N matrix.

[0167] Finally, the target vector is determined according to the edge weight matrix, the identity matrix, and a pre-saved parameter matrix of the recommendation model.

[0168] Specifically, the target vector can be determined by the following formula:

[0169]

[0170]

[0171] Where H is the target vector, X is the identity matrix, A is the edge weight matrix, D is the degree matrix, and W is the parameter matrix of the recommendation model.

[0172] Where each element on the diagonal line in the degree matrix D can be determined according to the following formula:

[0173]

[0174] Where D ii is an element in the i-th row and the i-th column of the degree matrix, and A ij is an element in the i-th row and the j-th column of the edge weight matrix.

[0175] It should be noted that the elements in the degree matrix other than the diagonal line are all 0.

[0176] Figure 6 FIG. 1 is a structural schematic diagram of a dialogue system provided by the present disclosure, which will be described in detail below. Figure 6

[0177] ​The dialogue system comprises a natural language understanding component (NLU), a dialogue manager component (DM) and a natural language generation component (NLG).

[0178] The NLU can determine the intention of the target user and express the intention of the target user through slot filling (Slot Filling) according to each text in the dialogue process of each target user with the dialogue system. The DM is the brain of the dialogue system, which decides to ask or diagnose the friendship needs or matching tendency characteristics of which target user. The NLG converts the execution actions of the dialogue system into natural language.

[0179] For example, the NLG of the dialogue system first outputs "Do you value appearance or inner more when you make friends?", and the target user inputs "I value appearance more, hope to be single, and can match young and beautiful girls" based on the text "Do you value appearance or inner more when you make friends?" output by the dialogue system. The NLU in the dialogue system can identify that the target user's target is to find an object and the matching tendency characteristics are young, good physique and beautiful, and the DM in the dialogue system can execute the action of "recommending young and beautiful girls to the target user".

[0180] Figure 7 A process diagram for generating a dialogue system is provided for some embodiments of the present disclosure, which will be described in detail with reference to Figure 7 .

[0181] A corpus is constructed, wherein the corpus contains a plurality of texts that can represent the user's friendship tendency and friendship needs and are helpful for the dialogue system to make matching recommendations.

[0182] A heterogeneous graph is constructed according to the corpus, wherein the heterogeneous graph contains a plurality of nodes corresponding to feature values and nodes corresponding to feature classes, and for each feature value, there is a connection relationship between the node corresponding to the feature value and the node corresponding to other feature values, and the edge weight corresponding to the connection relationship is saved, and for each feature class, there is a connection relationship between the node corresponding to the feature class and each node corresponding to the feature value, and the edge weight corresponding to the connection relationship is saved.

[0183] The isomorphism graph is a kind of knowledge graph, and the knowledge graph (KG) is derived from the next-generation intelligent semantic search engine technology of Google. In essence, it is based on the idea of semantic network and is a semantic knowledge base with a directed graph structure, which is used to describe the concepts and their mutual relationships in the physical world in symbolic form. Specifically, the knowledge graph is usually represented by (subject, predicate, object) triples to express knowledge, such as (World Health Organization, headquarters, Geneva, Switzerland), which represents that the headquarters of the World Health Organization is located in Geneva, Switzerland. The purpose of constructing the isomorphism graph is to facilitate the dialogue system to determine the friendship demand and matching tendency of the target user from a few short dialogues with the target user, and to recommend users suitable for the target user.

[0184] It should be noted that the present disclosure constructs a weighted isomorphism graph instead of a traditional ordinary isomorphism graph. The weighted isomorphism graph can better learn the connection relationship and correlation between feature values and feature values, and the connection relationship and correlation between feature values and feature classes from structural information and attribute information.

[0185] A DQN model is trained, and based on the constructed isomorphism graph and the trained DQN model, a complete solution for friendship matching and recommendation through the dialogue system is formed. This solution not only can effectively match and recommend for new registered users, but also can adapt to the change of the matching tendency of old users. According to the dialogue between the dialogue system and the target user, and according to the various texts interacted by the target user and the dialogue system in the dialogue process, the isomorphism graph and the trained DQN model, the target user is recommended to the user most suitable for the target user.

[0186] Figure 8 The display diagram of the complete dialogue between the target user and the dialogue system provided by some embodiments of the present disclosure will be described below. Figure 8

[0187] The dialogue system can first output a text corresponding to a greeting to the target user. The text can be "Hello handsome, do you want to match a suitable opposite sex?", or the user can actively input a text for greeting, which can be "Hello, I want to find a girlfriend".

[0188] Then the dialogue system and the target user carry out multiple rounds of dialogue which are helpful for the dialogue system to determine the friendship demand of the target user. Specifically, the dialogue content can be as follows:

[0189] ​The dialogue system outputs "Do you value external or internal more?", and then the target user inputs "I value external more". The dialogue system outputs "What kind of girl do you want to find?", and then the target user inputs "I hope my future girlfriend is beautiful, has a good figure, and is relatively young". The dialogue system outputs "Do you value external more? Do you have internal requirements for girls?", and the target user inputs "I value both external and internal, and internally, I like girls with a gentle personality". The dialogue system outputs "What kind of girl do you want to find?", and the target user inputs "I hope my future girlfriend is beautiful, has a good figure, and is relatively young". The dialogue system outputs "OK, I recommend young and beautiful girls and gentle and considerate girls for you", and the target user inputs "Thank you".

[0190] Finally, the dialogue system outputs a closing phrase, such as "You're welcome. Feel free to ask me anytime if you need help." or "I'm glad to chat with you".

[0191] Based on the same technical concept, the present disclosure provides a text processing device, Figure 9 A schematic diagram of a text processing device according to some embodiments is shown in FIG. 1. Figure 9 As shown in FIG. 1, the device includes:

[0192] A determination module 901 is configured to obtain each text interacted by a target user in a dialogue process with a dialogue system, and determine a text matrix according to content contained in the texts.

[0193] A processing module 902 is configured to construct a heterogeneous graph according to a pre-constructed corpus, input the heterogeneous graph into a pre-trained recommendation model, obtain a target vector output by the recommendation model, determine an action vector according to the target vector and the text matrix, and perform an action corresponding to a position of a maximum value in the action vector.

[0194] In some possible implementation manners, the determination module 901 is specifically configured to identify, for each text, a first target feature value contained in the text, determine a feature vector corresponding to the text according to a feature value corresponding to each position in a pre-stored empty vector and the first target feature value, and determine the text matrix according to the feature vector corresponding to each text.

[0195] In some possible implementation manners, the determination module 901 is specifically configured to set a component at a position corresponding to the first target feature value in the empty vector to a preset first value, set other components in the empty vector to a preset second value, and obtain the feature vector corresponding to the text.

[0196] In some possible implementation manners, the processing module 902 is specifically configured to identify all feature values contained in each text in the corpus, and construct nodes corresponding to all the feature values in the heterogeneous graph; for any two nodes corresponding to feature values, establish a connection relationship between the two nodes, and determine an edge weight corresponding to the connection relationship between the two nodes according to a number of times that the two feature values appear simultaneously in each text in the corpus, a total number of texts contained in the corpus, and a number of times that the two feature values appear in the corpus respectively, and save the edge weight.

[0197] In some possible implementation manners, the determining module 901 is further configured to, if nodes corresponding to preset feature classes are also constructed in the heterogeneous graph, a relationship between nodes corresponding to a feature value and a feature class is established, and an edge weight corresponding to a connection relationship between nodes corresponding to the feature value and the feature class is saved, determine, for each feature class and each feature value, a first number of users containing the feature value that are divided into the feature class, and determine the edge weight corresponding to the connection relationship between the nodes corresponding to the feature value and the feature class according to a second number of users corresponding to other feature values except the feature value in the feature class, and specifically, divide each user into a corresponding feature class according to second feature values corresponding to all features of the user.

[0198] In some possible implementation manners, the determining module 901 is specifically configured to, for each user and each feature class, determine whether any feature value range contains a second target feature value matched therewith according to a second target feature value corresponding to all features of the user and a feature value range corresponding to target features contained in the feature class that are saved in advance, and if so, divide the user into the feature class.

[0199] In some possible implementation manners, the processing module 902 is specifically configured to determine an edge weight matrix according to an edge weight corresponding to each connection relationship saved in the heterogeneous graph based on the recommendation model trained in advance; determine a dimension of an identity matrix according to a number of nodes in the heterogeneous graph; and determine the target vector according to the edge weight matrix, the identity matrix, and a parameter matrix of the recommendation model saved in advance.

[0200] Based on the same technical concept, the present disclosure further provides an electronic device, Figure 10 An electronic device structure schematic diagram provided by some embodiments is shown in FIG. 1, which includes 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 complete mutual communication through the communication bus 1004. Figure 10 As shown, the electronic device includes 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 complete mutual communication through the communication bus 1004.

[0201] The memory 1003 stores a computer program, which, when executed by the processor 1001, causes the processor 1001 to perform the following steps:

[0202] Obtain each text interacted in a conversation process between a target user and a dialogue system, and determine a text matrix according to content contained in the each text;

[0203] According to a pre-constructed corpus, construct a heterogeneous graph; input the heterogeneous graph into a pre-trained recommendation model to obtain a target vector output by the recommendation model;

[0204] Determine an action vector according to the target vector and the text matrix, and perform an action corresponding to a position of a maximum value in the action vector.

[0205] In some possible implementation manners, the processor 1001 is specifically configured to, for each text, identify a first target feature value contained in the text; and determine a feature vector corresponding to the text according to a feature value corresponding to each position of a pre-saved empty vector and the first target feature value.

[0206] Determine the text matrix according to the feature vector corresponding to each text.

[0207] In some possible implementation manners, the processor 1001 is specifically configured to set a component at a position corresponding to the first target feature value in the empty vector to a preset first value, and set other components in the empty vector to a preset second value, to obtain the feature vector corresponding to the text.

[0208] In some possible implementation manners, the processor 1001 is specifically configured to identify all feature values contained in each text in the corpus, and construct nodes corresponding to the all feature values in the heterogeneous graph; for any two nodes corresponding to feature values, establish a connection relationship between the two nodes, and determine an edge weight corresponding to the connection relationship between the two nodes according to a number of times that the two feature values appear simultaneously in each text in the corpus, a total number of texts contained in the corpus, and a number of times that the two feature values appear in the corpus respectively, and save the edge weight.

[0209] In some possible implementation, the processor 1001 is further configured to, if the preset nodes corresponding to each feature class are also constructed in the heterogeneous graph, the relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is established, and the edge weight corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is saved, determine, for each feature class and each feature value, the first quantity of users containing the feature value and divided into the feature class, and determine, according to the second quantity of users corresponding to other feature values except 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. Specifically, each user is divided into the corresponding feature class according to the second feature value corresponding to all features of each user.

[0210] In some possible implementation, the processor 1001 is specifically configured to, for each user and each feature class, determine, according to the second target feature value corresponding to all features of the user and the feature value range corresponding to each target feature included in the feature class, which is pre-stored, whether any feature value range contains the matching second target feature value, and if yes, divide the user into the feature class.

[0211] In some possible implementation, the processor 1001 is specifically configured to, based on the recommendation model trained in advance, determine an edge weight matrix according to the edge weight corresponding to each connection relationship saved in the heterogeneous graph, determine the dimension of an identity matrix according to the number of each node in the heterogeneous graph, and determine the target vector according to the edge weight matrix, the identity matrix, and a parameter matrix of the recommendation model pre-stored.

[0212] Since the principle of solving the problem of the above electronic device is similar to the text processing method, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be described here.

[0213] The communication bus mentioned in the above electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0214] The communication interface 1002 is configured to communicate between the above electronic device and other devices.

[0215] The memory can include a random access memory (RAM) and can also include a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.

[0216] The processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc., and can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic component, a discrete hardware component, etc.

[0217] Based on the same technical concept, the embodiment of the disclosure provides a computer readable storage medium, the computer readable storage medium stores a computer program executable by an electronic device, and when the program runs on the electronic device, the electronic device executes the following steps:

[0218] Obtain each text interacted in a conversation process between a target user and a dialogue system; and determine a text matrix according to content contained in the texts;

[0219] According to a pre-constructed corpus, construct a heterogeneous graph; input the heterogeneous graph into a pre-trained recommendation model to obtain a target vector output by the recommendation model;

[0220] Determine an action vector according to the target vector and the text matrix; and execute an action corresponding to a position of a maximum value of components in the action vector.

[0221] In some possible implementation manners, the determining the text matrix according to the content contained in the texts comprises:

[0222] For each text, identify a first target feature value contained in the text; determine a feature vector corresponding to the text according to a feature value corresponding to a component at each position in a pre-saved empty vector and the first target feature value;

[0223] Determine the text matrix according to the feature vector corresponding to each text.

[0224] In some possible implementation manners, the determining the feature vector corresponding to the text according to the feature value corresponding to the component at each position in the pre-saved empty vector and the first target feature value comprises:

[0225] Setting components in the null vector corresponding to positions of the first target feature values as a preset first value, and setting other components in the null vector as a preset second value, to obtain a feature vector corresponding to the text.

[0226] In some possible implementation manners, the constructing the heterogeneous graph according to the pre-constructed corpus comprises:

[0227] Identifying all feature values contained in each text in the corpus, and constructing nodes corresponding to all feature values in the heterogeneous graph;

[0228] For any two nodes corresponding to feature values, establishing a connection relationship between the two nodes corresponding to the feature values, determining an edge weight corresponding to the connection relationship between the two nodes corresponding to the feature values according to a number of times that the two feature values appear simultaneously in each text in the corpus, a total number of texts contained in the corpus, and a number of times that the two feature values appear in the corpus respectively, and saving the edge weight.

[0229] In some possible implementation manners, the heterogeneous graph further comprises nodes corresponding to pre-set feature classes, a relationship between nodes corresponding to feature values and nodes corresponding to feature classes is established, and an edge weight corresponding to a connection relationship between nodes corresponding to feature values and nodes corresponding to feature classes is saved;

[0230] The process of determining the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class comprises:

[0231] For each feature class and each feature value, determining a first number of users containing the feature value in the feature class, and determining an edge weight corresponding to a connection relationship between the node corresponding to the feature value and the node corresponding to the feature class according to a second number of users corresponding to other feature values than the feature value in the feature class, specifically, according to second feature values corresponding to all features of each user, each user is divided into a corresponding feature class.

[0232] In some possible implementation manners, the dividing each user into a corresponding feature class according to second feature values corresponding to all features of each user comprises:

[0233] For each user and each feature class, according to pre-saved second target feature values corresponding to all features of the user and feature value ranges corresponding to target features contained in the feature class, determining whether any feature value range contains a second target feature value matched therewith, and if so, dividing the user into the feature class.

[0234] In some possible implementation, the inputting the heterogeneous graph into the pre-trained recommendation model to obtain a target vector output by the recommendation model comprises:

[0235] Based on the pre-trained recommendation model, a matrix of edge weights is determined according to the edge weight corresponding to each connection relationship saved in the heterogeneous graph; a dimension of an identity matrix is determined according to the number of each node in the heterogeneous graph; and the target vector is determined according to the matrix of edge weights, the identity matrix, and a parameter matrix of the pre-saved recommendation model.

[0236] In some possible implementation, the action corresponding to each component position in the action vector comprises:

[0237] an action of asking a specific question to the target user or an action of recommending other users to the target user.

[0238] Since the principle of solving the problem by the above computer readable storage medium is similar to the text processing method, the implementation of the above computer readable storage medium can be referred to the implementation of the method, and the repeated parts will not be described.

[0239] The above computer readable storage medium can be any available medium or data storage device accessible by a processor in an electronic device, including but not limited to magnetic memories such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical memories such as CDs, DVDs, BDs, HVDs, etc., and semiconductor memories such as ROMs, EPROMs, EEPROMs, non-volatile memories (NAND FLASH), solid state disks (SSD), etc.

[0240] In the embodiments of the present disclosure, the text matrix capable of representing the friend-making intention of the target user can be determined according to the content contained in each text in the conversation process between the target user and the dialogue system, the heterogeneous graph constructed according to the pre-constructed corpus is input into the pre-trained recommendation model to obtain a target vector output by the recommendation model, and 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 the high-quality friend-making matching for the target user can be realized according to the friend-making demand of the target user, and the friend-making experience of the target user is improved.

[0241] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0242] The computer program instructions can 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 block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0243] These computer program instructions can 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 instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0244] The computer program instructions can 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 block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.

[0245] Obviously, numerous modifications and variations of the present disclosure are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the disclosure can be practiced otherwise than as specifically described.

Claims

1. A text processing method characterized by, The method comprises: obtaining each text interacted in a conversation process between a target user and a dialogue system, and determining a text matrix according to contents contained in the texts; wherein, the texts comprise texts input by the user and texts output by the dialogue system; each element in each row or each column in the text matrix is an element in a feature vector corresponding to each text; constructing a heterogeneous graph according to a pre-constructed corpus, inputting the heterogeneous graph into a pre-trained recommendation model, and obtaining a target vector output by the recommendation model; determining an action vector according to the target vector and the text matrix, and performing an action corresponding to a position of a maximum value in the action vector.

2. The method of claim 1, wherein, The actions corresponding to each component position in the action vector comprise: asking the target user a specific question or recommending other users to the target user.

3. The method of claim 1, wherein, The determining of the text matrix according to the contents contained in the texts comprises: for each text, identifying a first target feature value contained in the text, and determining a feature vector corresponding to the text according to feature values corresponding to components in each position in a pre-saved empty vector and the first target feature value; determining the text matrix according to the feature vector corresponding to each text.

4. The method of claim 3, wherein, The determining of the feature vector corresponding to the text according to the feature values corresponding to the components in each position in the pre-saved empty vector and the first target feature value comprises: setting a component in the empty vector corresponding to the position of the first target feature value as a pre-set first value, setting other components in the empty vector as pre-set second values, and obtaining the feature vector corresponding to the text.

5. The method of claim 1, wherein, The construction of the heterogeneous graph according to the pre-constructed corpus comprises: identifying all feature values contained in each text in the corpus, and constructing nodes corresponding to the feature values in the heterogeneous graph; for any two nodes corresponding to feature values, establishing a connection relationship between the two nodes, determining an edge weight corresponding to the connection relationship between the two nodes according to a number of times that the two feature values appear simultaneously in each text in the corpus, a total number of texts contained in the corpus, and a number of times that the two feature values appear in the corpus, and saving the edge weight.

6. The method of claim 5, wherein, The heterogeneous graph further comprises nodes corresponding to pre-set feature classes, a relationship between nodes corresponding to feature values and nodes corresponding to feature classes is established, and an edge weight corresponding to a connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes is saved; The process of determining the edge weight corresponding to the connection relationship between the nodes corresponding to the feature values and the nodes corresponding to the feature classes comprises: for each feature class and each feature value, determining a first number of users containing the feature value divided into the feature class, and determining an edge weight corresponding to a connection relationship between a node corresponding to the feature value and a node corresponding to the feature class according to a second number of users corresponding to other feature values except the feature value in the feature class, specifically, dividing each user into a corresponding feature class according to second feature values corresponding to all features of each user.

7. The method of claim 6, wherein, The second feature value corresponding to each feature of each user is used to divide each user into a corresponding feature class, including: For each user and each feature class, whether any feature value range contains a second target feature value matching the feature value range is determined according to a pre-stored second target feature value corresponding to all features of the user and a feature value range corresponding to each target feature contained in the feature class. If yes, the user is divided into the feature class.

8. The method of claim 1, wherein, The heterogeneous graph is input into a pre-trained recommendation model to obtain a target vector output by the recommendation model, including: Based on the pre-trained recommendation model, a edge weight matrix is determined according to an edge weight corresponding to each connection relationship saved in the heterogeneous graph; the dimension of an identity matrix is determined for the number of each node in the heterogeneous graph; and the target vector is determined according to the edge weight matrix, the identity matrix, and a pre-stored parameter matrix of the recommendation model.

9. A text processing apparatus characterized by comprising: The device includes: A determination module is configured to obtain each text interacted in a conversation process between a target user and a dialogue system, and determine a text matrix according to content contained in the texts. Each text includes a text input by the user and a text output by the dialogue system. Each element in each row or each column of the text matrix is an element in a feature vector corresponding to each text. A processing module is configured to construct a heterogeneous graph according to a pre-constructed corpus, input the heterogeneous graph into a pre-trained recommendation model to obtain a target vector output by the recommendation model, determine an action vector according to the target vector and the text matrix, and perform an action corresponding to a position of a maximum component in the action vector.

10. The apparatus of claim 9, wherein, The determination module is specifically configured to identify a first target feature value contained in each text, determine a feature vector corresponding to the 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, and determine the text matrix according to the feature vector corresponding to each text.

11. The apparatus of claim 10, wherein, The determination module is specifically configured to set a component at a position corresponding to the first target feature value in the empty vector to a pre-set first value, set other components in the empty vector to a pre-set second value, and obtain the feature vector corresponding to the text.

12. The apparatus of claim 9, wherein, The processing module is specifically configured to identify all feature values contained in each text in the corpus, construct nodes corresponding to all feature values in the heterogeneous graph, establish a connection relationship between nodes corresponding to any two feature values, determine an edge weight corresponding to the connection relationship between the nodes corresponding to the two feature values according to a number of times that the two feature values appear simultaneously in each text in the corpus, a total number of texts contained in the corpus, and a number of times that the two feature values appear in the corpus, and save the edge weight.

13. The apparatus of claim 12, wherein, If the nodes corresponding to each feature class are also constructed in the heterogeneous graph, the relationship between the node corresponding to the feature value and the node corresponding to the feature class is established, and 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 saved; The determination module is further configured to determine, for each feature class and each feature value, a first number of users containing the feature value in the feature class, and determine the edge weight corresponding to the connection relationship between the node corresponding to the feature value and the node corresponding to the feature class according to a second number of users corresponding to other feature values than the feature value in the feature class. Specifically, each user is divided into a corresponding feature class according to all second feature values corresponding to features of each user.

14. The apparatus of claim 13, wherein, The determination module is specifically configured to determine, for each user and each feature class, whether any feature value range contains a second target feature value matched therewith 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 so, divide the user into the feature class.

15. The apparatus of claim 9, wherein, The processing module is specifically configured to determine an edge weight matrix based on the recommendation model trained in advance according to the edge weight corresponding to each connection relationship saved in the heterogeneous graph, and determine the dimension of an identity matrix according to the number of each node in the heterogeneous graph; determine the target vector according to the edge weight matrix, the identity matrix, and a parameter matrix of the recommendation model saved in advance.

16. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the method of any one of claims 1-8 when executing the program.

17. A computer readable storage medium having stored thereon a computer program, characterized in that: The computer program implements the steps of the method of any one of claims 1-8 when executed by the processor.

Citation Information

Patent Citations

  • Task type interaction method and system based on deep reinforcement learning

    CN110390108A

  • Text readability automatic evaluation method and device

    CN113343690A