Text classification method and device

By using the target relationship diagram in text classification to recall the candidate category tag and input it into the encoder, the problem of low text classification accuracy in the prior art is solved, and higher text classification accuracy is achieved.

CN120234419APending Publication Date: 2025-07-01ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510394561.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The prior art has low accuracy in text classification, and it is difficult to effectively improve the accuracy of text classification results.

Method used

By obtaining the target relationship diagram, the candidate category tag of the text to be classified is recalled, and the candidate category tag is input to the encoder together with the text to be classified is determined, and the classification result of the text is determined based on the encoding result output by the encoder.

Benefits of technology

By leveraging the association relationship in the target relationship diagram, the encoder can more accurately understand the semantics of the text to be classified and improve the accuracy of text classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120234419A_ABST
    Figure CN120234419A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text classification method, which comprises the following steps of: obtaining a target relation graph which comprises a plurality of first entity nodes representing vocabularies, a plurality of second entity nodes representing category labels, and connecting edges representing association relationships among the entity nodes; according to a to-be-classified target text, determining a target first entity node matched with the to-be-classified target text from the target relation graph, and obtaining a target category label represented by a target second entity node having an association relationship with the target first entity node; and at least inputting the target text and the target category label into the target encoder. And determining a classification result of the target text according to an encoding result output by the target encoder.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification belong to the field of text processing, and particularly relate to a text classification method and device. Background Art

[0002] In many scenarios, text classification is involved. For example, in order to determine the industrial chain classification to which an enterprise belongs, it is necessary to classify the enterprise description text. Usually, accurate industrial chain classification can help an enterprise identify its own position in the market, optimize supply management, discover upstream and downstream cooperation opportunities, and improve the utilization efficiency of resources. In addition, it can also help an enterprise better predict industry trends, timely adjust its business strategy, and thus maintain an advantage in the competition. Therefore, it is very necessary to accurately classify the enterprise description text. For another example, in order to facilitate users to quickly retrieve and browse, it is necessary to classify academic papers into relevant categories and display them.

[0003] With the development of machine learning, training machine learning models for text classification has become a research hotspot. However, at present, the accuracy of text classification results obtained by using machine learning models is often not high. Therefore, a reasonable solution is needed to effectively improve the accuracy of text classification results. Summary of the Invention

[0004] The purpose of the present invention is to provide a text classification method and device that can classify text efficiently and accurately.

[0005] The first aspect of this specification provides a text classification method, including:

[0006] Obtain a target relationship graph, which includes several first entity nodes representing vocabulary, several second entity nodes representing category labels, and connection edges representing the association relationships between entity nodes;

[0007] According to the target text to be classified, determine the target first entity node that matches it from the target relationship graph, and obtain the target category label represented by the target second entity node that has an association relationship with the target first entity node;

[0008] Input at least the target text and the target category label into a target encoder;

[0009] Determine the classification result of the target text according to the encoding result output by the target encoder.

[0010] The second aspect of this specification provides a text classification device, including:

[0011] An acquisition unit for acquiring a target relationship graph, which includes a number of first entity nodes representing words, a number of second entity nodes representing category labels, and connection edges representing the association relationships between the entity nodes;

[0012] A determination unit for determining, according to the target text to be classified, a target first entity node that matches it in the target relationship graph, and acquiring a target category label represented by a target second entity node that has an association relationship with the target first entity node;

[0013] An input unit for inputting at least the target text and the target category label into a target encoder;

[0014] The determination unit is further configured to determine the classification result of the target text according to the encoding result output by the target encoder.

[0015] A third aspect of this specification provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute the method described in the first aspect.

[0016] A fourth aspect of this specification provides a computing device, including a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method described in the first aspect is implemented.

[0017] A fifth aspect of this specification provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the method described in the first aspect are implemented.

[0018] The text classification method and device provided by one or more embodiments of this specification, when classifying a text, first recall candidate category labels of the text to be classified based on a target relationship graph, then input the candidate category labels together with the text to be classified into an encoder, and finally determine the text classification result based on the encoding result output by the encoder. It should be noted that since the target relationship graph can reflect the association relationships between entities, the candidate category labels recalled by this solution are input into the encoder, enabling the encoder to more accurately understand the semantics of the text to be classified based on the association relationships between the text to be classified and the candidate category labels, and then output an accurate encoding result, which helps to improve the accuracy of text classification. Description of the Drawings

[0019] To more clearly illustrate the technical solutions of the embodiments of this specification, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0020] Figure 1 Schematic diagram of the implementation scenario of an embodiment disclosed in this specification;

[0021] Figure 2 Schematic diagram showing the target relationship diagram in an example of this specification;

[0022] Figure 3 Flowchart showing the construction method of the target relationship diagram in an example of this specification;

[0023] Figure 4 Flowchart showing the text classification method according to an embodiment of this specification;

[0024] Figure 5 Schematic diagram showing the classification method based on the tree relationship diagram in an example of this specification;

[0025] Figure 6 Schematic diagram showing the text classification method in an example of this specification;

[0026] Figure 7 Schematic diagram showing the text classification device according to an embodiment of this specification. Detailed implementation manners

[0027] In order to enable those skilled in the art to better understand the technical solutions in this specification, the following will clearly and completely describe the technical solutions in the embodiments of this specification in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the scope of protection of this specification.

[0028] As mentioned above, it is necessary to classify texts such as enterprise description texts and academic papers. The characteristics of such texts are described as follows:

