Text classification method and device, electronic equipment and storage medium

By fusing semantic features with industry prior features and quantifying them in a multi-layered structure to form a decision path, the problem of poor accuracy of existing text classification models in complex business scenarios is solved, achieving more refined hierarchical feature representation and higher classification accuracy.

CN122132567APending Publication Date: 2026-06-02SHIBO TECH (WUHAN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHIBO TECH (WUHAN) CO LTD
Filing Date
2026-03-19
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing text classification models suffer from poor classification accuracy, difficulty in integrating industry knowledge, and in achieving hierarchical feature representation when dealing with complex business scenarios. In particular, the classification accuracy drops significantly when the data is sparse or there is domain bias.

Method used

By fusing the semantic features of the text to be classified with industry statistical prior features, a fused feature is generated. Quantization is then performed in a multi-layered structure to form a decision path. The joint loss function is used to optimize the prototype vector, correct the error of the semantic model, and achieve a more refined hierarchical feature representation.

Benefits of technology

It improves the accuracy of text classification, enabling more refined representation of text features in real and complex business scenarios, correcting errors in semantic models, and enhancing the classification accuracy of the model in industry scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132567A_ABST
    Figure CN122132567A_ABST
Patent Text Reader

Abstract

This invention provides a text classification method, apparatus, electronic device, and storage medium, belonging to the field of data processing technology. The method includes: fusing semantic features of the text to be classified with industry statistical prior features to generate fused features; starting from the fused features, sequentially traversing a pre-constructed quantization space including hierarchical codebooks, performing quantization operations at the level to select prototype vectors from the hierarchical codebooks of the level, and calculating the residuals of the level to propagate to the next level, ultimately forming a decision path composed of the selected prototype vectors; optimizing all prototype vectors in the hierarchical codebooks through gradient backpropagation based on the joint loss until the joint loss converges; and obtaining the classification result of the text to be classified based on the optimal decision path formed when the joint loss converges. This invention can improve the accuracy of text classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and specifically to a text classification method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the accelerating pace of digitalization, enterprises process massive amounts of documents daily, making automatic document classification a key technology for improving information management efficiency. Traditional methods primarily rely on deep learning-based semantic models, which learn the semantic features of text through training to achieve classification. These methods have achieved good results in general domains, providing important support for applications such as information retrieval and content recommendation.

[0003] However, in practical industry applications, traditional semantic models face significant bottlenecks. First, these models heavily rely on the distribution of training data; when data is sparse or domain-biased (e.g., technical terms, industry-specific expressions), classification accuracy drops significantly, resulting in "semantic bias." Second, the models lack explicit guidance from prior industry knowledge, making it difficult to effectively combine the general semantics of text with industry-specific classification logic (e.g., regulatory requirements, business practices). For example, the term "position" in financial reports differs greatly from its general semantics, leading to misclassification. Finally, existing models are mostly "end-to-end" flat decision-making processes, failing to capture the hierarchical structure of text features and lacking the ability to fine-grainedly distinguish complex and ambiguous content, thus affecting classification accuracy.

[0004] How to enable document classification models to overcome the limitations of pure semantic learning, effectively integrate industry knowledge, and achieve more refined hierarchical feature representation, thereby steadily improving classification accuracy in real and complex business scenarios, is a problem that urgently needs to be solved. Summary of the Invention

[0005] In view of this, it is necessary to provide a text classification method, apparatus, electronic device and storage medium to solve the technical problem of poor text classification accuracy in the prior art.

[0006] To address the aforementioned technical problems, in a first aspect, the present invention provides a text classification method, comprising: The semantic features of the text to be classified are fused with industry statistical prior features to generate fused features; Starting with the fused features, the pre-built features are sequentially traversed. The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... The hierarchical codebook contains one or more learnable prototype vectors; Based on the joint loss, optimization is performed through gradient backpropagation. All prototype vectors in each level codebook are used until the joint loss converges. The joint loss includes at least the first loss based on the quantization error of each level in the decision path, and the second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics. The semantic distribution is obtained according to the decision path. The classification result of the text to be classified is obtained by using the optimal decision path that makes the joint loss converge.

[0007] In one possible implementation, the classification result of the text to be classified is obtained based on the optimal decision path formed when the joint loss converges, including: The reconstructed vector is obtained by summing all the prototype vectors in the optimal decision path; The reconstructed vector is subjected to a nearest neighbor search operation in the industry statistical standard classification label library to obtain the classification result.

[0008] In one possible implementation, the reconstructed vector is subjected to a nearest neighbor search operation in an industry-standard statistical classification label library to obtain classification results, including: Obtain the Euclidean distance or similarity between the reconstructed vector and each tag vector in the industry statistical standard classification tag library; The classification result is obtained based on the label vector that is closest to or most similar to the reconstructed vector in terms of Euclidean distance.

[0009] In one possible implementation, the semantic features of the text to be classified are fused with industry statistical prior features to generate fused features, including: Based on the correlation between semantic features and industry statistical prior features extracted using the normalized exponential function, a fused feature is obtained.

[0010] In one possible implementation, in the first... The layer performs quantization operations to extract from the first... The prototype vectors selected from the hierarchical codebook of the layer include: In the Layer performs quantization operations , so as to start from the Layer-level codebook Selecting the prototype vector .

[0011] In one possible implementation, the first Methods for obtaining layer residuals include: The first is obtained based on the following formula. Layer residuals: ; in, For the first The residual of the layer, For the first The residual of the layer.

[0012] In one possible implementation, the joint loss can be obtained in the following ways: The joint loss is obtained based on the following formula: ; in, For joint losses, The first loss, This is the second loss. For divergence operators, For preset weighting coefficients, For semantic distribution, This represents the prior distribution of industry statistics.

[0013] Secondly, the present invention also provides a text classification device, comprising: The first acquisition module is used to fuse the semantic features of the text to be classified with the prior features of industry statistics to generate fused features; The second acquisition module is used to sequentially traverse the pre-built dataset, starting with the fused features, including... The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... The hierarchical codebook contains one or more learnable prototype vectors; The optimization module is used to optimize the joint loss through gradient backpropagation. All prototype vectors in each level codebook are used until the joint loss converges. The joint loss includes at least the first loss based on the quantization error of each level in the decision path, and the second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics. The semantic distribution is obtained according to the decision path. The classification module is used to obtain the classification result of the text to be classified based on the optimal decision path formed when the joint loss converges.

[0014] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein, Memory, used to store programs; A processor, coupled to memory, is used to execute programs stored in memory to implement the steps in the text classification method in any of the above implementations.

[0015] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps of the text classification method in any of the above implementations.

[0016] The beneficial effects of this invention are as follows: The text classification method provided by this invention integrates the semantic features of the text to be classified with industry statistical prior features to form a more comprehensive and realistic fused feature. Then, a hierarchical residual quantization method is used to progressively refine the matching and extraction of this fused feature in a multi-layered structure, forming a decision path composed of prototype vectors at each layer. This process not only represents the text more precisely but also corrects the errors of the semantic model through industry prior knowledge. Finally, through the optimization of the joint loss function (including quantization error and semantic-prior distribution differences), the model simultaneously fits semantic information and industry patterns during training, achieving a more refined hierarchical feature representation, thereby improving the accuracy of text classification in real and complex business scenarios. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A schematic flowchart of an embodiment of the text classification method provided by the present invention; Figure 2 For the present invention Figure 1 A schematic diagram of an embodiment of S101; Figure 3 For the present invention Figure 1 A schematic diagram of an embodiment of S104; Figure 4 For the present invention Figure 3 A schematic diagram of an embodiment of S302; Figure 5 A schematic diagram of an embodiment of the text classification device provided by the present invention; Figure 6 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0020] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0021] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0023] In the relevant technologies, relying solely on keyword matching or single text classification models in the industry classification process of government and enterprise procurement data cannot meet the high-precision industry classification requirements of the National Bureau of Statistics. The main shortcomings of these technologies are as follows: (1) Semantics and statistics are disconnected: Text semantic models often ignore the inherent statistical distribution patterns of industry classification (such as the natural clustering of certain industries in specific regions).

