Text label generation, model training, text classification method and related device

By constructing a concept tree to obtain meta-concept paths and hierarchical relationships to determine label words, the problem of limited category label encoding is solved, thereby improving the accuracy of text classification models and the performance of classification tasks.

CN116127348BActive Publication Date: 2026-04-21MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MASHANG CONSUMER FINANCE CO LTD
Filing Date
2022-11-03
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, the encoding of category labels is limited by the semantics of keywords, which affects the accuracy of text classification models and the performance of classification tasks.

Method used

By constructing a concept tree, meta-concept paths are obtained from sample texts of the target classification task. The hierarchical relationship between meta-concepts is used to determine label words as category labels, thereby enhancing the semantic representation of the sample text.

Benefits of technology

It improves the training accuracy and classification task execution accuracy of the text classification model, provides more accurate supervision signals, and enhances the model's classification performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116127348B_ABST
    Figure CN116127348B_ABST
Patent Text Reader

Abstract

This application discloses a text label generation, model training, and text classification method and related equipment, which addresses the problem that category labels obtained in related technologies cannot accurately describe the category to which the sample corpus belongs, thus affecting the accuracy of the subsequently trained text classification model and the execution accuracy of text classification tasks based on the text classification model. The text label generation method includes: obtaining the meta-concept path corresponding to the sample text from a pre-constructed concept tree based on keywords in the sample text corresponding to the target classification task; the concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent the hierarchical relationship between multiple target meta-concepts related to the sample text in the concept tree; searching for label words in a pre-set meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts to determine the label words corresponding to the sample text and use them as the category labels corresponding to the sample text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method and related equipment for text label generation, model training, and text classification. Background Technology

[0002] Currently, pre-trained language models used in Natural Language Processing (NLP) mainly focus on encoding input data, specifically including encoding sample text and encoding the category labels corresponding to the sample text.

[0003] In text classification tasks, especially hierarchical classification tasks, encoding the category labels corresponding to the sample corpus is crucial. Related techniques typically involve identifying keywords from the sample corpus as category labels to represent the category to which the sample corpus belongs, and then encoding these keywords to achieve the category label encoding.

[0004] However, in practical applications, the connotation of keywords is affected by the context. The meaning of the category labels obtained by the above method is limited by the semantics of the keywords in the sample corpus and cannot represent the category to which the sample corpus belongs. This affects the accuracy of the text classification model trained based on the encoding results of the sample text and its corresponding category labels, and thus affects the accuracy of the text classification task based on the text classification model. Summary of the Invention

[0005] The purpose of this application is to provide a method and related equipment for text label generation, model training, and text classification, which solves the problem that the category labels obtained in related technologies cannot accurately describe the category to which the sample corpus belongs, thus affecting the accuracy of the subsequently trained text classification model and the execution accuracy of the text classification task based on the text classification model.

[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0007] In a first aspect, embodiments of this application provide a text tag generation method, including:

[0008] Based on the keywords in the sample text corresponding to the target classification task, the meta-concept path corresponding to the sample text is obtained from the pre-constructed concept tree. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a linguistic unit used to represent the meaning of a word.

[0009] Based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, a tag word search is performed in a preset meta-concept table to determine the tag words corresponding to the sample text. The tag words are used to represent the category to which the sample text belongs under the target classification task. The preset meta-concept table is used to represent the mapping relationship between words and word vectors.

[0010] The labeled words are determined as the category labels corresponding to the sample text.

[0011] The text label generation method provided in this application considers that meta-concepts are information obtained by abstracting the common essential characteristics of things perceived by humans. They can accurately describe the connotation of things and thus distinguish different things from their essence without being affected by context. Based on this, a pre-constructed concept tree representing the hierarchical relationship between multiple meta-concepts is used to determine multiple target meta-concepts related to the sample text and the hierarchical relationship between multiple target meta-concepts from the concept tree based on the keywords in the sample text corresponding to the target classification task. This allows these target meta-concepts to fundamentally reflect the semantics of the sample text. Furthermore, based on the hierarchical relationship between multiple target meta-concepts, the label words corresponding to the sample text are determined as category labels. This allows the semantics of the sample text to be enhanced through the hierarchical relationship between multiple target meta-concepts. As a result, the obtained label words as category labels can more accurately represent the category to which the sample text belongs under the target classification task, thereby providing a more accurate supervision signal for the text classification model. This is beneficial to improving the accuracy of the text classification model trained based on the sample text and its corresponding category labels, as well as the execution accuracy of the text classification task based on the text classification model.

[0012] Secondly, embodiments of this application provide a method for training a text classification model, including:

[0013] Obtain the sample text corresponding to the target classification task and the category label corresponding to the sample text, wherein the category label corresponding to the sample text is obtained based on the text label generation method described in the first aspect;

[0014] The sample text is encoded to obtain the text vector corresponding to the sample text;

[0015] The category label is encoded to obtain the label vector corresponding to the category label;

[0016] Based on the text vector corresponding to the sample text and the label vector corresponding to the category label, a text classification model is trained to perform the target classification task.

[0017] The text classification model training method provided in this application provides that, since the category labels obtained by the above-mentioned text label generation method can more accurately represent the category to which the sample text belongs under the target classification task, after obtaining the category labels corresponding to the sample text by the above-mentioned text label generation method, the sample text and its corresponding category labels are encoded respectively, and the text classification model for performing the target classification task is trained based on the encoding results of the sample text and its corresponding category labels. This enables the text classification model to learn and understand the semantics of the sample text more accurately from the supervision signals provided by the category labels corresponding to the sample text, thereby improving the training effect of the text classification model and helping to improve the classification accuracy of the text classification model.

[0018] Thirdly, embodiments of this application provide a text classification method, including:

[0019] Get the text to be processed;

[0020] The text to be processed is subjected to a target classification task by a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method described in the first aspect.

[0021] The text classification method provided in this application provides a more accurate representation of the category to which the sample text belongs under the target classification task by obtaining the category label corresponding to the sample text through the above-mentioned text label generation method. This provides a more accurate supervision signal for the text classification model and is beneficial to improving the accuracy of the text classification model trained on the sample text and its corresponding category label. On this basis, the text classification model trained is used to perform the target classification task on the text to be processed, which is beneficial to improving the classification accuracy of the text to be processed.

[0022] Fourthly, embodiments of this application provide a text tag generation apparatus, comprising:

[0023] The acquisition unit is used to acquire the meta-concept path corresponding to the sample text from a pre-constructed concept tree based on the keywords in the sample text corresponding to the target classification task. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a language unit used to represent the meaning of a word.

[0024] The determining unit is used to search for tag words in a preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, and to determine the tag words corresponding to the sample text. The tag words are used to represent the category to which the sample text belongs under the target classification task. The preset meta-concept table is used to represent the mapping relationship between words and word vectors.

[0025] The determining unit is further configured to determine the label words as category labels corresponding to the sample text.

[0026] Fifthly, embodiments of this application provide a training apparatus for a text classification model, comprising:

[0027] The acquisition unit is used to acquire sample text corresponding to the target classification task and category labels corresponding to the sample text, wherein the category labels corresponding to the sample text are obtained based on the text label generation method described in the first aspect.

[0028] The encoding unit is used to encode the sample text to obtain the text vector corresponding to the sample text;

[0029] The encoding unit is also used to encode the category label to obtain the label vector corresponding to the category label;

[0030] The training unit is used to train a text classification model for performing the target classification task based on the text vector corresponding to the sample text and the label vector corresponding to the category label.

[0031] Sixthly, embodiments of this application provide a text classification device, including:

[0032] The acquisition unit is used to acquire the text to be processed.

[0033] A classification unit is used to perform a target classification task on the text to be processed using a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method described in the first aspect.