[0029] For enterprise description texts, in the industrial chain, an enterprise usually belongs to more than one single industry or field, and its business activities may cover multiple industries / fields, and there may be interactions and hierarchical structures among these industries / fields. In this case, enterprise text classification belongs to a complex multi-label classification task. For academic papers, they usually also belong to complex multi-label classification tasks. For example, a paper on the application of artificial intelligence in medical image diagnosis may belong to multiple categories such as artificial intelligence, medical imaging, and medical diagnosis at the same time.

[0030] In addition, tags in the industrial chain are usually organized into a complex tree structure, which contains rich industry knowledge and relationships. This structured knowledge is crucial for accurate classification, so this type of information can be integrated and utilized into machine learning models.

[0031] Combined with the characteristics of the above text, the relevant technical solutions first tried the following two traditional machine learning models:

[0032] Support Vector Machine (SVN): It is widely used in text classification and multi-label classification tasks in bioinformatics. SVN is good at finding classification boundaries in high-dimensional spaces, but for non-linear problems or multi-label settings, some specific kernel functions and multi-classification strategies need to be coordinated.

[0033] Random Forest: It is often used for multi-label classification in commercial applications, has strong feature processing capabilities and relatively high robustness. In addition, it can handle a large number of features and can provide a certain degree of interpretability.

[0034] However, the above two models have the following disadvantages:

[0035] 1. Complex feature engineering. When using traditional machine learning models, feature engineering is an indispensable part. The process of feature engineering includes multiple steps such as data cleaning, feature extraction, feature selection, and feature transformation, which requires in-depth domain knowledge and rich practical experience. For complex data sets, developers need to painstakingly design effective features to ensure that the model can capture the effective information hidden in the data. This process is not only time-consuming and laborious, but also easily affected by human biases, restricting the overall efficiency and accuracy.

[0036] 2. Poor model interpretability. Although models such as Random Forest provide a certain degree of interpretability, when dealing with complex problems, they usually turn to more complex models (such as ensemble methods), which significantly reduces interpretability. For business decisions, the interpretability of the model is crucial because decision-makers need to understand how the model makes decisions in order to evaluate the credibility of its results. In the absence of transparency, decisions may face a relatively high risk of uncertainty.

[0037] 3. Difficult to iterate and update. Traditional machine learning models often assume that the statistical characteristics of the data are constant, while in the real world, especially in a rapidly developing industry environment, market and user behaviors often change. This dynamic nature often requires the model to quickly adapt to new trends and changes. However, traditional models lack the ability to adapt, and their adaptability to new data and ability to update in a timely manner are relatively weak, thus affecting their performance in a dynamic environment.

[0038] In view of the above-mentioned disadvantages of traditional machine learning models, related technical solutions finally attempt to use language models to perform the above multi-label classification task. However, traditional language models often face the problem of insufficient information when dealing with complex multi-label classification tasks. Although they can capture some semantic information through large-scale text data, these models tend to be stretched when it comes to specific knowledge of composite industrial chain labels.

[0039] For this reason, this solution further proposes to combine the target relationship graph with an encoder to classify text. Specifically, when classifying text, first, based on the target relationship graph, recall the candidate category labels of the text to be classified, then input the candidate category label together with the text to be classified into the encoder, and finally determine the text classification result based on the encoding result output by the encoder. It should be noted that since the target relationship graph can reflect the association relationship between entities, this solution inputs the recalled candidate category labels into the encoder, enabling the encoder to more accurately understand the semantics of the text to be classified based on the association relationship between the text to be classified and the candidate category labels, and then output an accurate encoding result, which helps to improve the accuracy of text classification.

[0040] The above is the inventive concept provided in this specification. Based on this inventive concept, this solution can be implemented. The following will describe this solution in detail.

[0041] Figure 1 It is a schematic diagram of the implementation scenario of an embodiment disclosed in this specification. Figure 1 In it, when classifying text, first, based on the text, recall several candidate category labels from the target relationship graph. Then input the recalled candidate category labels and the text into the encoder together to obtain the encoding result output by the encoder. Finally, through post-processing the encoding result output by the encoder, for example, calculating the similarity between the encoding result and various category labels, determine the classification result of the text.

[0042] It should be understood that Figure 1 This is only an exemplary illustration. In practice, the input of the encoder may also include other knowledge obtained from the target relationship graph, which is not limited in this specification.

[0043] The following describes the structure of the target relationship graph mentioned above and its construction process.

[0044] The target relationship graph described in this solution may include several entity nodes representing words (also called word nodes), several entity nodes representing category labels (also called label nodes), and connection edges representing the association relationship between entity nodes.

[0045] Figure 2 It shows a schematic diagram of the target relationship graph in an example of this specification. Figure 2In the target relationship graph, each vocabulary node is shown by a white circle, which corresponds to vocabulary w1-w4 respectively; each label node is shown by a gray circle, which corresponds to category labels l1-l4 respectively. In addition, the connection edge between the vocabulary node and the label node represents the belonging relationship, for example, vocabulary w2 belongs to category label l1. The connection edge between each vocabulary node represents the contextual relationship, for example, vocabulary w1 is the previous context of vocabulary w2, and vocabulary w2 is the following context of vocabulary w1. The connection edge between each label node represents the superior-subordinate relationship, for example, category label l3 is a subcategory of category label l2.

[0046] Figure 2 In the example, the label node has a label vector for reflecting the semantic information of the corresponding category label, which can be a fixed representation vector (for example, determined based on a pre-trained word embedding model) or a learnable representation vector, for example, it can be a value gradually determined in the process of iterative training of the target encoder mentioned later (detailed description later). In addition, the vocabulary node has an aggregation vector (also called an enhanced word vector), which is obtained by aggregating the label vectors of the label nodes that have an association relationship with the vocabulary node. In one example, each label vector can be averaged and pooled to obtain the above-mentioned aggregation vector. Of course, in practice, the average pooling can also be replaced by maximum pooling, etc., which is not limited in this specification. For example, the aggregation vector of the vocabulary node corresponding to the vocabulary w2 is obtained by aggregating the label vectors of the label nodes corresponding to the category labels l1-l4, which can be specifically expressed as W2, and the three aggregation vectors corresponding to the other three vocabularies are: W1, W3 and W4, respectively.

