Text processing methods, apparatus, electronic devices and storage media

By constructing a graph network model and utilizing users' behavioral implicit knowledge of text data, the problem of low text classification accuracy in the existing technology is solved, and higher text classification accuracy and resource efficiency are achieved.

CN114547308BActive Publication Date: 2024-08-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210191468.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-28
Publication Date
2024-08-23
Estimated Expiration
2042-02-28

AI Technical Summary

Technical Problem

In existing text classification technology, the model only uses the static attributes of text, resulting in low classification accuracy and inability to effectively utilize the user's behavioral tacit knowledge of text data.

Method used

By constructing a graph network, the user's behavior on text data is used as a node, and the connection method is the behavior of the user and the text data. A graph neural network model is constructed, and combined with the classification layer for training, the implicit knowledge of user behavior is introduced to improve the accuracy of text classification. sex.

Benefits of technology

It improves the accuracy of text classification by the neural network model, uses implicit knowledge of user behavior to improve the text recognition effect, and is suitable for knowledge sharing and resource consumption reduction between multiple classification tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547308B
    Figure CN114547308B
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device, equipment and storage medium for text processing, which relate to the field of natural language processing of artificial intelligence. The text processing method includes: obtaining text data to be predicted; performing feature extraction on the text data to obtain a feature vector of the text data; inputting the feature vector into a neural network model to obtain a label of the text data so as to classify the text data, wherein the neural network model is trained based on training data of at least one classification task; wherein the neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on the text data. The present application introduces implicit knowledge of the user's behavior on the text data into the neural network model through a graph network, which can help improve the accuracy of the neural network model in text classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method, apparatus, device and storage medium for text processing. Background Art

[0002] Text categorization refers to the process by which a computer classifies a document into one or more pre-given categories. For example, one or more categories can be determined for each document in a document collection according to pre-defined subject categories. Through text categorization, users can browse documents conveniently and search for required documents by category. Text categorization is an important part of text mining.

[0003] In conventional text classification schemes, one approach is to train a model for each classification task, with each model using the training data of its own task and predicting its own task. Another approach is to train a multi-task model for multiple classification tasks. For example, multiple classification tasks can share the bottom layer of the model, and the upper layer can be trained in a way that multiple classifications are learned separately. The above two classification methods usually only use the static properties of the text to obtain the model, resulting in low accuracy of text classification.

[0004] Therefore, how to improve the accuracy of text classification is an urgent problem to be solved. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device and storage medium for text processing, which introduce the implicit knowledge of the user's behavior on text data into the neural network model through a graph network, and can help improve the accuracy of the neural network model in text classification.

[0006] In a first aspect, a text processing method is provided, comprising:

[0007] Obtain the text data to be predicted;

[0008] Performing feature extraction on the text data to obtain a feature vector of the text data;

[0009] Inputting the feature vector into a neural network model to obtain a label of the text data so as to classify the text data, wherein the neural network model is trained based on training data of at least one classification task;

[0010] The neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on text data.

[0011] In a second aspect, a method for training a model is provided, comprising:

[0012] According to the user's behavior on the text data, a graph network is constructed, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data;

[0013] According to the graph network, a graph neural network is obtained;

[0014] Obtain training data for at least one classification task;

[0015] The graph neural network and the classification layer are trained according to the training data of the at least one classification task to obtain a trained neural network model, wherein the neural network model includes the graph neural network and the classification layer.

[0016] In a third aspect, a text processing device is provided, comprising:

[0017] An acquisition unit, used for acquiring text data to be predicted;

[0018] A feature extraction unit, used to extract features from the text data to obtain a feature vector of the text data;

[0019] A neural network model, used to obtain a label of the text data according to the input feature vector, so as to classify the text data, wherein the neural network model is trained according to training data of at least one classification task;

[0020] The neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on text data.

[0021] In a fourth aspect, a device for training a model is provided, comprising:

[0022] A construction unit, configured to construct a graph network according to the user's behavior on the text data, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data;

[0023] A neural network model, comprising a graph neural network and a classification layer, wherein the graph neural network is obtained according to the graph network;

[0024] An acquisition unit, used to acquire training data for at least one classification task;

[0025] A training unit is used to train the neural network model according to the training data of the at least one classification task to obtain the trained neural network model, wherein the neural network model includes the graph neural network and the classification layer.

[0026] In a fifth aspect, the present application provides an electronic device, including:

[0027] a processor adapted to implement computer instructions; and,