[0034] In a seventh aspect, embodiments of this application provide an electronic device, including: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method as described in the first aspect; or, the processor is configured to execute the instructions to implement the method as described in the second aspect; or, the processor is configured to execute the instructions to implement the method as described in the third aspect.

[0035] Eighthly, embodiments of this application provide a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method described in the first aspect; or, enables the electronic device to perform the method described in the second aspect; or, enables the electronic device to perform the method described in the third aspect. Attached Figure Description

[0036] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0037] Figure 1 A flowchart illustrating a text tag generation method provided in one embodiment of this application;

[0038] Figure 2 A schematic diagram of a concept tree structure provided for one embodiment of this application;

[0039] Figure 3 A flowchart illustrating a method for constructing a concept tree, provided as an embodiment of this application;

[0040] Figure 4 A flowchart illustrating a method for constructing a preset meta-concept table and a meta-concept mapping table, provided as an embodiment of this application;

[0041] Figure 5 A flowchart illustrating a training method for a text classification model provided in one embodiment of this application;

[0042] Figure 6 A flowchart illustrating a text classification method provided in one embodiment of this application;

[0043] Figure 7 A schematic diagram of a text tag generation device provided in one embodiment of this application;

[0044] Figure 8 A schematic diagram of the structure of a training device for a text classification model provided in one embodiment of this application;

[0045] Figure 9 A schematic diagram of the structure of a text classification device provided in one embodiment of this application;

[0046] Figure 10 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0048] The terms "first," "second," etc., used in this specification and claims are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in this specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0049] Explanation of some concepts:

[0050] Natural Language Processing (NLP) is an important field in computer science and artificial intelligence. It studies various theories and methods that enable effective communication between humans and computers using natural language.

[0051] BERT, short for Bidirectional Encoder Representation from Transformers, is a pre-trained language model. It emphasizes a departure from traditional unidirectional language models or shallow concatenation of two unidirectional language models for pre-training. Instead, it employs a novel Masked Language Model (MLM) to generate deep, bidirectional language representations.

[0052] Word2vec is a group of models used to generate word vectors. These models are shallow, two-layer neural networks trained to reconstruct linguistic word text. The network represents words and needs to guess the input words in adjacent positions. Under the bag-of-words assumption in Word2vec, the order of words is unimportant. After training, word2vec can be used to map each word to a vector, which can be used to represent the relationship between words. This vector is the hidden layer of the neural network.

[0053] ppl: short for perplexity, which measures the performance of a language model on an unseen string S. For a string S of length N, the language model gives a probability P(S), and the corresponding perplexity is 2^{-(1 / N)log2 P(S)}. The string length can be in units of characters or words.

[0054] TTS stands for Text to Speech, also known as speech synthesis or text-to-speech conversion.

[0055] ASR stands for Automatic Speech Recognition.

[0056] Meta-concepts are abstractions and generalizations of the common essential characteristics of perceived things, representing a shift from sensory to rational understanding during the cognitive process. They are expressions of self-awareness and form a habitual conceptual way of thinking. Meta-concepts are the most basic building blocks in the human cognitive system, used to represent information obtained through abstracting the common essential characteristics of perceived things. In other words, meta-concepts are linguistic units used to represent the meaning of words. Meta-concepts exist in a hierarchical relationship; a single thing can be described using multiple levels of meta-concepts. For example, "object—real thing—plant—flower" describes the thing "flower," "object—animal—feline" describes the thing "tiger," and so on.

[0057] As mentioned earlier, the encoding of category labels in related technologies typically involves identifying keywords from the sample corpus as category labels to represent the category to which the sample corpus belongs, and then encoding these keywords to achieve the category label encoding. However, in practical applications, the connotation of keywords is affected by the context, and the meaning of the category labels obtained by the above method is limited by the semantics of the keywords in the sample corpus and cannot represent the category to which the sample corpus belongs. This affects the accuracy of the text classification model trained based on the encoding results of the sample text and its corresponding category labels, and consequently affects the accuracy of the text classification task based on the text classification model.

[0058] In view of this, the embodiments of this application aim to propose a text label generation method. Considering that meta-concepts are information obtained by abstracting the common essential characteristics of things perceived by humans, they can truly and accurately describe the connotation of things, and thus can distinguish different things in essence without being affected by context. Based on this, a concept tree representing the hierarchical relationship between multiple meta-concepts is pre-constructed. Based on the keywords in the sample text corresponding to the target classification task, multiple target meta-concepts related to the sample text and the hierarchical relationship between multiple target meta-concepts are determined from the concept tree, so that these target meta-concepts can fundamentally reflect the semantics of the sample text. Furthermore, based on the hierarchical relationship between multiple target meta-concepts, the label words corresponding to the sample text are determined as category labels, so that the semantics of the sample text can be enhanced by the hierarchical relationship between multiple target meta-concepts. In this way, the obtained label words as category labels can more accurately represent the category to which the sample text belongs under the target classification task, thereby providing a more accurate supervision signal for the text classification model. This is beneficial to improving the accuracy of the text classification model trained on the sample text and its corresponding category labels, as well as the execution accuracy of the text classification task based on the text classification model.

[0059] This application also proposes a training method for a text classification model. Since obtaining the category label corresponding to the sample text through the above-mentioned text label generation method can more accurately represent the category to which the sample text belongs under the target classification task, after obtaining the category label corresponding to the sample text through the above-mentioned text label generation method, the sample text and its corresponding category label are encoded respectively. Furthermore, the text classification model for performing the target classification task is trained based on the encoding results of the sample text and its corresponding category label. This enables the text classification model to learn and understand the semantics of the sample text more accurately from the supervision signal provided by the category label corresponding to the sample text, thereby improving the training effect of the text classification model and helping to improve the classification accuracy of the text classification model.

[0060] This application also proposes a text classification method. Since the category label obtained by the above-mentioned text label generation method can more accurately represent the category to which the sample text belongs under the target classification task, it provides a more accurate supervision signal for the text classification model, which is conducive to improving the accuracy of the text classification model trained on the sample text and its corresponding category label. On this basis, the text classification model trained is used to perform the target classification task on the text to be processed, which is conducive to improving the classification accuracy of the text to be processed.

[0061] It should be understood that the text tag generation method, text classification model training method, and text classification method provided in the embodiments of this application can all be executed by electronic devices or software installed in electronic devices. The term "electronic device" here may include terminal devices, such as smartphones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, smartwatches, vehicle terminals, aircraft, etc.; or, the electronic device may also include a server, such as a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0062] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0063] Please see Figure 1 The following is a flowchart illustrating a text tag generation method according to an embodiment of this application. The method may include the following steps:

[0064] S102, based on the keywords in the sample text corresponding to the target classification task, obtain the meta-concept path corresponding to the sample text from the pre-constructed concept tree.

[0065] In this embodiment of the application, the target classification task refers to the task of classifying text, which may include, but is not limited to, at least one of the following classification tasks: sentiment classification, intent classification, news classification, spam detection, etc.

[0066] Different classification tasks correspond to different sample texts. For example, the sample text for a sentiment classification task can include sample texts with different sentiments, such as positive sample texts expressing at least one positive sentiment like liking or sympathy, and negative sample texts expressing at least one negative sentiment like anger, sadness, or fear; similarly, the sample text for an intent classification task can include sample texts with different intents, such as sample texts asking for addresses, product inquiries, or after-sales service inquiries; furthermore, the sample text for a spam detection task can include normal email content text as positive sample text and spam content text as negative sample text, and so on.