[0047] The above-mentioned aggregate vector not only contains the semantic information in the traditional sense, but also integrates the knowledge correlation characteristics from the target relationship graph. In other words, through this aggregate vector, not only a single word can be expressed, but also the overall characteristics of the field to which it belongs can be reflected.

[0048] It should be understood that Figure 2 This is just an exemplary description. In practice, the target relationship graph may also include other entity nodes representing other entity types, and this specification does not limit this.

[0049] In summary, this solution designs an industry relationship network diagram based on vocabulary nodes and label nodes, and innovatively constructs multi-dimensional association relationships between nodes. Among them, vocabulary nodes can capture key terms and entity information in the text. Label nodes can build a hierarchical structure between classification labels. And vocabulary-label edges and label-label edges can form a complete knowledge network.

[0050] It should be noted that by constructing a target relationship graph, this solution can achieve automatic feature extraction and enhancement, and by leveraging the association relationship between the lexical nodes and label nodes in the target relationship graph, relevant features can be automatically discovered. In addition, the target relationship graph constructed by this solution provides a clear knowledge structure and association path, based on which it can be inferred what text is recalled to what category label. Finally, the target relationship graph constructed by this solution supports incremental updates, and new entity nodes and association relationships can be dynamically added, that is, it has the ability to continuously optimize.

[0051] Figure 3 The flowchart of the method for constructing a target relationship graph in an example of this specification is shown. This method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. As Figure 3 shown, the method may include the following steps:

[0052] Step S302, collect a number of corpus texts, and each corpus text has an annotated category label.

[0053] In one example, the above-mentioned corpus text may be enterprise description text, which may include one or more of the following information: company name, bidding information, business scope, patent information, industrial and commercial information, product list information, and announcement information, etc.

[0054] In addition, the annotated category labels of the above-mentioned enterprise description text may include the industry / field to which the enterprise belongs; and / or, the sub-industry / sub-field divided according to the industry / field. For example, the industry / field to which the enterprise belongs may be: steel, cement, glass, new energy, etc., and the industry / sub-field divided according to the steel industry / field may include: steel materials, steel-related information services, etc.

[0055] In another example, the above-mentioned corpus text may be an academic paper, and the corresponding annotated category labels may include the subject field and its sub-fields. Among them, the academic fields may include: natural science, social science, and humanities science, etc. Taking natural science as an example, the corresponding sub-fields may include: physics, chemistry, and biology, etc.

[0056] Step S304, extract each keyword from a number of corpus texts respectively, and determine the target keywords whose corresponding word frequency statistical values are greater than a preset threshold.

[0057] Additionally, before performing the above steps of extracting each keyword, the following preprocessing can be performed on each corpus text: cleaning, standardization, etc. Further, cleaning can include deduplication and error correction; where deduplication means deleting duplicate corpus texts to ensure the uniqueness of the text. Error correction means correcting spelling mistakes, format errors, etc. in the corpus text. Standardization can include format unification and encoding conversion; where format unification means converting corpus texts from different sources into a unified format, such as dates, currency units, etc. Encoding conversion means converting unstructured text into structured text, for example, converting Chinese numerals into Arabic numerals, etc.

[0058] In one example, a rule-based method can be used to extract keywords. For example, the frequency of each word in the corpus text can be counted, and then the words with higher frequencies can be selected as keywords.

[0059] In another example, machine learning-based methods such as the term frequency-inverse document frequency (TF-IDF) algorithm, TextRank algorithm, classification models, etc. can be used to extract keywords.

[0060] In still another example, deep learning-based methods (such as word embedding techniques or pre-trained language models) can be used to extract keywords.

[0061] Additionally, for the above target keywords, they can also be matched with each standard vocabulary in the knowledge base to obtain the standard vocabulary that matches them. For example, calculate the similarity between the target keyword and each standard vocabulary, and select the standard vocabulary with the largest corresponding similarity as the standard vocabulary that matches it.

[0062] In practice, if the maximum similarity is less than the similarity threshold, and the word frequency statistical value of the target keyword is greater than the predetermined threshold, then the target keyword can be added to the knowledge base.

[0063] Step S306, construct the above-mentioned vocabulary nodes based on the target keywords, construct the above-mentioned label nodes based on the labeled category labels of the corpus text, and construct the above-mentioned connection edges at least based on the attribution relationship between the target keywords and the labeled category labels, so as to obtain the above-mentioned target relationship graph.

[0064] It should be understood that in the case where corresponding standard vocabulary is also selected for the target keyword, the above-mentioned vocabulary nodes can be constructed based on the selected standard vocabulary.

[0065] Among them, the attribution relationship between the above-mentioned target keyword and the labeled category label can also be understood as the annotation relationship between the source text of the target keyword and the labeled category label.

[0066] In addition, in practice, the above-mentioned connection edges can also be constructed according to the hierarchical relationship between various category tags and the context relationship between various words.

[0067] It should also be understood that when the above-mentioned connection edges are constructed according to the hierarchical relationship between various category tags in this solution, the constructed target relationship graph simultaneously includes the complex tree structure described above.

[0068] Thus, the above-mentioned target relationship graph is obtained. After that, the label vectors of the label nodes therein can be initialized and iteratively updated during the process of training the target encoder. Of course, the label vector can also be set as a fixed representation vector, and this specification does not limit this.

