A text topic classification method, device, chip and terminal

By denoising, destop words, word segmentation and obfuscation mapping of Chinese text, and using the ERNIE-BiGRU model for semantic classification, the problem of inaccurate text classification in the prior art is solved, and a higher classification accuracy is achieved.

CN117708324BActive Publication Date: 2025-03-14SHANDONG RUIXIN SEMICONDUCTOR TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311472935.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-07
Publication Date
2025-03-14
Estimated Expiration
2043-11-07

AI Technical Summary

Technical Problem

When the existing text classification method processes Chinese text, feature extraction is inaccurate, resulting in inaccurate classification.

Method used

A text theme classification method is adopted to obtain the text theme to be classified, remove noise, remove stop words, word segmentation and obfuscation mapping processing to obtain a word collection. Then, the word set is input into the pre-trained ERNIE-BiGRU model, semantic classification is performed, and the word set after semantic classification is obtained. Finally, classification is carried out based on the correlation between the word set and the preset domain word ontology.

Benefits of technology

The text topics are classified semantically through the ERNIE-BiGRU model, which preserves the intrinsic connection and completeness between words in the sentence, improves the accuracy of text classification, and solves the problem of inaccurate text classification in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117708324B_ABST
    Figure CN117708324B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and provides a text topic classification method, device, chip and terminal. The method obtains a text topic to be classified, and sequentially removes noise, removes stop words, performs word segmentation and confusion mapping processing on the text topic to obtain a first word set; the first word set is input into an ERNIE-BiGRU model, and semantic classification is performed on each word in the first word set to obtain a second word set; each word in each obtained second word set is subjected to a correlation operation with a preset domain word body according to a preset rule, thereby realizing the classification of the text topic. The method converts the text topic into a second word set represented by a sentence-level vector through the ERNIE-BiGRU model, retains the intrinsic connection and integrity between words in the sentence, and then performs a correlation operation according to a preset rule to further determine the classification of the text topic, thereby solving the problem of inaccurate classification of existing text classification methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a text topic classification method, device, chip and terminal. Background Art

[0002] Text classification is a hot issue in natural language processing. With the continuous development of my country's economy, information has grown explosively. Due to the diversity and complexity of texts, as well as the overlapping and similar contents of texts, the high correlation between categories, and the unclear boundaries, it is of great significance to quickly classify massive amounts of text.

[0003] Unlike the English context, where the same word is used at the character level to adapt to multiple parts of speech and tenses to express specific meanings, each word in the context is independent. If you want to express information such as tense, you need to use specific words to represent it. It can be seen that applying the feature extraction method of English text to Chinese text will inevitably affect the extraction task of key features, and ultimately lead to inaccurate classification. Summary of the invention

[0004] Based on this, the present invention provides a text topic classification method, device, chip and terminal for improving the accuracy of text classification.

[0005] In a first aspect, a text topic classification method is provided, comprising:

[0006] Obtaining a text topic to be classified, and performing noise removal, stop word removal, word segmentation, and confusion mapping processing on the text topic in sequence to obtain a first word set;

[0007] Inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set by the ERNIE-BiGRU model to obtain a second word set;

[0008] Performing a correlation operation between each word in each obtained second word set and a preset domain word body according to a preset rule;

[0009] Based on the relevance of each second word set to the preset domain word ontology, the classification of the text topic is determined.

[0010] Optionally, performing a relevance calculation on each word in each obtained second word set and a preset domain word body according to a preset rule includes:

[0011] Rule 1: If the words in the second word set are the same as the words in the preset domain word body, then continue to execute the step of determining the classification of the text topic based on the relevance of each second word set and the preset domain word body; if they are not the same, then execute Rule 2;

[0012] Rule 2: Perform concept matching on the words in the second word set and the words in the preset domain word body. If the concept matching is successful, calculate the concept relevance; if the concept matching is unsuccessful, execute Rule 3;

[0013] Rule 3: Perform sense-meta matching on the words in the second word set and the words in the preset domain word body, and calculate sense-meta relevance.

[0014] Optionally, each word in each obtained second word set is subjected to a relevance calculation with a preset domain word body according to a preset rule, and then the method further includes:

[0015] The words whose relevance values ​​are greater than a preset threshold are added to the preset domain word ontology to update the preset domain word ontology.

[0016] Optionally, a text topic to be classified is obtained, and noise removal, word segmentation and confusion mapping are sequentially performed on the text topic to obtain a first word set, including:

[0017] Collect text topics from web pages or user input, and query noise characters and stop words in the text topics based on meaningless connecting characters between words and sentences in the context to obtain short text of sentences;

[0018] The sentence short text is converted into a directed acyclic graph, and the segmentation nodes of the words in the directed acyclic graph are predicted by using a hidden Markov model, and are marked to obtain a word segmentation sequence;

[0019] Identify the English and network terms in the word segmentation sequence, query the corresponding meanings of the English and the network terms in the network dictionary, and replace them to obtain a first word set.

[0020] Optionally, the sentence short text is converted into a directed acyclic graph, and the segmentation nodes of the words in the directed acyclic graph are predicted using a hidden Markov model, and are marked to obtain a word segmentation sequence, including:

[0021] Matching the sentences to be split in the sentence short text with the characters or words in the dictionary to generate a prefix tree;

[0022] According to each character or word in the prefix tree, a directed acyclic graph is generated according to different word group lengths;

[0023] Using the pre-trained hidden Markov transition probability matrix and observation probability matrix, the Viterbi algorithm is used to find the sub-path with the highest probability, and the starting node and the ending node positions of the sub-path with the highest probability in the directed acyclic graph are recorded;

[0024] Based on the positions of the starting node and the ending node as the segmentation positions, the tags of the sentence to be split are recombined to obtain a word segmentation sequence.

[0025] Optionally, the pre-trained ERNIE-BiGRU model is composed of an ERNIE pre-trained sub-model, a BiGRU sub-model and a softmax sub-model, and the first word set is input into the pre-trained ERNIE-BiGRU model, and each word in the first word set is semantically classified by the ERNIE-BiGRU model to obtain a second word set, including:

[0026] Inputting the first word set into the ERNIE pre-training sub-model, pre-training the first word set, and obtaining a sentence-level word vector representation sequence;