[0067] In this embodiment, a concept tree is used to represent the hierarchical relationship between multiple meta-concepts. The hierarchical relationship between meta-concepts can include, but is not limited to, at least one of the following: hierarchical relationship, same-position relationship, etc. Specifically, the concept tree includes multiple nodes and connecting edges between the nodes. Each node corresponds to a meta-concept, and the connecting edges represent the hierarchical relationship between the connected nodes. A meta-concept in the concept tree is a linguistic unit used to represent the meaning of a word. For example, Figure 2The diagram illustrates concept tree 1, which is composed of meta-concepts related to objects; concept tree 2, which is composed of meta-concepts related to actions; and concept tree 3, which is composed of meta-concepts related to attitudes. Taking concept tree 1 as an example, for each node, the meta-concept corresponding to that node and the meta-concept corresponding to the next level node are in a hierarchical relationship. For example, the meta-concept "object" and the meta-concept "physical object" and the meta-concept "abstract object" are in a hierarchical relationship. Nodes at the same level are in a peer relationship. For example, the meta-concept "physical object" and the meta-concept "abstract object" are in a peer relationship, and so on.

[0068] In practical applications, before step S102 above, the concept tree can be constructed using any suitable method. In one optional implementation, to ensure the constructed concept tree can cover the meta-concepts that may be involved in various text classification tasks, thereby improving the accuracy of category labels for various text classification tasks, such as... Figure 3 As shown, the above concept tree can be constructed through the following steps:

[0069] Step A1: Obtain the text set.

[0070] The text set includes texts corresponding to multiple classification tasks. For example, these multiple classification tasks may include, but are not limited to, intent classification tasks, sentiment classification tasks, news classification, and spam detection. Each classification task can correspond to multiple types of text; for instance, an intent classification task can correspond to texts with various intents, a sentiment classification task can correspond to texts expressing positive and negative sentiments, a news classification task can correspond to multiple categories of news texts, and a spam detection task can correspond to legitimate email content texts and spam email content texts, and so on.

[0071] Step A2 involves performing semantic analysis on the keywords in the texts within the text set to obtain a meta-concept set.

[0072] The meta-concept set includes the meta-concepts involved in the texts within the text set.

[0073] For each classification task, the keywords in the text refer to the words in the text that are related to that classification task. Specifically, the keywords in the text can be obtained by segmenting the text into words, then parsing each word to get the words related to the classification task.

[0074] In practical applications, if the classification task is an emotion classification task, words expressing emotions (such as words expressing positive emotions like liking and sympathy, and words expressing negative emotions like anger, resentment, and sadness) and words indicating the subject to which the emotion is directed (such as words indicating objects) can be extracted from the text corresponding to this classification task as keywords. If the classification task is an intention classification task, words expressing intention (such as the strong agentive verb "like" expressing semantic intention and the strong agentive verb "take away" expressing pragmatic intention) can be extracted from the text corresponding to this classification task as keywords, and so on.

[0075] Step A3 involves classifying the meta-concepts in the meta-concept set to obtain multiple meta-concept subsets.

[0076] Each meta-concept subset includes meta-concepts of the same category. For example, considering that the meta-concepts involved in text classification tasks typically include object-related meta-concepts, action-related meta-concepts, and attitude-related meta-concepts—for instance, intention classification tasks typically involve objects and actions, while sentiment classification tasks include two sub-tasks: identifying the speaker's attitude towards each subject in the sentence and the emotional tone conveyed by the speaker when speaking the entire sentence. The former typically involves objects and attitudes, while the latter typically involves attitudes, etc.—we can thus classify the meta-concepts in the meta-concept set according to objects, actions, and attitudes, obtaining object-related meta-concept subsets, action-related meta-concept subsets, and attitude-related meta-concept subsets.

[0077] Step A4: Based on the hierarchical relationship between meta-concepts in each meta-concept subset, construct the concept tree corresponding to each meta-concept subset.

[0078] The concept tree corresponding to each subset of meta-concepts is used to represent the hierarchical relationship between meta-concepts of the same category.

[0079] Specifically, for each subset of meta-concepts, a corresponding node can be created for each meta-concept within that subset. Connecting edges are then created between nodes corresponding to meta-concepts with hierarchical relationships, thus obtaining the concept tree corresponding to that subset of meta-concepts. For example, Figure 2 The diagram shows concept tree 1 for objects, concept tree 2 for actions, and concept tree 3 for attitudes.

[0080] In this embodiment, keywords in the sample text refer to words in the sample text that are related to the target classification task. Specifically, keywords in the sample text can be obtained by segmenting the sample text into words, then parsing each word to obtain words related to the target classification task as keywords.

[0081] Meta-concept paths are used to represent multiple target meta-concepts related to the sample text in the concept tree, as well as the hierarchical relationships between these target meta-concepts. After obtaining the keywords in the sample text, the semantics of the keywords can be analyzed. Based on the semantic analysis results, the meta-concepts involved in the keywords are determined from the concept tree and used as target meta-concepts related to the sample text. Paths containing these target meta-concepts are selected from the concept tree as the aforementioned meta-concept paths, thus obtaining the hierarchical relationships between the target meta-concepts related to the sample text. It is evident that these target meta-concepts and their hierarchical relationships can fundamentally reflect the semantics of the sample text without being affected by the context. Specifically, the semantics of a word are the breakdown of its rational meaning. A word can have at least one rational meaning, and each rational meaning corresponds to a semantic item. For example, the semantic item of the word "man" can be "male adult." By analyzing the semantics of this word, the meta-concepts involved in the word and their hierarchical relationships can be obtained as follows: object -> physical object -> animal -> higher animal -> person -> male -> adult.

[0082] In practical applications, if the target classification task is an emotion classification task, words expressing emotions (such as words expressing positive emotions like liking and sympathy, and words expressing negative emotions like anger, resentment, and sadness) and words indicating the subject to which the emotion is directed (such as words indicating objects) can be extracted from the sample text corresponding to the target classification task as keywords. Furthermore, by analyzing the semantics of these keywords, the meta-concepts involved in the keywords are determined from the concept tree based on the semantic analysis results and used as target meta-concepts related to the sample text. The paths containing these target meta-concepts are then selected from the concept tree as the aforementioned meta-concept paths, thus obtaining the hierarchical relationship between the target meta-concepts related to the sample text. For example, if the sample text is "I like this dress," the words "like" and "dress" can be extracted as keywords. Further semantic analysis of the keywords reveals that the meta-concepts involved in the keyword "like" include "attitude" and "positive," and the meta-concepts involved in the keyword "dress" include "object" and "real object." Therefore, the meta-concept paths can be determined from the concept tree: attitude -> positive, object -> real object.

[0083] If the target classification task is an intent classification task, words expressing intent (such as the strong agentive predicate "like" expressing semantic intent and the strong agentive predicate "take away" expressing pragmatic intent) can be extracted from the sample text corresponding to this target classification task as keywords. By analyzing the semantics of these keywords, the meta-concepts involved in the keywords are determined from the concept tree based on the semantic analysis results and used as target meta-concepts related to the sample text. Furthermore, paths containing these target meta-concepts are selected from the concept tree as the aforementioned meta-concept paths, thus obtaining the hierarchical relationship between the target meta-concepts related to the sample text. Here, semantic intent refers to the intention to convey certain information to a certain object, while pragmatic intent refers to the intention to expect a certain object to perform a certain actual action, not merely a verbal response.

[0084] For example, the sample text is "Take it away". The word "take away" can be extracted as a keyword. By further analyzing the meaning of the keyword, it can be determined that the meta-concepts involved in the keyword include "action", "behavioral action" and "self-behavioral action". Then, the meta-concept path can be determined from the concept tree: action -> behavioral action -> other-action behavioral action.

[0085] S104. Based on the concept vectors corresponding to multiple target meta-concepts and the hierarchical relationship between multiple target meta-concepts, the tag words are searched in the preset meta-concept table to determine the tag words corresponding to the sample text.