[0024] (2) Redundancy in classification hierarchy: For cross-industry projects, a single vector representation is difficult to reflect the residual relationship in multi-level industry classification.

[0025] (3) Weak handling of long-tail distribution: When niche industries lack large-scale labeled samples, the classification accuracy is extremely low.

[0026] This invention provides a text classification method, apparatus, electronic device, and storage medium, which are described below.

[0027] Figure 1 A schematic flowchart of an embodiment of the text classification method provided by the present invention is shown below. Figure 1As shown, the text classification method includes steps S101 to S104.

[0028] Step S101: Fuse the semantic features of the text to be classified with the prior features of industry statistics to generate fused features.

[0029] It should be noted that the text to be classified can be core text data in bidding and procurement activities (such as government and enterprise procurement data). Any text information that can reflect the project content, technical attributes or service scope in the bidding process falls within the scope of the text to be classified in this invention.

[0030] In step S101, the semantic features of the text to be classified Feature extraction can typically be achieved using pre-trained language models (PLMs). Models pre-trained on large-scale corpora (such as BERT, RoBERTa, Sentence-BERT, etc.) are used as feature extractors.

[0031] The specific steps are as follows: First, the text to be classified (e.g., "General Contracting for the Construction of the Comprehensive Building of the Vehicle Depot of Metro Line 19 in a Certain City") is input into a pre-trained language model. Second, this pre-trained language model encodes the text through its internal Transformer layer, understanding its syntax, semantics, and contextual information. Finally, mean pooling is performed on all word vectors in the last layer to obtain a fixed-dimensional vector (e.g., 768-dimensional or 1024-dimensional). This vector represents the semantic feature, capturing the deeper meaning of the text.