[0027] Extracting context information of each word in the word vector representation sequence using the BiGRU sub-model;

[0028] The softmax sub-model is used to perform semantic classification based on the extracted context information to obtain a second word set.

[0029] Optionally, the ERNIE pre-trained sub-model is a network consisting of two parts: transformer encoding and knowledge integration. The first word set is input into the ERNIE pre-trained sub-model, and the first word set is pre-trained to obtain a sentence-level word vector representation sequence, including:

[0030] Inputting the first word set into the transformer encoder, extracting keywords of each sentence in the first word set by the transformer encoder using a full attention mechanism, and encoding based on the extracted keywords to obtain vector representations of all words;

[0031] Perform a weighted summation on the vector representations of all words, and sort the vector representations based on the summation to obtain a vector sequence;

[0032] Through a multi-stage knowledge masking strategy, each word in the first word set is randomly masked, and the masked phrases are semantically analyzed and integrated;

[0033] The integrated phrases are used to adjust the vector sequence to obtain a sentence-level word vector representation sequence.

[0034] In a second aspect, a text topic classification device is provided, comprising:

[0035] An acquisition module is used to acquire text topics to be classified, and sequentially perform noise removal, stop word removal, word segmentation and confusion mapping processing on the text topics to obtain a first word set;

[0036] A prediction module, used for inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set through the ERNIE-BiGRU model to obtain a second word set;

[0037] A calculation module, used for performing a relevance calculation between each word in each obtained second word set and a preset domain word body according to a preset rule;

[0038] The classification module is used to determine the classification of the text topic based on the relevance of each second word set and the preset domain word ontology.

[0039] Optionally, the acquisition module includes:

[0040] A de-noising unit is used to collect text topics from web pages or user input, and query noise characters and stop words in the text topics based on meaningless connecting characters between words and sentences in the context to obtain sentence short texts;

[0041] A marking unit, used for converting the sentence short text into a directed acyclic graph, predicting the segmentation nodes of words in the directed acyclic graph by using a hidden Markov model, and marking them to obtain a word segmentation sequence;

[0042] The replacement unit is used to identify the English and network terms in the word segmentation sequence, query the corresponding meanings of the English and the network terms in the network dictionary, and replace them to obtain a first word set.

[0043] Optionally, the marking unit is specifically used for:

[0044] Matching the sentences to be split in the sentence short text with the characters or words in the dictionary to generate a prefix tree;

[0045] According to each character or word in the prefix tree, a directed acyclic graph is generated according to different word group lengths;

[0046] Using the pre-trained hidden Markov transition probability matrix and observation probability matrix, the Viterbi algorithm is used to find the sub-path with the highest probability, and the starting node and the ending node positions of the sub-path with the highest probability in the directed acyclic graph are recorded;

[0047] Based on the positions of the starting node and the ending node as the segmentation positions, the tags of the sentence to be split are recombined to obtain a word segmentation sequence.

[0048] According to a third aspect, a chip is provided, comprising a first processor for calling and running a computer program from a first memory, so that a device equipped with the chip executes each step of the text topic classification method as described above.

[0049] In a fourth aspect, a terminal is provided, comprising a second memory, a second processor, and a computer program stored in the second memory and executable on the second processor, wherein the second processor implements the various steps of the text topic classification method introduced above when executing the computer program.

[0050] The text topic classification method, device, chip and terminal provided by the present application obtain the text topic to be classified, and perform noise removal, stop word removal, word segmentation and confusion mapping processing on the text topic in sequence to obtain a first word set; input the first word set into a pre-trained ERNIE-BiGRU model, and perform semantic classification on each word in the first word set through the ERNIE-BiGRU model to obtain a second word set; perform relevance calculation on each word in each obtained second word set and a preset domain word ontology according to preset rules; and finally classify the text topic based on the relevance of each second word set and the preset domain word ontology. The method can process the text topic to obtain a first word set, convert the text topic into a second word set represented by a sentence-level vector through the ERNIE-BiGRU model, retain the internal connection and integrity between words in the sentence, and then perform relevance calculation based on the preset domain word ontology according to preset rules, and determine the text classification based on the relevance, thereby solving the problem of inaccurate text classification in the existing text classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0052] Figure 1 A first flow chart of a text topic classification method provided by an embodiment of the present invention;

[0053] Figure 2 A flowchart of ontology semantic relevance calculation provided by an embodiment of the present invention;

[0054] Figure 3 A second flow chart of the text topic classification method provided by an embodiment of the present invention;

[0055] Figure 4 This is an overall architecture diagram of the ERNIE-BiGRU model of an embodiment of the present invention;

[0056] Figure 5 It is a structural diagram of the ERNIE pre-training sub-model of an embodiment of the present invention;

[0057] Figure 6 A structural diagram of a BiGRU sub-model according to an embodiment of the present invention;

[0058] Figure 7 A preset domain word ontology framework diagram provided by an embodiment of the present invention;

[0059] Figure 8 is a basic structural block diagram of a text classification device according to an embodiment of the present invention;

[0060] Fig. 9 A basic structural block diagram of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0062] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 11, 12, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to different types.

[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0064] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0065] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0066] See also Figure 1 , Figure 1 A flowchart of a text topic classification method provided in this embodiment specifically includes the following steps:

[0067] S11, obtaining the text topic to be classified, and performing noise removal, stop word removal, word segmentation and confusion mapping processing on the text topic in sequence to obtain a first word set.

[0068] In this step, the acquisition of text topics is specifically based on the premise of legal authorization, using a crawler tool to call a search engine to crawl web page text topics from the corresponding resource address, which is pre-set, and obtain the text topic corresponding to the Uniform Resource Locator (URL) in the queue to be crawled. The text topic can be a topic name such as an article title, a news title, a text topic title of a video, or a short text such as an abstract, a brief description, etc. In an embodiment of the present invention, the crawler can make a web page resource request through existing technology, and use existing technology to parse the URL in each request and add it to the queue to be crawled.

[0069] Of course, it is also possible to capture data from books or documents through monitoring tools such as cameras, and then convert the captured data (text topics) into short texts, and then preprocess the short texts. The preprocessing includes processing steps such as noise removal, stop word removal, word segmentation, and confusion mapping. The main purpose is to remove useless information and obtain more accurate word vectors in the feature extraction process to facilitate computer processing. Of course, it is also possible to preprocess the captured data (text topics) directly without converting them into short texts.