[0086] The label words are used to indicate the category to which the sample text belongs in the target classification task.

[0087] For each target meta-concept, the corresponding concept vector refers to the representation of the target meta-concept in vector form. Specifically, the concept vector corresponding to the target meta-concept is the vector obtained by mapping the target meta-concept to the corresponding vector space.

[0088] In one alternative implementation, to ensure that the concept vector corresponding to the target meta-concept can more accurately represent the target meta-concept, the target meta-concept can be represented separately from vector spaces corresponding to multiple attributes (i.e., multiple meta-concept spaces). For example, meta-concepts can be classified according to attributes into syntactic meta-concepts, categorical meta-concepts, and intensional meta-concepts. Syntactic meta-concepts can include three dimensions: part of speech, legal syntactic collocation slots, and illegal syntactic collocation slots. Categorical meta-concepts can include two dimensions: biological and non-biological. Intensional meta-concepts can include time dimension, space dimension, and color dimension, etc.

[0089] Accordingly, a vector space can be constructed for each attribute, resulting in multiple meta-concept spaces, including the syntactic meta-concept space, the categorical meta-concept space, and the intensional meta-concept space. For each meta-concept space, a concept sub-vector corresponding to the target meta-concept in that meta-concept space can be generated based on the attributes the target meta-concept possesses within that space. That is, the concept sub-vector represents the attributes the target meta-concept possesses in that concept space. For example, taking the categorical meta-concept space as an example, if the target meta-concept is a meta-concept representing a living organism, then the value of the target meta-concept in the living dimension can be set to 1, and the value of the target meta-concept in the non-living dimension can be set to 0. Thus, the concept sub-vector corresponding to the target meta-concept in the categorical meta-concept space is (1, 0).

[0090] Furthermore, for each target meta-concept, after obtaining the concept sub-vectors corresponding to the target meta-concept in multiple meta-concept spaces, the concept sub-vectors corresponding to the target meta-concept in multiple meta-concept spaces can be merged based on the preset priority order among the multiple meta-concept spaces to obtain the concept vector corresponding to the target meta-concept.

[0091] It should be noted that the merging process in this embodiment can employ various merging methods commonly used in the art, such as splicing and weighted combination. The specific method can be selected according to actual needs, and this embodiment does not limit this. Furthermore, the preset priority order among the aforementioned multiple meta-concept spaces can be set according to actual needs, and this embodiment does not limit this. For example, the preset priority order can be syntactic meta-concept space -> category meta-concept space -> intensional meta-concept space, to better conform to the order in which humans perceive things.

[0092] In another alternative implementation, to improve the generation of concept vectors, a pre-created meta-concept mapping table can be queried based on each target meta-concept to obtain the concept vector corresponding to each target meta-concept. The meta-concept mapping table represents the mapping relationship between meta-concepts and concept vectors.

[0093] A pre-defined meta-concept table is used to represent the mapping relationship between words and word vectors. In practical applications, the meta-concept mapping table can be created in any appropriate way, depending on actual needs; this application embodiment does not limit this. The specific method for creating the meta-concept mapping table will be described in detail later.

[0094] Considering that the meaning of each word can be represented by a corresponding word vector, and each meta-concept can also be represented by a corresponding concept vector, based on this vector and concept vector, multiple target meta-concepts that fundamentally reflect the semantics of the sample text can be linked to words that can describe the category to which the sample text belongs. Based on the existing mapping relationship between words and word vectors and the concept vectors of each of the multiple target meta-concepts, the words that can be used to describe the category to which the sample text belongs can be accurately determined as the label words corresponding to the sample text. Specifically, S104 above may include the following steps:

[0095] S1041, Based on the hierarchical relationship between multiple target meta-concepts, determine the arrangement order of the concept vectors corresponding to the multiple target meta-concepts respectively.

[0096] Specifically, the hierarchical relationship between multiple target meta-concepts can be used as the arrangement order of the concept vectors corresponding to each target meta-concept. For example, if the hierarchical relationship between the multiple target meta-concepts indicated by the above meta-concept path is action -> behavioral action -> other-action behavioral action, then the arrangement order of the concept vectors corresponding to the target meta-concepts "action", "behavioral action", and "other-action behavioral action" can be determined as the concept vector of the target meta-concept "action" -> the concept vector of the target meta-concept "behavioral action" -> the concept vector of the target meta-concept "other-action behavioral action".

[0097] S1042, based on the arrangement order of the concept vectors corresponding to multiple target element concepts, the concept vectors corresponding to multiple target element concepts are concatenated to obtain a merged vector.

[0098] Specifically, the concept vectors corresponding to multiple target meta-concepts can be concatenated into a higher-dimensional vector according to the arrangement order of the concept vectors corresponding to the multiple target meta-concepts, thus obtaining the merged vector.

[0099] S1043, Based on the preset meta-concept table, determine the words corresponding to the merged vector and use them as the label words corresponding to the sample text.

[0100] Specifically, based on the mapping relationship represented by the preset meta-concept table, the merged vector can be mapped to the corresponding word and the word can be used as the label word corresponding to the sample text.

[0101] In this embodiment, the preset meta-concept table can be pre-created in any appropriate manner, and the specific method can be selected according to actual needs. This embodiment does not limit this. Optionally, before S1043 above, this embodiment also includes a method for creating a preset meta-concept mapping table. In order to create a meta-concept table that can more accurately represent the mapping relationship between words and word vectors, such as... Figure 4As shown, the method may include the following steps:

[0102] Step B1: Obtain the first statement containing the sample words and the second statement containing the related words of the sample words, and obtain the semantic differentiation meta-concept sequence of the sample words.

[0103] Step B2: Based on the first and second statements, construct the statement groups corresponding to the sample words.

[0104] The sample word can be any word in the word set, which can include words that may be involved in various classification tasks, such as words that express intent that may be involved in intent classification tasks, words that express emotion that may be involved in sentiment classification tasks, and specific words that may be involved in spam detection tasks (such as words like "winning a prize," "link," and "virus").

[0105] The keywords of the sample words may include at least one of the following: synonyms, antonyms, illegal words, etc.

[0106] Each statement group includes a first statement and a second statement. The semantic differentiation meta-concept sequence of the statement group includes meta-concepts used to distinguish the semantics of sample words and their associated words.

[0107] Optionally, the second statement can be a statement containing synonyms or antonyms of the sample word. The semantic differentiation meta-concept sequence of this word can include meta-concepts that distinguish the word from its synonyms and antonyms, thus fundamentally reflecting the semantic differences between the word and its synonyms and antonyms. For example, taking the word "sea" as an example, the first statement can be "I like the sea," and the second statement can include "I like the ocean" and "I like the land." Assuming that the meta-concept sequence of the word "sea" includes [meta-concept 1][meta-concept 2][meta-concept 3], the meta-concept sequence of the synonym "ocean" includes [meta-concept 1][meta-concept 2][meta-concept 4], and the meta-concept sequence of the antonym "land" includes [meta-concept 1][meta-concept 5][meta-concept 6], it can be determined that the semantic differentiation meta-concept sequence of the word "sea" can include [meta-concept 2][meta-concept 3].

[0108] Optionally, the first statement can be a legal statement including the sample word, and the second statement can be an illegal statement containing the illegal word corresponding to the sample word. In this case, the semantic differentiation meta-concept sequence of the word includes meta-concepts used to distinguish the word from its corresponding illegal word in the second statement from the perspective of the overall grammar of the sentence, thus fundamentally reflecting the semantic difference between the different words in the two statements. For example, taking the word "Xiaoming" as an example, the first statement can be "Xiaoming likes to eat apples", and the second statement can include "The table likes to eat apples". Assuming that the meta-concept sequence of the word "Xiaoming" includes [meta-concept 1] [meta-concept 2], and the meta-concept sequence of the illegal word "table" in the illegal statement includes [meta-concept 1] [meta-concept 3], it can be determined that the semantic differentiation meta-concept sequence of the word "Xiaoming" can include [meta-concept 2].