[0028] The memory stores computer instructions, where the computer instructions are suitable for being loaded by the processor and executing the method of the first aspect or the method of the second aspect.

[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are read and executed by a processor of a computer device, the computer device executes the method of the first aspect or the method of the second aspect mentioned above.

[0030] In a seventh aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of the first aspect or the method of the second aspect.

[0031] Based on the above technical solution, it is possible to introduce implicit knowledge of users' behavior towards text data into the neural network model through a graph network. Since users' behavior towards text data is an important implicit knowledge, it has an implicit improvement effect on the recognition effect of the text. Therefore, the embodiment of the present application can help improve the accuracy of the neural network model for text classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a system architecture involved in an embodiment of the present application;

[0033] Figure 2 A schematic flow chart of a method for training a model provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of a process of constructing a graph structure according to an embodiment of the present application;

[0035] Figure 4 A schematic diagram of a neural network model provided in an embodiment of the present application;

[0036] Figure 5 A schematic flow chart of another method for training a model provided in an embodiment of the present application;

[0037] Figure 6 A schematic flow chart of another method for training a model provided in an embodiment of the present application;

[0038] Figure 7 A schematic flow chart of a text processing method provided in an embodiment of the present application;

[0039] Figure 8 is a schematic block diagram of a text processing device provided in an embodiment of the present application;

[0040] Fig. 9 is a schematic block diagram of a device for training a model provided in an embodiment of the present application;

[0041] Fig.10 It is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0043] It should be understood that in the embodiment of the present application, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based only on A, and B can also be determined based on A and / or other information.

[0044] In the description of the present application, unless otherwise specified, "at least one" means one or more, and "plurality" means two or more than two. In addition, "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0045] It should also be understood that the first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects, without any distinction of order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.

[0046] It should also be understood that the specific features, structures or characteristics related to the embodiments in the specification are included in at least one embodiment of the present application. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.

[0047] In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device.

[0048] The embodiments of the present application are applied to the field of artificial intelligence technology.

[0049] Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0050] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0051] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0052] Embodiments of the present application may involve natural language processing (NLP) technology in artificial intelligence technology. NLP is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes text processing, semantic understanding, machine translation, robot question answering, knowledge graphs and other technologies.

[0053] The embodiments of the present application may also involve machine learning (ML) in artificial intelligence technology. ML is a multi-disciplinary cross-discipline involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all fields of artificial intelligence. Machine learning and deep learning generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching.

[0054] In addition, the solution provided in the embodiment of the present application relates to a method of text processing in natural language processing.

[0055] Figure 1 A schematic diagram of a system architecture involved in an embodiment of the present application is shown in FIG. Figure 1 As shown, the system architecture may include a user device 101 , a data collection device 102 , a training device 103 , an execution device 104 , a database 105 and a content library 106 .

[0056] The data collection device 102 is used to read the training data from the content library 106 and store the read training data in the database 105. The training data involved in the embodiment of the present application includes a pair consisting of text data and a label.

[0057] The training device 103 trains the machine learning model based on the training data maintained in the database 105, so that the trained machine learning model can effectively classify text, for example, predict the label of text data, so as to determine whether the text data belongs to a certain classification task according to the label. The machine learning model obtained by the training device 103 can be applied to different systems or devices.

[0058] In addition, refer to Figure 1The execution device 104 is configured with an I / O interface 107 for data exchange with external devices. For example, the text data of the task to be predicted sent by the user device 101 is received through the I / O interface. The calculation module 109 in the execution device 104 uses the trained prediction model to predict the input text data, outputs the label of the text data, and sends the corresponding result to the user device 101 through the I / O interface.

[0059] The user device 101 may include a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a mobile internet device (MID), or other terminal devices with a browser function installed.

[0060] The execution device 104 may be a server.

[0061] Exemplarily, the server may be a computing device such as a rack server, a blade server, a tower server or a cabinet server, etc. The server may be an independent test server or a test server cluster composed of multiple test servers.

[0062] In this embodiment, the execution device 104 is connected to the user device 101 through a network. The network can be a wireless or wired network such as an intranet, the Internet, the Global System of Mobilecommunication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or a call network.

[0063] It should be noted that Figure 1 It is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. In some embodiments, the data acquisition device 102 and the user device 101, the training device 103 and the execution device 104 can be the same device. The database 105 can be distributed on one server or on multiple servers, and the content library 106 can be distributed on one server or on multiple servers.