[0032] Statistical prior features in step S101 It is used to represent the proportion of a certain industry in the total, and it is obtained by transforming macro-level industry distribution knowledge (such as the industry proportion data published by the National Bureau of Statistics) into a vector that can be used for calculation.

[0033] Specific operations: Data sources: For example, obtain the National Economic Industry Classification standard published by the National Bureau of Statistics, as well as the frequency (or proportion) statistics of each industry in historical bidding data.

[0034] Constructing a vector: Treat the entire industry classification system (such as major categories and intermediate categories) as a dimensional space. Calculate the probability (or frequency) of occurrence of each industry category to form a probability distribution vector.

[0035] Example: Suppose there are 10 major industry categories. Statistics show that "construction" accounts for 30%, "manufacturing" accounts for 25%, and so on. The statistical prior features can be represented as a vector [0.3, 0.25, ...].

[0036] like Figure 2 As shown, in some embodiments of the present invention, step S101 may specifically include: Step S201: Extract the correlation between semantic features and industry statistical prior features based on the normalized exponential function to obtain fused features.

[0037] The normalized exponential function used in this embodiment of the invention is: Function. Utilizing The function captures the semantic features obtained above. and statistical prior features Specifically, the correlation between the two is captured using a cross-attention mechanism to obtain fused features. The fused features ensure that the initial features already have spatial constraints of statistical dimensions, as shown in the following formula: ; in, As a feature of fusion, , , To learn the weight matrix, For feature dimension, As a scaling factor, to prevent in the calculation The gradient vanishes when the function has too high a dimension.

[0038] Step S102: Starting with the fused features, sequentially traverse the pre-built features, including... The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... A hierarchical codebook contains one or more learnable prototype vectors.

[0039] It should be noted that in step S102, the pre-construction includes... Quantization space of each level of codebook In this embodiment of the invention, we will use The first codebook have The first prototype vector represents the coarsest granularity (e.g., industry category); the second codebook... have One vector represents a finer granularity (such as a broad industry category), and so on.