[0069] The following describes the text classification method based on the target relationship graph.

[0070] Figure 4 The flowchart of the text classification method according to an embodiment of this specification is shown. This method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities. As Figure 4 shown, this method may include the following steps:

[0071] Step S402, obtain the target relationship graph.

[0072] The target relationship graph may include several entity nodes representing words (also referred to as word nodes), several entity nodes representing category tags (also referred to as label nodes), and connection edges representing the association relationships between entity nodes. Specifically, reference can be made to Figure 2 shown.

[0073] Step S404, according to the target text to be classified, determine the target word nodes in the target relationship graph that match it, and obtain the target category tags represented by the target label nodes having an association relationship with the target word nodes.

[0074] Specifically, the target text can be segmented to obtain several target words. It should be understood that this step aims to break down the continuous text stream into individual but semantically complete word units (referred to as words or terms for short) so as to be able to extract information more efficiently and accurately subsequently. Then, the above-mentioned several target words can be respectively compared with the words represented by each word node in the target relationship graph, and the word nodes corresponding to the words with consistent comparison results are determined as the target word nodes. It should be understood that this step aims to map the above-mentioned several target words to the entity nodes in the target relationship graph to recall the relevant target category tags.

[0075] Of course, in practice, the target vocabulary node can also be determined by calculating the similarity between the target vocabulary and each vocabulary node in the target relationship graph. For example, the vocabulary node corresponding to the maximum similarity is determined as the target vocabulary node. This specification does not limit this.

[0076] Step S406, at least input the target text and the target category label into the target encoder.

[0077] In one embodiment, the above-mentioned target encoder can be implemented based on a deep learning model (eg, a convolutional neural network CNN, a recurrent neural network RNN, etc.).

[0078] In another embodiment, the target encoder can be selected from a pre-trained large language model (e.g., a BERT model or a GPT series model). It should be noted that the present solution selects an encoder from a pre-trained large language model, which can reduce the reliance on manual feature engineering and thus improve the model training efficiency.

[0079] Specifically, the word vectors of each word in the target text and the label vectors of the target label nodes corresponding to the target category labels can be combined as target vectors of different types to obtain a target vector sequence. After that, the target vector sequence is input into the target encoder. In other words, any target vector among the target vectors belongs to one of the following types: word vector and label vector.

[0080] It should be noted that the above target category label can be understood as a candidate category label for determining the final classification result of the target text, so the above target category label can also be called a candidate category label. In addition, the target category label here is actually additional information selected from the target relationship graph based on the target text, which can overcome the problem of insufficient information acquisition in traditional technology. In addition, since the target relationship graph can reflect the association relationship between entities, this scheme inputs the recalled target category label into the target encoder, so that the target encoder can understand the semantics of the target text more accurately based on the association relationship between the target text and the target category label, which helps the target encoder to encode the target text more accurately.

[0081] In practice, in addition to the target category label, the additional added information may also include the aggregate vector of the target vocabulary node (also called enhanced word vector). Since the aggregate vector can not only express a single word, but also reflect the overall characteristics of the field to which it belongs, when the aggregate vector is also input into the target encoder, the accuracy of the encoding result output by the target encoder can be further improved.

[0082] Specifically, the word vectors of each word in the target text, the aggregation vector of the target vocabulary node, and the label vector of the target label node corresponding to the target category label are combined as various target vectors of different types to obtain a target vector sequence. Then, the target vector sequence is input into the target encoder. That is to say, any one of the target vectors belongs to one of the following types: word vector, aggregation vector, and label vector.

[0083] In addition, when the target encoder is selected from a pre-trained large language model, the input of the above target encoder can also include the character vector of a predetermined character (i.e., another type of target vector), and the predetermined character is the mask token MASK used by the masked language model MLM during the pre-training of the large language model. It should be noted that by inputting the mask token MASK into the target encoder, the target encoder can learn how to infer missing or hidden information based on the surrounding environment. Or rather, this mask token MASK can help the target encoder better capture potential associated items that are not explicitly listed but should logically exist.

[0084] It should be understood that when the target encoder is selected from a pre-trained large language model, the target encoder can include an attention layer.

[0085] In one embodiment, in this attention layer, for any one target vector v1 among the target vectors, the attention coefficients between the target vector v1 and each target vector are calculated, and each target vector is summed with the attention coefficient of each target vector as the weight factor to obtain a summation result as the updated vector of the target vector v1. In this way, the updated vectors corresponding to each target vector are obtained.

[0086] It should be understood that this is just a simplified expression. In practice, usually, each target vector needs to be mapped into a query vector, a key vector, and a value vector respectively, and then based on the query vector and the key vector, the attention coefficients are calculated, and the value vectors are summed. In addition, based on multiple attention heads, the updated vectors corresponding to each target vector are determined. However, since these are all conventional processing procedures of the attention layer, therefore, this specification simplifies the expression here and in the following text.

[0087] In another embodiment, in this attention layer, for any one of the above target vectors v1, after obtaining the corresponding summation result, the target vector v2 different from the type of the target vector v1 among the target vectors can be superimposed on the basis of the summation result to obtain the updated vector corresponding to the target vector v1. In this way, the updated vectors corresponding to each target vector are obtained.

[0088] Among them, when the target vector v1 is a word vector, the target vector v2 includes at least one of the above-mentioned aggregated vector, label vector, and character vector marked with MASK; when the target vector v1 is an aggregated vector, the target vector v2 includes at least one of the above-mentioned word vector, label vector, and character vector marked with MASK; when the target vector v1 is a label vector, the target vector v2 includes at least one of the above-mentioned word vector, aggregated vector, and character vector marked with MASK; when the target vector v1 is a character vector marked with MASK, the target vector v2 includes at least one of the above-mentioned word vector, aggregated vector, and label vector.