[0064] Exemplarily, the application scenarios of the embodiments of the present application include but are not limited to text classification within the WeChat ecosystem. For example, for text within the WeChat ecosystem, such as but not limited to public account articles, web pages, applets, etc., there are many classification requirements, such as determining the category of the text, or determining whether the text belongs to vulgar content, determining the emotional bias of the text, etc. Moreover, such requirements will continue to increase.

[0065] When it comes to classifying text, there are two different solutions:

[0066] 1) Train a model for each classification task;

[0067] 2) Train a multi-task model for multiple classification tasks.

[0068] In solution 1), each model uses the training data of its own task and predicts its own task separately. In solution 2), the model can be trained in a way that multiple classification tasks share the bottom layer of the model and the upper layer performs multi-classification learning separately. In solutions 1) and 2), the model is usually trained only by the static attributes of the text, resulting in low accuracy of text classification.

[0069] In view of this, an embodiment of the present application provides a text processing solution that can utilize user behavior on text data to obtain a classification model, thereby helping to improve the accuracy of text classification.

[0070] Specifically, after obtaining the text data to be predicted, the text data can be feature extracted to obtain a feature vector of the text data, and then the feature vector is input into a neural network model to obtain a label of the text data, so as to classify the text data, wherein the neural network model is trained based on training data of at least one classification task, and the neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on the text data. The user's behavior on the text data is an important implicit knowledge, which has an implicit improvement effect on the recognition effect of the text. Therefore, introducing the implicit knowledge of the user's behavior on the text data into the neural network model through the graph network can help improve the accuracy of the neural network model for text classification.

[0071] In some optional embodiments, a multi-task model can be trained for multiple classification tasks, multiple classification tasks can share a graph neural network, each classification task can have an exclusive classification layer, and each classification layer can be trained in a separate learning manner. In this way, on the one hand, knowledge sharing between multiple classification tasks can be utilized, and generalization applicability is high. On the other hand, there is no need to train a model for each classification task separately, and resource consumption is small.

[0072] In some optional embodiments, a model may be trained for each classification task, and each model uses the training data of its own task separately and predicts its own task separately. This application does not limit this.

[0073] Exemplarily, the text processing method of the present application can be applied to multiple fields such as information retrieval, automatic classification of web documents, digital libraries, automatic abstracts, classified newsgroups, text filtering, word semantic analysis, and document organization and management. As a specific example, it can be applied to the WeChat ecosystem, such as WeChat search circle of friends, public account articles, mini-programs, music, etc., without limitation.

[0074] The text processing method of the embodiment of the present application may include a model training phase and a model prediction phase. The text processing method involved in the embodiment of the present application is introduced below in conjunction with the accompanying drawings.

[0075] First, the model training phase is described.

[0076] Figure 2 The present invention provides a schematic flow chart of a method 200 for training a model. The method 200 can be performed by any electronic device with data processing capabilities. For example, the electronic device can be implemented as a server or a terminal device. For example, the electronic device can be implemented as Figure 1 The training device 103 in the present application is not limited to this. For example, the model can be used for text classification in the WeChat ecosystem.

[0077] like Figure 2 As shown, the method 200 for training a model may include steps 210 to 240 .

[0078] 210. Construct a graph network according to the user's behavior on the text data, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data.

[0079] Figure 3 A schematic diagram of the process of building a graph structure is shown. Taking the WeChat ecosystem as an example, text data may include articles, such as articles in public accounts and Moments, etc., without limitation. Exemplarily, the user's behavior on the article includes at least one of reading, sharing and commenting. As a specific example, Figure 3 Graph (a) in the figure can represent the reading behavior between users and articles. Based on the reading behavior in graph (a), a network can be constructed with users and articles as nodes and the reading behavior between users and articles as edges of the network, as shown in Figure 3 Optionally, nodes in the network, such as users or articles, can have labels, such as Figure 3 Label 1 and label 2 in .

[0080] As a possible implementation method, we can obtain the logs of users reading public account articles in the WeChat ecosystem and organize them into pairs of <user userid, article docid>, indicating that there is a reading behavior between the user and the article. Then, we can represent all the obtained pairs as a graph network structure, through which we can obtain the neighbors of each node (such as user or article).

[0081] 220, based on the graph network, a graph neural network is obtained.

[0082] Exemplarily, a graph neural network model (GNN) can be trained according to the graph network structure in step 210 to obtain a trained graph neural network model. Specifically, the graph network structure including the initial feature vector of each node is input into the GNN, and the GNN can iteratively learn the feature vector and corresponding label of each node by extracting features from each node.