[0040] codebook This is the first The specific content of the layer codebook space is a learnable parameter matrix with dimensions [ , ].in It is the number of prototype vectors in this layer. This is the dimension of the prototype vector. Each row in this matrix is ​​a "codebook vector".

[0041] For example: Assumption This represents the "Industry Category" layer, which is configured to have... =10 vectors (corresponding to 10 categories). Therefore: The codebook space structure is: There are 10 A 10-dimensional vector. This "10" is fixed.

[0042] codebook It is itself a A 3D matrix.

[0043] In step S102, starting from the fusion features generated in step S101, an iterative quantization process based on the codebook is executed, progressing from coarse to fine. The goal of this process is to "translate" the continuous, high-dimensional fusion features layer by layer into a series of discrete, hierarchical industry classification "decision codes".

[0044] The specific implementation is as follows: First, before performing quantization, the system has already built a framework including... The quantization space of a multi-level codebook.

[0045] From 1 to : Represents a range from the coarsest granularity (such as industry category) to the finest granularity (such as industry sub-category). Each decision-making level.

[0046] No. Layer Codebook This is a learnable parameter matrix that contains... Each prototype vector can be understood as a typical industry characteristic pattern at that level.

[0047] Under normal circumstances, The smaller the codebase, the more abstract it is (and the wider its coverage). (smaller) The larger the codebook, the more specific it is (smaller coverage area). (relatively large)