[0070] In addition, since most of the captured data (text topics) contain certain noise and words that do not express meaning, the useless parts of the captured data (text topics) are removed before classification.

[0071] S12, inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set through the ERNIE-BiGRU model to obtain a second word set.

[0072] The Enhanced Representation through Knowledge Integration (ERNIE) model is based on the BERT model, and the logic of BERT pre-training is improved. At the same time, a large amount of data sets are used for pre-training data, so it is more in line with the use requirements of the present invention. In addition, in order to further extract the information of the text topic context, a bidirectional gated recurrent unit (BiGRU) is added to the ERNIE model, and the word vector trained by the ERNIE model is used as the input of the BiGRU for further feature extraction to obtain better classification results.

[0073] In this embodiment, the ERNIE-BiGRU model is based on the ERNIE model, using the bidirectional encoder representation of Transformer, and using the attention mechanism (attention mechanism) to make the upper and lower layers of the model directly connected to each other, truly realizing the bidirectional connection model of all layers in the model. Compared with traditional LSTM, GRU and other models, when capturing long-distance interdependent features, the attention mechanism will have the problem of declining effective capture effect as time increases. During the calculation process, the attention mechanism will directly connect the connection between any two words in the sentence through a calculation step, and finally perform weighted summation on the representation of all words, and the weight is obtained by the dot product of the representation of the word and the encoded word representation and by softmax. Using the attention mechanism will greatly shorten the distance between long-distance dependent features, and the effective utilization rate of features will be greatly improved. Therefore, the attention mechanism structure can better model the user's behavior sequence.

[0074] The entire ERNIE-BiGRU model consists of three parts: Figure 4 shown.

[0075] First, the pre-processed dataset is pre-trained using the ERNIE pre-trained model (hereinafter referred to as the "ERNIE model") to obtain sentence-level word vector representations;

[0076] Then, the model output is used as the input of the BiGRU (Bidirectional Gated Recurrent Unit) layer to further extract the contextual information of each word in the sentence;

[0077] Finally, a softmax layer is used for semantic classification.

[0078] Specifically, the first word set is input into the ERNIE-BiGRU model, and each word in the first word set is encoded and decoded by the model and converted into a word vector. Based on the word vector, the bidirectional parsing method is used to perform semantic analysis on each word to obtain the corresponding semantic features and perform semantic classification to obtain the second word set.

[0079] After step S12, the embodiment of the present application adopts the ontology semantic relevance algorithm as the classification method. The method first calculates the relevance between words. The algorithm flow is as follows: Figure 2 As shown in the figure. The main process is: first compare the word match; if the word does not match, then calculate the concept relevance; in the case of concept mismatch, finally calculate the sense-meta relevance, mainly using the depth of the sense-meta node in the sense-meta tree structure and the distance between two sense-meta nodes to calculate the relevance value. Here we first introduce some concepts.

[0080] The preset domain word ontology refers to the core and essential concept set of a certain domain and gives a formal and clear expression of these concepts. These concepts are rarely seen in other domains and can uniquely identify a certain domain. In some examples of the embodiments of the present application, the preset domain word ontology framework can be as follows: Figure 7 In this framework diagram:

[0081] Keyword means a characteristic word, which is a representative word used to distinguish different fields. Each characteristic word contains the following contents:

[0082] Concept is a concept. A feature word may have N concepts. Each concept is composed of different semantic elements.

[0083] Semno is the sense number. According to the sense number, we can see the depth of different senses in the tree structure. Sem is the sense value.

[0084] FatherPath is the path that the semantic element takes from the root node to the current node in the entire tree structure;

[0085] ChildPath is the path that the semantic element takes from the current node to the last leaf node in the tree structure;

[0086] Synonyms are synonyms and near-synonyms of the feature word Keyword.

[0087] S13, performing relevance calculation on each word in each obtained second word set and a preset domain word body according to preset rules.

[0088] In the embodiment of the present application, the text subject to be classified is represented as D, and the preset domain word ontology is represented as O i, sim(A,B) represents the correlation value between A and B. The input of step S13 is the second word set: the text topic D to be classified, setting the preset domain word ontology O = {O1, O2..., O i}, then output the relevance results according to rules 1 to 3. For example: the word "w k Concept 1 |…Concept n|” and the pre-defined domain word ontology O i When comparing the relevance of the words "kwl concept 1 | ... concept m |", the following rules 1 to 3 are followed:

[0089] Rule 1: If the words in the second word set are the same as the words in the preset domain word body, continue to execute the step of determining the classification based on the relevance of each second word set and the preset domain word body; if they are not the same, execute Rule 2.

[0090] That is, when w k and kw l If they are the same, then sim(w k ,km l )=1, and end w k and O i Compare the rest of the words in . If they are different, proceed to Rule 2;

[0091] Rule 2: Perform concept matching on the words in the second word set and the words in the preset domain word body. If the concept matching is successful, calculate the concept relevance; if the concept matching is unsuccessful, execute Rule 3.

[0092] That is, when w k and kw l If they are not the same, a comparison based on word concepts is performed, i.e., w k and kw l The concepts in are compared pairwise. If there are two concepts that are exactly the same, then:

[0093]

[0094] Among them, α is the artificial weight factor, m and n are w k and kw l The number of concepts, f(con i ,con j ) is the number of complete concept matches. i =con j When f(con i ,con j )=1, otherwise, go to rule 3.

[0095] Rule 3: Sense-matching is performed on the words in the second word set and the words in the preset domain word body, and the sense-meta correlation is calculated.

[0096] That is, when the concept matching is unsuccessful, the matching comparison based on the sense element in the concept is performed, then:

[0097]

[0098]