[0083] Exemplarily, the GNN may be a graph convolutional network (GCN) or other GNN representations, which are not limited in this application.

[0084] 230, obtaining training data for at least one classification task.

[0085] Exemplarily, the training data for each classification task can be represented as a pair of <article, label>. For example, when the classification task is category current events, the training data can specifically be <article 1, category current events>, <article 2, category current events>, etc. For another example, when the classification task is whether it is vulgar, the training data can specifically be <article 3, vulgar>, <article 4, not vulgar>, etc.

[0086] As a possible implementation, after obtaining the training data, feature extraction can be performed on the text data. For example, taking the training data as <article, tag>, feature extraction can be performed on the content of the article, for example, by using BERT (Bidirectional Encoder Representations from Transformers), long-short term memory (LSTM), TextCNN or other models to extract text features from the article content, so that the training data <article, tag> can be converted into <article embedding, tag>. Here, embedding is an embedding vector.

[0087] 240. According to the training data of the at least one classification task, the graph neural network and the classification layer are trained to obtain a trained neural network model, wherein the neural network model includes the graph neural network and the classification layer.

[0088] Figure 4 It is a schematic diagram of a neural network model provided in an embodiment of the present application, which includes an input layer 310, a GNN layer 320 and a classification layer 330. Exemplarily, the input layer 310, the GNN layer 320 and the classification layer 330 can be connected to form the God General Network model. As an example, the GNN can be a GCN, or other representations of GNN; the classification layer can be a fully connected classification layer, which can be connected to the GNN without limitation. As an example, the classification layer can include a hidden layer, and the number of the hidden layers can be customized, for example, the number of hidden layer nodes can be set to 128.

[0089] Exemplarily, the GNN layer 320 may be based on Figure 3 The GNN model obtained by the graph network structure in (b) of FIG. Exemplarily, the parameters of the GNN layer 320 and the classification layer 330 can be trained through at least one training data of a classification task, such as <article, tag>, to obtain the parameters of the GNN layer 320 and the classification layer 330.

[0090] In the embodiment of the present application, since the user's behavior on text data is an important implicit knowledge and has an implicit improvement effect on the recognition effect of the text, introducing the implicit knowledge of the user's behavior on text data into the neural network model through a graph network can help improve the accuracy of the neural network model for text classification.

[0091] It should be understood that in some embodiments of the present application, a multi-task model can be trained for multiple classification tasks, multiple classification tasks can share a graph neural network, each classification task can have an exclusive classification layer, and each classification layer can be trained in a separate learning manner. In this way, on the one hand, knowledge sharing between multiple classification tasks can be utilized, and generalization applicability is high. On the other hand, there is no need to train a model for each classification task separately, and resource consumption is small.

[0092] In other embodiments of the present application, a model may be trained for each classification task, and each model uses the training data of its own task separately and predicts its own task separately. The present application does not impose any limitation on this.

[0093] When training a multi-task model for multiple classification tasks, the process of training the model may include an initial single-task learning training phase and a multi-task continuous learning training phase.

[0094] In some optional embodiments, after the graph neural network and neural network model are constructed, the training of the first classification task can be started. At this time, the model training of the initial single task learning training stage can be performed. Figure 5 Describe the initial single-task learning training phase.

[0095] See also Figure 5 , the initial single task can be learned and trained through steps 510 and 520.

[0096] 510, obtaining training data for a first classification task.

[0097] The at least one classification task includes the first classification task. Exemplarily, the first classification task can be represented as task1, that is, the training data of task1 can be obtained. As a specific example, the training data of task1 can be represented as <article i, category current affairs>.

[0098] 520. Train the graph neural network and the classification layer according to the training data of the first classification task to obtain a first parameter of the graph neural network and a second parameter of the classification layer corresponding to the first classification task.

[0099] For example, in Figure 5 In the model training process, you can use Figure 4 The neural network model shown. For example, the training data of the task (such as <article embedding, label>) can be input into the neural network model for training in a min-batch manner. Optionally, the size of the batchsize can be customized, for example, setting the batchsize to 64. For example, the parameter training of the GNN layer and the classification layer can be completed through the training data of task1, and the parameter W of the classification layer can be obtained. c1 and the parameters W of the GNN layer g1 .

[0100] In some embodiments, after completing the training of the first classification task, the obtained neural network model can be saved.