[0048] Secondly, the initial "information residual" is set as... For the first Layer Codebook Find the nearest quantitative center: For each layer Repeat the following two core operations: Step A: Quantitative selection (this layer's decision).

[0049] Operation: in the first Layer codebook In the middle, find the residual with the current input (i.e., the previous layer). The closest prototype vector.

[0050] In some embodiments of the present invention, in the first The layer performs quantization operations to extract from the first... Selecting prototype vectors in the hierarchical codebook of a layer can include: In the Layer performs quantization operations , so as to start from the Layer-level codebook Selecting the prototype vector .

[0051] In this embodiment of the invention, the selected first The expression for selecting the prototype vector in the layer-level codebook is as follows: ; in, For from the first The prototype vector selected from the hierarchical codebook of the layer.

[0052] Step B: Residual calculation and transfer (information update).

[0053] No. Layer residuals Defined as the first Layer residuals Subtract the current layer's quantization value. Its purpose is to ensure that the next layer's quantization only focuses on "details that the previous layer failed to express," thus achieving layer-by-layer refinement.

[0054] In some embodiments of the present invention, the first Methods for obtaining layer residuals include: The first is obtained based on the following formula. Layer residuals: ; in, For the first The residual of the layer, For the first The residual of the layer.

[0055] In this embodiment of the invention, the following formula can be used: Layer residuals: ; in, For the first The residual of the layer, For the first The residual of the layer.

[0056] Final output: Decision path; go through After layer iteration, a sequence of prototype vectors can be obtained. This path is the complete classification decision chain generated by the model for the text to be classified, from coarse to fine. Pointing to the coarsest category, It points to more detailed categories.

[0057] The above steps decompose the fusion features layer by layer. Each residual represents the "information increment" of the text to be classified in a more subdivided industry dimension after the upper-level industry classification is known.

[0058] Step S103: Optimize the results using gradient backpropagation based on the joint loss. All prototype vectors in each level codebook are used until the joint loss converges. The joint loss includes at least a first loss based on the quantization error of each level in the decision path, and a second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics. The semantic distribution is obtained according to the decision path.

[0059] To ensure that the decision paths obtained above conform to the industry distribution patterns of the National Bureau of Statistics, this embodiment of the invention introduces a joint loss. The joint loss is defined as a weighted sum of the reconstruction error and the statistical distribution deviation, specifically composed of a first loss based on the quantification errors at each level of the decision path, and a second loss summing the differences between the semantic distribution of the text to be classified and the prior industry statistical distribution.

[0060] In some embodiments of the present invention, the joint loss is obtained in the following ways: The joint loss is obtained based on the following formula: ; in, For joint losses, The first loss, This is the second loss. For divergence operators, For preset weighting coefficients, For semantic distribution, This represents the prior distribution of industry statistics.

[0061] In this embodiment of the invention, the joint loss can be calculated using the following formula. This joint loss, by penalizing the selection of prototype vectors at each layer, forces the system to learn quantization centers that better reflect the actual distribution in the industry. ; in, The first loss, This is the second loss. This is a divergence operator used to force the semantic distribution to approximate the industry statistical prior distribution. For preset weighting coefficients, For semantic distribution, This represents the prior distribution of industry statistics.

[0062] It should be noted that, It is obtained by statistically analyzing the final decision results of the current batch of texts to be classified. Specifically: Each sample is mapped to a final industry label through its decision path (e.g., by nearest neighbor retrieval via a classifier or reconstructed vector).

[0063] By statistically analyzing the frequency of each industry label in this batch, an empirical probability distribution is formed. .

[0064] : Fixed, real industry distribution derived from external input (such as data from the National Bureau of Statistics).

[0065] After calculating the joint loss based on the above formula, the gradient of the loss function with respect to all trainable parameters in the model is calculated using the backpropagation algorithm, and then these parameters are updated using an optimizer (such as Adam).

[0066] In each training iteration, the model parameters (mainly the codebook vector) are updated slightly in the opposite direction of the gradient. This process continues to iterate until the joint loss converges.

[0067] Step S104: Based on the optimal decision path formed when the joint loss converges, obtain the classification result of the text to be classified.

[0068] In this embodiment of the invention, the classification result of the text to be classified is obtained by labeling the optimal decision path obtained when the above-mentioned joint loss converges.

[0069] like Figure 3 As shown, in some embodiments of the present invention, step S104 may specifically include: Step S301: Accumulate all prototype vectors in the optimal decision path to obtain the reconstructed vector; Step S302: Perform a nearest neighbor search operation on the reconstructed vector in the industry statistical standard classification label library to obtain the classification result.

[0070] In this embodiment of the invention, vector addition is performed on the prototype vector in the optimal decision path obtained above to obtain a reconstructed vector. This reconstructed vector contains both high-level abstract concepts and low-level specific details, as well as comprehensive industry characteristics.

[0071] It should be noted that the industry statistical standard classification label library can be a collection, for example... ,in It is the first Label vector representation of each industry category It is the corresponding official classification code and name (such as "C35 Special Equipment Manufacturing").

[0072] The reconstructed vectors obtained above are used to perform a nearest neighbor search operation in the industry statistical standard classification label library to obtain the classification result of the text to be classified.

[0073] like Figure 4 As shown, in some embodiments of the present invention, step S302 may specifically include: Step S401: Obtain the Euclidean distance or similarity between the reconstructed vector and each tag vector in the industry statistical standard classification tag library; Step S402: Obtain the classification result based on the label vector that is closest or most similar to the reconstructed vector in terms of Euclidean distance.

[0074] In this embodiment of the invention, the nearest neighbor operation is achieved by calculating the Euclidean distance or similarity (such as cosine similarity) between the reconstructed vector and each tag vector in the industry statistical standard classification tag library.

[0075] Obtain the label vector that is closest to or most similar to the reconstructed vector in terms of Euclidean distance, and obtain the classification result of the text to be classified based on the official classification code and name corresponding to the label vector.

[0076] For example: The title of a tender notice is "Procurement for the Construction of an Agricultural Modernization Internet of Things in a Certain City," which involves the intersection of "agriculture" and "information technology."

[0077] Initialization: The system integrates the text feature of "agriculture" with the "digital agriculture investment weight" published by the local statistics bureau to generate integrated features.

[0078] Hierarchical quantification: Quantified to the major categories of "agriculture, forestry, animal husbandry and fishery".

[0079] Capturing the semantics of "Internet of Things" from the residuals and quantifying it to the class center of "agricultural professional and auxiliary activities". .

[0080] Loss Correction: The system detected that classifying the project as purely "IT industry" would cause a surge in the divergence operator (deviating from the agricultural statistical nature of the project), and therefore corrected it. The selection process retains the agricultural attributes.

[0081] The final output is the National Bureau of Statistics industry label: [A0512] (Agricultural Machinery and Digital Services), which achieves accurate quantification of cross-industry semantics.

[0082] In summary, the text classification method provided in this invention integrates the semantic features of the text to be classified with industry statistical prior features to form a more comprehensive and realistic fused feature. Next, a hierarchical residual quantization method is used to progressively refine the matching and extraction of this fused feature within a multi-layered structure, forming a decision path composed of prototype vectors from each layer. This process not only represents the text more precisely but also corrects errors in the semantic model through industry prior knowledge. Finally, by optimizing the joint loss function (including quantization error and semantic-prior distribution differences), the model simultaneously fits semantic information and industry patterns during training, achieving a more refined hierarchical feature representation, thereby improving the accuracy of text classification in complex real-world business scenarios.

[0083] To better implement the text classification method in the embodiments of the present invention, based on the text classification method, correspondingly, such as... Figure 5 As shown, this embodiment of the invention also provides a text classification device, the text classification device 500 including: The first acquisition module 501 is used to fuse the semantic features of the text to be classified with the prior features of industry statistics to generate fused features; The second acquisition module 502 is used to sequentially traverse the pre-built dataset, starting from the fused features, including... The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... The hierarchical codebook contains one or more learnable prototype vectors; Optimization module 503 is used to optimize the joint loss through gradient backpropagation. All prototype vectors in each level codebook are used until the joint loss converges. The joint loss includes at least the first loss based on the quantization error of each level in the decision path, and the second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics. The semantic distribution is obtained according to the decision path. The classification module 504 is used to obtain the classification result of the text to be classified based on the optimal decision path formed when the joint loss converges.

[0084] The text classification device 500 provided in the above embodiments can implement the technical solutions described in the above text classification method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above text classification method embodiments, and will not be repeated here.

[0085] like Figure 6 As shown, the present invention also provides an electronic device 600. The electronic device 600 includes a processor 601, a memory 602, and a display 603. Figure 6 Only some components of the electronic device 600 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0086] In some embodiments, processor 601 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 602 or process data, such as the text classification method of the present invention.