[0099] Among them, f(p i ,p j ) is p i and p j The semantic distance between two senses, deep ij For p i and p j The depth of the common node between two senses in the sense tree. i =p j When d ij =0; when pi≠pj, ​​d ij Yes i and p j The path length in the semantic hierarchy is a positive integer. γ is an adjustable parameter. β is a human-given weight factor, x and y are w respectively. k and kw l The number of sense units. The longer the path between two sense units, the deeper the common depth, and the greater the semantic relevance value. For example: the sense unit number of the sense unit "affairs" is "111311", the sense unit number of the sense unit "money" is "1111229", and the sense unit number of the sense unit "things" is "11131". The common node depth of the two sense units "affairs" and "money" is 3, and the distance between the two sense units is 7. The common node depth of the two sense units "affairs" and "things" is 3, and the distance between the two sense units is 5. The sense units "affairs" and "things" are closer.

[0100] The embodiment of the present application measures the relevance between words by calculating the amount of information of the same sense units contained in different concepts. The more the same sense units are contained in different concepts, the greater the concept relevance value. This is used as the basis for comparing the relevance between the text subject to be classified and the preset domain word ontology, so that a lot of large-scale calculation processes that are not very meaningful for classification can be omitted. For example, in the "expression recognition algorithm based on VGG convolutional neural network model" and "semantic recognition algorithm based on deep residual network model", "VGG convolutional neural network" and "deep residual network", "expression recognition" and "semantic recognition" have different concepts, but the two words have the same sense units "network model" and "recognition algorithm", so the relevance can be determined, and for two words without the same sense units, the relevance can be compared based on the depth of the sense units in the sense unit tree and the distance between the sense units.

[0101] In some examples of the embodiments of the present application, words with a relevance value greater than a preset threshold are added to the preset domain word ontology to update the preset domain word ontology. k ,kw j ) is greater than a given threshold, the word w k Add to preset domain word ontology O i In the process, the preset domain word ontology is updated.

[0102] S14. Determine the classification of the text topic based on the relevance of each second word set and the preset domain word ontology.

[0103] Word k With the body O i The correlation value of takes the maximum value of the correlation between wk and kwj as follows:

[0104] sim(w k ,O i )=max{sim(w k ,kw1),sim(w k ,kw2),...,sim(w k ,kw M )}

[0105] Among them, M is the number of words in the preset domain word ontology.

[0106] The calculation formula for the relevance between the text topic D and the preset domain word ontology Oi is:

[0107]

[0108] Where N is the number of words in the text topic D.

[0109] Finally, the text topic D belongs to the relevance result sim(w k ,O i )The largest category.

[0110] In summary, this method can first process the text topic to obtain the first word set, and then convert the text topic into a second word set represented by a sentence-level vector through the ERNIE-BiGRU model, retaining the intrinsic connection and integrity between words in the sentence, and then performing relevance calculations based on the preset domain word ontology according to preset rules, and determining the classification of the text topic based on the relevance, which solves the problem of inaccurate sentence-level text classification in existing pre-training models.

[0111] See also Figure 3 , Figure 3 The second flow chart of the text topic classification method provided in this embodiment specifically includes the following steps:

[0112] S21, obtaining the text topics to be classified, and performing noise removal, stop word removal, word segmentation and confusion mapping processing on the text topics in sequence to obtain a first word set.

[0113] In this embodiment, by collecting data on a web page or data input by a user, and querying noise characters and stop words in the data based on meaningless connecting characters between words and sentences in the context, a short sentence text is obtained; the short sentence text is converted into a directed acyclic graph, and the hidden Markov model is used to predict the segmentation nodes of the words in the directed acyclic graph, and mark them to obtain a word segmentation sequence; English and network terms in the word segmentation sequence are identified, the corresponding meanings of English and network terms in the network dictionary are queried, and replaced to obtain a first word set.

[0114] In practical applications, the denoising process includes two steps: noise removal and stop word removal. The specific operation method is as follows:

[0115] (1) Noise Removal

[0116] Removing short text noise is a major part of preprocessing. Denoising, also known as data cleaning, is to clean up the redundant and meaningless short text or symbol data in the acquired text topic. Short news texts usually contain emoticons and special symbols such as non-punctuation, printing characters, special characters, numbers and qualifiers. These contents have no special meaning and sometimes only represent semantic pauses and intervals. Usually, dictionary matching or regular expression matching is used to remove noise and replace the removed words with spaces.

[0117] (2) Remove stop words

[0118] For the removal of stop words, we mainly determine and remove stop words by querying the stop word library. Stop words in the context mainly refer to some modifying words that have no effect on the text theme and have no practical meaning or value, such as auxiliary words, personal names, conjunctions and modal particles in Chinese. The main purpose of removing stop words is to improve the efficiency of feature extraction and reduce the impact of the large-scale repeated use of stop words on the accuracy of feature extraction. These words can add emotional features to the language when used in oral communication, but the amount of information they carry in the text classification process is very small, and their contribution to classification is negligible. The stop word list used in this article was sorted and removed from the stop word library of Harbin Institute of Technology, etc., and 1,322 words were obtained.

[0119] In this embodiment, after removing noise and stop words, the text topic is segmented, wherein the word segmentation in this embodiment is specifically implemented using the jiaba word segmentation method, and the specific implementation process is as follows: the sentences to be split in the sentence short text are matched with the characters or words in the dictionary to generate a prefix tree; according to each character or word in the prefix tree, a directed acyclic graph is generated according to different word group lengths; using the pre-trained hidden Markov transition probability matrix and observation probability matrix, the Viterbi algorithm is used to find the sub-path with the highest probability, and the starting node and ending node positions of the sub-path with the highest probability in the directed acyclic graph are recorded; based on the starting node and ending node positions as the segmentation positions, the sentences to be split are recombined with tags to obtain a word segmentation sequence.

[0120] In practical applications, jieba is currently the best Python Chinese word segmentation component. It has the following three main features: supports three word segmentation modes: precise mode, full mode, search engine mode; supports traditional Chinese word segmentation; supports custom dictionaries. The dictionary used in the word segmentation process of jieba is its own dictionary. The dictionary consists of nearly 350,000 lines, each of which contains the target word, the number of occurrences, and the part of speech. In order to improve the search efficiency, the words in the dictionary are constructed into a prefix tree. In the word segmentation process, the sentence to be split is matched with the prefix tree generated by the dictionary, and a directed acyclic graph is generated according to all the word grouping methods in the sentence. Each node in the directed acyclic graph represents the index of the sentence, each edge represents a word, and the characters or words on each edge are in the dictionary.