[0109] Of course, it should be understood that in practical applications, there can be multiple second statements, which may include the two forms of second statements mentioned above. This application embodiment does not limit this.

[0110] Step B3: The meta-concept model is trained using the sentence groups corresponding to the sample words as training samples and the meta-concept sequences that distinguish the meanings of the sample words as labels corresponding to the training samples. The meta-concept sequences of the sample words output by the meta-concept model during the training process are then obtained.

[0111] The meta-concept model can be a model whose target task is to output a sequence of meta-concepts for words. In practical applications, the meta-concept model can adopt any appropriate structure, such as the BERT model or other language models. The specific choice can be made according to actual needs, and this application does not limit this.

[0112] Each word's meta-concept sequence includes at least one meta-concept related to that word.

[0113] In step B3 above, the meta-concept model is trained by using the sentence groups corresponding to the sample words as training samples and the semantic differentiation meta-concept sequences of the sample words as labels corresponding to the training samples. This allows the semantic differentiation meta-concept sequences of the sample words to provide supervision signals for the meta-concept model, enabling the meta-concept model to output the meta-concept sequences of the sample words based on the sentence groups corresponding to the sample words during the training process.

[0114] Step B4: Obtain the concept vector of each metaconcept in the metaconcept sequence of sample words.

[0115] To ensure that the concept vector corresponding to each meta-concept can more accurately represent that meta-concept, each meta-concept can be represented separately from multiple attribute-corresponding vector spaces (i.e., multiple meta-concept spaces). As mentioned earlier, meta-concepts can be classified according to their attributes into syntactic meta-concepts, categorical meta-concepts, and intensional meta-concepts. Syntactic meta-concepts can include three dimensions: part of speech, legal syntactic collocation slots, and illegal syntactic collocation slots. Categorical meta-concepts can include two dimensions: biological and non-biological. Intensional meta-concepts can include time, space, and color dimensions, etc.

[0116] Accordingly, a vector space can be constructed for each attribute, resulting in multiple meta-concept spaces including syntactic meta-concept space, categorical meta-concept space, and intensional meta-concept space. The first meta-concept can be mapped to multiple meta-concept spaces to obtain the concept sub-vectors corresponding to the first meta-concept in each meta-concept space. The meta-concept sequence of sample words includes the first meta-concept, which is any meta-concept in the meta-concept sequence of sample words. Each meta-concept space is used to represent one attribute of the meta-concept.

[0117] For example, for each meta-concept space, a concept sub-vector corresponding to the first meta-concept in that meta-concept space can be generated based on the attributes that the first meta-concept possesses in that meta-concept space. That is, the concept sub-vector is used to represent the attributes that the first meta-concept possesses in that concept space. For example, taking the category meta-concept space as an example, if the first meta-concept is a meta-concept representing a living organism, then the value of the first meta-concept in the living organism dimension can be set to 1, and the value of the first meta-concept in the non-living organism dimension can be set to 0. Thus, the concept sub-vector corresponding to the first meta-concept in the category meta-concept space is (1, 0).

[0118] Furthermore, after obtaining the concept sub-vectors corresponding to the first meta-concept in multiple meta-concept spaces, the concept sub-vectors corresponding to the first meta-concept in multiple meta-concept spaces can be merged based on the preset priority order among the multiple meta-concept spaces to obtain the concept vector corresponding to the first meta-concept.

[0119] It should be noted that the preset priority order among the above-mentioned multiple meta-concept spaces can be set according to actual needs, and this application embodiment does not limit this. For example, the preset priority order can be syntactic meta-concept space -> category meta-concept space -> connotation meta-concept space, in order to better conform to the order of human cognition of things.

[0120] Step B5: Merge the concept vectors of each metaconcept in the metaconcept sequence of the sample words to obtain the word vectors of the sample words.

[0121] Specifically, the concept vectors of each meta-concept in the meta-concept sequence can be merged according to the order indicated by the meta-concept sequence.

[0122] Step B6: Construct a pre-defined meta-concept table based on the sample words and their word vectors.

[0123] In practical applications, there are multiple sample words. After obtaining the word vector for each sample word, each sample word can be used as a key, and the corresponding word vector can be used as the value, thus obtaining a pre-defined meta-concept table. The key-value pairs in this pre-defined meta-concept table represent the mapping relationship between words and word vectors.

[0124] Alternatively, in another embodiment of this application, such as Figure 4 As shown, after step B3 above, the text tag generation method provided in this application embodiment may further include: step B7, constructing a meta-concept mapping table based on the meta-concept sequence of sample words and the concept vector of each meta-concept in the meta-concept sequence, wherein the meta-concept mapping table is used to represent the mapping relationship between meta-concepts and concept vectors.

[0125] For example, after obtaining the meta-concept sequence of sample words, each meta-concept in the sequence can be used as a key, and the concept vector of each meta-concept can be used as the value corresponding to the key, thus obtaining a preset meta-concept mapping table. The key-value pairs formed by the keys and values ​​in this preset meta-concept mapping table can represent the mapping relationship between meta-concepts and concept vectors.

[0126] This application embodiment only illustrates one specific implementation of S104 described above. Of course, it should be understood that S104 can also be implemented in various ways commonly used in the art, and the specific implementation can be selected according to actual needs. This application embodiment does not limit this implementation.

[0127] S106, determine the label words as the category labels corresponding to the sample text.

[0128] By identifying the labeled words as the category labels corresponding to the sample text, the category labels can more accurately represent the category to which the sample text belongs in the target classification task. This provides a more accurate supervision signal for the text classification model, which is beneficial to improving the accuracy of the text classification model trained on the sample text and its corresponding category labels, as well as the execution accuracy of the text classification task based on the text classification model.

[0129] The text label generation method provided by one or more embodiments of this application considers that meta-concepts are information obtained by abstracting the common essential characteristics of things perceived by humans. They can accurately describe the connotation of things and thus distinguish different things from their essence without being affected by context. Based on this, a pre-constructed concept tree representing the hierarchical relationship between multiple meta-concepts is used to determine multiple target meta-concepts related to the sample text and the hierarchical relationship between multiple target meta-concepts from the concept tree based on the keywords in the sample text corresponding to the target classification task. This allows these target meta-concepts to fundamentally reflect the semantics of the sample text. Furthermore, based on the hierarchical relationship between multiple target meta-concepts, the label words corresponding to the sample text are determined as category labels. This allows the semantics of the sample text to be enhanced through the hierarchical relationship between multiple target meta-concepts. As a result, the obtained label words as category labels can more accurately represent the category to which the sample text belongs under the target classification task, thereby providing a more accurate supervision signal for the text classification model. This is beneficial to improving the accuracy of the text classification model trained based on the sample text and its corresponding category labels, as well as the execution accuracy of the text classification task based on the text classification model.

[0130] This application also provides a method for training a text classification model, used to train a text classification model to perform a target classification task. Please refer to... Figure 5 The following is a flowchart illustrating a training method for a text classification model, provided as an embodiment of this application. The method may include the following steps:

[0131] S502, obtain the sample text corresponding to the target classification task and the category label corresponding to the sample text.

[0132] The category labels corresponding to the sample text are obtained based on the text label generation method provided in one or more embodiments of this application.

[0133] S504, encode the sample text to obtain the text vector corresponding to the sample text.

[0134] Specifically, sample text can be encoded using a pre-trained language model, such as the BERT model, to obtain the corresponding text vector.

[0135] S506, encode the category labels corresponding to the sample text to obtain the label vectors corresponding to the category labels.