[0101] In some optional embodiments, after the initial single-task learning training is completed, if there are new classification tasks to be learned later, model training in the multi-task continuous learning training phase can be performed. Figure 6 Describe the multi-task continuous learning training phase.

[0102] See also Figure 6 , the initial multi-task learning and training can be achieved through steps 610 to 630.

[0103] 610, obtaining training data for a second classification task.

[0104] The at least one classification task includes the second classification task. Exemplarily, the second classification task can be represented as task2, that is, the training data of task2 can be obtained. As a specific example, the training data of task2 can be represented as <article j, is it vulgar>.

[0105] It should be noted that in Figure 6 During the model training process, you can reuse Figure 4 The neural network model shown in Figure 1. The GNN layer is a shared layer for all classification tasks, and the upper classification layer is specific to each classification task. In other words, different classification tasks correspond to different classification layers. In the learning and training of a certain classification task, the parameters of the GNN layer and the parameters of the classification layer corresponding to the classification task can be trained.

[0106] At 620 , a loss function is determined based on constraints on parameters of the graph neural network.

[0107] In the process of training and learning new classification tasks, in order to avoid retraining all historical tasks and reduce training costs, the definition of the loss function can be changed, that is, the loss function can be re-determined according to the constraints on the parameters of the graph neural network model, so that the neural network model can continuously learn new task knowledge while not forgetting historical tasks.

[0108] For example, it can be Figure 5 Based on the original cross entropy in the training process, a constraint on the parameters of the graph neural network model is added to determine a new loss function. As a specific example, the new loss function can be expressed as the following formula (1):

[0109]

[0110] Among them, L all represents the new loss function, represents the original cross entropy, L c Indicates an added constraint.

[0111] In some optional embodiments, the above-mentioned additional constraints may include sparsity constraints and / or orthogonality constraints. As an example, the additional constraint L may be determined according to the following formula (2): c :

[0112] L c =λ s L b +λ o L o (2)

[0113] Among them, L b =∑ W ‖W‖2, represents the sparsity constraint on the parameter W of the GNN layer, that is, to try to concentrate the effective activation of the network of the GNN layer on some nodes, so as to facilitate the expansion of subsequent new tasks;

[0114] in, It represents the orthogonal constraint on the parameters W of the GNN layer to minimize the influence of the key parameters learned in the current classification task on the parameters of the previous classification task. pre represents the parameters of the graph neural network obtained after at least one classification task before the second classification task. For example, when the second classification task is the nth classification task of the training, W pre Represents the parameters of the GNN obtained after training the first (n-1) classification tasks, where n is a positive integer greater than 1.

[0115] 630. Train the graph neural network and the classification layer according to the training data of the second classification task and the loss function to obtain a third parameter of the graph neural network and a fourth parameter of the classification layer corresponding to the second classification task, wherein the at least one classification task also includes the second classification task.

[0116] In some embodiments, after the training of the second classification task is completed, the obtained neural network model can be saved. Optionally, after the training of the second classification task is completed, when there are new classification tasks to be learned, the neural network model can be saved according to the training of the second classification task. Figure 6 The multi-task continuous learning training method shown in the figure is used to learn and train the subsequent new classification tasks. For specific training methods, please refer to Figure 6 The description in will not be repeated here.

[0117] Therefore, when the embodiment of the present application trains a multi-task model for multiple classification tasks, during the training and learning process of a new classification task, by redetermining the loss function, the neural network model can not only continuously learn new task knowledge but also not forget historical tasks, thereby avoiding retraining all historical tasks and reducing training costs.

[0118] The model prediction stage is described below.

[0119] Figure 7 The following is a schematic flow chart of a text processing method 700 provided in an embodiment of the present application. The method 700 can be executed by any electronic device with data processing capability. For example, the electronic device can be implemented as a server or a terminal device. For another example, the electronic device can be implemented as Figure 1The execution device 104 in the present application is not limited to this. Exemplarily, the method 700 can be used for text classification prediction in the WeChat ecosystem.

[0120] In some embodiments, the electronic device may include (e.g., deploy) a machine learning model, which may be used to perform the text processing method 700, for example, inputting the text data to be predicted into the machine learning model, and having the machine model predict the label of the text data to classify the text data. Exemplarily, the machine learning model may be a deep learning model, a neural network model, or other models, without limitation. Specifically, the machine learning model may be Figure 4 For the neural network model in , please refer to the description above for details.

[0121] like Figure 7 As shown, the text processing method 700 may include steps 710 to 730 .