[0121] Use the dynamic programming method to calculate the sub-path with the highest probability in all paths from the node of each Chinese character to the end of the text, and record the starting node and ending node positions of the sub-path with the highest probability in the directed acyclic graph. According to the starting position of the node, the word segmentation result is obtained.

[0122] Furthermore, for unregistered words that are not recorded in the dictionary, the Jieba word segmentation method uses HMM (Hidden Markov Model) to process them. BEMS is used to represent the hidden state, and the observed state is the sentence to be segmented. Among them, B represents begin, which is the beginning part of the word; E represents end, which is the end part of the word; M represents middle, which is the middle position; S represents single, which is an independent part. The short text to be segmented is represented by the BEMS model, and the Viterbi algorithm is used to find the word segmentation method with the highest probability by combining the pre-trained HMM transition probability matrix and observation probability matrix. In the sequence, the positions before B, after E, and before and after S are used as segmentation positions, and the sentences to be segmented are reassembled.

[0123] Among them, the confusion mapping process is to observe the results after word segmentation and find that there are a lot of abbreviations and Internet terms in the word segmentation results of short texts, such as "GDP" for gross domestic product, "yyds" for eternal god, "emo" for depression, etc. These words are not noise and stop words but words that express actual meanings. These professional abbreviations and Internet terms can easily mislead the extraction of keywords. The abbreviations in the text can be converted into text using dictionary matching and replacement.

[0124] S22, inputting the first word set into the ERNIE pre-training sub-model, pre-training the first word set, and obtaining a sentence-level word vector representation sequence;

[0125] In this embodiment, the ERNIE pre-training sub-model is a part of the ERNIE-BiGRU model, which is specifically a network consisting of two parts: transformer encoding and knowledge integration. When the words in the first word set are vectorized, specifically:

[0126] Input the first word set into the transformer encoder, extract the keywords of each sentence in the first word set by using the full attention mechanism through the transformer encoder, and encode based on the extracted keywords to obtain the vector representation of all words;

[0127] Perform a weighted summation on the vector representations of all words, and sort the vector representations based on the summation to obtain a vector sequence;

[0128] Through a multi-stage knowledge masking strategy, each word in the first word set is randomly masked, and the masked phrases are semantically analyzed and integrated;

[0129] The integrated phrases are used to adjust the vector sequence to obtain a sentence-level word vector representation sequence.

[0130] The ERNIE pre-trained sub-model is an enhanced model based on the knowledge masking strategy. By masking semantic units such as words and entities, the model learns the semantic representation of complete concepts. The ERNIE model is mainly divided into two parts in structure: transformer encoding and knowledge integration. The former uses transformer as the basic encoder of the model to generate corresponding word vector representations to retain the contextual information of the words in the text; the latter integrates the knowledge at the phrase and entity levels into the language representation through a multi-stage knowledge masking strategy. The structure is as follows: Figure 5 shown.

[0131] Depend on Figure 5As can be seen from the structure, the output of the model contains the word vector representation of the text context information, and each word vector [T1, T2, T3, …, Tn] contains the text information of the entire sequence. Since the traditional language model is trained to predict the next word, the use of bidirectional encoding will make the word to be predicted indirectly "see itself" between multiple layers of context. In other words, if the input Ent at time t is to be predicted, each input will see the information of the target En in the hidden layer, causing information leakage. To solve this problem, the BERT model changes the input at the corresponding position into a [mask] tag, randomly masking part of the input sequence. The ERNIE pre-trained sub-model is further optimized on this basis, and a multi-stage knowledge masking strategy is proposed, which elevates the masking of words to the masking of phrases and entities.

[0132] Specifically, the ERNIE pre-trained sub-model is a language model built based on a multi-layer bidirectional transformer encoder. The transformer encoder uses a full attention mechanism. The attention mechanism is similar to the principle of human understanding of sentences, which is to understand the overall meaning of the sentence based on the key points in the sentence. Its principle is shown in the following formula.

[0133]

[0134] Among them, Q, K, V represent the input word vector matrix, dk is the input vector dimension, and T represents transpose.

[0135] During the calculation process, the transformer encoder directly connects any two words in the sentence through a calculation step, and performs weighted summation on the representations of all words. The weight is obtained by the dot product of the representation of the word and the encoded word through the softmax layer, thereby greatly shortening the distance between long-distance dependent features and greatly improving the effective utilization of features.

[0136] S23, using the BiGRU sub-model to extract word vectors to represent the context information of each word in the sequence;

[0137] In this step, the BiGRU sub-model is a bidirectional gated recurrent unit. Based on this, the process of extracting context information is as follows:

[0138] Using bidirectional gated recurrent units, word vectors are predicted from the forward and reverse directions to represent the context of each word in the sequence.

[0139] Based on the previous and next connections, the semantic calculation formula is used to perform forward and backward semantic analysis on each word to obtain the context information of each word.

[0140] In this embodiment, the semantic calculation formula is:

[0141] z t =σ(ω z ·[h t-1 ,x t ])

[0142] r t =σ(ω r ·[h t-1 , x t ])

[0143]

[0144]

[0145] Among them, z t is the update gate; σ is the sigmoid nonlinear activation function; ω z ,ω r , ω is the weight matrix; h t ,h t-1 is the hidden layer state at time t and the previous time; x t is the input at time t; r t To reset the gate.

[0146] The BiGRU sub-model uses a bidirectional information retention method to obtain the connection between a word in the context. In the text classification scenario, BiGRU can obtain the semantic features of a word in the text through the context information and retain the information of the word in the context as much as possible, thereby improving the classification accuracy. The structural model of BiGRU is as follows Figure 6 As shown in the figure, the hidden state of the BiGRU unit at time t is determined by the output of the forward hidden layer state at time t and the output of the reverse hidden layer state at time t-1. Therefore, for each word in a sentence, the semantic feature of the word is determined by the position of the word in the sentence and the information of the context corresponding to the word. This can retain the information of a word in the context as much as possible and improve the accuracy of classification.

[0147] S24, using the softmax sub-model, performing semantic classification based on the extracted context information to obtain a second word set.

[0148] S25, performing relevance calculation on each word in each obtained second word set and a preset domain word body according to a preset rule.

[0149] S26, determining the classification of the text topic based on the relevance of each second word set and the preset domain word ontology.

