Text classification method and device, equipment, storage medium and program product
By combining the FastText model with the large Transformer model to form a fusion model, the problem of insufficient accuracy of text classification in the power industry is solved, and efficient and accurate text classification effect is achieved.
Patent Information
- Application Number
- CN202510069820.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-02-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing text classification technologies perform poorly in the application of the power industry, especially when data feature sparsity, domain specificity and classification granularity requirements are high.
Combining the lightweight FastText model and the large Transformer model, through fusion strategy collaboration, text data of preset fields is obtained, and preliminary classification is performed in the pre-constructed fusion model, and finally the text classification results are determined based on the classification probability difference.
It significantly improves the accuracy and efficiency of text classification, dynamically optimizes performance, improves the flexibility and applicability of the system, and achieves efficient and accurate text classification.
Smart Images

Figure CN119493860A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a text classification method, device, equipment, storage medium and program product. Background Art
[0002] In recent years, text processing technology has made significant progress and can achieve basic text classification, text generation, text dialogue, etc. However, current text processing technologies are usually pre-trained on general texts. Although they have good performance in a wide range of fields, they are not accurate enough in specific fields, such as the power industry.
[0003] Take the power industry as an example. In order to better ensure the safe operation of the power system, the power industry needs to process and manage a large amount of technical documents, event reports, monitoring data and related research materials. These text data are highly professional and complex in classification hierarchy, involving information from power production to power transmission and distribution, equipment maintenance and emergency response. Traditional text classification methods, including Naive Bayes, Support Vector Machine (SVM), K Nearest Neighbor (KNN), etc., have achieved remarkable results in general fields. However, when applied to the power industry, these methods often perform poorly, for reasons including but not limited to: data feature sparsity, domain specificity and high text classification granularity requirements. In addition, although natural language processing (NLP) technology based on deep learning has made breakthroughs in recent years, there are still some application bottlenecks. Another commonly used text processing technology is the large language model (LLM) pre-trained based on the Transformer architecture, which has shown strong performance in various natural language understanding tasks. These large models are pre-trained on large-scale corpora, have strong context understanding and semantic expression capabilities, and can effectively capture complex language structures. However, relying solely on large pre-trained models for text classification, especially on domain-specific datasets, may face challenges in the model's generalization ability and classification efficiency.
[0004] Therefore, the inventors found that how to combine the traditional lightweight model with the modern large-scale model to form an efficient and accurate text classification method has become an urgent problem to be solved. Summary of the invention
[0005] In view of this, the present invention provides a text classification method, apparatus, device, storage medium and program product to improve the accuracy of text classification in professional fields.
[0006] In a first aspect, the present invention provides a text classification method, the method comprising: Get text data of preset fields; Input text data into a pre-built fusion model to obtain a first preliminary classification result corresponding to a first sub-model in the fusion model and a second preliminary classification result corresponding to a second sub-model in the fusion model; wherein the fusion model is a model corresponding to a preset domain; the first sub-model adopts a FastText model, and the second sub-model adopts a Transformer model; Based on the first preliminary classification result and the second preliminary classification result, a final text classification result is determined.
[0007] The present invention collaborates the two models through a fusion strategy, combining the high efficiency of a lightweight model with the deep semantic analysis capability of a large language model, significantly improving the classification performance, and dynamically optimizing the performance under different text characteristics, thereby enhancing the flexibility and applicability of the system and achieving efficient and accurate text classification.
[0008] In an optional implementation, determining a final text classification result based on the first preliminary classification result and the second preliminary classification result includes: Obtaining a first probability value corresponding to each text category in the first preliminary classification result; Obtaining a second probability value corresponding to each text category in the second preliminary classification result; Calculate the probability difference between the first probability value and the second probability value corresponding to the same text category; When the probability difference meets the preset standard, the corresponding text category is output as the text classification result.
[0009] In this implementation, a judgment mechanism based on classification probability difference is designed to achieve high controllability and adaptability of classification results. By comparing the classification probability distribution of FastText and a large pre-trained model and setting an adjustable difference threshold, when the output difference of the two models is less than the threshold, the classification result is considered reliable and automatically output, which can significantly reduce the workload of manual participation and improve recognition efficiency and accuracy.
[0010] In an optional implementation, when the probability difference does not meet the preset standard, the user judgment stage is entered, and the user judgment result is used as the text classification result; When the difference between the outputs of the two models is less than the threshold, the classification result is considered reliable and automatically output. When the difference between the classification results of the two models is greater than the threshold, it enters the manual judgment stage. Professionals analyze and confirm the category of the text to ensure the accuracy and authority of the final output result.
[0011] In an optional implementation, after entering the user determination phase, the determination text category determined by the user is responded to, and the determination text category is fed back to the fusion model to optimize the fusion model.
[0012] The manual judgment provided in this embodiment can not only improve the accuracy of classification, but also provide higher quality training data for the model. Through the manual feedback mechanism, the system can continuously optimize and improve its own performance and has strong adaptive learning ability. The manual annotation data feeds back to the model training, which helps to gradually improve the accuracy of text classification.
[0013] In an optional implementation, before inputting text data into a pre-built fusion model, the process includes: Obtain a text dataset in a preset field, which includes a training set, a test set, and a validation set; The first sub-model and the second sub-model are trained based on the text data set respectively; wherein the second sub-model further includes an optimization prompt word; The trained first sub-model and the second sub-model are encapsulated into a fusion model.
[0014] In this implementation, the accuracy of text classification is significantly improved by combining FastText and Transformer large pre-trained models. Traditional models perform well in processing short texts and high-frequency words, while large models have advantages in understanding complex semantics and domain-specific terms. The fusion of the two achieves a balance between accuracy and stability.
[0015] In an optional implementation, the text data set is a data set that has been preprocessed, and the data preprocessing includes: The text data in the text data set is sequentially cleaned, word segmented, stop word removed, and data standardized; The text data obtained after data standardization is processed by text segmentation, paragraph segmentation, sentence length segmentation and natural language breakpoint segmentation.
[0016] In this embodiment, by performing data cleaning, word segmentation, stop word removal and data standardization on the text data set, the text quality can be effectively improved, noise information can be removed, and subsequent text analysis can be more accurate and efficient. By segmenting by paragraph, sentence length and natural language breakpoint, the text structure can be further optimized, so that the model can better understand the text content and improve the processing ability and effect of the model.
[0017] In a second aspect, the present invention provides a text classification device, the device comprising: An acquisition module is used to acquire text data of a preset field; A classification module, used to input text data into a pre-built fusion model, and obtain a first preliminary classification result corresponding to a first sub-model in the fusion model and a second preliminary classification result corresponding to a second sub-model in the fusion model; wherein the fusion model is a model corresponding to a preset domain; the first sub-model adopts a FastText model, and the second sub-model adopts a Transformer model; The determination module is used to determine the final text classification result based on the first preliminary classification result and the second preliminary classification result.
[0018] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the text classification method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0019] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the text classification method of the first aspect or any corresponding embodiment thereof.
[0020] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the text classification method of the first aspect or any corresponding embodiment thereof.
[0021] It should be noted that the text classification device, computer device, computer readable storage medium and computer program product provided by the present invention correspond to the above-mentioned text classification method. Therefore, for the beneficial effects of the text classification device, computer device, computer readable storage medium and computer program product, please refer to the description of the corresponding beneficial effects of the text classification method above, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 is a flowchart of a text classification method according to an embodiment of the present invention; Figure 2 is a structural block diagram of a text classification device according to an embodiment of the present invention; Figure 3It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0025] According to an embodiment of the present invention, a text classification method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0026] In this embodiment, a text classification method is provided, which can be executed by a server, a terminal, a mobile terminal and other devices. Figure 1 is a flowchart of a text classification method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps: Step S101, obtaining text data of a preset field. The preset field in this embodiment takes the text data of the power industry as an example, and of course it can also be professional fields such as finance and medicine. The text data of the power industry includes but is not limited to technical reports, accident analysis documents, equipment maintenance manuals and academic research papers.
[0027] Step S102, input the text data into a pre-built fusion model to obtain a first preliminary classification result corresponding to the first sub-model in the fusion model and a second preliminary classification result corresponding to the second sub-model in the fusion model; wherein the fusion model is a model corresponding to a preset domain; the first sub-model adopts the FastText model and the second sub-model adopts the Transformer model.
[0028] In this embodiment, the lightweight traditional model is preferentially combined with the large language model. The first sub-model can use the FastText model (a word vector and text classification model open sourced by Facebook) as the basic classification model, and the second sub-model can use a large language model pre-trained based on the Transformer architecture, and the first sub-model and the second sub-model are both models corresponding to the preset field, such as the power industry field, that is, the training data of the first sub-model and the second sub-model are trained based on the power industry data. The text data passes through the first sub-model and the second sub-model at the same time, and the first preliminary classification result corresponding to the first sub-model and the second preliminary classification result corresponding to the second sub-model are output respectively. Taking the text data of the power industry as an example, the preliminary classification result output by the first sub-model can be: [Technical Report, 0.88], that is, the text category is "Technical Report", the prediction probability is 0.88, and the preliminary classification result output by the second sub-model can be: [Technical Report, 0.85].
[0029] Step S103, based on the first preliminary classification result and the second preliminary classification result, determine the final text classification result. Still taking the above example, when the prediction probability in the first preliminary classification result output by the first sub-model is 0.88 and the prediction probability in the first preliminary classification result output by the second sub-model is 0.85, it is determined that the text classification result corresponding to the final text data is "technical report".
[0030] In this embodiment, by organically combining the traditional FastText model with a large pre-trained language model, the FastText model can quickly process and classify short texts or structured texts, and excels in capturing the basic semantic relationships of word vectors, which is particularly suitable for scenarios where vocabulary appears frequently. The large pre-trained model has deep semantic understanding capabilities and can handle complex and professional industry texts. The two models collaborate through a fusion strategy, combining the efficiency of lightweight models with the deep semantic analysis capabilities of large language models, significantly improving classification performance, and dynamically optimizing performance under different text characteristics, improving the flexibility and applicability of the system, and achieving efficient and accurate text classification.
[0031] In some optional implementations, determining a final text classification result based on the first preliminary classification result and the second preliminary classification result includes: Obtain a first probability value corresponding to each text category in the first preliminary classification result.
[0032] A second probability value corresponding to each text category in the second preliminary classification result is obtained.
[0033] The probability difference between the first probability value and the second probability value corresponding to the same text category is calculated.
[0034] When the probability difference meets the preset standard, the corresponding text category is output as the text classification result.
[0035] In this embodiment, the probability distribution difference of the output of the FastText model and the large language model can be analyzed by comparing the classification results of the two models. To this end, an adjustable difference threshold can be designed, that is, a preset standard is used as a judgment standard. If the probability difference between the two models is less than the set threshold, it is considered that the classification results are consistent and can be directly output. In this embodiment, the preset standard can be set to [0, 0.1].
[0036] Still taking the above example, for the text category of "technical report", when the prediction probability output by the first sub-model is 0.88 and the prediction probability output by the second sub-model is 0.85, the probability difference between the first probability 0.88 and the first probability 0.85 is 0.03, which meets the preset standard. The final text classification result is determined to be technical report.
[0037] Of course, the model may predict more than one text category. If all of them meet the preset standards, the final text classification result will include multiple text categories, and the text categories are mapped with probability values.
[0038] In this embodiment, a judgment mechanism based on classification probability difference is designed to achieve high controllability and adaptability of classification results. By comparing the classification probability distribution of FastText and a large pre-trained model and setting an adjustable difference threshold, when the output difference of the two models is less than the threshold, the classification result is considered reliable and automatically output, which can significantly reduce the workload of manual participation and improve recognition efficiency and accuracy.
[0039] In some optional implementations, when the probability difference does not meet the preset standard, the user judgment stage is entered, and the user judgment result is used as the text classification result.
[0040] When the difference between the outputs of the two models is less than the threshold, the classification result is considered reliable and automatically output. When the difference between the classification results of the two models is greater than the threshold, it enters the manual judgment stage. Professionals analyze and confirm the category of the text to ensure the accuracy and authority of the final output result.
[0041] In some optional implementations, after entering the user determination phase, the determination text category determined by the user is responded to, and the determination text category is fed back to the fusion model to optimize the fusion model.
[0042] In this embodiment, the results of manual judgment are fed back into the training data set, and FastText and large language models are retrained. Through continuous iteration, the model can gradually learn new features and patterns, thereby improving classification accuracy and generalization ability. The self-learning ability of the model enables it to maintain efficient performance when dealing with emerging terminology and changes in fields such as the power industry. Manual judgment can not only improve the accuracy of classification, but also provide higher quality training data for the model. Through the manual feedback mechanism, the system can continuously optimize and improve its own performance, and has a strong adaptive learning ability. Manually annotated data feeds back model training, which helps to gradually improve the accuracy of text classification.
[0043] This design takes into account both automated processing and manual accuracy, and can flexibly adjust the threshold according to different scenarios. For example, the threshold can be more stringent for texts with higher security requirements, while it can be set loosely for general texts to flexibly respond to different types of text data, ensure that the model is adaptable to a variety of application scenarios, and optimize the classification process and controllability of the results. This method has good scalability and can easily introduce other pre-trained models or optimization strategies.
[0044] In addition, by introducing manual judgment and feedback optimization, manual judgment is performed when there are large differences in classification results, and the annotation results are fed back to the model as new data for retraining. Through continuous manual feedback and multiple rounds of iterations, the model can continuously optimize the classification accuracy and enhance the understanding of the semantics of the power industry. This mechanism ensures that the system can quickly adjust and adapt to new types of text or changing semantic environments, and continuously improve its performance. In addition, a self-evolving learning system is constructed in the feedback optimization mechanism, which can gradually accumulate more industry knowledge and ensure that the model maintains efficient and stable classification capabilities in long-term use.
[0045] In some optional implementations, before inputting text data into a pre-built fusion model, the following steps are included: Get a text dataset of a preset field. The text dataset includes a training set, a test set, and a validation set.
[0046] The first sub-model and the second sub-model are trained respectively based on the text data set; wherein, optimization prompt words are also added to the second sub-model.
[0047] The trained first sub-model and the second sub-model are encapsulated into a fusion model.
[0048] In this embodiment, the FastText model is selected as the basic classification model. FastText is known for its high efficiency and low computational cost. It can quickly process large-scale text data and performs well in processing text phrases and high-frequency words. The FastText model mainly uses the word vector representation method to represent the text as a dense vector and retain the semantic information of the text.
[0049] Specifically, the preprocessed text data is converted into vector form, the FastText model generates feature representations by training word vectors, and uses the Softmax classifier to classify the text. The Softmax function is used to calculate the probability distribution of each category to ensure that the classification results are interpretable and have clear probability measurements. Then, based on the annotated text dataset, the FastText model is trained and tuned to improve its performance in specific professional fields.
[0050] Furthermore, the FastText model can be optimized by cross-validation, data enhancement, and parameter adjustment. Using cross-validation technology to evaluate model performance can prevent overfitting and enhance the generalization ability of the model. The data set can also be enhanced by synonym replacement, sentence reorganization, etc. to improve the robustness of the model. According to the experimental results, the model's learning rate, word vector dimension and other hyperparameters are continuously adjusted to ensure that the model achieves optimal performance.
[0051] To further improve the accuracy of classification, the present invention also introduces a large pre-trained language model. In this embodiment, a large pre-trained language model based on the Transformer architecture is used. This model is pre-trained on a large corpus and has the ability to understand context and complex semantics, which is suitable for processing texts with numerous terms and complex structures in professional industries.
[0052] Since the large model relies on input prompts to understand the classification task, it is also possible to design and optimize prompt words to guide the large model to output the expected classification results. For example: embed professional terms and common classification standards of the power industry in the prompt words to help the model parse the text semantics more accurately. Further clarify the problem and make the model's classification task clearer by optimizing the prompts, thereby reducing the ambiguity and uncertainty of the output. The text is classified through the large model and the probability distribution of each category is output. Using prompt word optimization, the model's understanding of specific problems can be adjusted to perform better in the text classification task of the power industry.
[0053] In this embodiment, by combining the FastText and Transformer large pre-trained models, the accuracy of text classification is significantly improved. Traditional models perform excellently in processing short texts and high-frequency words, while large models have advantages in understanding complex semantics and domain-specific terms. The integration of the two achieves a balance between accuracy and stability.
[0054] In some alternative embodiments, the text dataset is a dataset after data preprocessing, and the data preprocessing includes: Successively performing data cleaning, word segmentation, stop word removal, and data standardization on the text data in the text dataset; Performing text chunking, paragraph segmentation, sentence length segmentation, and natural language breakpoint segmentation on the text data obtained after data standardization respectively.
[0055] To effectively perform text classification, first, comprehensive data collection and preprocessing are carried out to ensure the quality and adaptability of the data. Specifically, taking the power industry as an example, the data source obtains various types of text data from the field of power safety. These data include but are not limited to technical reports, accident analysis documents, equipment maintenance manuals, and academic research papers. The texts in the power industry have significant characteristics, such as frequent use of professional terms, uneven distribution of documents, and complex hierarchical structures. Therefore, multiple sub-domains need to be covered during the collection process to ensure the comprehensiveness and representativeness of the data.
[0056] Furthermore, the collected text data may contain various noises and invalid information, so cleaning and standardization processing are required. The main operations include: Removing irrelevant information, that is, data cleaning: filtering HTML tags, special symbols, and other characters irrelevant to the text content to ensure the cleanliness of the text; Word segmentation processing: According to the language characteristics of Chinese, using accurate word segmentation methods (such as jieba, NLTK, or spaCy) to divide the text into word units, and judging the specific meaning of polysemous words according to the context to ensure the accuracy of the word segmentation results, which is helpful for subsequent feature extraction and model training; Removing stop words: Stop words refer to words that frequently appear in the text but are not helpful for the classification task, such as "de", "he", "zai", etc.; removing stop words can reduce noise and improve the training efficiency of the model; Data standardization: including unifying the numbers, time formats, and specific symbols in the text to ensure that all data has a consistent format, so as to reduce the variability of vocabulary and improve the generalization ability of the model; Text segmentation: In order to better adapt to the classification model, long text is segmented into multiple logical paragraphs or short sentences to ensure that each segment has complete semantic information; this segmentation method can be segmented according to paragraph or sentence length or natural semantic breakpoints; Paragraph segmentation: segment text according to natural paragraphs to ensure that each text block can convey complete semantic information; Sentence length segmentation: Segment long sentences according to the preset sentence length standard (such as sent_tokenize of NLTK) to avoid semantic loss when the model processes lengthy content; Natural semantic breakpoint segmentation: Use obvious semantic breakpoints in the text, such as punctuation, titles, and chapter separators, to naturally divide the text into appropriate segments.
[0057] In this embodiment, by performing data cleaning, word segmentation, stop word removal and data standardization on the text data set, the text quality can be effectively improved, noise information can be removed, and subsequent text analysis can be more accurate and efficient. By segmenting by paragraph, sentence length and natural language breakpoint, the text structure can be further optimized, so that the model can better understand the text content and improve the processing ability and effect of the model.
[0058] In this embodiment, a text classification device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0059] This embodiment provides a text classification device, such as Figure 2 As shown, the device comprises: An acquisition module 201 is used to acquire text data of a preset field; The classification module 202 is used to input text data into a pre-built fusion model to obtain a first preliminary classification result corresponding to a first sub-model in the fusion model and a second preliminary classification result corresponding to a second sub-model in the fusion model; wherein the fusion model is a model corresponding to a preset domain; the first sub-model adopts a FastText model, and the second sub-model adopts a Transformer model; The judgment module 203 is used to determine the final text classification result based on the first preliminary classification result and the second preliminary classification result. It is used to obtain the first probability value corresponding to each text category in the first preliminary classification result; obtain the second probability value corresponding to each text category in the second preliminary classification result; calculate the probability difference between the first probability value and the second probability value corresponding to the same text category; if the probability difference meets the preset standard, output the corresponding text category as the text classification result; if the probability difference does not meet the preset standard, enter the user judgment link, and use the user judgment result as the text classification result.
[0060] In some optional implementations, the determination module 203 includes: The feedback unit, after entering the user determination phase, responds to the determination text category determined by the user and feeds back the determination text category to the fusion model to optimize the fusion model.
[0061] In some optional embodiments, the device comprises: A construction module is provided, which is used to obtain a text data set in a preset field, wherein the text data set includes a training set, a test set and a validation set; the first sub-model and the second sub-model are trained respectively based on the text data set; wherein optimization prompt words are also added to the second sub-model; and the trained first sub-model and the second sub-model are encapsulated into a fusion model.
[0062] The preprocessing module is used to perform data cleaning, word segmentation, stop word removal and data standardization on the text data in the text data set in sequence; the text data obtained after data standardization is subjected to text segmentation, paragraph segmentation, sentence length segmentation and natural language breakpoint segmentation.
[0063] The text classification device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and a memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0064] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0065] The embodiment of the present invention also provides a computer device having the above Figure 2 The text classification device shown.
[0066] See also Figure 3 , Figure 3 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 3As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 10 is taken as an example.
[0067] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0068] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0069] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0070] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0071] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0072] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0073] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0074] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A text classification method, characterized in that: The method comprises: Get text data of preset fields; Input the text data into a pre-built fusion model to obtain a first preliminary classification result corresponding to a first sub-model in the fusion model and a second preliminary classification result corresponding to a second sub-model in the fusion model; wherein the fusion model is a model corresponding to the preset domain; the first sub-model adopts a FastText model, and the second sub-model adopts a Transformer model; A final text classification result is determined based on the first preliminary classification result and the second preliminary classification result.
2. The method according to claim 1, characterized in that: The determining a final text classification result based on the first preliminary classification result and the second preliminary classification result includes: Obtaining a first probability value corresponding to each text category in the first preliminary classification result; Obtaining a second probability value corresponding to each text category in the second preliminary classification result; Calculating the probability difference between the first probability value and the second probability value corresponding to the same text category; When the probability difference meets the preset standard, the corresponding text category is output as the text classification result.
3. The method according to claim 2, characterized in that When the probability difference does not meet the preset standard, the user judgment stage is entered, and the user judgment result is used as the text classification result.
4. The method according to claim 3, characterized in that After entering the user determination phase, the determination text category determined by the user is responded to, and the determination text category is fed back to the fusion model to optimize the fusion model.
5. The method according to claim 1, characterized in that Before feeding the text data into the pre-built fusion model, include: Acquire a text dataset of the preset domain, wherein the text dataset includes a training set, a test set, and a validation set; Based on the text data set, the first sub-model and the second sub-model are respectively trained; wherein the second sub-model further includes an optimization prompt word; The first sub-model and the second sub-model after training are encapsulated into the fusion model.
6. The method according to claim 5, characterized in that The text data set is a data set that has been preprocessed, and the data preprocessing includes: The text data in the text data set is sequentially subjected to data cleaning, word segmentation, stop word removal and data standardization; The text data obtained after the data standardization process is subjected to text segmentation processing, paragraph segmentation processing, sentence length segmentation processing and natural language breakpoint segmentation processing.
7. A text classification device, characterized in that: The device comprises: An acquisition module is used to acquire text data of a preset field; A classification module, used for inputting the text data into a pre-built fusion model to obtain a first preliminary classification result corresponding to a first sub-model in the fusion model and a second preliminary classification result corresponding to a second sub-model in the fusion model; wherein the fusion model is a model corresponding to the preset domain; the first sub-model adopts a FastText model, and the second sub-model adopts a Transformer model; A determination module is used to determine a final text classification result based on the first preliminary classification result and the second preliminary classification result.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the text classification method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the text classification method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the text classification method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Text analysis method and terminal
CN109376240A
Text classification and recommendation method and device, equipment and storage medium
CN111444340A
Text data processing method and device, text data classification method and device and readable storage medium
CN111813932A
Text processing method and device, electronic equipment and computer readable storage medium
CN112528645A
Text classification method, device and equipment
CN113535960A
Cited By
Data generation and classification method and large model for data generation and classification
CN121167362A