[0122] 710, obtaining text data to be predicted.

[0123] Exemplarily, text data of a classification task A to be predicted may be obtained. The classification task A may be, for example, the first classification task, the second classification task, or others, and may specifically be a category of current affairs, or whether it is vulgar, etc.

[0124] Exemplarily, the text data may be text data of a friend circle, public account articles, mini-programs, music, etc. in the WeChat ecosystem, or text data in other application fields, without limitation.

[0125] 720, extract features from the text data to obtain a feature vector of the text data.

[0126] For example, it can be used with Figure 2 The text data is subjected to feature extraction using the same feature extraction method as in step 230, and this application does not limit this.

[0127] 730, input the feature vector into a neural network model to obtain a label of the text data so as to classify the text data, wherein the neural network model is trained based on training data of at least one classification task. The neural network model includes a graph neural network and a classification layer, wherein the graph neural network is obtained by constructing a graph network based on the user's behavior on the text data.

[0128] Exemplarily, the neural network model can output the probability distribution of the label to be predicted, and then the label corresponding to the maximum probability value can be selected as the label of the text data to classify the text data. As a specific example, when the classification task A is the category of current events, the obtained label can be the category of current events, or not the category of current events; when the classification task A is whether it is vulgar, the obtained label can be vulgar or not vulgar.

[0129] Exemplarily, the neural network model can be Figure 4 The neural network model shown in the figure can be found in the above text for the training process of the neural network model. Figures 2 to 6 The description in will not be repeated here.

[0130] In some embodiments, when the neural network model is a multi-task model trained for multiple classification tasks, and the text data to be predicted is the text data of classification task A, the classification layer in the neural network model is a classification layer exclusive to classification task A.

[0131] Therefore, through the solution of the embodiment of the present application, it is possible to introduce the implicit knowledge of the user's behavior on text data into the neural network model through the graph network. Since the user's behavior on text data is an important implicit knowledge, it has an implicit improvement effect on the recognition effect of the text. Therefore, the embodiment of the present application can help improve the accuracy of the neural network model for text classification.

[0132] The specific implementation modes of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above implementation modes. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present application. For example, the various specific technical features described in the above specific implementation modes can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different implementation modes of the present application can also be arbitrarily combined, and as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.

[0133] It should also be understood that in the various method embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. It should be understood that these sequence numbers can be interchanged where appropriate, so that the embodiments of the present application described can be implemented in an order other than those shown or described.

[0134] The above describes the method embodiment of the present application in detail. Figures 8 to 10, describe in detail the device embodiments of the present application.

[0135] Figure 8 8 is a schematic block diagram of a text processing device 800 according to an embodiment of the present application. Figure 8 As shown, the text processing device 800 may include an acquisition unit 810, a feature extraction unit 820 and a neural network model 830.

[0136] An acquisition unit 810, configured to acquire text data to be predicted;

[0137] A feature extraction unit 820 is used to extract features from the text data to obtain a feature vector of the text data;

[0138] A neural network model 830, used to obtain a label of the text data according to the input feature vector, so as to classify the text data, wherein the neural network model is trained according to training data of at least one classification task;

[0139] The neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on text data.

[0140] Optionally, the text processing apparatus 800 further includes a training unit, which is used to:

[0141] According to the user's behavior on the text data, a graph network is constructed, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data;

[0142] According to the graph network, obtaining the graph neural network;

[0143] Obtaining training data for the at least one classification task;

[0144] The graph neural network and the classification layer are trained according to the training data of the at least one classification task to obtain the trained neural network model.

[0145] Optionally, the training unit is specifically used for:

[0146] The graph neural network and the classification layer are trained according to the training data of the first classification task to obtain first parameters of the graph neural network and second parameters of the classification layer corresponding to the first classification task, wherein the at least one classification task includes the first classification task.

[0147] Optionally, the training unit is specifically used for:

[0148] Determining a loss function according to constraints on parameters of the graph neural network;

[0149] The graph neural network and the classification layer are trained according to the training data of the second classification task and the loss function to obtain third parameters of the graph neural network and fourth parameters of the classification layer corresponding to the second classification task, wherein the at least one classification task also includes the second classification task.

[0150] Optionally, the constraint includes a sparsity constraint.

[0151] Optionally, the constraints include orthogonality constraints, wherein the orthogonality constraints are determined based on parameters of the graph neural network and parameters of the graph neural network obtained after at least one classification task before the second classification task.