[0087] In some embodiments, processor 601 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 601 may be local or remote. In some embodiments, processor 601 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, intranet, multi-cloud, etc., or any combination thereof.

[0088] In some embodiments, memory 602 may be an internal storage unit of electronic device 600, such as a hard disk or memory of electronic device 600. In other embodiments, memory 602 may also be an external storage device of electronic device 600, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 600.

[0089] Furthermore, the memory 602 may include both internal storage units of the electronic device 600 and external storage devices. The memory 602 is used to store application software and various types of data installed on the electronic device 600.

[0090] In some embodiments, display 603 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 603 is used to display information from electronic device 600 and to display a visual user interface. Components 601-603 of electronic device 600 communicate with each other via a system bus.

[0091] In one embodiment, when processor 601 executes the text classification program in memory 602, the following steps may be performed: The semantic features of the text to be classified are fused with industry statistical prior features to generate fused features; Starting with the fusion feature, sequentially traverse the pre-constructed features including The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... The hierarchical codebook contains one or more learnable prototype vectors; Based on the joint loss, the optimization is performed through gradient backpropagation. The joint loss is calculated from all prototype vectors in the hierarchical codebook until the joint loss converges. The joint loss includes at least a first loss based on the quantization error of each layer in the decision path, and a second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics, wherein the semantic distribution is obtained according to the decision path. The classification result of the text to be classified is obtained based on the optimal decision path formed when the joint loss converges.

