Text classification method and device, electronic equipment and storage medium
By performing word segmentation, filtering and vectorization of HSE text in the petrochemical industry, using the support vector machine model, a text classification model with high classification accuracy was constructed, which solved the problem of low vocabulary classification accuracy in the HSE field in the existing technology, and realized the Accurate classification of professional vocabulary in the HSE field of the petrochemical industry.
Patent Information
- Application Number
- CN202310533331.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2024-11-12
AI Technical Summary
The existing text classification methods cannot accurately classify professional vocabulary in the HSE field in the petrochemical industry, resulting in poor recognition accuracy.
By obtaining the HSE system review problem text, performing word segmentation and filtering, multiple HSE vocabulary are obtained, and their vectorization is represented, input the HSE review problem text classification model, and using the support vector machine model for classification to build a high classification accuracy HSE review audit with high classification accuracy Problem text classification model.
It has achieved accurate classification of professional vocabulary in the HSE field of the petrochemical industry, and improved the accuracy and efficiency of text classification.
Smart Images

Figure CN118939798A_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, a text classification device, an electronic device and a readable storage medium. Background Art
[0002] In view of the characteristics of the petrochemical industry, the current common practice in the industry is to formulate an HSE (Health, Safety, Environment) management system. Through the HSE management system audit, problems in the enterprise management process can be effectively discovered, and problems in various elements of the system can be classified and analyzed in a timely manner to find out the root causes, thereby improving the enterprise's safety management level and preventing accidents.
[0003] Due to the limitations of the current HSE management system and the methods of manual statistics and analysis, this method is time-consuming and laborious, and has a low accuracy rate when facing large amounts of data. Relevant personnel in the fields of communications, electricity, customer service, etc. have conducted research on multi-label classification technology based on short texts. Currently, the more widely used text classification methods include naive Bayes classification, k-nearest neighbor classification, support vector machine model classification, and classification based on decision trees.
[0004] However, due to the large number of professional vocabulary in the HSE field of the petrochemical industry, the sample distribution is uneven, the length of the question text formed by the audit is relatively short, and the existing text classification methods need to consider the robustness of machine learning algorithms in texts in different fields, which leads to poor recognition accuracy of the semantics of professional vocabulary. In other words, the existing text classification methods cannot accurately classify the professional vocabulary in the HSE field of the petrochemical industry. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a text classification method, device, electronic device and storage medium to solve the problem that the existing text classification method cannot accurately classify professional vocabulary in the HSE field of the petrochemical industry.
[0006] In order to achieve the above object, an embodiment of the present invention provides a text classification method, comprising:
[0007] Get the text of HSE system audit questions;
[0008] Performing word segmentation and filtering processing on the HSE system audit question text to obtain multiple HSE words;
[0009] Vectorizing the multiple HSE words to obtain multiple HSE word vectors;
[0010] The multiple HSE vocabulary vectors are input into the HSE audit question text classification model to obtain the category of the HSE system audit question text.
[0011] Optionally, the HSE audit question text classification model is trained in the following way:
[0012] Obtain HSE system audit question text training data;
[0013] Using a preset label word as a category of the HSE system audit question text training data; the preset label word is one of a plurality of label words in a preset petrochemical industry HSE label word list;
[0014] Performing word segmentation and filtering processing on the HSE system audit question text training data to obtain a plurality of HSE training vocabularies;
[0015] Vectorizing the plurality of HSE training vocabulary words to obtain a plurality of HSE training vocabulary vectors;
[0016] Using a word frequency-inverse text frequency model, the multiple HSE training words are calculated to obtain a TF-IDF value of each HSE training word, and the category of the HSE training word corresponding to the maximum TF-IDF value is determined as the preset label word;
[0017] A classifier of a support vector machine model is constructed according to the HSE training vocabulary vector corresponding to the maximum TF-IDF value and the preset label word, and after the training is completed, the HSE audit question text classification model is obtained.
[0018] Optionally, the HSE system audit question text training data is segmented and filtered to obtain a plurality of HSE training vocabularies, including:
[0019] Using the Jieba word segmentation tool, the HSE system audit question text training data is segmented to obtain multiple training words;
[0020] The plurality of training words are filtered according to a preset stop word library to obtain a plurality of HSE training words.
[0021] Optionally, vectorizing the multiple HSE training vocabulary to obtain multiple HSE training vocabulary vectors includes:
[0022] According to TfidfVectorizer, the multiple HSE training vocabulary are vectorized to obtain the multiple HSE training vocabulary vectors.
[0023] Optionally, determining the category of the HSE training vocabulary corresponding to the maximum TF-IDF value as the preset label word includes:
[0024] It is determined that the HSE training vocabulary corresponding to the maximum TF-IDF value does not include an exclusion word, and the category of the HSE training vocabulary corresponding to the maximum TF-IDF value is determined as the preset label word.
[0025] Optionally, before the step of segmenting and filtering the HSE system audit question text training data to obtain a plurality of HSE training vocabularies, the method further includes:
[0026] The words identical to the preset fixed professional vocabulary are selected from the HSE system audit question text and retained.
[0027] Optionally, the preset fixed professional vocabulary includes: a plurality of label words in a preset petrochemical industry HSE label vocabulary and specific words in element names, system names and terminology explanation chapters in an HSE management system manual.
[0028] Optionally, after the step of inputting a plurality of HSE vocabulary vectors into the HSE audit question text classification model to obtain the category of the HSE system audit question text, the step further includes:
[0029] Establishing association relationships among a plurality of HSE system audit question texts according to the categories of the HSE system audit question texts, and establishing a petrochemical industry knowledge base based on the association relationships;
[0030] Associating the petrochemical industry knowledge base with a pre-built knowledge graph architecture to generate a petrochemical industry knowledge graph;
[0031] The MongoDB database is used to store the petrochemical industry knowledge graph.
[0032] Optionally, after the step of storing the petrochemical industry knowledge graph using the MongoDB database, the step further includes:
[0033] Receive the category query request of HSE system audit question text sent from the terminal device;
[0034] Based on the category query request, searching the petrochemical industry knowledge graph for a category of HSE system audit question text corresponding to the category query information;
[0035] Feedback the category of the HSE system audit question text to the terminal device.
[0036] In a second aspect of the embodiments of the present invention, a text classification device is provided, comprising:
[0037] Data acquisition module, used to obtain the text of HSE system audit questions;
[0038] A data processing module, used for performing word segmentation and filtering on the HSE system audit question text to obtain a plurality of HSE words;
[0039] A matrix construction module, used for vectorizing the plurality of HSE vocabulary words to obtain a plurality of HSE vocabulary vectors;
[0040] The text classification module is used to input the multiple HSE vocabulary vectors into the HSE audit question text classification model to obtain the category of the HSE system audit question text.
[0041] In a third aspect of the embodiments of the present invention, an electronic device is provided, including: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the above-mentioned text classification method is performed.
[0042] In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, storing computer instructions. When the computer instructions are executed on a computer, the computer executes the above-mentioned text classification method.
[0043] In an embodiment of the present invention, an HSE system audit question text is obtained; the HSE system audit question text is segmented and filtered to obtain a plurality of HSE words; the plurality of HSE words are vectorized to obtain a plurality of HSE word vectors; and the plurality of HSE word vectors are input into an HSE audit question text classification model to obtain a category of the HSE system audit question text.
[0044] The present invention filters the word segmentation results of the text to make the word segmentation results more in line with the word usage habits of the petrochemical industry, and at the same time constructs a HSE audit question text classification model with high classification accuracy, so as to accurately classify the HSE system audit question text.
[0045] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0047] Figure 1 is a flowchart of a text classification method provided by an embodiment of the present invention;
[0048] Figure 2 It is a schematic diagram of the structure of a preset HSE label vocabulary for the petrochemical industry provided by an embodiment of the present invention;
[0049] Figure 3 It is a structural diagram of a text classification device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0052] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0053] Embodiment 1
[0054] Please refer to Figure 1 , Figure 1 : is a flow chart of a text classification method provided by an embodiment of the present invention, the method comprising the following steps:
[0055] S100, obtain the text of HSE system audit questions;
[0056] It is understandable that the text classification method provided by the embodiment of the present invention is applicable to the field of petrochemical industry.
[0057] The HSE system is the abbreviation of Health, Safety and Environment. It is a management system commonly used in the international petroleum industry for health, safety and environmental management in the oil and gas exploration, development and construction industries.
[0058] Audit is a systematic, independent and documented process for obtaining audit evidence and evaluating it objectively to determine the extent to which the audit criteria are fulfilled.
[0059] HSE system audit issues refer to non - conformities found by auditors in the process of auditing an enterprise's HSE management system. Non - conformities refer to defects in performance, documents, or procedures, which make the quality of an item unacceptable or uncertain. For example: **The fire operation permit for the management area (2021 - 1 - 11 - 071) records the start time as 13:10 and the sampling time as 16:00. The sampling time is later than the start time, which does not conform to Article 3.3.5 of the "Implementation Rules for the Safety Management of Fire Operations in XX Company" (**Oil Development
[2019] No. 33).
[0060] S200, perform word segmentation and filtering on the HSE system audit issue text to obtain multiple HSE vocabulary words;
[0061] Word segmentation is the process of dividing a sequence of Chinese characters into individual words and recombining the continuous character sequence into a word sequence according to certain specifications. This method includes, but is not limited to: word segmentation methods based on string matching, understanding - based word segmentation methods, and statistics - based word segmentation methods.
[0062] Filtering is to filter out invalid words from the vocabulary obtained after text word segmentation. For example, modal particles such as "ba", etc. Invalid words can be set according to user needs or determined according to a professional thesaurus. The embodiments of the present invention do not make specific limitations on this.
[0063] HSE vocabulary words refer to professional vocabulary in the management system of the petrochemical industry. For example: leadership, HSE policy management, documents and records, etc.
[0064] S300, represent multiple HSE vocabulary words vectorially to obtain multiple HSE vocabulary vectors;
[0065] S400, input multiple HSE vocabulary vectors into the HSE audit issue text classification model to obtain the category of the HSE system audit issue text.
[0066] The HSE audit issue text classification model refers to a model obtained by constructing multiple classifiers of a support vector machine model based on the HSE system audit issue text and the corresponding text categories, and after the training is completed. The specific training process will be introduced in detail later and will not be elaborated here too much.
[0067] Specifically, after inputting multiple HSE vocabulary vectors into the HSE audit issue text classification model, the internal calculation process of the model is as follows: match the internal classification labels of the HSE audit issue text classification model with multiple HSE vocabulary words to determine the categories of multiple HSE vocabulary words, then calculate the TF - IDF values of multiple HSE vocabulary words, and use the HSE vocabulary word corresponding to the maximum TF - IDF value as the category of the HSE system audit issue text, and finally output the category of the HSE system audit issue text.
[0068] In an embodiment of the present invention, the HSE system audit question text is obtained; the HSE system audit question text is segmented and filtered to obtain multiple HSE words; the multiple HSE words are vectorized to obtain multiple HSE word vectors; the multiple HSE word vectors are input into the HSE audit question text classification model to obtain the category of the HSE system audit question text. The present invention filters the word segmentation result of the text so that the word segmentation result is more in line with the word usage habits of the petrochemical industry, and at the same time constructs a high classification accuracy HSE audit question text classification model, so that the HSE system audit question text can be accurately classified.
[0069] Optionally, the HSE audit question text classification model is trained in the following way:
[0070] S410, obtaining HSE system audit question text training data;
[0071] S420, using a preset label word as a category of HSE system audit question text training data; the preset label word is one of multiple label words in a preset petrochemical industry HSE label word list;
[0072] It is understandable that before training the support vector machine model, we first need to know the category of the HSE system audit question text training data, and its category belongs to one of the multiple label words in the preset classification label word list.
[0073] like Figure 2 As shown in the figure, the preset classification label word list includes: first-level label words, second-level label words and keywords, among which, the first-level label words contain second-level label words, and the second-level label words contain keywords, so as to construct a hierarchical classification of HSE system classification labels, and each label is used as a category of the HSE system audit question text. For example: first-level label: leadership, commitment and responsibility; second-level label: leadership leadership, full participation; keywords: leadership, leadership, full participation, participation.
[0074] Among them, the first-level tag words also include: safety, health and environmental system management requirements for contractors and suppliers, safety, health and environmental system management requirements for contractors and suppliers, operation and maintenance of the HSE management system, change management and emergency management, inspection and supervision of the HSE management system, accident handling and prevention, system audit, review and continuous improvement. The present invention does not limit the number of first-level tag words, and the specific design can be based on actual needs.
[0075] S430, performing word segmentation and filtering processing on the HSE system audit question text training data to obtain a plurality of HSE training words;
[0076] The process of word segmentation and filtering here is consistent with the process of word segmentation and filtering in the application process mentioned above, so it will not be repeated here.
[0077] S440, vectorizing the plurality of HSE training vocabulary to obtain a plurality of HSE training vocabulary vectors;
[0078] The process of vectorizing the multiple training words of the petrochemical industry here is consistent with the process of vectorizing in the application process mentioned above, and the process will not be repeated.
[0079] S450, using a word frequency-inverse text frequency model, calculating multiple HSE training words to obtain a TF-IDF value of each HSE training word, and determining the category of the HSE training word corresponding to the maximum TF-IDF value as a preset label word;
[0080] The Term Frequency-Inverse Document Frequency (TF-IDF) model is a commonly used weighting technique for information retrieval and data mining. TF (Term Frequency) is the term frequency, and IDF (Inverse Document Frequency) is the inverse document frequency. It is used to evaluate the importance of each word. The specific calculation process is as follows:
[0081] Among them, TF represents the word frequency of HSE training vocabulary, n represents the number of times the HSE training vocabulary appears in the HSE system audit question text training data, and N represents the number of HSE training vocabulary that appear in multiple HSE system audit question text training data.
[0082] Wherein, IDF represents inverse document frequency, M represents the number of multiple HSE system audit question text training data, and m represents the number of texts containing HSE training vocabulary in the multiple HSE system audit question text training data.
[0083] S460, constructing a classifier of a support vector machine model according to the HSE training vocabulary vector corresponding to the maximum TF-IDF value and the preset label words, and obtaining an HSE audit question text classification model after the training is completed.
[0084] Specifically, since the TF-IDF value is the largest, it means that the training vocabulary corresponding to the maximum TF-IDF value is the most important and can be used as the key feature of the HSE system audit question text training data, that is, it can indicate the category of the HSE system audit question text training data. Therefore, the word frequency-inverse text frequency model is used to calculate multiple HSE training vocabularies, and the TF-IDF values of multiple HSE training vocabularies are obtained.
[0085] Since the categories of the HSE system audit problem text training data are known in advance, and the HSE training vocabulary corresponding to the maximum TF-IDF value is sufficient to indicate the categories of the HSE system audit problem text training data, the preset label word is used as the category of the HSE training vocabulary with the maximum TF-IDF value. In other words, the HSE training vocabulary with the maximum TF-IDF value is added to the preset label in the preset classification label vocabulary to expand the preset classification label vocabulary. Finally, according to the HSE training vocabulary vector with the maximum TF-IDF value and the preset label word, a classifier of the support vector machine model is constructed, and after the training is completed, the HSE audit problem text classification model is obtained.
[0086] In one embodiment, the HSE audit question text training data is split into a training set and a test set in a ratio of 7:3.
[0087] In one embodiment, the algorithm parameter C-SVC of the support vector machine model has a default value of 1.0 for its penalty parameter C. Considering the influence of professional dictionaries, this experiment sets it to 1.6. The larger C is, the greater the penalty for misclassification, tending to fully classify the training set. In this way, the accuracy rate is higher when testing the training set, while retaining a certain generalization ability. The kernel function uses the Sigmoid function.
[0088] In this embodiment, multiple HSE training vocabularies are obtained by performing word segmentation and filtering on the HSE system audit question text training data, and then the word frequency-inverse text frequency model is used to calculate the multiple HSE training vocabularies to obtain the TF-IDF values of the multiple HSE training vocabularies, and then the category of the HSE training vocabulary corresponding to the maximum TF-IDF value is determined as the preset label word, and finally, according to the HSE training vocabulary vector corresponding to the maximum TF-IDF value and the preset label word, a classifier of the support vector machine model is constructed, and after the training is completed, the HSE audit question text classification model is obtained, thereby obtaining a model that can accurately identify the HSE system audit question text.
[0089] Optionally, the above step S430 may further specifically include the following steps:
[0090] Using the Jieba word segmentation tool, the HSE system audit question text training data is segmented to obtain multiple training words;
[0091] Jieba word segmentation tool is an open source word segmentation library in Python, which is used to segment Chinese words. It has three word segmentation modes, such as: precise mode: tries to segment the sentence most accurately, suitable for text analysis; full mode: scans all words in the sentence that can form words, which is very fast, but cannot resolve ambiguity; search engine mode: based on the precise mode, it segments long words again to improve the recall rate, which is suitable for search engine word segmentation.
[0092] According to the preset stop word library, multiple training words are filtered to obtain multiple HSE training words.
[0093] The preset stop word library refers to invalid words defined by the user, such as modal particles, etc., and the purpose is to further refine the word segmentation results so as to obtain more accurate words. In the present embodiment, the preset stop word library includes but is not limited to: the stop word list of Harbin Institute of Technology, the stop word list of the Machine Intelligence Laboratory of Sichuan University, and the stop word list of the safety management major.
[0094] In this embodiment, since the jieba word segmentation tool can accurately segment the HSE system audit question text training data, and filter the segmentation results through a preset stop word library containing a large number of precise invalid words, it is possible to provide better training samples for the support vector machine model, thereby obtaining a more accurate HSE audit question text classification model.
[0095] Optionally, the above step S440 may further specifically include the following steps:
[0096] According to TfidfVectorizer, multiple HSE training vocabulary are vectorized to obtain multiple HSE training vocabulary vectors.
[0097] TfidfVectorizer is an algorithm integration toolkit based on Python language, which is used to calculate TF-IDF algorithm. By inputting the training set matrix, each row represents a text, TfidfVectorizer can automatically build a vocabulary and term IDF value, and convert the input text list into a feature vector in matrix form.
[0098] In this embodiment, the TfidfVectorizer model is used to improve the IDF value of vocabulary. In addition to considering the frequency of a certain vocabulary in the current training text, the distribution characteristics of the vocabulary among all texts are also considered. The more training texts there are, the more advantages the feature quantization method of TfidfVectorizer has.
[0099] Optionally, the above step S450 may further include the following steps:
[0100] It is determined that the HSE training vocabulary corresponding to the maximum TF-IDF value does not contain the exclusion word, and the category of the HSE training vocabulary corresponding to the maximum TF-IDF value is determined as the preset label word.
[0101] Exclusion words are used to distinguish two types of problems with the same "keywords". That is, as long as the problem description contains any word in the "exclusion words", it means that it does not meet the category rules. Different category rules contain different exclusion words. This embodiment does not make specific restrictions on the setting of exclusion words, and can be reasonably set according to actual needs. For example: the "exclusion words" of the leadership, commitment and responsibility category are defined as "rules", while the "exclusion words" of the planning category are defined as "laws".
[0102] For ease of understanding, the following example is given:
[0103] Reference Figure 2 For example, the vocabulary "leadership and rules" should be classified into the category "leadership, commitment and responsibility", but the "exclusion word" of the category "leadership, commitment and responsibility" is "rules", so the vocabulary "leadership and rules" cannot be classified into the category "leadership, commitment and responsibility".
[0104] In the embodiment of the present invention, by defining "exclusion words" for text category rules, the classification of HSE system audit question texts can be determined more accurately.
[0105] Optionally, the above step S430 may further include the following steps:
[0106] Filter out the words in the HSE system audit question text that are the same as those in the preset fixed professional vocabulary and retain them.
[0107] In this embodiment, by retaining the words in the HSE system audit question text that are the same as the preset fixed professional vocabulary without performing word segmentation processing, it is ensured that the word segmentation results conform to the word usage habits of the petrochemical industry, which provides better training data for model training, thereby improving the accuracy of the HSE audit question text classification model.
[0108] Optionally, the preset fixed professional vocabulary includes: multiple label words in the preset classification label vocabulary and specific vocabulary in the element name, system name and term explanation chapter in the HSE management system manual.
[0109] In this embodiment, the preset fixed professional vocabulary is specifically limited to multiple label words in the preset classification label vocabulary and specific vocabulary in the element names, system names and terminology explanation chapters in the HSE management system manual, so that the word segmentation results are more in line with the word usage habits of the petrochemical industry, thereby further improving the accuracy of the HSE audit question text classification model.
[0110] Optionally, the above step S400 may further include the following steps:
[0111] S500, constructs the association relationship between multiple HSE system audit question texts according to the categories of HSE system audit question texts, and constructs the petrochemical industry knowledge base based on the association relationship;
[0112] It is understandable that after identifying a large number of HSE system audit question text categories, we can summarize the correlation between the various HSE system audit question text categories, thereby constructing a petrochemical industry knowledge base.
[0113] S600, associates the petrochemical industry knowledge base with the pre-built knowledge graph architecture to generate a petrochemical industry knowledge graph;
[0114] Specifically, the knowledge graph architecture is a pre-built framework with nodes. Since the petrochemical industry knowledge base has an associative relationship, the petrochemical industry knowledge base is filled in according to the knowledge graph architecture, thereby forming a petrochemical industry knowledge graph.
[0115] S700 uses MongoDB database to store the knowledge graph of the petrochemical industry.
[0116] In this embodiment, the association relationship between multiple HSE system audit question texts is constructed according to the categories of the HSE system audit question texts, and a petrochemical industry knowledge base is constructed based on the association relationship. Then, it is associated with the pre-constructed knowledge graph architecture to generate a petrochemical industry knowledge graph. Finally, the MongoDB database is used to store the petrochemical industry knowledge graph, which realizes the induction and organization of the HSE system audit question texts and facilitates the subsequent analysis and query of the data.
[0117] Optionally, the above step S700 may further include the following steps:
[0118] Receive the category query request of HSE system audit question text sent from the terminal device;
[0119] Based on the category query request, the category of the HSE system audit question text corresponding to the category query information is searched from the petrochemical industry knowledge graph;
[0120] Feedback the categories of HSE system audit problem texts to the terminal equipment.
[0121] In this embodiment, by receiving a category query request for the HSE system audit question text sent from the terminal device, and based on the category query request, searching the petrochemical industry knowledge graph for the category of the HSE system audit question text corresponding to the category query information, and then feeding back the category to the terminal device, it is possible to allow users to effectively query the problems existing in the enterprise management process, thereby improving the level of safety management.
[0122] Embodiment 2
[0123] Please refer to Figure 3 , Figure 3 It is a structural diagram of a text classification device provided by an embodiment of the present invention.
[0124] The text classification device 200 comprises:
[0125] Data acquisition module 210, used to obtain HSE system audit question text;
[0126] The data processing module 220 is used to perform word segmentation and filtering on the HSE system audit question text to obtain a plurality of HSE words;
[0127] A matrix construction module 230, for vectorizing a plurality of HSE vocabulary words to obtain a plurality of HSE vocabulary vectors;
[0128] The text classification module 240 is used to input multiple HSE vocabulary vectors into the HSE audit question text classification model to obtain the category of the HSE system audit question text.
[0129] It should be understood that the device corresponds to the above-mentioned text classification method embodiment and can perform the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be referred to in the above description. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or fixed in the operating system (OS) of the device.
[0130] Embodiment 3
[0131] In a typical configuration, the electronic device includes: a processor and a memory, the memory stores machine-readable instructions executable by the processor, and the above-mentioned text classification method is performed when the machine-readable instructions are executed by the processor.
[0132] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0133] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0134] Embodiment 4
[0135] An embodiment of the present invention also provides a computer-readable storage medium, which stores instructions, and the instructions are used to execute a program with the following method steps when executed by a processor: obtaining an HSE system audit problem text; performing word segmentation and filtering on the HSE system audit problem text to obtain multiple HSE words; vectorizing the multiple HSE words to obtain multiple HSE word vectors; inputting the multiple HSE word vectors into an HSE audit problem text classification model to obtain a category of the HSE system audit problem text.
[0136] In one embodiment, the above-mentioned text classification method also includes: obtaining HSE system audit problem text training data; using a preset label word as the category of the HSE system audit problem text training data; the preset label word is one of multiple label words in a preset petrochemical industry HSE label word list; performing word segmentation and filtering on the HSE system audit problem text training data to obtain multiple HSE training words; vectorizing the multiple HSE training words to obtain multiple HSE training word vectors; using a word frequency-inverse text frequency model to calculate the multiple HSE training words to obtain the TF-IDF value of each HSE training word, and determining the category of the HSE training word corresponding to the maximum TF-IDF value as the preset label word; constructing a classifier of a support vector machine model based on the HSE training word vector corresponding to the maximum TF-IDF value and the preset label word, and after the training is completed, obtaining an HSE audit problem text classification model.
[0137] In one embodiment, the above text classification method also includes: using the jieba word segmentation tool to perform word segmentation processing on the HSE system audit question text training data to obtain multiple training words; filtering the multiple training words according to a preset stop word library to obtain multiple HSE training words.
[0138] In one embodiment, the text classification method further includes: vectorizing a plurality of HSE training vocabulary words according to TfidfVectorizer to obtain a plurality of HSE training vocabulary vectors.
[0139] In one embodiment, the text classification method further includes: determining that the HSE training vocabulary corresponding to the maximum TF-IDF value does not contain an exclusion word, and determining the category of the HSE training vocabulary corresponding to the maximum TF-IDF value as a preset label word.
[0140] In one embodiment, the above-mentioned text classification method further includes: selecting and retaining words that are the same as those in a preset fixed professional vocabulary from the HSE system audit question text.
[0141] In one embodiment, the above-mentioned text classification method also includes: constructing an association relationship between multiple HSE system audit question texts according to the categories of HSE system audit question texts, and constructing a petrochemical industry knowledge base based on the association relationship; associating the petrochemical industry knowledge base with a pre-built knowledge graph architecture to generate a petrochemical industry knowledge graph; and using a MongoDB database to store the petrochemical industry knowledge graph.
[0142] In one embodiment, the above-mentioned text classification method also includes: receiving a category query request for the HSE system audit question text sent from a terminal device; based on the category query request, searching for the category of the HSE system audit question text corresponding to the category query information from the petrochemical industry knowledge graph; and feeding back the category of the HSE system audit question text to the terminal device.
[0143] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0144] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0145] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0147] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention will not further describe various possible combinations.
[0148] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0149] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0150] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A text classification method, characterized in that: include: Get the text of HSE system audit questions; The HSE system audit question text is segmented and filtered to obtain a plurality of HSE words; Vectorizing the multiple HSE words to obtain multiple HSE word vectors; The multiple HSE vocabulary vectors are input into the HSE audit question text classification model to obtain the category of the HSE system audit question text.
2. The text classification method according to claim 1, characterized in that: The HSE audit question text classification model is trained in the following way: Obtain HSE system audit question text training data; Using a preset label word as a category of the HSE system audit question text training data; the preset label word is one of a plurality of label words in a preset petrochemical industry HSE label word list; The HSE system audit question text training data is segmented and filtered to obtain a plurality of HSE training vocabularies; Vectorizing the plurality of HSE training vocabulary words to obtain a plurality of HSE training vocabulary vectors; Using a word frequency-inverse text frequency model, the multiple HSE training words are calculated to obtain a TF-IDF value of each HSE training word, and the category of the HSE training word corresponding to the maximum TF-IDF value is determined as the preset label word; A classifier of a support vector machine model is constructed according to the HSE training vocabulary vector corresponding to the maximum TF-IDF value and the preset label word, and after the training is completed, the HSE audit question text classification model is obtained.
3. The text classification method according to claim 2, characterized in that: The HSE system audit question text training data is segmented and filtered to obtain a plurality of HSE training vocabularies, including: Using the Jieba word segmentation tool, the HSE system audit question text training data is segmented to obtain multiple training words; The plurality of training words are filtered according to a preset stop word library to obtain a plurality of HSE training words.
4. The text classification method according to claim 2, characterized in that: The vectorizing the multiple HSE training vocabulary to obtain multiple HSE training vocabulary vectors includes: According to TfidfVectorizer, the multiple HSE training vocabulary are vectorized to obtain the multiple HSE training vocabulary vectors.
5. The text classification method according to claim 2, characterized in that: The step of determining the category of the HSE training vocabulary corresponding to the maximum TF-IDF value as the preset label word includes: It is determined that the HSE training vocabulary corresponding to the maximum TF-IDF value does not include an exclusion word, and the category of the HSE training vocabulary corresponding to the maximum TF-IDF value is determined as the preset label word.
6. The text classification method according to claim 3, characterized in that: Before the step of segmenting and filtering the HSE system audit question text training data to obtain a plurality of HSE training vocabularies, the method further includes: The words identical to the preset fixed professional vocabulary are selected from the HSE system audit question text and retained.
7. The text classification method according to claim 6, characterized in that: The preset fixed professional vocabulary includes: multiple label words in the preset petrochemical industry HSE label vocabulary and specific words in the element name, system name and term explanation chapter in the HSE management system manual.
8. The text classification method according to claim 1, characterized in that: After the step of inputting a plurality of HSE vocabulary vectors into the HSE audit question text classification model to obtain the category of the HSE system audit question text, the method further includes: Establishing association relationships among a plurality of HSE system audit question texts according to the categories of the HSE system audit question texts, and establishing a petrochemical industry knowledge base based on the association relationships; Associating the petrochemical industry knowledge base with a pre-built knowledge graph architecture to generate a petrochemical industry knowledge graph; The MongoDB database is used to store the petrochemical industry knowledge graph.
9. The text classification method according to claim 8, characterized in that: After the step of using the MongoDB database to store the petrochemical industry knowledge graph, the method further includes: Receive the category query request of HSE system audit question text sent from the terminal device; Based on the category query request, searching the petrochemical industry knowledge graph for a category of HSE system audit question text corresponding to the category query information; Feedback the category of the HSE system audit question text to the terminal device.
10. A text classification device, characterized in that: include: Data acquisition module, used to obtain the text of HSE system audit questions; A data processing module, used for segmenting and filtering the HSE system audit question text to obtain a plurality of HSE words; A matrix construction module, used for vectorizing the plurality of HSE vocabulary words to obtain a plurality of HSE vocabulary vectors; The text classification module is used to input the multiple HSE vocabulary vectors into the HSE audit question text classification model to obtain the category of the HSE system audit question text.
11. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the text classification method according to any one of claims 1 to 9 is executed.
12. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed on a computer, the computer is enabled to execute the text classification method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Text classification method, text classification device and terminal equipment
CN109684476A
Text classification method and device and classifier model training method
CN110019792A
Electric power audit text classification method for enhancing domain features
CN110990567A
Text classification method, apparatus, computer device, and storage medium
WO2022227207A1