[0150] In summary, the text topics to be classified are obtained, and the text topics are processed by removing noise, removing stop words, segmenting and confusing mapping in turn to obtain the first word set; the first word set is input into the pre-trained ERNIE-BiGRU model, and the words in the first word set are semantically classified by the ERNIE-BiGRU model to obtain the second word set; the internal connection between the words is determined based on the predicted semantics, and the word sequence is constructed based on the internal connection; the features of the text topic are extracted based on the word sequence, and the text is classified based on the extracted features. This method adds the vectorization of the text topic by the ERNIE-BiGRU model. Specifically, the logic of BERT pre-training is improved on the basis of the BERT model, and the pre-training data uses a large amount of data sets, so it is more in line with the use requirements. In addition, in order to further extract the information of the text topic context, we added a bidirectional gated recurrent unit (BiGRU) on the basis of the ERNIE model, and used the word vector trained by the ERNIE model as the input of BiGRU for further feature extraction to obtain better text classification results.

[0151] In order to solve the above technical problems, an embodiment of the present invention further provides a text topic classification device.

[0152] Please refer to Figure 8 , Figure 8 The basic structural diagram of the text subject classification device for this implementation includes:

[0153] An acquisition module is used to acquire the text topics to be classified, and sequentially perform noise removal, stop word removal, word segmentation and confusion mapping processing on the text topics to obtain a first word set;

[0154] A prediction module, used for inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set through the ERNIE-BiGRU model to obtain a second word set;

[0155] A calculation module, used for performing a relevance calculation between each word in each obtained second word set and a preset domain word body according to a preset rule;

[0156] The classification module is used to determine the classification of the text topic based on the relevance of each second word set and the preset domain word ontology.

[0157] Optionally, the acquisition module includes:

[0158] The de-noising unit is used to collect text topics from web pages or user input, and query the noise characters and stop words in the text topics based on the meaningless connecting characters between words and sentences in the context to obtain the short text of the sentence;

[0159] The tagging unit is used to convert the sentence short text into a directed acyclic graph, and use the hidden Markov model to predict the segmentation nodes of the words in the directed acyclic graph, and tag them to obtain the word segmentation sequence;

[0160] The replacement unit is used to identify English and network terms in the word segmentation sequence, query the corresponding meanings of English and network terms in the network dictionary, and replace them to obtain the first word set.

[0161] Optionally, the marking unit is specifically used for:

[0162] Match the sentences to be split in the short text with the characters or words in the dictionary to generate a prefix tree;

[0163] According to each character or word in the prefix tree, a directed acyclic graph is generated according to different word group lengths;

[0164] Using the pre-trained hidden Markov transition probability matrix and observation probability matrix, the Viterbi algorithm is used to find the sub-path with the highest probability, and the starting and ending node positions of the sub-path with the highest probability in the directed acyclic graph are recorded;

[0165] Based on the start node and the end node positions as the segmentation positions, the tokens of the sentences to be split are reassembled to obtain the word segmentation sequence.

[0166] Optional, pre-trained ERNIE-BiGRU model consists of ERNIE pre-trained sub-model, BiGRU sub-model and softmax sub-model, and the prediction module includes:

[0167] A pre-training unit, used for inputting the first word set into the ERNIE pre-training sub-model, pre-training the first word set, and obtaining a sentence-level word vector representation sequence;

[0168] The extraction unit is used to extract the context information of each word in the word vector representation sequence using the BiGRU sub-model; and to perform semantic classification based on the extracted context information using the softmax sub-model to obtain the semantic features of each word.

[0169] Optional, ERNIE pre-trained sub-model The ERNIE pre-trained sub-model is a network consisting of two parts: transformer encoding and knowledge integration. The pre-trained unit is specifically used for:

[0170] Input the first word set into the transformer encoder, extract the keywords of each sentence in the first word set by using the full attention mechanism through the transformer encoder, and encode based on the extracted keywords to obtain the vector representation of all words;

[0171] Perform a weighted summation on the vector representations of all words, and sort the vector representations based on the summation to obtain a vector sequence;

[0172] Through a multi-stage knowledge masking strategy, each word in the first word set is randomly masked, and the masked phrases are semantically analyzed and integrated;

[0173] The integrated phrases are used to adjust the vector sequence to obtain a sentence-level word vector representation sequence.

[0174] Optionally, the BiGRU sub-model is a bidirectional gated recurrent unit, and the extraction unit is specifically used for:

[0175] Using bidirectional gated recurrent units, the word vectors are predicted from the forward and reverse directions to represent the context of each word in the text topic.

[0176] Based on the previous and next connections, the semantic calculation formula is used to perform forward and backward semantic analysis on each word to obtain the context information of each word.

[0177] In this embodiment, a first word set is obtained by obtaining a text topic to be classified, and the text topic is processed in sequence to remove noise, stop words, word segmentation and confusion mapping; the first word set is input into a pre-trained ERNIE-BiGRU model, and each word in the first word set is semantically classified by the ERNIE-BiGRU model to obtain a second word set; the internal connection between each word is determined based on the predicted semantics, and a word sequence is constructed based on the internal connection; the features of the text topic are extracted based on the word sequence, and the text is classified based on the extracted features. The text topic is converted into a sentence-level vector representation by the ERNIE-BiGRU model, which not only retains the internal connection and integrity between words in the sentence, but also solves the problem of inaccurate text classification at the sentence level in the existing pre-training model.

[0178] To solve the above technical problems, an embodiment of the present invention further provides a chip, which can be a general-purpose processor or a dedicated processor. The chip includes a processor, which is used to support the terminal to execute the above related steps, such as calling and running a computer program from a memory so that a device equipped with the chip executes the text topic classification method in each of the above embodiments.

[0179] Optionally, in some examples, the chip further includes a transceiver, and the transceiver is used to receive control of the processor and to support the terminal to execute the above-mentioned related steps to implement the text topic classification method in the above-mentioned embodiments.

[0180] Optionally, the chip may also include a storage medium.

[0181] It should be noted that the chip can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGA), programmable logic devices (PLD), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits that can perform the various functions described throughout this application.

[0182] The present invention also provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the text topic classification method provided in the above embodiment are implemented.