[0089] The following uses an example to illustrate the calculation process of the above-mentioned another embodiment:

[0090] Suppose the target vector sequence is shown in Table 1:

[0091] Table 1

[0092] Word vector 1 Word vector 2 Aggregate vector 1 Aggregate vector 2 Label vector 1 Label vector 2 Character vector w1 w2 W1 W2 l1 l2 M

[0093] Taking w1 as an example, the calculation formula of the corresponding update vector is as follows:

[0094] A1(w1,w1)·w1+A2(w1,w2)·w2+A3(w1,W1)·W1+A4(w1,W2)·W2+A5(w1,l1)·L1+A6(w1,l2)·l2+A7(w1,M)·M+B1(w1,W1)·W1+B2(w1,W2)·W2+C1(w1,l1)·l1+C2(w1,l2)·l2+D(w1,M)·M;

[0095] Among them, Ai, Bi, Ci, and Di represent attention coefficients, and Ai is the attention coefficient used when performing the above summation calculation, and Bi, Ci, and Di are the attention coefficients used when performing the above superposition operation.

[0096] In practice, B1 is equal to A3, B2 is equal to A4, C1 is equal to A5, C2 is equal to A6, and D is equal to A7.

[0097] It should be noted that in the above-mentioned another embodiment, by stacking the target vector v2 again, the target encoder can be made to pay more attention to different types of target vectors, so that the target encoder can adaptively pay attention to different types of important information.

[0098] Of course, in practical applications, the above-mentioned target encoder may further include other network layers such as a feed-forward neural network layer and a layer normalization layer. In short, after being processed by the target encoder, the final vectors corresponding to the above-mentioned target vectors can be obtained. The final vectors are highly abstract and generalizable.

[0099] In one embodiment, the final vectors corresponding to the target vectors can be combined, and the combination result is used as the encoding result output by the target encoder for the target text.

[0100] In another embodiment, the final vector corresponding to the MASK token output by the target encoder can be used as the encoding result output by the target encoder for the target text.

[0101] In short, the present solution proposes a multi-layer input sequence construction technology that fuses the original text, category labels, and enhanced word vectors, breaking through the limitations of traditional single-text input. It should be understood that by constructing this multi-layer input sequence, multi-source information can be effectively integrated, enhancing the feature expression ability of the model. In addition, by introducing the MASK token, the inference of implicit relationships can be realized, and the knowledge learned by the masked language model during pre-training can be efficiently utilized. Finally, in the present solution, the input design of the target encoder supports the dynamic plugging and unplugging of the target relationship graph, and can enhance the multi-label classification ability of the present solution as the data grows.

[0102] Step S408, determine the classification result of the target text according to the encoding result output by the target encoder.

[0103] In one embodiment, the similarity between the encoding result and the label vectors of each category label in the above-mentioned target relationship graph can be calculated in sequence, and then several category labels whose corresponding similarities are greater than a preset threshold are determined as the classification result of the target text.

[0104] Among them, the similarity here can be, for example, cosine similarity, Euclidean distance, Manhattan distance, and Pearson correlation coefficient, etc.

[0105] As mentioned above, when there is a hierarchical relationship among the category labels in the target relationship graph, the category labels form a tree structure or a tree-shaped relationship graph (i.e., a label tree) in the target relationship graph. Each node in it represents a category label, and the nodes with direct hierarchical relationships are connected by connecting edges.

[0106] In the present solution, in the case where the target labels can form a tree-shaped relationship graph, starting from the top layer of the multi-level tree-shaped relationship graph, in the order from top to bottom, based on the encoding result, similar nodes are selected for each layer of nodes until reaching the bottom layer. Then, according to the category labels covered by the path from the similar nodes at the bottom layer to the similar nodes at the top layer selected, the classification result of the target text is determined.

[0107] Among them, the selection of similar nodes for any level i includes: determining each candidate node as the nodes among the nodes at level i that are connected to the similar nodes at level i - 1 by connection edges. Calculate the similarity between the encoding result and each candidate node, and determine the candidate node with the largest corresponding similarity among each candidate node as the similar node at level i.

[0108] Figure 5 Fig. shows a schematic diagram of a classification method based on a tree relationship graph in an example of this specification. Figure 5 In it, first, the similarity between the encoding result of the target text and the label nodes l1 and l2 at the first level can be calculated. Assuming that the similarity corresponding to the label node l1 is the largest, the label node l1 is selected as the similar node at the first level. Then, enter the second level, and determine the label nodes l3 and l4 at the second level as two candidate nodes, and calculate the similarity between the encoding result and the label nodes l3 and l4. Assuming that the similarity corresponding to the label node l4 is the largest, the label node l4 can be selected as the similar node at the second level. Immediately afterwards, enter the third level, and determine the label nodes l5 and l6 at the third level as two candidate nodes, and calculate the similarity between the encoding result and the label nodes l5 and l6. Assuming that the similarity corresponding to the label node l5 is the largest, the label node l5 can be selected as the similar node at the third level. Since the bottom layer has been reached, the category labels corresponding to the label nodes l1, l4, and l5 can be determined as the classification result of the target text.

[0109] In this solution, the classification method from top to bottom based on the tree relationship graph integrates a path constraint mechanism, and the determined classification result conforms to the hierarchical relationship between category labels. This classification method can effectively reduce the classification difficulty and improve the model performance. In addition, this solution classifies the text based on the hierarchical structure of the label tree, and can display the reasoning process of the classification decision.