[0152] Optionally, the number of the classification layers is at least one, and each classification layer corresponds to a classification task.

[0153] Optionally, the training data includes pairs of text data and labels.

[0154] Optionally, the user's behavior on the text data includes at least one of reading, sharing and commenting.

[0155] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, in this embodiment, the device 800 for text processing may correspond to the corresponding subject of the method 700 for executing the embodiment of the present application, and the aforementioned and other operations and / or functions of each module in the device 800 are respectively for implementing the corresponding processes in the method 700 above, and for the sake of brevity, no further description is given here.

[0156] Fig. 9 is a schematic block diagram of a device 900 for training a model according to an embodiment of the present application. Fig. 9 As shown, the device 900 for training the model may include a construction unit 910, a neural network model 920, an acquisition unit 930 and a training unit 940.

[0157] A construction unit 910 is used to construct a graph network according to the user's behavior on the text data, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data;

[0158] A neural network model 920, comprising a graph neural network and a classification layer, wherein the graph neural network is obtained according to the graph network;

[0159] An acquisition unit 930, configured to acquire training data for at least one classification task;

[0160] The training unit 940 is used to train the neural network model according to the training data of the at least one classification task to obtain the trained neural network model, wherein the neural network model includes the graph neural network and the classification layer.

[0161] Optionally, the training unit 940 is specifically used for:

[0162] The graph neural network and the classification layer are trained according to the training data of the first classification task to obtain first parameters of the graph neural network and second parameters of the classification layer corresponding to the first classification task, wherein the at least one classification task includes the first classification task.

[0163] Optionally, the training unit 940 is specifically used for:

[0164] Determining a loss function according to constraints on parameters of the graph neural network;

[0165] The graph neural network and the classification layer are trained according to the training data of the second classification task and the loss function to obtain third parameters of the graph neural network and fourth parameters of the classification layer corresponding to the second classification task, wherein the at least one classification task also includes the second classification task.

[0166] Optionally, the constraint includes a sparsity constraint.

[0167] Optionally, the constraints include orthogonality constraints, wherein the orthogonality constraints are determined based on parameters of the graph neural network and parameters of the graph neural network obtained after at least one classification task before the second classification task.

[0168] Optionally, the number of the classification layers is at least one, and each classification layer corresponds to a classification task.

[0169] Optionally, the training data includes pairs of text data and labels.

[0170] Optionally, the user's behavior on the text data includes at least one of reading, sharing and commenting.

[0171] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, it will not be repeated here. Specifically, the device 900 for training the model in this embodiment may correspond to the corresponding subject of the method 200 for executing the embodiment of the present application, and the aforementioned and other operations and / or functions of each module in the device 900 are respectively to implement the corresponding processes in the method 200 above, and for the sake of brevity, they will not be repeated here.

[0172] The above describes the device and system of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.

[0173] like Fig.10 It is a schematic block diagram of an electronic device 1000 provided in an embodiment of the present application.

[0174] like Fig.10 As shown, the electronic device 1000 may include:

[0175] The memory 1010 and the processor 1020, the memory 1010 is used to store the computer program and transmit the program code to the processor 1020. In other words, the processor 1020 can call and run the computer program from the memory 1010 to implement the method in the embodiment of the present application.

[0176] For example, the processor 1020 may be configured to execute the steps in the above method 200 or 700 according to the instructions in the computer program.

[0177] In some embodiments of the present application, the processor 1020 may include but is not limited to:

[0178] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.

[0179] In some embodiments of the present application, the memory 1010 includes but is not limited to:

[0180] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).

[0181] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 1010 and executed by the processor 1020 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 1000.

[0182] Optionally, the electronic device 1000 may further include:

[0183] The transceiver 1030 may be connected to the processor 1020 or the memory 1010 .

[0184] The processor 1020 may control the transceiver 1030 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 1030 may include a transmitter and a receiver. The transceiver 1030 may further include an antenna, and the number of antennas may be one or more.

[0185] It should be understood that the various components in the electronic device 1000 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.

[0186] According to one aspect of the present application, a communication device is provided, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory, so that the encoder executes the method of the above method embodiment.

[0187] According to one aspect of the present application, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.

[0188] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of the above method embodiment.

[0189] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state disk (solid state disk, SSD)), etc.