[0183] Please refer to Fig. 9 , Fig. 9 The basic structural block diagram of a terminal shown in FIG. 1 includes a processor, a non-volatile storage medium, a memory, and a network interface connected via a system bus. The non-volatile storage medium of the terminal stores an operating system, a database, and a computer-readable instruction. The database may store a control information sequence. When the computer-readable instruction is executed by the processor, the processor may implement a text theme classification method. The processor of the terminal is used to provide computing and control capabilities to support the operation of the entire terminal. The memory of the terminal may store computer-readable instructions. When the computer-readable instruction is executed by the processor, the processor may execute a text theme classification method. The network interface of the terminal is used to connect and communicate with the terminal. It can be understood by those skilled in the art that the structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the terminal to which the scheme of the present application is applied. The specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0184] It will be understood by those skilled in the art that the "terminal" and "terminal device" used herein include both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are electronic devices with receiving and transmitting hardware capable of performing two-way communications on a two-way communication link. Such electronic devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, Internet / intranet access, a web browser, a notepad, a calendar and / or a GPS (Global Positioning System) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with a radio frequency receiver. The "terminal" and "terminal device" used herein may be portable, transportable, installed in a vehicle (air, sea and / or land), or adapted and / or configured to operate locally, and / or in a distributed form, at any other location on the earth and / or in space. The "terminal" and "terminal device" used herein may also be a communication terminal, an Internet terminal, a music / video playing terminal, such as a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.

[0185] The present invention also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the text topic classification method in any of the above embodiments.

[0186] This embodiment also provides a computer program that can be distributed on a computer-readable medium and executed by a computing device to implement at least one step of the text topic classification method introduced above; and in some cases, at least one of the steps shown or described can be executed in an order different from that described in the above embodiment.

[0187] This embodiment further provides a computer program product, including a computer readable device, on which the computer program as shown above is stored. In this embodiment, the computer readable device may include the computer readable storage medium as shown above.

[0188] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0189] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0190] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0191] The above embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.

Claims

1. A text topic classification method, characterized in that: include: Obtaining a text topic to be classified, and performing noise removal, stop word removal, word segmentation, and confusion mapping processing on the text topic in sequence to obtain a first word set, wherein the confusion mapping processing includes converting abbreviations, English, and network terms in the word segmentation result into regular texts with the same meaning; Inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set by the ERNIE-BiGRU model to obtain a second word set; Performing a relevance calculation on each word in each obtained second word set and a preset domain word ontology according to a preset rule, wherein the preset domain word ontology includes feature words, concepts and sense element numbers, and performing a relevance calculation according to the preset rule includes matching the feature words, concepts and sense element numbers in the preset domain word ontology; Determining the classification of the text topic based on the relevance of each second word set to the preset domain word ontology; The method of obtaining a text topic to be classified and sequentially performing noise removal, stop word removal, word segmentation and confusion mapping processing on the text topic to obtain a first word set includes: Collect text topics from web pages or user input, and query noise characters and stop words in the text topics based on meaningless connecting characters between words and sentences in the context to obtain short text of sentences; The sentence short text is converted into a directed acyclic graph, and the segmentation nodes of the words in the directed acyclic graph are predicted by using a hidden Markov model, and are marked to obtain a word segmentation sequence; Identify English and Internet terms in the word segmentation sequence, query the corresponding meanings of the English and Internet terms in an Internet dictionary, and replace them to obtain a first word set; The text topic to be classified is represented as D, and the preset domain word ontology is represented as O i ={O1,O2...,O i }, sim(A,B) represents the correlation value between A and B; the second word set in the text topic D is represented by w k Concept 1 |…Concept n|, preset domain word ontology O i The word in is represented by kw l Concept 1|…Concept m|, then: The step of performing a correlation operation between each word in each obtained second word set and a preset domain word body according to a preset rule includes: Rule 1: If the words in the second word set are the same as the words in the preset domain word body, then w k and kw l Same, sim(w k ,kw l )=1, then end w k and O i Compare the remaining words in the second word set with the preset domain word body, and continue to perform the step of determining the classification of the text subject based on the relevance of each second word set with the preset domain word body; if they are not the same, execute rule 2; Rule 2: Perform concept matching on the words in the second word set and the words in the preset domain word body. If the concept matching is successful, calculate the concept relevance; if the concept matching is unsuccessful, execute Rule 3; The concept relevance calculation method is as follows: Among them, α is the artificial weight factor, m and n are w k and kw l The number of concepts, f(con i ,con j ) is the number of complete concept matches. i =con j When f(con i ,con j )=1; Rule 3: performing sense-unit matching on the words in the second word set and the words in the preset domain word body, and calculating sense-unit relevance; The calculation method of the semantic relevance is as follows: Among them, f(p i ,p j ) is p i and p j The semantic distance between two senses, deep ij For p i and p j The depth of the common node between two senses in the sense tree. i =p j When d ij =0; when pi≠pj, ​​d ij Yes i and p j The path length in the semantic hierarchy is a positive integer. γ is an adjustable parameter; β is a human-given weight factor, x and y are w respectively. k and kw l The longer the paths between two sense-units are, the deeper the common depth is, and the greater the semantic relevance value is; The step of determining the classification of the text topic based on the relevance of each second word set to the preset domain word ontology includes: Calculate the second word set w k and the preset domain word ontology O i The maximum value of the correlation is: sim(w k ,O i )=max{sim(w k ,kw1),sim(w k ,kw2),...,sim(w k ,kw M )} Then the calculation formula for the relevance between the text topic D and the preset domain word ontology Oi is: The text topic D belongs to the relevance result sim(w k ,O i ) is the largest category, where N represents the number of second word sets in the text topic D.

2. The text topic classification method according to claim 1, characterized in that: The step of converting the sentence short text into a directed acyclic graph, predicting the segmentation nodes of words in the directed acyclic graph using a hidden Markov model, and marking them to obtain a word segmentation sequence includes: Matching the sentences to be split in the sentence short text with the characters or words in the dictionary to generate a prefix tree; According to each character or word in the prefix tree, a directed acyclic graph is generated according to different word group lengths; Using the pre-trained hidden Markov transition probability matrix and observation probability matrix, the Viterbi algorithm is used to find the sub-path with the highest probability, and the starting node and the ending node positions of the sub-path with the highest probability in the directed acyclic graph are recorded; Based on the positions of the starting node and the ending node as the segmentation positions, the tags of the sentence to be split are recombined to obtain a word segmentation sequence.