[0110] So far, the classification process for a text is completed.

[0111] It should be noted that when the above target text is the text in the training text set for training the target encoder, then the classification loss can also be calculated based on the above encoding result and the labeled category label of the target text using the cross-entropy loss function. Then, based on the comprehensive loss of the classification losses corresponding to each text in the training text set, using the backpropagation method, the update gradients corresponding to the parameters of the target encoder are calculated respectively, and the parameters of the target encoder are updated based on them to obtain the trained target encoder.

[0112] In addition, based on the above comprehensive loss, the update gradients of the label vectors corresponding to each label node can be calculated, and the label vectors of each label node can be updated accordingly to obtain the finally used label vectors (i.e., the label vectors used to calculate the aggregated vectors).

[0113] It should be noted that the training process of the target encoder is also simplified here. In practice, the training of the target encoder usually includes multiple rounds of iteration, and the label vectors of each label node are also continuously updated in multiple rounds of iteration. However, since the iterative training of machine learning models is a conventional design, this solution will not be elaborated here.

[0114] Figure 6 The schematic diagram of the text classification method in an example of this specification is shown. Figure 6 In it, the target relationship graph includes vocabulary nodes w1 - w4 representing vocabulary, label nodes l1 - l4 representing category labels, and connection edges between the nodes. In addition, the label nodes l1 - l4 have label vectors for reflecting the semantic information of the corresponding category labels, and the vocabulary nodes w1 - w4 have aggregated vectors (also called enhanced word vectors), which can be obtained by aggregating the label vectors of the label nodes associated with the vocabulary node. The aggregated vectors corresponding to the nodes w1 - w4 are respectively represented as: W1 - W4.

[0115] Figure 6 In it, assuming that after classifying the target text to be classified, the vocabulary: w1, w2, and w3 can be obtained, then based on this target text, 3 target vocabulary nodes: w1 - w3 can be determined from the target relationship graph. Among them, based on the target vocabulary node w2, the target category labels: l1 - l4 can be obtained, and based on the target vocabulary node w3, the target category label l3 can be obtained. Thus, the finally obtained target category labels include: l1 - l4.

[0116] After that, the word vectors of w1, w2, and w3 (represented by w1, w2, and w3), the aggregated vectors of w1, w2, and w3 (represented by W1, W2, and W3), the label vectors of l1 - l4 (represented by l1, l2, l3, and l4), and the character vector of the MASK character (represented by M) can be combined to obtain the target vector sequence. Then, the target vector sequence is input into the target encoder to obtain the encoding result of the target text.

[0117] Finally, the similarity between the encoding result and each category label l1 - l4 is calculated, and based on this similarity, the classification result of the text is determined: l1 and l3.

[0118] From Figure 6It can be seen that this solution has developed a label prediction optimization technology assisted by a relational network graph, which improves the accuracy of multi-label classification. Specifically, on the one hand, candidate category labels can be initially recalled through the relational network graph; on the other hand, classification can be performed layer by layer from top to bottom based on the relational network graph. Compared with the prior art, this solution has significant advantages in terms of knowledge utilization, feature expression, and classification performance. At the same time, due to the clear structure of the relational network graph, the selection of the final classification label is highly interpretable.

[0119] In summary, the text classification method provided in this embodiment of the specification can classify text based on a target relational graph. Specifically, the category labels recalled from the target relational graph that match the text to be classified, as well as the enhanced word vectors of the entity nodes that match the text to be classified, can be used as additional information and input into the encoder. As a result, the encoder can more accurately understand the semantics of the text to be classified, and then output an accurate encoding result, which helps to improve the accuracy of text classification.

[0120] Corresponding to the above text classification method, an embodiment of this specification also provides a text classification device, as Figure 7 shown. The device may include:

[0121] An acquisition unit 702, configured to acquire a target relational graph, which includes a plurality of first entity nodes representing vocabulary, a plurality of second entity nodes representing category labels, and connection edges representing the association relationships between the entity nodes.

[0122] A determination unit 704, configured to determine, according to the target text to be classified, target first entity nodes that match it from the target relational graph, and acquire target category labels represented by target second entity nodes that have an association relationship with the target first entity nodes.

[0123] An input unit 706, configured to input at least the target text and the target category labels into the target encoder.

[0124] The determination unit 704 is further configured to determine the classification result of the target text according to the encoding result output by the target encoder.

[0125] In one embodiment, a single first entity node has an aggregation vector, which is obtained by aggregating the label vectors of second entity nodes that have an association relationship with the first entity node;

[0126] The input unit 706 includes:

[0127] The combinatorial sub-module 7062 is configured to combine the word vectors of each word in the target text, the aggregated vector of the target first entity node, and the label vector of the target second entity node corresponding to the target category label as respective target vectors of different types to obtain a target vector sequence;

[0128] The input sub-module 7064 is configured to input the target vector sequence into the target encoder.

[0129] In one embodiment, the target encoder includes an attention layer;

[0130] The input sub-module 7064 is specifically configured to:

[0131] In the attention layer, for any first target vector among the respective target vectors, calculate the attention coefficients of the first target vector and the respective target vectors, and sum the respective target vectors with the respective attention coefficients of the respective target vectors as weight factors to obtain a summation result;

[0132] Based on the above summation result, further stack second target vectors different in type from the first target vector among the respective target vectors to obtain an updated vector corresponding to the first target vector, and thus obtain updated vectors corresponding to the respective target vectors, which are used to determine the above encoding result.

[0133] Wherein, when the first target vector is the word vector, the second target vectors include the aggregated vector and the label vector;

