Method and apparatus for determining labels of text data
By constructing a tree-shaped structure to characterize the multi-level relationship of the label system and integrating label embedding features and text features, the problem of not considering the label relationship in the multi-label classification of user feedback information in catering industry is solved, and the accuracy and accuracy of the classification are improved.
Patent Information
- Application Number
- CN202111545363.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-12-16
AI Technical Summary
The prior art fails to fully consider the relationships in the label system in the multi-label classification of user feedback information in the catering industry, resulting in insufficient classification accuracy.
By constructing a tree structure to characterize the multi-level relationship of the label system, and fuse the label embedding features with the text features to form fusion features to improve the accuracy of multi-label classification.
It significantly improves the accuracy of multi-label classification results under complex label systems and enhances the accuracy of text data label tags.
Smart Images

Figure CN114254110B_ABST
Abstract
Description
Background Art
[0002] In service industries such as the catering industry, timely obtaining user feedback on products and services helps improve the product quality and service level of stores. User feedback information can not only improve products and services but also guide the future business of stores.
[0003] User feedback information is usually obtained by the customer service department during the process of accepting user evaluations and complaints, and the key features therein are extracted and classified for business through manual or automated means. The classification schemes for feedback information have evolved from traditional binary classification methods (such as positive and negative reviews) to multi-category evaluation methods. Compared with binary and multi-category classification methods, using more complex classification algorithms and models to perform multi-label classification on feedback information can target more dimensional features of the feedback information and achieve better feedback information extraction. Therefore, how to more accurately perform multi-label classification on text data has become an urgent problem to be solved currently. Summary of the Invention
[0004] To at least partially solve the defects existing in the prior art mentioned above, embodiments of the present application propose a method and device for determining labels of text data, which can fully consider the influence of the mutual relationship factors of labels in the label system during the process of performing multi-label determination on text data, especially feedback text data, for multi-label classification, and improve the accuracy of label determination and classification of text data.
[0005] According to one aspect of the present application, a method for determining labels of text data is proposed, including: obtaining text data; extracting text features of the text data; fusing the text features and label embedding features into a fused feature, where the label embedding features are determined according to the hierarchical relationship of multiple labels to be predicted; and determining at least one label associated with the text data from the multiple labels based on the fused feature.
[0006] According to another aspect of the present application, a device for determining labels of text data is proposed, including: an obtaining unit configured to obtain text data; a feature extraction unit configured to extract text features of the text data; a fusion unit configured to fuse the text features and label embedding features into a fused feature, where the label embedding features are determined according to the hierarchical relationship of multiple labels to be predicted; and a label determination unit configured to determine at least one label associated with the text data from the multiple labels based on the fused feature.
[0007] According to still another aspect of the present application, a computer-readable storage medium is proposed, on which a computer program is stored, and the computer program includes executable instructions, and when the executable instructions are executed by a processor, the method described above is implemented.
[0008] According to another aspect of the present application, an electronic device is provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement the method as described above.
[0009] By adopting the solution for determining the tags of text data proposed in the present application, based on extracting the language habits and characteristics of the evaluation expressions in the user's feedback text data, a tree structure can be used to represent the multi-level tag relationships in the tag system and further construct the tag system into a tag relationship graph model, increasing the tag embedding features that introduce tag relationship information under the graph model. The fusion feature that combines the tag embedding feature and the text feature of the text data can significantly improve the tag marking accuracy of the multi-tag determination algorithm and model for the text data under a complex tag system compared with the traditional text feature, and improve the accuracy of the multi-tag classification result. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] By referring to the accompanying drawings and describing its exemplary embodiments in detail, the above and other features and advantages of the present application will become more obvious.
[0011] Figure 1 FIG. is a schematic logical block diagram of a system for determining tags of text data according to an embodiment of the present application.
[0012] Figure 2 FIG. is a schematic logical block diagram of constructing a graph model based on a tree structure and determining tag embedding features in a system for determining tags of text data according to an embodiment of the present application.
[0013] Figure 3 FIG. is a schematic flowchart of a method for determining tags of text data according to an embodiment of the present application.
[0014] Figure 4 FIG. is a schematic structural block diagram of a device for determining tags of text data according to an embodiment of the present application.
[0015] Figure 5 FIG. is a schematic structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0016] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the content of the technical solutions of the present application becomes comprehensive and complete, and the concept of the exemplary embodiments is fully conveyed to those skilled in the art. In the figures, for clarity, the dimensions of some elements may be exaggerated or deformed. The same reference numerals in the figures denote the same or similar structures, and thus their detailed descriptions will be omitted.
[0017] In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application may be practiced without one or more of the specific details, or other methods, elements, etc. may be employed. In other cases, well-known structures, methods, or operations are not shown or described in detail to avoid obscuring aspects of the present application.
[0018] In this paper, taking the user evaluation in the feedback text information related to food and service extracted from the feedback information scenarios of restaurants and stores in the catering industry as an example, the method and device for determining the labels of text data in the embodiments of the present application are introduced. However, this scenario is only an example and not a limitation. Those skilled in the art can apply the text data label determination scheme to various scenarios and industries that require multi-label classification of data. Text data generally refers to a collection of natural language words in the form of sentences or paragraphs. Depending on the application scenario, the text data can come from user feedback texts such as in the customer service scenario, or can also come from text data containing specific intentions and topics obtained from other sources, in order to extract key feature information from the text data and perform label marking and multi-label classification on the text data based on the multi-dimensional attributes of the intentions and topics of the text data. For example, in the customer service scenario, the user feedback information obtained may be information recorded in voice or video format. In this case, before performing multi-label determination and classification, these formats need to be converted into text data information in text form through technologies such as speech recognition.
[0019] The process of multi-label determination and classification of text data using a label system can extract more characteristics and differences in dimensions or attributes of the text data compared to traditional binary classification and multi-class classification. The classification results of binary classification (e.g., positive and negative types such as "good reviews" and "bad reviews") are mutually exclusive, and the sum of the probabilities of the text data being classified into two types is 1. Multi-class classification (e.g., four different season types of "spring, summer, autumn, and winter") extends the number of types to multiple. Correspondingly, the sum of the probabilities of the text data being classified into multiple types is still 1, and there is still mutual exclusivity between the types. The multi-label classification process evaluates the differences in different attributes and feature dimensions and determines the probabilities of the text data belonging to the attributes and feature dimensions corresponding to different labels. Generally, the probabilities of the text data being determined or labeled with different labels are not related. According to different label system settings, the text data can have one or more corresponding labels and their probabilities. Generally, the process of determining the labels of text data for multi-label classification is the process of determining whether the text data has a probability that meets a predetermined threshold condition (e.g., the probability of having the attributes and feature dimensions corresponding to the label is higher than a certain threshold) in the attributes and feature dimensions represented by the corresponding labels. The models and algorithms for multi-label determination and classification of text data are generally different from binary classification and multi-class classification.
[0020] According to an embodiment of the present application, the label system includes multiple labels and the mutual relationships between the labels. Hereinafter, a combination of one or more labels may be referred to as a label set. The label set includes at least one label. For the multi-label determination and classification process, the label set includes multiple labels. The determination and classification scheme for simple multi-label text data usually does not consider the mutual relationships between the labels and only considers the language features in the feedback text information. Since the attributes of the label system itself are not considered, the multi-label classification algorithm needs to rely on the prior information of the labels to form an inherent order, resulting in poor multi-label classification and marking effects when it is applied to a label system with complex label relationships. The improved multi-label determination and classification scheme considers the mutual relationships between the labels, so that the label generation model usually depends on the prior information and rules of the labels, such as a certain sorting rule of the labels, and sequentially generates labels with a fixed order, where each label is known and its mutual relationship is determined in advance. This determined label relationship is relatively simple (e.g., in an order relationship, such as sorted according to label importance). In a label system with multiple attributes and feature dimensions, the complex mutual relationships between the labels (e.g., a hierarchical relationship with more levels) also have a significant impact on the label marking results of the text data, making it impossible to accurately find the accurate correspondence between the text features and the labels only by combining the language features such as keywords of the text data itself with a simple label sorting.
[0021] According to embodiments of the present application, additional feature data capable of characterizing the mutual relationship between multi-labels in a label system can be added to the input data of the multi-label determination and classification algorithm and model, in addition to the text feature data of the text data. This enables the multi-label determination model to receive complex information from the label system, thereby improving the accuracy of label determination and classification results under a label system with complex label relationships. The process of adding additional feature data related to label relationships is called label embedding, and the additional features can also be referred to as label embedding features. The label embedding features are fused with the text features of the text data to obtain fused features, which serve as the new input feature data for the multi-label determination algorithm and model.
[0022] Embodiments of the present application take a label system with a hierarchical relationship of multiple levels as an example to introduce systems, methods, and devices for multi-label determination and multi-label classification using label embedding features. In the process of characterizing the complex label relationships of the label system, how to use a suitable data model and system to represent the label relationships of the label system is one of the key points.
[0023] Figure 1 Shows a system flow for determining labels of text data for multi-label classification according to embodiments of the present application.
[0024] The system first obtains text data 102.
[0025] The system needs to complete multi-label classification based on a label system. Therefore, the system needs to store or obtain in advance the label set 101 of the label system, where the label set 101 includes multiple labels, and the labels of the text data are selected from these labels. The multiple labels in the label set 101 can also be referred to as multiple labels to be predicted. According to embodiments of the present application, the system can also obtain the label set 101 simultaneously when obtaining the text data 102 or before needing to use the label hierarchical relationship of the label set 101.
[0026] The label system is used to determine and classify multiple labels for text data obtained in a predetermined scenario, and is usually related to the applied field and scenario. For example, there are multiple feedback information attributes related to the content of the customer service work in the user feedback information in the customer service scenario. In the user feedback information of a catering store such as the fast food industry, the label system involved in the text data should be composed of feedback information attributes related to food and food services. For the user feedback information in the retail industry, the user feedback information obtained by the customer service department may include feedback information attributes related to the quality, price, payment, and commodity sales service level of the commodity. For each feedback information attribute, or the dimension of the feedback information, there is a corresponding label to represent the attribute or dimension. In this article, the label can be the attribute or dimension information itself, or a mark or symbol set for the attribute or dimension information. The label system can be determined in advance by the customer service department according to the scenario of the user feedback information, or updated when the scenario is updated.
[0027] The label set 101 of the label system includes multiple labels, and the relatively complex interrelationships among these labels constitute the label relationship of the label system. In the embodiments of the present application, the process of modeling the label relationship of the label system is introduced by taking a hierarchical relationship with multiple levels as an example. The hierarchical relationship includes the upper and lower subordinate or inheritance relationships between levels, that is, a certain level can have a higher level to which it is subordinate, or a lower level that is subordinate to this level. For adjacent levels, the higher level is directly subordinate to the adjacent lower level. Correspondingly, the lower level is directly subordinate to the adjacent higher level. For non-adjacent levels, the higher level is indirectly subordinate to the lower level, and the lower level is indirectly subordinate to the higher level. Each level includes or has at least one label. According to the level to which each label belongs, the labels can be divided into labels of different levels according to the upper and lower subordinate or inheritance relationships of the levels. For a certain label, the labels in the upper level of the level to which it belongs belong to the superior labels of this label, that is, this label is subordinate to its superior label or the superior label is subordinate to this label. The labels in the lower level of the level to which the label belongs belong to the subordinate labels of this label, and this label is subordinate to the subordinate label or the subordinate label is subordinate to this label. All the labels in the label set 101 can be arranged or traversed hierarchically in sequence from the highest level to the lowest level or from the lowest level to the highest level according to the corresponding levels in their hierarchical relationships. Generally speaking, the labels in the same level are in a parallel relationship and there is no mutual subordination relationship. In a complex label relationship, there can also be sub-levels and sub-subordination relationships between the same levels.
[0028] The text data 102 can be from the user feedback information collected by the customer service department of a catering store. The text data 102 of user feedback is collected and stored at each store, or can be uniformly collected and provided by the customer service department of the upper-level store or headquarters of a chain catering store. The text data 102 can be stored in the local server or database of the store or enterprise and obtained in a wired or wireless manner through a dedicated data interface or user interface, or can be stored in a server or database provided on a remote or network (such as a cloud server) and obtained in a wired or wireless manner through an interface / screen similar to or different from the local scenario.
[0029] The text data 102 can also be referred to as text corpus, which is a symbolic natural language statement or a combination of multiple statements, usually including an ordered combination of text symbols. Before using the text data 102, it can be preprocessed to obtain the processed text data 121 including keywords w1, w2, w3,... etc. that make up the statements. The processed text data 121 can also include a first sentence marker CLS for segmenting and marking statements when the text data includes multiple statements (such as statement pairs). The preprocessing can include deleting unnecessary punctuation marks, conjunctions, adverbs, and modal particles in the statements, as well as other symbols (such as emojis and pictures) that are not relevant to the recognition of the text data 102.
[0030] The text feature 122 of the text data 102 is the feature data extracted from the text data 102 that can characterize the intention or theme contained in the text data 102, and it has attribute or dimensional information related to a certain or some labels in the label set 101 of the label system. The text feature in the text data 102 or the processed text data 121 can be extracted through an algorithm or model 120 based on technologies such as natural language processing NLP. Figure 1 The BERT model is used as the feature extraction model 120 herein. Those skilled in the art know that the feature extraction model 120 can also adopt algorithms or models of traditional technologies, or be implemented using a machine learning model structure or a neural network model structure. The neural network model can be a deep neural network DNN model structure or a convolutional neural network CNN model structure. Specifically, models such as Roberta (such as Roberta-wwm) applicable to large-scale language processing can also be adopted. Roberta is a network model pre-trained based on news data such as WIKI encyclopedia, combined with pre-training using calibrated unlabeled user feedback information from catering stores as training data, and can better learn the text features with the language expression habits of user evaluations. The text features extracted by the Roberta-wmm model carry word vectors with context information.
[0031] Through the text feature extraction model 120, text features 122 represented by feature vectors can be obtained. The text features 122 include multiple feature vectors with a feature dimension D1, where the feature dimension D1 is related to the text feature extraction model 120 and is generally a positive integer greater than 0. In Figure 1 In the illustrated BERT model example, the text features 122 include 4 feature vectors.
[0032] Since the process of feature extraction for the text data 102 or the processed text data 121 does not require the introduction of label information, the text feature extraction model 120 can be pre-trained in advance to obtain a pre-trained model.
[0033] Based on the multiple labels and hierarchical relationships in the label set 101 of the label system, a tree structure capable of representing the hierarchical relationship is constructed. The tree structure is one of the typical topological structures representing hierarchical relationships. The node topological structure of the tree structure can represent the upper and lower subordination or inheritance relationships in the hierarchical structure corresponding to the parent-child subordination or inheritance relationships between nodes. The label system using the tree structure to represent the label hierarchical relationship can also be called a tree-shaped label system. Those skilled in the art can understand that other hierarchical structures can also be used to represent the hierarchical relationships between labels in the label system.
[0034] Now, in combination with Figure 2 the tree structure shown in introduces the correspondence between the hierarchical relationship of the label system and the tree structure. Among them, the tree structure 210 only shows a part, which is used to illustrate the hierarchical relationship of some labels represented by the traversal path in the tree structure 210.
[0035] The number of leaf nodes in the tree structure 210 is the same as the number of labels in the label set 101. Each leaf node and its traversal path (the shortest path) from the root node of the tree structure 210 to this leaf node uniquely correspond to the label in the label set 101 that corresponds to this leaf node. Based on this correspondence, the hierarchical subordination relationship of the labels can be characterized by the hierarchical relationship between the nodes passed through during the traversal of the path from the root node to the leaf node. The number of all nodes (the sum of intermediate nodes and leaf nodes) in the tree structure 210 should be greater than the number of labels in the label set 101. The tree structure 210 is divided layer by layer from the root node root into different branches, forming a multi-level node structure of the tree structure 210. Therefore, different-level leaf nodes corresponding to it can be formed in the tree structure 210 based on the labels with hierarchical relationships, and a corresponding tree structure with hierarchical relationships can be established. According to the top-down subordination relationship of the tree structure from the root node to the leaf node, the hierarchical relationship of the label system can be sorted from the highest level to the lowest level and marked as the first level, the second level,..., the Nth level, where there are N different levels in the hierarchical relationship, and N is a positive integer greater than 0. In this article, in order to reflect the correspondence between the tree structure 210 and the hierarchical relationship of the label system, the first level to the Nth level can be used to represent both the level to which the nodes in the tree structure 210 belong (for example, a first-level node belongs to the first level), and the level to which the labels in the label set 101 belong (for example, if a label belonging to the first level appears as an intermediate node / intermediate label in the path from the root node to a certain leaf node, it corresponds to a certain first-level node on this path of the tree structure 210).
[0036] In this article, the term "label" is used to represent the labels in the label set 101 that are used to label text data during the multi-label determination and classification process. The term "intermediate label" is used to represent those labels passed through during the traversal of the hierarchical relationship. These intermediate labels correspond to the intermediate nodes passed through during the traversal of the path from the root node to the leaf node in the tree structure. In other words, the nodes corresponding to those labels that are intermediate labels appear as intermediate nodes rather than leaf nodes in the traversal paths where other labels are leaf nodes. However, in the tree structure 210, there must be cases where the nodes corresponding to these labels that are intermediate labels appear as leaf nodes.
[0037] First, for example, for a leaf node 234a corresponding to a certain tag in the tag set 101, starting from the root node root, the tree structure is divided into two first-level nodes 231a and 231b in two branches, which are represented by labels 1 and 2 respectively. According to an embodiment of the present application, the intermediate tags passed through during the traversal of the tags from the highest level to the lowest level can be used as intermediate nodes in the traversal path of the tree structure with this tag as the leaf node, that is, the name of the intermediate tag is the name of the intermediate node, or the intermediate tag can be stored as data in the corresponding intermediate node of the tree structure 210 or a corresponding relationship is established with the corresponding intermediate node (for example, represented in the form of a pointer pointing to the data of this intermediate tag), and a corresponding intermediate node label or symbol is set for the corresponding intermediate node for reference. Tags represent the characteristics or information of text data in a certain attribute or dimension, and tag data belonging to different levels can be represented in the form of a tag vector, such as the tag vector 221a of the first level. In Figure 2 the first-level nodes 231a and 231b, represented by labels 1 and 2 respectively, represent two first-level intermediate nodes that may be passed through in the path from the root node to the leaf node 234a, represented in the form of the tag vector 221a of the first level. These two intermediate nodes correspond to the first-level tags in the tag set 101, that is, the intermediate tags mentioned above. There are two first-level tags in the tag set 101. When they are used as intermediate tags corresponding to the intermediate nodes on the travel path of the leaf node 234a corresponding to other tags, they respectively form the first-level nodes 231a and 231b (labeled 1 and 2) of the corresponding tree structure 210. When the two first-level tags in the tag set 101 are used as leaf nodes themselves, the tree structure 210 also includes two leaf nodes of the first level that belong to the same first level as the first-level nodes 231a and 231b in the first-level nodes to correspond to these two first-level tags ( Figure 2 not shown in the figure). Therefore, the tags in the tag set 101 will necessarily find a unique leaf node and its traversal path in the node level corresponding to the level where the tag is located in the tree structure 210. However, when this tag exists as an intermediate tag in the traversal path of other tags in the hierarchical relationship, during the travel of the traversal path starting from the root node with other tags (especially other tags at a level lower than this tag) as leaf nodes, the intermediate tag corresponding to the passed intermediate node is reused. The first-level nodes 231a and 231b are the child nodes of the root node root. On the contrary, the root node is the parent node of the first-level nodes 231a and 231b. In this way, the subordinate relationship between a certain tag and its upper-level tag and its lower-level tag can be uniquely represented by the subordinate relationship between the parent node and the child node of a certain level node corresponding to this tag in the tree structure 210.
[0038] Then, for example, for the leaf node 234a, the tree structure 210 is further divided from the first-level node 231a (labeled 1) into the second-level nodes 232a and 232b (labeled 01 and 02 respectively) in two branches; and from the first-level node 231b (labeled 2) into the second-level nodes 232c and 232d (labeled 03 and 04 respectively) in two branches. In the partial structure of the shown tree structure 210, there are a total of four second-level nodes, including nodes 232a to 232d labeled 01 to 04 respectively, representing four second-level intermediate nodes that may be passed through in the traversal path of the leaf node 234a in the form of the second-level label vector 221b. These four intermediate nodes correspond to the intermediate labels formed by the second-level labels in the label set 101. In this way, the parent-child subordination relationship or inheritance relationship between the first-level node and the second-level node correspondingly represents the subordination relationship between the first-level and second-level labels in the label set 101 in the label system.
[0039] The second-level node 232a is further divided into third-level nodes in three branches, labeled 01 (node 233a), 02, and 03 respectively. The second-level node 232c is also further divided into third-level nodes in three branches, labeled 01, 02, and 10 (node 233b) respectively. The second-level node 232d has only one branch and has one third-level node labeled 01. The second-level node 232b is further divided into third-level nodes in multiple branches, which are not detailed in the figure. In Figure 2 In the partial structure of the shown tree structure, there are at least 7 third-level nodes, which are the children of the second-level nodes 232a (labeled 01), 232c (labeled 03), and 232d (labeled 04) respectively. Conversely, the parent nodes of these child nodes are the three second-level nodes 232a, 232c, and 232d respectively. It should be noted that although in nodes of different levels and in the same level, child nodes subordinate to different parent nodes (or under different parent nodes) may have the same label, due to their different subordinate parent nodes, these child nodes can still be distinguished as different nodes at the same level or different levels. It is also possible to assign a unique label to each node in the tree structure 210. The above-mentioned third-level nodes respectively represent multiple third-level intermediate nodes or leaf nodes in the form of the third-level label vector 221c, and these intermediate nodes or leaf nodes respectively correspond to the third-level labels in the label set 101, that is, the third-level intermediate labels (corresponding to intermediate nodes) or labels (corresponding to leaf nodes).
[0040] Similarly, the third-level node 233a (labeled 01) is further divided into fourth-level nodes in three branches, labeled 01, 02 (node 234a), and 07 respectively. The third-level node labeled 03 that belongs to the second-level node 232a also has a separate branch with a fourth-level node 234b labeled 01. The fourth-level nodes respectively represent multiple fourth-level intermediate nodes or leaf nodes in the form of the fourth-level label vector 221d, and these intermediate nodes or leaf nodes respectively correspond to the fourth-level labels in the label set 101, that is, the fourth-level intermediate labels (corresponding to intermediate nodes) or labels (corresponding to leaf nodes). Further, the fourth-level node 234b (labeled 01) has a fifth-level node 235a (labeled 01) under its separate branch, and it and other sibling nodes respectively represent multiple fifth-level intermediate nodes or leaf nodes in the form of the fifth-level label vector 221e, and these intermediate nodes or leaf nodes respectively correspond to the fifth-level labels in the label set 101, that is, the fifth-level intermediate labels (corresponding to intermediate nodes) or labels (corresponding to leaf nodes). In this way, for the leaf node 234a, during the traversal path from the root node root, it passes through the first-level node 231a (label 1), the second-level node 232a (label 01), the third-level node 233a (label 01), and finally reaches the fourth-level node 234a (label 02). The intermediate labels that need to be passed through during the hierarchical traversal of the labels belonging to the fourth level in the label set 101 are respectively the intermediate labels corresponding to these intermediate nodes, that is, the four different-level labels in the label set corresponding to these intermediate labels. In Figure 2 the tree structure 210 in
[0041] at most has 5 levels of nodes and can represent a label hierarchical relationship with at most five levels. Figure 2 As can be seen from
[0042] it, some of the leaf nodes of the tree structure 210 are at the third-level nodes, such as the leaf node 233b, some are at the fourth-level nodes in the tree structure, such as the leaf node 234a, and some are at the fifth-level nodes (the lowest-level nodes) in the tree structure, such as the leaf node 235a. The position distribution of the leaf nodes is related to the label system setting and characterizes the attribute or dimension information related to the application scenario of the multi-label text data corresponding to the label system. Figure 2The left part of is at least composed of different partial structures of the traversal paths of leaf node 234a and its two leaf nodes on the left and right (labeled 01 and 07), leaf node 235a and its two leaf nodes on the left (labeled 01 and 04), etc., which are merged. And Figure 2 The right part of is at least composed of different partial structures of the traversal paths of leaf node 233b, etc., which are merged. Figure 2 The tree structure 210 of also includes parts of the traversal paths of other leaf nodes that are not shown, some of which are merged and some are not.
[0043] The travel path from the root node of the tree structure 210 as the starting point to any leaf node as the ending point includes all intermediate nodes passed through during the branch division process. The number of times of branch division is called the path length of this travel path. The path length can also be understood as the number of connecting line segments between nodes passed through when traveling from one node to another node. There may be multiple travel paths from any one node to another node. The minimum path length among the path lengths of these travel paths can be called the path distance between these two nodes. When both nodes are leaf nodes, the minimum path length between the two leaf nodes is the path distance between the leaf nodes. Select two leaf nodes from all leaf nodes to form a leaf node combination, then the minimum path length of each leaf node combination can be found as its path distance. From the topological graph of the tree structure, the maximum level of the nodes determines the maximum path length of the tree structure from the root node to any node (leaf node), that is, the number of levels (or the maximum number of levels) in the hierarchical relationship determines the maximum path length of the tree structure from the root node to any node (leaf node). The minimum path length (path distance) between two nodes in the tree structure can exceed the maximum path length from the root node to any node (leaf node) because the travel path between these two nodes is likely to be from a node to the root node and then from the root node to another node (equivalent to two travel paths from the root node to the node). The minimum path length (path distance) between two nodes can also be less than the maximum path length from the root node to any node (leaf node) because the travel path between these two nodes is likely to be from a node to their common nearest parent node and then directly to another node without passing through the root node.
[0044] The hierarchical relationship of the label system can be modeled in the graph domain (graph space) according to the topological structure of the tree structure 210 to obtain a graph model, and the label embedding features can be obtained using the graph model. The graph model in the three-dimensional space can represent more complex variable relationships. Therefore, the complex hierarchical relationship of the label system can be mapped into the graph through the tree structure constructed above. The label determination and classification of text data can introduce the label hierarchical relationship obtained by processing and computing the modeled graph model to obtain more accurate and faster processing results, that is, the label embedding features with the embedded label hierarchical relationship. The graph model is no longer composed of the eigenvectors, matrices, or numerical-form elements of the labels, but is composed of a set of points formed by multiple spatial points and a set of edges or paths connecting these spatial points. According to the embodiments of the present application, all the leaf nodes in the tree structure 210 corresponding to all the labels in the label set 101 in the label system can be used as the set of points of the spatial points in the graph model, and the travel paths between these leaf nodes can be used as the set of edges of the edges in the graph model to construct Figure 1 the graph model 110 shown in. Therefore, the point feature part of the set of points processed by the graph model 110 is generated based on the leaf nodes respectively, and the edge feature part of the set of edges processed by the graph model 110 is generated based on the paths between the leaf nodes. Further, the point features of the graph model can be generated based on the information associated with the travel paths from the root node to the leaf nodes. The minimum path length of the travel paths between the leaf nodes can be used as the spatial distance between the corresponding leaf nodes. In this way, the label system can be represented as a spatial graph through the above mapping method. The graph model 110 can be implemented by a model for processing graph data. For example, it can be a machine learning model structure or a neural network model structure capable of processing graph data. The graph neural network model structure GNN (Graph Neutral Network) is a neural network model structure dedicated to processing graph data. For example, it includes graph convolutional neural network GCNN, graph attention neural network GAT (Graph ATtention network), etc. The processing of graph data includes graph feature extraction and transformation, classification of graph data, etc. In the present application, the graph feature extraction and transformation functions of the graph neural network GNN are mainly used. The input data of the graph neural network GNN consists of the point feature part composed of the attribute features of the points in the graph space and the edge feature part composed of the attributes of the edges in the graph space (such as the length of the edge or the spatial point distance) (such as the adjacency matrix between spatial points), and its output is the feature data related to the graph after being processed by the GNN.
[0045] The following takes the user feedback text data sample of a catering store as an example to introduce the process of the graph model 110 determining the label embedding features based on multiple labels in the input label set 101 and the hierarchical relationship between the labels.
[0046] The customer service department extracts all the attribute or dimension information of the feedback text data involved in the feedback text data sample, and constructs the label set 101. The label "(Positive comment - Food - Glutinous rice ball - Delicious)" in the label set 101 is used as a label sample with a multi-level relationship. According to the node subordination relationship of the tree structure 210, it is divided level by level from the root node to the lowest-level node (i.e., a certain leaf node) involved in the label sample. The label "Positive comment - Food - Glutinous rice ball - Delicious" can be extracted from the feedback text "(Positive comment, among the food) the glutinous rice ball is soft and delicious", for example. Similar labels can also be "Positive comment" (a label with only one label level belonging to the first level), "Positive comment - Food" (a label with two label levels belonging to the first level and the second level), "Positive comment - Food - Glutinous rice ball" (a label with three label levels belonging to the first level to the third level), "Positive comment - Food - Glutinous rice ball - Soft rice" (a label with four label levels belonging to the first level to the fourth level), "Positive comment - Food - Glutinous rice ball - Abundant filling", "Positive comment - Food - Overall - Positive comment", "Positive comment - Overall - Positive comment", or "Negative comment - Food - Glutinous rice ball - The rice is too hard", etc. According to the above introduction, at least one of the labels "Positive comment", "Positive comment - Food", and "Positive comment - Food - Glutinous rice ball" can be used as the intermediate label corresponding to the intermediate node in the traversal path when the label "Positive comment - Food - Glutinous rice ball - Delicious" or "Positive comment - Food - Glutinous rice ball - Abundant filling" is a leaf node in the tree structure 210.
[0047] For example, starting from the root node root, the first-level intermediate labels at the two branch nodes 231a and 231b are "positive comment" and "negative comment" respectively. If the label sample belongs to a positive comment or has the attribute of a positive comment, then the label sample proceeds or is classified into the branch where the first-level node 231a (with the intermediate label "positive comment") is located. Among the second-level intermediate labels of the child nodes (second-level nodes) of the first-level node 231a, the object categories targeted by the feedback samples are involved. For example, the intermediate label of the second-level node 232a is "food" and the intermediate label of the second-level node 232b is "drink". Since "glutinous rice ball" belongs to food, in the positive comment branch where the first-level node 231a is located, the label sample is further classified into the branch where the second-level node 232a corresponding to the intermediate label "food" is located. Among the third-level nodes under the second-level node 232a, there are third-level nodes representing the intermediate labels "glutinous rice ball" (node 233a), "rice porridge", and "rice cake" (marked as 01, 02, and 03 respectively). Since "glutinous rice ball" belongs to "glutinous rice ball", at the second-level node 232a (representing the intermediate label "food"), the label sample is further classified into the branch where the third-level node 233a representing the intermediate label "glutinous rice ball" is located. The child nodes of the third-level node 233a (representing the intermediate label "glutinous rice ball"), that is, the fourth-level nodes, have intermediate labels representing the state of the rice such as "tasty" (marked as 01), "soft rice" (marked as 02), and "abundant fillings" (marked as 07). Since "tasty" belongs to "tasty", at the third-level node 233a, the label sample is classified into the branch where the fourth-level node 234a with the mark "tasty" (marked as 02) is located. Since the fourth-level node 234a is a leaf node, the label sample "positive comment - food - glutinous rice ball - tasty" finally proceeds to the leaf node 234a and ends. Similarly, the label samples "positive comment - food - glutinous rice ball - soft rice" and "negative comment - food - glutinous rice ball - too hard rice" can also traverse from the root node root of the tree structure 210 to the leaf nodes corresponding to the respective label samples.
[0048] It can be seen that the process of traversing the label sample from the highest-level intermediate label to the lowest-level intermediate label involved in the label sample based on its attributes corresponds to the process of traversing from the root node root to a certain leaf node in the tree structure 210. It can be considered that for each label sample, there is a corresponding traversal path to a leaf node in the tree structure 210 during the hierarchical classification process. Therefore, the hierarchical attribute information of the label can be identified according to the characteristics of the traversal path from the root node to the leaf node, so as to introduce the hierarchical relationship of the label into the features of the text data 102.
[0049] According to an embodiment of the present application, the hierarchical attribute information can be characterized by using the node sequence data of the nodes included or passed through in the travel path from the root node to the leaf node of the tree structure 210. Each node in the tree structure 210 corresponds to or is composed of the label of the corresponding level, and each leaf node and its traversal path uniquely correspond to the labels in the label set 101. Therefore, these labels can be combined in the order of appearance in the node sequence, that is, the hierarchical relationship order of the labels (for example, from the highest first level to the lowest fifth level in Figure 2 ) to obtain the spatial point data in the graph model. For the label sample "Good review - Food - Glutinous rice ball - Delicious" mentioned above, the node sequence of its traversal path is {231a, 232a, 233a, 234a}, and the ordered character sequence or string represented by the node label is {1, 01, 01, 02}. Correspondingly, the label vectors corresponding to the node sequence or the node label sequence are 221a, 221b, 221c, and 221d in turn. The label vectors corresponding to the node sequence can be concatenated in turn to form the feature vector 111 representing the label sample with label hierarchical relationship, as shown in Figure 1 and 2 . Assuming that each label vector has the same dimension D2 (D2 is a positive integer greater than 0), the feature vector 111 of the concatenated label sample is a feature vector with a dimension of D2 * 4 concatenated in the order of the label vectors 221a, 221b, 221c, and 221d (if represented as a row vector, it is {221a, 221b, 221c, 221d}), which is called the initial label embedding feature. Figure 2 The maximum number of levels of the hierarchical relationship of the label system represented by the tree structure 210 in is 5. Then, the maximum dimension of the initial label embedding feature obtained according to the above concatenation operation is D2 * 5, that is, a feature vector with a dimension of D2 * 5 concatenated in the order of the label vectors 221a, 221b, 221c, 221d, and 221e. If the leaf node reached by the traversal process of the label sample is not the lowest-level node of the tree structure 210, the path length of the travel path at this time is equal to the node level of the leaf node. For example, the node level of the leaf node 234a of the label sample "Good review - Food - Glutinous rice ball - Delicious" is 4, that is, the path length of the travel path is 4. In order to ensure that all label samples have the same dimension of the initial label embedding feature, when the length of the traversal travel path of the text data calculated by the node level of the leaf node or the number of nodes passed through or included in the travel path is less than the maximum path length of the tree structure, the dimension of the initial label embedding feature of the label sample is expanded to the dimension of the maximum number of levels with hierarchical relationship ( Figure 2The eigenvector is for D2*5). The dimension of this maximum number of levels can be referred to as the normalized dimension of the initial label embedding features. The maximum number of levels in the hierarchical relationship is equal to the maximum number of levels of nodes in the tree structure 210, and is also equal to the maximum value among the path lengths of the traversal paths of all leaf nodes. The leaf nodes of the traversal path with the maximum path length are those lowest-level nodes. For example, Figure 2 Among them, the leaf node 235a which belongs to the lowest-level five-level node. The initial label embedding features of the label samples traversed or finally partitioned to the leaf node 235a are the eigenvector with the maximum dimension of D2*5 concatenated from the label vectors corresponding to the node marking sequence {1, 01, 03, 01, 01}. The above-mentioned label sample "Good review - Food - Glutinous rice ball - Delicious" only has a dimension of D2*4, and a label vector 221e with a dimension of D2 needs to be added to the initial label embedding features, that is, expanded from the vector in the form of {221a, 221b, 221c, 221d} to the vector in the form of {221a, 221b, 221c, 221d, 221e}. The dimension expansion operation includes, for example, adding an empty vector or a zero vector with the corresponding dimension after obtaining the concatenated feature or vector, so that the expanded eigenvector does not affect subsequent feature processing and operations. If the hierarchical relationship of the label system has a maximum number of levels m (m is a positive integer greater than 0), then the normalized dimension is D2*m.
[0050] The input data input into the graph model also includes an edge feature part. According to the correspondence between the label samples and the leaf nodes of the tree structure 210, the path data between any two leaf node combinations (which can also be called leaf node pairs) among all the leaf nodes in the tree structure can be input as the edge feature part. For example, Figure 2 Among them, the path represented by the dashed line A is a path from the leaf node 234a to the leaf node 233b. It can be known from the graph model modeling process that the minimum path length of the path between any two nodes is the path distance between these two nodes. Therefore, the unique minimum path length between a pair of two leaf nodes can be determined as the data of the edge feature part of these leaf nodes. The data of the edge feature part of the leaf nodes is also the data of the edge feature part of the label set 101 under the graph model. According to the definition of the adjacency matrix of spatial points, the minimum path lengths of all pairs of two leaf nodes constitute an adjacency matrix 112 associated with the tree structure, which is an n*n matrix composed of minimum path length values, where the positive integer n greater than zero is the number of leaf nodes in the tree structure 210. Figure 2 The path A in it is the shortest traversal path from the leaf node 234a to the leaf node 233b and has the minimum path length. If the leaf nodes are marked as i1, i2,..., i n, the minimum path length from each leaf node to another leaf node can be queried through the row and column labels of the adjacency matrix 112. The adjacency matrix 112 can be calculated after the creation of the tree structure 210 and remains constant during the label determination and multi-label classification processes of the text data. Generally speaking, the adjacency matrix 112 is a triangular symmetric matrix. The adjacency matrix 112 is only adjusted accordingly when the label set and hierarchical relationship of the label system change.
[0051] Through the above definition, the input of the node feature part (i.e., the initial label embedding feature 111) and the input of the edge feature part (i.e., the adjacency matrix 112) of the graph model 110 generated by the tree structure 210 can be obtained under the hierarchical relationship of the label system. The two are input into the pre-trained graph model 110 to obtain the label embedding feature introducing the label hierarchical relationship.
[0052] Now return to Figure 1 , the label embedding feature generated by the graph model 110 is fused with the text feature 122 of the text data through the fusion operation 130 to obtain the fusion feature of the text data 102. The fusion operation 130 can include, for example, multiplication operations such as matrix multiplication or vector multiplication or vector concatenation operations for concatenation operations. According to the input data format requirements of the subsequent label determination unit 140 for multi-label classification, the fused fusion feature can have the same feature vector dimension as the text feature 122. For example, if the text feature 122 is a row vector of dimension D1, the label embedding feature output by the graph model 110 can be a feature vector with dimensions D1 * D1. When the fusion operation 130 is vector multiplication, the fusion feature is still a row vector of dimension D1, and the dimensional characteristics of the input data of the label determination unit 140 remain unchanged. If the fusion operation 130 is a vector concatenation operation, the label embedding feature output by the graph model 110 can also be a row vector of dimensions such as D2 * m or other dimensions. After concatenating with the text feature 122, a row vector with dimensions D2 * m + D1 or other combined dimensions is obtained. Correspondingly, the dimension of the input data of the label determination unit 140 needs to be adjusted accordingly compared to those existing units or models that determine labels only based on the text feature 122.
[0053] The label determination unit 140 finally outputs the multi-label classification result 150 corresponding to the text data 102. The multi-label classification result 150 can be, for example, in the form of the labels associated with the text data 102 and the probabilities of belonging to the attributes or dimensions represented by the labels. When the classification result 150 has multiple labels, the determined text data 102 has corresponding probabilities for each label.
[0054] The label determination unit 140 can be implemented, for example, by a machine learning model structure or a neural network model structure. The neural network model structure can be implemented, for example, using various neural network model structures for multi-label classification such as CNN, DNN, etc.
[0055] Before using Figure 1 the graph model 110 and the label determination unit 140 implemented by a machine learning model structure or a neural network model structure, text data samples with calibrated labels can be used as training data to train the label determination unit 140 to determine its parameters. The overall system model formed by adding the feature extraction model 120 can also be trained. At this time, the overall system model can be regarded as a complete machine learning model or neural network model, and is trained and fine-tuned using labeled and / or calibrated text data samples with labels. The feature extraction model 120 can be pre-trained before use.
[0056] During the use of the system, the parameters of the overall system model or some of its units or models (such as at least one of the models in the label determination unit 140 and the feature extraction model 120) can also be calibrated and fine-tuned again based on the text data with calibrated labels as incremental update training data. Among them, the graph model 110 is calibrated and fine-tuned based on the adjusted label system (label set 101).
[0057] Figure 3 An exemplary process of a method for determining labels of text data for multi-label classification according to an embodiment of the present application is shown. Among them, parts that are the same or similar to the system process described in combination with Figure 1 and Figure 2 will not be described in detail again.
[0058] The method first obtains user feedback data from, for example, a customer service department as text data for which labels are to be determined in step S310. The method can store or obtain in advance a label system for multi-label classification of text data. The label system includes a label set with multiple labels, and there is a hierarchical relationship among these labels. The label set can also be obtained simultaneously with the acquisition of the text data or before the hierarchical relationship of the labels in the label set is needed.
[0059] After obtaining the text data, the text features of the text data can be extracted in step S320.
[0060] In step S330, label embedding features are determined for fusing the label embedding features with the text features in step S340. The label embedding features are determined according to the hierarchical relationship of multiple labels in the label set to be predicted. In Figure 3In the exemplary method flow shown, a graph model is constructed based on the tag set and hierarchical relationship of the tag system to determine tag embedding features. According to an embodiment of the present application, steps S320 and S330 can run in parallel independently of each other. For example, step S330 can be completed at any time before step S340 to provide the tag embedding features required for step S340. According to an embodiment of the present application, the system and method for multi-label classification can also pre-determine and store tag embedding features for multiple tags to be predicted. At this time, step S330 is not necessary in the method flow for multi-label classification of text data. Therefore, Figure 3 this step is shown as a dashed line in
[0061] Step S330 may further include constructing a tree structure representing the tag system, especially the tag hierarchical relationship of the tag system, where the leaf nodes of the tree structure correspond to the tags in the tag set. Next, use the tags in each level to form the node, the parent node, and the child node of the node in the tree structure with the superior tag to which it belongs and the inferior tags subordinate to it respectively, or store these tags as the data of the corresponding nodes respectively, or establish a correspondence relationship between the tags and the corresponding nodes, so as to use the parent-child node relationship of the tree structure to represent the upper and lower subordinate or inheritance relationship between different levels of the tag system. After constructing the tree structure, use the leaf nodes in the tree structure as the spatial points of the graph, and the travel path between each leaf node as the edge of the graph to construct a graph model representing the tag system.
[0062] Based on the hierarchical attributes of the tags, generate the travel path of the tags from the root node to the leaf node in the tree structure according to the tag hierarchical relationship, record the intermediate nodes included or passed through in the travel path, and splice the intermediate tags corresponding to these intermediate nodes in sequence according to the hierarchical relationship to form the initial tag embedding feature introducing the tag hierarchical relationship as the spatial point feature part of the input of the graph model. The dimension of the initial tag embedding feature can be expanded according to the standard dimension determined based on the maximum number of levels, so that all the initial tag embedding features are normalized. At the same time, select any two leaf nodes in the tree structure to form a leaf node combination or leaf node pair, and generate an adjacency matrix associated with the tree structure for the minimum path length between the two leaf nodes of all leaf node combinations or pairs as the edge feature part in the input of the graph model. The initial tag embedding feature and the adjacency matrix are used as the input of the graph model, and the tag embedding feature embedding the tag hierarchical relationship is calculated.
[0063] Next, in step S340 of the method, the text feature from step S320 and the tag embedding feature from step S330 or pre-determined and stored are fused into a fusion feature. The fusion feature is input into the tag determination unit in step S350 to determine the tags of the text data to complete multi-label classification.
[0064] The text feature extraction operation in step S320, the graph model in step S330, and the label determination process in step S340 can all be implemented through corresponding machine learning model structures or neural network structures. Before using these model structures or the overall model structure of the system, calibrated or labeled data can be used as training data to pre-train, train, or fine-tune the parameters of these models.
[0065] Figure 4 FIG. 5 is an exemplary structural block diagram of a device 300 for determining labels of text data for multi-label classification according to an embodiment of the present application. The device 300 may include an acquisition unit 310, a feature extraction unit 320, an optional label embedding unit 330, a fusion unit 340, and a label determination unit 350.
[0066] The acquisition unit 310 can acquire text data. The device 300 can store or acquire in advance a label system for multi-label classification, such as a label set including multiple labels of the label system and the hierarchical relationship of the labels. The feature extraction unit 320 is used to extract the text features of the text data. The optional label embedding unit 330 is used to determine label embedding features for fusing the label embedding features with the text features in the fusion unit 340. The label embedding features are determined according to the hierarchical relationship of multiple labels of the label set to be predicted. In Figure 4 the exemplary device 300 shown in FIG. 6, the label embedding unit 330 constructs a tree structure based on the label set and the hierarchical relationship, and further constructs a graph model to determine the label embedding features. The device 300 can also determine and store in advance the label embedding features for multiple labels to be predicted. In this case, the label embedding unit 330 is not necessary. Therefore, in Figure 4 FIG. 6, the label embedding unit 330 is shown in dashed lines. The fusion unit 340 receives the text features from the feature extraction unit 320 and the label embedding features from the label embedding unit 330 or the pre-stored label embedding features, and fuses them into fusion features. The fusion features are provided to the label determination unit 350 to determine at least one label associated with the text data, completing the multi-label classification operation.
[0067] The device 300 may further include an output unit (not shown) for outputting the classification result to the user and a model training unit (not shown) for pre-training and fine-tuning the models used by each unit in the device.
[0068] Each unit of the device 300 can further complete the functions and methods introduced in Figures 1 - 3 FIG. 7, which will not be repeated here.
[0069] By adopting the solution for determining the tags of text data proposed in this application, based on extracting the language habits and characteristics of the evaluation expressions in the user's feedback text data, a tree structure can be used to represent the multi-level tag relationships in the tag system and further construct the tag system into a tag relationship graph model, increasing the tag embedding features that introduce tag relationship information under the graph model. The fusion feature that fuses the tag embedding feature and the text feature of the text data can significantly improve the tag marking accuracy of the multi-tag determination algorithm and model for text data under a complex tag system compared to traditional text features, and improve the accuracy of the multi-tag classification result.
[0070] It should be noted that although several modules or units of the system for determining the tags of text data are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units. The components shown as modules or units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0071] In an exemplary embodiment of the present application, a computer-readable storage medium is also provided, on which a computer program is stored. The program includes executable instructions, and when the executable instructions are executed by, for example, a processor, the steps of the method for determining the tags of text data described in any one of the above embodiments can be implemented. In some possible implementation manners, various aspects of the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present application described in this specification for the method of determining the tags of text data.
[0072] The program product for implementing the above method according to the embodiments of the present application can adopt a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of the present application is not limited to this. In this document, the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device.
[0073] The program product may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0074] The computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium may also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the above.
[0075] The program code for performing the operations of the present application may be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, executed as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0076] In an exemplary embodiment of the present application, an electronic device is further provided. The electronic device may include a processor and a memory for storing executable instructions of the processor. Wherein, the processor is configured to execute the steps of the method for determining the label of text data in any one of the above embodiments by executing the executable instructions.
[0077] Those skilled in the art can understand that various aspects of the present application can be implemented as a system, a method, or a program product. Therefore, various aspects of the present application can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuit", "module", or "system" here.
[0078] Next, refer to Figure 5 to describe the electronic device 500 according to this embodiment of the present application. Figure 5 The shown electronic device 500 is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0079] As Figure 5 shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 may include but are not limited to: at least one processing unit 510, at least one storage unit 520, a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510), a display unit 540, etc.
[0080] Among them, the storage unit stores program codes, and the program codes can be executed by the processing unit 510, so that the processing unit 510 executes the steps according to various exemplary embodiments of the present application described in the method for determining the tags of text data in this specification. For example, the processing unit 510 can execute the steps as Figure 3 shown in.
[0081] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202, and may further include a read-only storage unit (ROM) 5203.
[0082] The storage unit 520 may further include a program / utility 5204 having a set (at least one) of program modules 5205. Such program modules 5205 include but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.
[0083] The bus 530 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any bus structure in a variety of bus structures.
[0084] The electronic device 500 can also communicate with one or more external devices 600 (such as a keyboard, a pointing device, a Bluetooth device, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 500, and / or communicate with any device that enables the electronic device 500 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication can be carried out through the input / output (I / O) interface 550. Moreover, the electronic device 500 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 560. The network adapter 560 can communicate with other modules of the electronic device 500 through the bus 530. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0085] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or can be implemented by the way of software in combination with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the method for determining the tags of text data according to the embodiments of the present application.
[0086] After considering the specification and practicing the content disclosed herein, those skilled in the art will readily think of other implementation schemes of the present application. The present application aims to cover any variations, uses, or adaptive changes of the present application, and these variations, uses, or adaptive changes follow the general principles of the present application and include the common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and the embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the appended claims.
Claims
1. A method for determining tags of text data, comprising: Obtaining the text data; Extracting text features of the text data; Fusing the text features and tag embedding features into a fused feature, wherein the tag embedding features are determined according to the hierarchical relationship of multiple tags to be predicted, and determining the tag embedding features based on the multiple tags and the hierarchical relationship includes: Generating a tree structure based on the multiple tags and the hierarchical relationship, the tree structure having leaf nodes corresponding to the tags in the multiple tags; Generating point features and edge features respectively based on the leaf nodes of the tree structure and the paths between the leaf nodes, including: Dividing the tags in the tree structure from the root node to the leaf nodes based on the hierarchical relationship, and recording the travel paths during the division process; Generating an initial tag embedding feature as the point feature based on the information associated with the travel path; and Determining the tag embedding features using a graph model based on the point features and the edge features; and Determining at least one tag associated with the text data from the multiple tags based on the fused feature.
2. The method according to claim 1, characterized in that, The hierarchical relationship has multiple levels, each level including at least one tag, the tag having a superior tag to which it belongs and / or an inferior tag subordinate to the tag, wherein the superior tag belongs to the upper level of the level where the tag is located, and the inferior tag belongs to the lower level of the level where the tag is located. Generating the tree structure based on the multiple tags and the hierarchical relationship further includes: Each of the tags constitutes a node of the tree structure, the superior tag of the tag constitutes the parent node of the node, and the inferior tag of the tag constitutes the child node of the node.
3. The method according to claim 2, wherein Generating point features and edge features respectively based on the leaf nodes of the tree structure and the paths between the leaf nodes further includes: For each combination of leaf nodes composed of two leaf nodes of the tree structure, generating an adjacency matrix associated with the tree structure as the edge feature based on the minimum path length between the two leaf nodes in the leaf node combination.
4. The method according to claim 1, wherein Generating point features and edge features respectively based on the leaf nodes of the tree structure and the paths between the leaf nodes further includes: For each of the travel paths, concatenating the tags corresponding to the nodes in the travel path according to the hierarchical relationship as the initial tag embedding feature.
5. The method according to claim 4, characterized in that, Concatenating the tags corresponding to the nodes in the travel path according to the hierarchical relationship as the initial tag embedding feature further includes, in the case where the path length of the travel path is less than the maximum path length of the tree structure, expanding the dimension of the initial tag embedding feature.
6. The method according to any one of claims 1 to 5, characterized in that, The graph model includes a graph neural network model structure.
7. The method according to claim 6, wherein The graph model includes a graph attention network model structure.
8. The method according to claim 1, wherein Extracting the text features of the text data using a machine learning model structure or a neural network model structure.
9. The method according to claim 1, wherein Determining at least one tag associated with the text data based on the fused feature using a machine learning model structure or a neural network model structure.
10. The method according to claim 9, wherein, Train at least one of the machine learning model structure or the neural network model structure using text data with tags.
11. The method according to any one of claims 1 to 10, characterized in that, The text data includes user feedback data.
12. The method according to claim 11, wherein The user feedback data includes user feedback data in the catering industry.
13. A device for determining tags of text data, comprising: An acquisition unit configured to acquire text data; A feature extraction unit configured to extract text features of the text data; A fusion unit configured to fuse the text features and tag embedding features into fusion features, wherein the tag embedding features are determined according to the hierarchical relationship of multiple tags to be predicted, and the tag embedding features are determined based on the multiple tags and the hierarchical relationship, including: generating a tree structure based on the multiple tags and the hierarchical relationship, the tree structure having leaf nodes corresponding to the tags in the multiple tags; generating point features and edge features respectively based on the leaf nodes of the tree structure and the paths between the leaf nodes, including: partitioning the tags in the tree structure from the root node to the leaf nodes based on the hierarchical relationship, and recording the travel paths during the partitioning process; generating initial tag embedding features as the point features based on the information associated with the travel paths; and determining the tag embedding features using a graph model based on the point features and the edge features; and A tag determination unit configured to determine at least one tag associated with the text data from the multiple tags based on the fusion features.
14. A computer-readable storage medium having a computer program stored thereon, the computer program including executable instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 12.
15. An electronic device, characterized in that, Comprising: A processor; And A memory for storing the executable instructions of the processor; Wherein the processor is configured to execute the executable instructions to implement the method according to any one of claims 1 to 12.