[0092] It should be understood that when the processor 601 executes the text classification program in the memory 602, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.

[0093] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 600 mentioned. Electronic device 600 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 600 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0094] Accordingly, this application also provides a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the steps or functions in the text classification methods provided in the above-described method embodiments.

[0095] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0096] The text classification method, apparatus, electronic device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A text classification method, characterized in that, include: The semantic features of the text to be classified are fused with industry statistical prior features to generate fused features; Starting with the fusion feature, sequentially traverse the pre-constructed features including The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... The hierarchical codebook of a layer contains one or more learnable prototype vectors; Based on the joint loss, the optimization is performed through gradient backpropagation. The joint loss is calculated from all prototype vectors in the hierarchical codebook until the joint loss converges. The joint loss includes at least a first loss based on the quantization error of each layer in the decision path, and a second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics, wherein the semantic distribution is obtained according to the decision path. The classification result of the text to be classified is obtained based on the optimal decision path formed when the joint loss converges.

2. The text classification method according to claim 1, characterized in that, The classification result of the text to be classified is obtained based on the optimal decision path formed when the joint loss converges, including: The reconstructed vector is obtained by summing all the prototype vectors in the optimal decision path; The reconstructed vector is subjected to a nearest neighbor search operation in the industry statistical standard classification label library to obtain the classification result.

3. The text classification method according to claim 2, characterized in that, The step of performing a nearest neighbor search operation on the reconstructed vector in the industry statistical standard classification label library to obtain the classification result includes: Obtain the Euclidean distance or similarity between the reconstructed vector and each tag vector in the industry statistical standard classification tag library; The classification result is obtained based on the label vector that is closest to or most similar to the reconstructed vector in terms of Euclidean distance.

4. The text classification method according to claim 1, characterized in that, The process of fusing the semantic features of the text to be classified with industry statistical prior features to generate fused features includes: The correlation between the semantic features and the industry statistical prior features is extracted based on the normalized exponential function to obtain the fused features.

5. The text classification method according to claim 1, characterized in that, In the first The layer performs quantization operations to extract from the first... The prototype vectors selected from the hierarchical codebook of the layer include: In the Layer performs quantization operations , so as to start from the Layer-level codebook Selecting the prototype vector .

6. The text classification method according to claim 1, characterized in that, The first Methods for obtaining layer residuals include: The number is obtained based on the following formula. Layer residuals: ; in, For the first The residual of the layer For the first The residual of the layer.

7. The text classification method according to claim 1, characterized in that, The methods for obtaining the joint loss include: The joint loss is obtained based on the following formula: ; in, For joint losses, The first loss, This is the second loss. For divergence operators, For preset weighting coefficients, For semantic distribution, This represents the prior distribution of industry statistics.

8. A text classification device, characterized in that, include: The first acquisition module is used to fuse the semantic features of the text to be classified with the prior features of industry statistics to generate fused features; The second acquisition module is used to sequentially traverse the pre-built dataset, starting from the fused features. The quantization space of the codebook at each level, in the first... The layer performs quantization operations to extract from the first... The prototype vector is selected from the hierarchical codebook of the layer, and the first-order vector is calculated. The residuals from one layer are passed to the next, ultimately forming a decision path composed of the selected prototype vectors, where the first... A hierarchical codebook contains one or more learnable prototype vectors; The optimization module is used to optimize the joint loss through gradient backpropagation. The joint loss is calculated from all prototype vectors in the hierarchical codebook until the joint loss converges. The joint loss includes at least a first loss based on the quantization error of each layer in the decision path, and a second loss based on the difference between the semantic distribution of the text to be classified and the prior distribution of industry statistics, wherein the semantic distribution is obtained according to the decision path. The classification module is used to obtain the classification result of the text to be classified based on the optimal decision path formed when the joint loss converges.

9. An electronic device, characterized in that, Including memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the text classification method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the text classification method according to any one of claims 1 to 7.