[0134] When the first target vector is the aggregated vector, the second target vectors include the word vector and the label vector;

[0135] When the first target vector is the label vector, the second target vectors include the word vector and the aggregated vector.

[0136] In one embodiment, the apparatus further includes:

[0137] The collection unit 708 is configured to collect a plurality of corpus texts, and each corpus text has an annotated category label;

[0138] The extraction unit 710 is configured to extract respective keywords from the plurality of corpus texts and determine target keywords with a word frequency statistical value greater than a preset threshold therefrom;

[0139] The construction unit 712 is configured to construct a first entity node based on the target keywords, construct a second entity node based on the annotated category labels of the corpus texts, and construct connection edges at least based on the attribution relationship between the target keywords and the annotated category labels, so as to obtain the above target relationship graph.

[0140] In one embodiment, the annotation category labels corresponding to several corpus texts have a hierarchical relationship, and the construction unit 712 is specifically configured to:

[0141] Based on the attribution relationship, construct a first connection edge between the first entity node and the second entity node;

[0142] Based on the hierarchical relationship, construct second connection edges between the second entity nodes.

[0143] In one embodiment, a single corpus text is an enterprise description text, and the annotation category labels of a single corpus text include the industry / field to which the enterprise belongs; and / or, the sub-industry / sub-field divided according to the industry / field.

[0144] In one embodiment, the determination unit 704 includes:

[0145] A word segmentation sub-module 7042, configured to perform word segmentation on the target text to obtain a number of target words;

[0146] A comparison sub-module 7044, configured to respectively compare a number of target words with the words represented by each first entity node in the target relationship graph, and determine the first entity node corresponding to the word with a consistent comparison as the target first entity node.

[0147] In one embodiment, the above-mentioned target relationship graph includes multiple category labels with a hierarchical relationship, and the multiple category labels form a multi-level tree relationship graph, where each node represents a category label, and the nodes with a direct hierarchical relationship are connected by connection edges;

[0148] The determination unit 704 further includes:

[0149] A selection sub-module 7046, configured to start from the top layer of the multi-level tree relationship graph, and select similar nodes for each layer of nodes in the order from top to bottom based on the coding result until reaching the bottom layer;

[0150] A determination sub-module 7048, configured to determine the classification result of the target text according to the category labels covered by the path from the similar nodes in the bottom layer to the similar nodes in the top layer selected.

[0151] In one embodiment, the selection sub-module 7046 is specifically configured to:

[0152] Determine each candidate node as the nodes in the current layer that are connected to the similar nodes in the previous layer by connection edges;

[0153] Calculate the similarity between the coding result and each candidate node, and determine the candidate node with the largest corresponding similarity among the candidate nodes as the similar node in the current layer.

[0154] In one embodiment, the target encoder is selected from pre-trained large language models. The input of the target encoder further includes a predetermined character, which is the masked token used by the masked language model during the pre-training of the large language model;

[0155] The above encoding result is the representation vector corresponding to the predetermined character output by the target encoder.

[0156] In one embodiment, the above second entity node has a label vector, and the device further includes:

[0157] A calculation unit 714, configured to calculate a classification loss according to the encoding result and the annotation category label of the target text;

[0158] An update unit 716, configured to update the target encoder and the label vector of the target second entity node according to the classification loss.

[0159] The functions of the functional units of the device in the above embodiments of this specification can be implemented by the steps of the above method embodiments. Therefore, the specific working process of the device provided in an embodiment of this specification will not be repeated here.

[0160] The text classification device provided in an embodiment of this specification can classify texts efficiently and accurately.

[0161] According to an embodiment of another aspect, there is also provided a computer-readable storage medium, on which a computer program is stored. When the computer program is executed in a computer, the computer is made to execute the combination Figure 4 The method described.

[0162] According to an embodiment of still another aspect, there is also provided a computing device, including a memory and a processor. An executable code is stored in the memory. When the processor executes the executable code, the method described in the combination Figure 4 The method described.

[0163] The embodiments in this specification are all described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the differences emphasized in each embodiment are those different from other embodiments. In particular, for the medium or device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.

[0164] The steps of the methods or algorithms described in connection with the disclosure of this specification may be implemented in hardware or by a processor executing software instructions. The software instructions may be composed of corresponding software modules, and the software modules may be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable hard disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may be located in an ASIC. Additionally, the ASIC may be located in a server. Of course, the processor and the storage medium may also exist as discrete components in the server.

[0165] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many method flow improvements today can be regarded as direct improvements to hardware circuit structures. Almost all designers obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented using a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. Designers can program themselves to "integrate" a digital system onto a single PLD without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL), and there is not just one type of HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow using the above-mentioned several hardware description languages and programming it into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.

[0166] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26k20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers to achieve the same function. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or structures within the hardware component.

[0167] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the development of future computer technologies, the computers for implementing the functions of the above embodiments can be, for example, personal computers, laptop computers, in-vehicle human-machine interaction devices, cellular phones, camera phones, smart phones, personal digital assistants, media players, navigation devices, email devices, game consoles, tablet computers, wearable devices, or any combination of these devices.

[0168] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way among the execution orders of numerous steps and does not represent the only execution order. When the actual device or terminal product is executed, it may be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (such as in an environment of parallel processors or multi-threaded processing, or even in a distributed data processing environment). The term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, product or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, product or device. Without further limitation, there is no exclusion of additional identical or equivalent elements in the process, method, product or device comprising the said elements. For example, if terms such as first and second are used to denote names, they do not denote any particular order.

[0169] For the convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing one or more of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware, or the modules implementing the same function can be realized by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in the form of electricity, mechanics or others.

[0170] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0171] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in the block or blocks.