3. The text topic classification method according to claim 1, characterized in that: The steps of performing a correlation calculation between each word in each second word set and a preset domain word body according to a preset rule further include: The words whose relevance values ​​are greater than a preset threshold are added to the preset domain word ontology to update the preset domain word ontology.

4. The text topic classification method according to any one of claims 1 or 2, characterized in that: The pre-trained ERNIE-BiGRU model is composed of an ERNIE pre-trained sub-model, a BiGRU sub-model and a softmax sub-model. The first word set is input into the pre-trained ERNIE-BiGRU model, and the second word set is obtained by semantically classifying each word in the first word set through the ERNIE-BiGRU model, including: Inputting the first word set into the ERNIE pre-training sub-model, pre-training the first word set, and obtaining a sentence-level word vector representation sequence; Extracting context information of each word in the word vector representation sequence using the BiGRU sub-model; The softmax sub-model is used to perform semantic classification based on the extracted context information to obtain a second word set.

5. The text topic classification method according to claim 4, characterized in that: The ERNIE pre-training sub-model is a network consisting of two parts: transformer encoding and knowledge integration; The step of inputting the first word set into the ERNIE pre-training sub-model, pre-training the first word set, and obtaining a sentence-level word vector representation sequence includes: Inputting the first word set into the transformer encoder, extracting keywords of each sentence in the first word set by the transformer encoder using a full attention mechanism, and encoding based on the extracted keywords to obtain vector representations of all words; Perform a weighted summation on the vector representations of all words, and sort the vector representations based on the summation to obtain a vector sequence; Through a multi-stage knowledge masking strategy, each word in the first word set is randomly masked, and the masked phrases are semantically analyzed and integrated; The integrated phrases are used to adjust the vector sequence to obtain a sentence-level word vector representation sequence.

6. A text topic classification device, characterized in that: include: An acquisition module is used to acquire a text topic to be classified, and sequentially perform noise removal, stop word removal, word segmentation and confusion mapping processing on the text topic to obtain a first word set, wherein the confusion mapping processing includes converting abbreviations, English and network terms in the word segmentation result into regular text with the same meaning; A prediction module, used for inputting the first word set into a pre-trained ERNIE-BiGRU model, and performing semantic classification on each word in the first word set through the ERNIE-BiGRU model to obtain a second word set; A calculation module, configured to perform a relevance calculation on each word in each obtained second word set and a preset domain word ontology according to a preset rule, wherein the preset domain word ontology includes feature words, concepts, and sense element numbers, and the relevance calculation according to the preset rule includes matching the feature words, concepts, and sense element numbers in the preset domain word ontology; A classification module, used to determine the classification of the text topic based on the relevance of each second word set and the preset domain word body; The acquisition module is used for: Collect text topics from web pages or user input, and query noise characters and stop words in the text topics based on meaningless connecting characters between words and sentences in the context to obtain short text of sentences; The sentence short text is converted into a directed acyclic graph, and the segmentation nodes of the words in the directed acyclic graph are predicted by using a hidden Markov model, and are marked to obtain a word segmentation sequence; Identify English and Internet terms in the word segmentation sequence, query the corresponding meanings of the English and Internet terms in an Internet dictionary, and replace them to obtain a first word set; The text topic to be classified is represented as D, and the preset domain word ontology is represented as O i ={O1,O2...,O i }, sim(A,B) represents the correlation value between A and B; the second word set in the text topic D is represented by w k Concept 1 |…Concept n|, preset domain word ontology O i The word in is represented by kw l Concept 1|…Concept m|, then: The calculation module is used for: Rule 1: If the words in the second word set are the same as the words in the preset domain word body, then w k and kw l Same, sim(w k ,kw l )=1, then end w k and O i Compare the remaining words in the second word set with the preset domain word body, and continue to perform the step of determining the classification of the text subject based on the relevance of each second word set with the preset domain word body; if they are not the same, execute rule 2; Rule 2: Perform concept matching on the words in the second word set and the words in the preset domain word body. If the concept matching is successful, calculate the concept relevance; if the concept matching is unsuccessful, execute Rule 3; The concept relevance calculation method is as follows: Among them, α is the artificial weight factor, m and n are w k and kw l The number of concepts, f(con i ,con j ) is the number of complete concept matches. i =con j When f(con i ,con j )=1; Rule 3: performing sense-unit matching on the words in the second word set and the words in the preset domain word body, and calculating sense-unit relevance; The calculation method of the semantic relevance is as follows: Among them, f(p i ,p j ) is p i and p j The semantic distance between two senses, deep ij For p i and p j The depth of the common node between two senses in the sense tree. i =p j When d ij =0; when pi≠pj, ​​d ij Yes i and p j The path length in the semantic hierarchy is a positive integer. γ is an adjustable parameter; β is a human-given weight factor, x and y are w respectively. k and kw l The longer the paths between two sense-units are, the deeper the common depth is, and the greater the semantic relevance value is; The classification module is used to: Calculate the second word set w k and the preset domain word ontology O i The maximum value of the correlation is: sim(w k ,O i )=max{sim(w k ,kw1),sim(w k ,kw2),...,sim(w k ,kw M )} Then the calculation formula for the relevance between the text topic D and the preset domain word ontology Oi is: The text topic D belongs to the relevance result sim(w k ,O i ) is the largest category, where N represents the number of second word sets in the text topic D.

7. A chip, characterized in that: include: The first processor is used to call and run a computer program from a first memory, so that a device equipped with the chip executes the steps of the text topic classification method as described in any one of claims 1 to 5.

8. A terminal, characterized in that: The method comprises a second memory, a second processor, and a computer program stored in the second memory and running on the second processor, wherein the second processor implements the steps of the text topic classification method as described in any one of claims 1 to 5 when executing the computer program.

Citation Information

Patent Citations

  • Complex semantic recognition method based on document word segmentation

    CN111008530A

  • Chinese text classification method based on ERNIE-BiGRU

    CN111581383A

  • Text category determination method, related device and equipment

    CN113821590A