[0136] Specifically, a pre-trained language model, such as the Word2vec model, can be used to encode the category labels corresponding to the sample text, thereby obtaining the text vectors corresponding to the category labels.

[0137] S508 trains a text classification model to perform the target classification task based on the text vector corresponding to the sample text and the label vector corresponding to the category label.

[0138] Specifically, the text vector corresponding to the sample text can be input into the text classification model to obtain the predicted category vector representing the predicted category to which the sample text belongs; further, based on the predicted category vector corresponding to the sample text and the label vector corresponding to the category label of the sample text, the classification loss of the text classification model is determined, and the model parameters of the text classification model are adjusted based on the classification loss of the text classification model.

[0139] The model parameters of a text classification model may include the number of each network layer (such as neurons), the connection relationships between nodes in different network layers, the weights of the connection edges, and the biases of the nodes in each network layer.

[0140] In this context, the classification loss of the text classification model represents the difference between the predicted class vector corresponding to the sample text and the label vector corresponding to the class label of the sample text. More specifically, a backpropagation algorithm can be used to reduce the classification loss of the text classification model, and the model parameters of the text classification model can be adjusted based on the classification loss.

[0141] It should be noted that the above describes only one model parameter adjustment process. In practical applications, the model parameters of the text classification model may need to be adjusted multiple times. Therefore, the above process can be repeated multiple times until the preset training stopping condition is met, thereby completing the training of the text classification model. The preset training stopping condition may include the classification loss of the text classification model being less than a preset loss threshold, or the number of adjustments reaching a preset number, or the PPL of the text classification model being within a preset range, etc. The specific condition can be set according to actual needs, and this application embodiment does not limit it.

[0142] The text classification model training method provided by one or more embodiments of this application, since the category label corresponding to the sample text obtained by the above-mentioned text label generation method can more accurately represent the category to which the sample text belongs under the target classification task, after obtaining the category label corresponding to the sample text by the above-mentioned text label generation method, encodes the sample text and its corresponding category label respectively, and further trains the text classification model for performing the target classification task based on the encoding results of the sample text and its corresponding category label, so that the text classification model can learn and understand the semantics of the sample text more accurately from the supervision signal provided by the category label corresponding to the sample text, thereby improving the training effect of the text classification model and helping to improve the classification accuracy of the text classification model.

[0143] This application also provides a text classification method for performing a target classification task on the text to be processed, and obtaining the category to which the text to be processed belongs under the target classification task. Please refer to [link to relevant documentation]. Figure 6 The following is a flowchart illustrating a text classification method according to an embodiment of this application. The method may include the following steps:

[0144] S602, Obtain the text to be processed.

[0145] In practical applications, the text to be processed can be obtained through any appropriate means. For example, the text to be processed can be the text obtained by converting the audio to be recognized using ASR technology for speech recognition and then using TTS technology.

[0146] S604 uses a text classification model to perform a target classification task on the text to be processed, and obtains the category to which the text to be processed belongs under the target classification task.

[0147] The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application.

[0148] The text classification method provided by one or more embodiments of this application can more accurately represent the category to which the sample text belongs under the target classification task by obtaining the category label corresponding to the sample text through the above-mentioned text label generation method. This provides a more accurate supervision signal for the text classification model, which is beneficial to improving the accuracy of the text classification model trained on the sample text and its corresponding category label. On this basis, the text classification model trained is used to perform the target classification task on the text to be processed, which is beneficial to improving the classification accuracy of the text to be processed.

[0149] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0150] In addition, with the above Figure 1 Corresponding to the text label generation method shown, this application also provides a text label generation apparatus. Please refer to... Figure 7 The diagram below illustrates the structure of a text tag generation device 700 according to an embodiment of this application. The device 700 may include:

[0151] The acquisition unit 710 is used to acquire the meta-concept path corresponding to the sample text from a pre-constructed concept tree based on the keywords in the sample text corresponding to the target classification task. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a language unit used to represent the meaning of a word.

[0152] The determining unit 720 is used to search for tag words in a preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, and to determine the tag words corresponding to the sample text. The tag words are used to represent the category to which the sample text belongs under the target classification task. The preset meta-concept table is used to represent the mapping relationship between words and word vectors.

[0153] The determining unit 720 is further configured to determine the label words as category labels corresponding to the sample text.

[0154] Optionally, the determining unit determines the tag words corresponding to the sample text based on the plurality of target meta-concepts and the hierarchical relationship between the plurality of target meta-concepts, including:

[0155] Based on the hierarchical relationship between the multiple target meta-concepts, determine the arrangement order of the concept vectors corresponding to the multiple target meta-concepts respectively;

[0156] Based on the arrangement order of the concept vectors corresponding to the multiple target element concepts, the concept vectors corresponding to the multiple target element concepts are concatenated to obtain a merged vector;

[0157] The words corresponding to the merged vector are determined based on the preset meta-concept table and used as the tag words corresponding to the sample text.

[0158] Optionally, the acquisition unit is further configured to:

[0159] Before the determining unit determines the words corresponding to the merged vector based on the preset meta-concept table and uses them as the tag words corresponding to the sample text, a first statement containing the sample words and a second statement containing the related words of the sample words are obtained, and a semantic differentiation meta-concept sequence of the sample words is obtained, wherein the semantic differentiation meta-concept sequence includes meta-concepts used to distinguish the semantics of the sample words and the related words;

[0160] Based on the first statement and the second statement, construct the statement group corresponding to the sample words;

[0161] The meta-concept model is trained using the sentence groups corresponding to the sample words as training samples and the semantic distinction meta-concept sequences of the sample words as labels corresponding to the training samples. The meta-concept sequences of the sample words output by the meta-concept model during the training process are then obtained.

[0162] Obtain the concept vector of each metaconcept in the metaconcept sequence of the sample words;

[0163] The concept vectors of each meta-concept in the meta-concept sequence of the sample words are merged to obtain the word vectors of the sample words;

[0164] Based on the sample words and their word vectors, the preset meta-concept table is constructed.

[0165] Optionally, the acquisition unit is further configured to:

[0166] After obtaining the meta-concept sequence of the sample words output by the meta-concept model during training, a meta-concept mapping table is constructed based on the meta-concept sequence of the sample words and the concept vector of each meta-concept in the meta-concept sequence. The meta-concept mapping table is used to represent the mapping relationship between meta-concepts and concept vectors.

[0167] The acquisition unit is also used for:

[0168] Before searching for tag words in the preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, the meta-concept mapping table is queried based on each target meta-concept to obtain the concept vector corresponding to each target meta-concept.

[0169] Optionally, the meta-concept sequence of the sample words includes a first meta-concept, which is any one of the meta-concepts in the meta-concept sequence of the sample words;

[0170] The acquisition unit acquires the concept vector of each meta-concept in the meta-concept sequence of the sample words, including:

[0171] The first meta-concept is mapped to multiple meta-concept spaces to obtain the concept sub-vectors corresponding to the first meta-concept in the multiple meta-concept spaces. Each meta-concept space is used to represent an attribute of the meta-concept.

[0172] Based on the preset priority order among the multiple meta-concept spaces, the concept sub-vectors corresponding to the first meta-concept under the multiple meta-concept spaces are merged to obtain the concept vector of the first meta-concept.

[0173] Optionally, the acquisition unit is further configured to acquire a text set, which includes texts corresponding to multiple classification tasks, before the acquisition unit acquires the meta-concept path corresponding to the sample text from a pre-built concept tree based on the keywords in the sample text corresponding to the target classification task;

[0174] The device 700 further includes:

[0175] The parsing unit is used to perform semantic parsing on the keywords in the text of the text set to obtain a meta-concept set, which includes the meta-concepts involved in the text of the text set;