[0172] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes and / or blocks Figure 1 in one or more processes and / or blocks Figure 1 specified in the block or blocks.

[0173] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0174] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.

[0175] Computer-readable media includes permanent and non-permanent, removable and non-removable media and can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage, graphene storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

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

[0177] One or more embodiments of this specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0178] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the related content. In the description of this specification, the description of reference terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0179] The above description is only for the embodiments of one or more embodiments of this specification and is not used to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims.

Claims

1. A text classification method, comprising: Obtaining a target relationship graph, which includes a plurality of first entity nodes representing vocabulary, a plurality of second entity nodes representing category labels, and connection edges representing association relationships between the entity nodes; According to the target text to be classified, determining a target first entity node that matches the target text from the target relationship graph, and obtaining a target category label represented by a target second entity node that has an association relationship with the target first entity node; Inputting at least the target text and the target category label into a target encoder; The classification result of the target text is determined according to the encoding result output by the target encoder.

2. The method according to claim 1, wherein: A single first entity node has an aggregate vector obtained by aggregating label vectors of second entity nodes having an association relationship with the first entity node; The step of inputting the target text and the target category label into a target encoder comprises: Combining the word vectors of each word in the target text, the aggregate vector of the target first entity node, and the label vector of the target second entity node corresponding to the target category label as different types of target vectors to obtain a target vector sequence; The target vector sequence is input into a target encoder.

3. The method according to claim 2, wherein: The target encoder comprises an attention layer; The step of inputting the target vector sequence into a target encoder comprises: In the attention layer, for any first target vector among the target vectors, an attention coefficient between the first target vector and each target vector is calculated, and each target vector is summed using the attention coefficient of each target vector as a weight factor to obtain a sum result; On the basis of the summation result, a second target vector of a type different from that of the first target vector is superimposed again among the target vectors to obtain an update vector corresponding to the first target vector, thereby obtaining an update vector corresponding to each target vector, which is used to determine the encoding result.

4. The method according to claim 3, wherein: In the case where the first target vector is the word vector, the second target vector includes the aggregation vector and the label vector; In the case where the first target vector is the aggregate vector, the second target vector includes the word vector and the label vector; In the case where the first target vector is the label vector, the second target vector includes the word vector and the aggregation vector.

5. The method according to claim 1, wherein: The target relationship graph is constructed by the following steps: Collect several corpus texts; each corpus text has an annotated category label; Extracting keywords from the plurality of corpus texts respectively, and determining target keywords whose corresponding word frequency statistics are greater than a preset threshold value; The first entity node is constructed based on the target keyword, the second entity node is constructed based on the annotated category label of the corpus text, and the connecting edge is constructed based on at least the attribution relationship between the target keyword and the annotated category label, so as to obtain the target relationship graph.

6. The method according to claim 5, wherein: The annotation category labels corresponding to the plurality of corpus texts have a superior-subordinate relationship; The step of constructing the connecting edge comprises: Based on the belonging relationship, construct a first connection edge between the first entity node and the second entity node; Based on the superior-subordinate relationship, a second connection edge is constructed between the second entity nodes.

7. The method according to claim 5, wherein: A single corpus text is a description text of an enterprise, and the annotation category labels of the single corpus text include the industry / field to which the enterprise belongs; and / or the sub-industries / sub-fields divided according to the industry / field.

8. The method according to claim 1, wherein: The step of determining a target first entity node that matches the target relationship graph includes: Segmenting the target text to obtain a number of target words; The target words are respectively compared with the words represented by the first entity nodes in the target relationship graph, and the first entity nodes corresponding to the words that are matched consistently are determined as the target first entity nodes.

9. The method according to claim 1, wherein: The target relationship graph includes a plurality of category labels having a superior-subordinate relationship, and the plurality of category labels form a multi-level tree relationship graph, wherein each node represents a category label, and the nodes having a direct superior-subordinate relationship are connected by connecting edges; Determining the classification result of the target text includes: Starting from the top layer of the multi-level tree relationship diagram, similar nodes are selected for nodes of each layer based on the encoding result in descending order until the bottom layer is reached; The classification result of the target text is determined according to the category labels covered by the selected path from the lowest layer similar node to the highest layer similar node.

10. The method according to claim 9, wherein: The similar node selection includes: Determine the nodes in the current layer that are connected to similar nodes in the previous layer through connecting edges as candidate nodes; The similarity between the encoding result and each candidate node is calculated, and the candidate node with the largest corresponding similarity among the candidate nodes is determined as the similar node of the current layer.

11. The method according to claim 1, wherein: The target encoder is selected from a pre-trained large language model; the input of the target encoder also includes a predetermined character; the predetermined character is a mask mark used by the mask language model in the pre-training of the large language model; The encoding result is a representation vector corresponding to a predetermined character output by the target encoder.

12. The method according to claim 1, wherein: The second entity node has a label vector; the method further includes: Calculating classification loss based on the encoding result and the annotated category label of the target text; According to the classification loss, the target encoder and the label vector of the target second entity node are updated.

13. A text classification device, comprising: An acquisition unit, used to acquire a target relationship graph, which includes a plurality of first entity nodes representing vocabulary, a plurality of second entity nodes representing category labels, and connection edges representing association relationships between the entity nodes; A determination unit, configured to determine, according to the target text to be classified, a target first entity node that matches the target text from the target relationship graph, and obtain a target category label represented by a target second entity node that has an association relationship with the target first entity node; An input unit, used for inputting at least the target text and the target category label into a target encoder; The determination unit is further used to determine the classification result of the target text according to the encoding result output by the target encoder.

14. A computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 12 is implemented.