[0190] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0191] In the several embodiments provided in the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0192] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0193] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for text processing, characterized in that: include: Obtain the text data to be predicted; Performing feature extraction on the text data to obtain a feature vector of the text data; Inputting the feature vector into a neural network model to obtain a label of the text data so as to classify the text data, wherein the neural network model is trained based on training data of at least one classification task; The neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on text data; Wherein, before inputting the feature vector into the neural network model to obtain the label of the text data, the method further includes: According to the user's behavior on the text data, a graph network is constructed, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data; According to the graph network, obtaining the graph neural network; Obtaining training data for the at least one classification task; The graph neural network and the classification layer are trained according to the training data of the at least one classification task to obtain the trained neural network model.

2. The method according to claim 1, characterized in that The step of training the graph neural network and the classification layer according to the training data of the at least one classification task to obtain the trained neural network model comprises: The graph neural network and the classification layer are trained according to the training data of the first classification task to obtain first parameters of the graph neural network and second parameters of the classification layer corresponding to the first classification task, wherein the at least one classification task includes the first classification task.

3. The method according to claim 2, characterized in that Also includes: Determining a loss function according to constraints on parameters of the graph neural network; The graph neural network and the classification layer are trained according to the training data of the second classification task and the loss function to obtain third parameters of the graph neural network and fourth parameters of the classification layer corresponding to the second classification task, wherein the at least one classification task also includes the second classification task.

4. The method according to claim 3, characterized in that The constraints include sparsity constraints.

5. The method according to claim 3, characterized in that: The constraints include orthogonality constraints, wherein the orthogonality constraints are determined based on parameters of the graph neural network and parameters of the graph neural network obtained after at least one classification task before the second classification task.

6. The method according to any one of claims 1 to 5, characterized in that: The number of the classification layers is at least one, and each classification layer corresponds to a classification task.

7. The method according to any one of claims 1 to 5, characterized in that: The training data includes pairs of text data and labels.

8. The method according to any one of claims 1 to 5, characterized in that: The user's behavior on the text data includes at least one of reading, sharing and commenting.

9. A method for training a model, characterized in that: include: According to the user's behavior on the text data, a graph network is constructed, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data; According to the graph network, a graph neural network is obtained; Obtain training data for at least one classification task; Training the graph neural network and the classification layer according to the training data of the at least one classification task to obtain a trained neural network model, wherein the neural network model includes the graph neural network and the classification layer; The step of training the graph neural network and the classification layer according to the training data of the at least one classification task to obtain a trained neural network model includes: The graph neural network and the classification layer are trained according to the training data of the first classification task to obtain first parameters of the graph neural network and second parameters of the classification layer corresponding to the first classification task, wherein the at least one classification task includes the first classification task.

10. A text processing device, characterized in that: include: An acquisition unit, used for acquiring text data to be predicted; A feature extraction unit, used to extract features from the text data to obtain a feature vector of the text data; A neural network model, used to obtain a label of the text data according to the input feature vector, so as to classify the text data, wherein the neural network model is trained according to training data of at least one classification task; The neural network model includes a graph neural network and a classification layer, and the graph neural network is obtained by constructing a graph network based on the user's behavior on text data; A training unit is used to construct a graph network according to the user's behavior on text data, wherein the nodes of the graph network include users and text data, and the connection method of the nodes of the graph network includes the user's behavior on the text data; obtain the graph neural network according to the graph network; obtain training data of at least one classification task; and train the graph neural network and the classification layer according to the training data of at least one classification task to obtain the trained neural network model.

11. A device for training a model, characterized in that: include: A construction unit, configured to construct a graph network according to the user's behavior on the text data, wherein the nodes of the graph network include the user and the text data, and the connection mode of the nodes of the graph network includes the user's behavior on the text data; A neural network model, comprising a graph neural network and a classification layer, wherein the graph neural network is obtained according to the graph network; An acquisition unit, used to acquire training data for at least one classification task; A training unit, configured to train the neural network model according to the training data of the at least one classification task, so as to obtain the trained neural network model, wherein the neural network model includes the graph neural network and the classification layer; Wherein, the training unit is specifically used for: The graph neural network and the classification layer are trained according to the training data of the first classification task to obtain first parameters of the graph neural network and second parameters of the classification layer corresponding to the first classification task, wherein the at least one classification task includes the first classification task.

12. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the processor executes the method according to any one of claims 1 to 9.

13. A computer storage medium, characterized in that: Used to store a computer program, the computer program comprising instructions for executing the method according to any one of claims 1 to 9.

14. A computer program product, characterized in that The method comprises a computer program code, and when the computer program code is executed by an electronic device, the electronic device executes the method according to any one of claims 1 to 9.