[0176] A classification unit is used to classify the meta-concepts in the meta-concept set to obtain multiple meta-concept subsets, wherein each meta-concept subset includes meta-concepts of the same category;

[0177] The building unit is used to construct a concept tree corresponding to each meta-concept subset based on the hierarchical relationship between meta-concepts in each meta-concept subset. The concept tree corresponding to each meta-concept subset is used to represent the hierarchical relationship between meta-concepts of the same category.

[0178] Obviously, the text tag generation device provided in this application embodiment can serve as... Figure 1 The execution body of the text label generation method shown, for example, Figure 1 In the text label generation method shown, step S102 can be generated by... Figure 7 The acquisition unit in the text label generation device shown executes the steps S104 and S106, which can be executed by the determination unit in the text label generation device.

[0179] According to another embodiment of this application, Figure 7 The various units in the text label generation device shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the text label generation device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0180] According to another embodiment of this application, a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), can run an application capable of performing tasks such as... Figure 1 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 7 The text label generation apparatus shown herein, and the text label generation method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, and may be transferred to and run in an electronic device via such a medium.

[0181] In addition, with the above Figure 5 Corresponding to the training method of the text classification model shown, this application embodiment also provides a training apparatus for a text classification model. Please refer to... Figure 8 The diagram below illustrates the structure of a text classification model training device 800 according to an embodiment of this application. The device 800 may include:

[0182] The acquisition unit 810 is used to acquire sample text corresponding to the target classification task and category labels corresponding to the sample text, wherein the category labels corresponding to the sample text are obtained based on the text label generation method provided in one or more embodiments of this application.

[0183] The encoding unit 820 is used to encode the sample text to obtain the text vector corresponding to the sample text;

[0184] The encoding unit 820 is further configured to encode the category label to obtain a label vector corresponding to the category label;

[0185] Training unit 830 is used to train a text classification model for performing the target classification task based on the text vector corresponding to the sample text and the label vector corresponding to the category label.

[0186] Obviously, the training device for the text classification model provided in this application embodiment can be used as... Figure 5 The entity that performs the training method for the text classification model shown, for example, Figure 5 In the training method of the text classification model shown, step S502 can be performed by... Figure 8 The acquisition unit in the training device of the text classification model shown is executed, and steps S504 and S506 can be executed by the encoding unit in the training device of the text classification model, and step S508 can be executed by the training unit in the training device of the text classification model.

[0187] According to another embodiment of this application, Figure 8 The units in the training device of the text classification model shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effect of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the training device of the text classification model may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0188] According to another embodiment of this application, a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit, random access storage medium, and read-only storage medium, can be used to run an application capable of performing tasks such as... Figure 5 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 8 The diagram illustrates a training apparatus for a text classification model, and a training method for implementing the text classification model according to embodiments of this application. The computer program may be recorded on, for example, a computer-readable storage medium, and may be transferred to and run in an electronic device via such a medium.

[0189] In addition, with the above Figure 6 Corresponding to the text classification method shown, this application also provides a text classification device. Please refer to... Figure 9 The image below is a schematic diagram of the structure of a text classification device 900 provided in one embodiment of this application. The device 900 may include:

[0190] Acquisition unit 910 is used to acquire the text to be processed;

[0191] The classification unit 920 is used to perform a target classification task on the text to be processed using a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application.

[0192] Obviously, the text classification device provided in this application embodiment can serve as... Figure 6 The entity that performs the text classification method shown, for example, Figure 6In the text classification method shown, step S602 can be performed by... Figure 9 The acquisition unit in the text classification device shown executes step S604, which can be executed by the classification unit in the text classification device.

[0193] According to another embodiment of this application, Figure 9 The text classification device shown can be constructed by combining each unit individually or entirely into one or more other units, or one or more of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effect of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the text classification device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0194] According to another embodiment of this application, a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit, random access storage medium, and read-only storage medium, can be used to run an application capable of performing tasks such as... Figure 6 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 9 The text classification apparatus shown herein, and the text classification method for implementing embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, and may be transferred to and run in an electronic device via such a medium.

[0195] Figure 10 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Please refer to it. Figure 10 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.

[0196] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0197] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.

[0198] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, forming a text tag generation device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:

[0199] Based on the keywords in the sample text corresponding to the target classification task, the meta-concept path corresponding to the sample text is obtained from the pre-constructed concept tree. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a linguistic unit used to represent the meaning of a word.

[0200] Based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, a tag word search is performed in a preset meta-concept table to determine the tag words corresponding to the sample text. The tag words are used to represent the category to which the sample text belongs under the target classification task. The preset meta-concept table is used to represent the mapping relationship between words and word vectors.

[0201] The labeled words are determined as the category labels corresponding to the sample text.

[0202] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and runs it, forming a training device for the text classification model at the logical level. The processor executes the program stored in memory and specifically performs the following operations:

[0203] Obtain the sample text corresponding to the target classification task and the category label corresponding to the sample text, wherein the category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application above;

[0204] The sample text is encoded to obtain the text vector corresponding to the sample text;

[0205] The category label is encoded to obtain the label vector corresponding to the category label;

[0206] Based on the text vector corresponding to the sample text and the label vector corresponding to the category label, a text classification model is trained to perform the target classification task.

[0207] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and runs it, forming a text classification device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:

[0208] Get the text to be processed;

[0209] The text to be processed is subjected to a target classification task by a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application.

[0210] The above is as stated in this application. Figure 1 The method executed by the text tag generation apparatus disclosed in the illustrated embodiment can be applied to a processor, or implemented by a processor; as stated above in this application. Figure 5 The method executed by the training apparatus for the text classification model disclosed in the illustrated embodiment can be applied to a processor, or implemented by a processor; as stated above in this application. Figure 6The text classification device disclosed in the illustrated embodiments can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0211] The electronic device can also perform Figure 1 The method, and implement the text label generation device in Figure 1 , Figure 3 , Figure 4 The illustrated embodiment may also perform the functions of the electronic device, or the electronic device may also perform the functions of the embodiment shown. Figure 5 The method, and the implementation of a training device for a text classification model in Figure 5 The illustrated embodiment may also perform the functions of the electronic device, or the electronic device may also perform the functions of the embodiment shown. Figure 6 The method, and implement the text classification device in Figure 6 The functions of the embodiments shown are not described in detail here.

[0212] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0213] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by a portable electronic device including multiple applications, enable the portable electronic device to perform... Figure 1 The method of the illustrated embodiment is specifically used to perform the following operations:

[0214] Based on the keywords in the sample text corresponding to the target classification task, the meta-concept path corresponding to the sample text is obtained from the pre-constructed concept tree. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a linguistic unit used to represent the meaning of a word.

[0215] Based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, a tag word search is performed in a preset meta-concept table to determine the tag words corresponding to the sample text. The tag words are used to represent the category to which the sample text belongs under the target classification task. The preset meta-concept table is used to represent the mapping relationship between words and word vectors.

[0216] The labeled words are determined as the category labels corresponding to the sample text.

[0217] Alternatively, when executed by a portable electronic device that includes multiple applications, the instruction can enable the portable electronic device to perform... Figure 5 The method of the illustrated embodiment is specifically used to perform the following operations:

[0218] Obtain the sample text corresponding to the target classification task and the category label corresponding to the sample text, wherein the category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application above;

[0219] The sample text is encoded to obtain the text vector corresponding to the sample text;

[0220] The category label is encoded to obtain the label vector corresponding to the category label;

[0221] Based on the text vector corresponding to the sample text and the label vector corresponding to the category label, a text classification model is trained to perform the target classification task.

[0222] Alternatively, when executed by a portable electronic device that includes multiple applications, the instruction can enable the portable electronic device to perform... Figure 6The method of the illustrated embodiment is specifically used to perform the following operations:

[0223] Get the text to be processed;

[0224] The text to be processed is subjected to a target classification task by a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method provided in one or more embodiments of this application.

[0225] In summary, the above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

[0226] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0227] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, 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, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0228] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0229] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

Claims

1. A method for generating text tags, characterized in that, include: Based on the keywords in the sample text corresponding to the target classification task, the meta-concept path corresponding to the sample text is obtained from the pre-constructed concept tree. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a linguistic unit used to represent the meaning of a word. Based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, a tag word search is performed in a preset meta-concept table to determine the tag words corresponding to the sample text. The tag words represent the category to which the sample text belongs under the target classification task. The preset meta-concept table represents the mapping relationship between words and word vectors. The tag words are obtained by concatenating the concept vectors corresponding to the multiple target meta-concepts based on the hierarchical relationship between the multiple target meta-concepts, and then querying the preset meta-concept table based on the merged vector obtained from the concatenation. The labeled words are determined as the category labels corresponding to the sample text.

2. The method according to claim 1, characterized in that, The process of searching for tag words in a preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts to determine the tag words corresponding to the sample text includes: Based on the hierarchical relationship between the multiple target meta-concepts, determine the arrangement order of the concept vectors corresponding to the multiple target meta-concepts respectively; Based on the arrangement order of the concept vectors corresponding to the multiple target element concepts, the concept vectors corresponding to the multiple target element concepts are concatenated to obtain a merged vector; The words corresponding to the merged vector are determined based on the preset meta-concept table and used as the tag words corresponding to the sample text.

3. The method according to claim 2, characterized in that, Before determining the words corresponding to the merged vector based on the preset meta-concept table and using them as the tag words corresponding to the sample text, the method further includes: Obtain a first statement containing sample words and a second statement containing related words of the sample words, and obtain a semantic differentiation meta-concept sequence of the sample words, wherein the semantic differentiation meta-concept sequence includes meta-concepts for semantic differentiation of the sample words and the related words; Based on the first statement and the second statement, construct the statement group corresponding to the sample words; The meta-concept model is trained using the sentence groups corresponding to the sample words as training samples and the semantic distinction meta-concept sequences of the sample words as labels corresponding to the training samples. The meta-concept sequences of the sample words output by the meta-concept model during the training process are then obtained. Obtain the concept vector of each meta-concept in the meta-concept sequence of the sample words; The concept vectors of each meta-concept in the meta-concept sequence of the sample words are merged to obtain the word vectors of the sample words; Based on the sample words and their word vectors, the preset meta-concept table is constructed.

4. The method according to claim 3, characterized in that, After obtaining the meta-concept sequence of the sample words output by the meta-concept model during training, the method further includes: Based on the meta-concept sequence of the sample words and the concept vector of each meta-concept in the meta-concept sequence, a meta-concept mapping table is constructed, wherein the meta-concept mapping table is used to represent the mapping relationship between meta-concepts and concept vectors; Before performing tag word search in a preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationships between the multiple target meta-concepts, the method further includes: Based on each target meta-concept, the meta-concept mapping table is queried to obtain the concept vector corresponding to each target meta-concept.

5. The method according to claim 3, characterized in that, The meta-concept sequence of the sample words includes a first meta-concept, which is any meta-concept in the meta-concept sequence of the sample words. Obtaining the concept vector for each meta-concept in the meta-concept sequence of the sample words includes: The first meta-concept is mapped to multiple meta-concept spaces to obtain the concept sub-vectors corresponding to the first meta-concept in the multiple meta-concept spaces. Each meta-concept space is used to represent an attribute of the meta-concept. Based on the preset priority order among the multiple meta-concept spaces, the concept sub-vectors corresponding to the first meta-concept under the multiple meta-concept spaces are merged to obtain the concept vector of the first meta-concept.

6. The method according to any one of claims 1 to 5, characterized in that, Before obtaining the meta-concept path corresponding to the sample text from a pre-constructed concept tree based on the keywords in the sample text corresponding to the target classification task, the method further includes: Obtain a text set, which includes texts corresponding to multiple classification tasks; The keywords in the text of the text set are analyzed for semantic meaning to obtain a meta-concept set, which includes the meta-concepts involved in the text of the text set; The meta-concepts in the meta-concept set are classified to obtain multiple meta-concept subsets, wherein each meta-concept subset includes meta-concepts of the same category; Based on the hierarchical relationship between meta-concepts in each meta-concept subset, a concept tree corresponding to each meta-concept subset is constructed, wherein the concept tree corresponding to each meta-concept subset is used to represent the hierarchical relationship between meta-concepts of the same category.

7. A training method for a text classification model, characterized in that, include: Obtain the sample text corresponding to the target classification task and the category label corresponding to the sample text, wherein the category label corresponding to the sample text is obtained based on the text label generation method according to any one of claims 1 to 6; The sample text is encoded to obtain the text vector corresponding to the sample text; The category label is encoded to obtain the label vector corresponding to the category label; Based on the text vector corresponding to the sample text and the label vector corresponding to the category label, a text classification model is trained to perform the target classification task.

8. A text classification method, characterized in that, include: Get the text to be processed; The text to be processed is subjected to a target classification task by a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method of any one of claims 1 to 6.

9. A text tag generation device, characterized in that, include: The acquisition unit is used to acquire the meta-concept path corresponding to the sample text from a pre-constructed concept tree based on the keywords in the sample text corresponding to the target classification task. The concept tree is used to represent the hierarchical relationship between multiple meta-concepts, and the meta-concept path is used to represent multiple target meta-concepts related to the sample text in the concept tree and the hierarchical relationship between the multiple target meta-concepts. A meta-concept in the concept tree is a language unit used to represent the meaning of a word. The determining unit is used to search for tag words in a preset meta-concept table based on the concept vectors corresponding to the multiple target meta-concepts and the hierarchical relationship between the multiple target meta-concepts, and to determine the tag words corresponding to the sample text. The tag words represent the category to which the sample text belongs under the target classification task. The preset meta-concept table represents the mapping relationship between words and word vectors. The tag words are obtained by concatenating the concept vectors corresponding to the multiple target meta-concepts based on the hierarchical relationship between the multiple target meta-concepts, and then querying the preset meta-concept table based on the merged vector obtained from the concatenation. The determining unit is further configured to determine the label words as category labels corresponding to the sample text.

10. A training device for a text classification model, characterized in that, include: The acquisition unit is used to acquire sample text corresponding to the target classification task and category labels corresponding to the sample text, wherein the category labels corresponding to the sample text are obtained based on the text label generation method according to any one of claims 1 to 6; An encoding unit is used to encode the sample text to obtain a text vector corresponding to the sample text; The encoding unit is also used to encode the category label to obtain the label vector corresponding to the category label; The training unit is used to train a text classification model for performing the target classification task based on the text vector corresponding to the sample text and the label vector corresponding to the category label.

11. A text classification device, characterized in that, include: The acquisition unit is used to acquire the text to be processed. A classification unit is configured to perform a target classification task on the text to be processed using a text classification model to obtain the category to which the text to be processed belongs under the target classification task. The text classification model is trained based on the sample text corresponding to the target classification task and the category label corresponding to the sample text. The category label corresponding to the sample text is obtained based on the text label generation method according to any one of claims 1 to 6.

12. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 6; or, the processor is configured to execute the instructions to implement the method as described in claim 7; or, the processor is configured to execute the instructions to implement the method as described in claim 8.

13. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 6; or, enabled to perform the method as described in claim 7; or, enabled to perform the method as described in claim 8.

Citation Information

Patent Citations

  • Method and system for constructing ontology base in mobile application

    CN103020293A

  • Method and device for outputting information

    CN110457325A