CN111159412B - Classification method, classification device, electronic equipment and readable storage medium - Google Patents

Classification method, classification device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN111159412B
CN111159412B CN201911420328.8A CN201911420328A CN111159412B CN 111159412 B CN111159412 B CN 111159412B CN 201911420328 A CN201911420328 A CN 201911420328A CN 111159412 B CN111159412 B CN 111159412B
Authority
CN
China
Prior art keywords
classification
word
text
words
feature
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911420328.8A
Other languages
Chinese (zh)
Other versions
CN111159412A (en
Inventor
刘志煌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911420328.8A priority Critical patent/CN111159412B/en
Publication of CN111159412A publication Critical patent/CN111159412A/en
Application granted granted Critical
Publication of CN111159412B publication Critical patent/CN111159412B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/355Class or cluster creation or modification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a classification method, a classification device, electronic equipment and a readable storage medium. The method comprises the following steps: determining first classification feature words of each first target object contained in the text to be classified; extracting text features of the text to be classified and word features of the first classification feature words; and respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object, and obtaining classification results corresponding to the first target objects based on the combination features corresponding to the first target objects for each first target object. In the embodiment of the application, the final classification result is determined based on the combined characteristics obtained after the text characteristics and the word characteristics are spliced during classification, and compared with the method for determining the classification result based on the text characteristics of the text to be classified, the method and the device can better mine the information of the classification result, improve the accuracy of characteristic extraction and improve the classification effect.

Description

Classification method, classification device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of text classification technologies, and in particular, to a classification method, apparatus, electronic device, and readable storage medium.
Background
Text classification (Text Classification) refers to automatic classification marking of text according to a certain classification system or standard. As a classical natural language processing task, text classification technology has been widely applied to various scenes such as emotion analysis, user comment mining, and the like. With the improvement of application requirements, classification granularity is also increasingly refined, emotion analysis is taken as an example, fine-granularity emotion analysis, also called attribute-level emotion analysis, belongs to text emotion analysis, and the emotion attribute of an evaluation object is mined in a more specific dimension, so that an analysis result has a more reference meaning and value, and is widely applied to the fields of e-commerce platforms, news recommendation, social platforms and the like.
In the prior art, text classification is usually performed by manually labeling evaluation elements on a training sample, then performing classification model training based on the labeled training sample, and determining a final classification result based on the trained classification model. However, in practical application, the extraction effect of the extraction of the evaluation element in the current classification model is not ideal, so that the accuracy of the text classification result is required to be improved.
Disclosure of Invention
The invention provides a classification method, a classification device, electronic equipment and a readable storage medium, so as to improve the accuracy of text classification results.
In a first aspect, embodiments of the present application provide a classification method, including:
determining first classification feature words of each first target object contained in the text to be classified;
extracting text features of the text to be classified and word features of the first classification feature words;
word features of the first classification feature words of the first target objects are spliced with text features respectively to obtain combination features corresponding to the first target objects;
and for each first target object, based on the classification result corresponding to the first target object and the combination characteristic corresponding to the first target object.
In an optional embodiment of the first aspect, the text to be classified is a sentence, and extracting text features of the text to be classified includes:
word segmentation processing is carried out on the text to be classified, word vectors of first words in the text to be classified are extracted, and the first words comprise words of a first target object;
respectively splicing the word vector of each first word segment in the text to be classified with the word vector of the first target object to obtain a spliced vector corresponding to each first word segment;
And extracting text features of the text to be classified based on the spliced vectors corresponding to the first segmentation words.
In an optional embodiment of the first aspect, determining a first classification feature word of each first target object in the text to be classified includes:
determining first classification feature words of first target objects in the text to be classified based on class sequence rules (Class Sequential Rules, CSR);
the class sequence rule is determined based on a labeling sequence in the benchmark sample text, and the labeling sequence characterizes the part of speech and the class of words of each benchmark feature word contained in the benchmark sample text.
In an optional embodiment of the first aspect, determining, based on the class sequence rule, a first classification feature word of each first target object in the text to be classified includes:
determining reference feature words contained in each first segmentation word;
labeling the text to be classified based on the part of speech of each first word and the part of speech of each reference feature word to obtain a labeling sequence of the text to be classified;
and determining each first classification characteristic word based on the class sequence rule and the labeling sequence of the text to be classified.
In an optional embodiment of the first aspect, when a specified type of word exists in the text to be classified, extracting word features of the first classification feature word includes:
Combining the specified type words with the corresponding first classification feature words to obtain combined first classification feature words, wherein the specified type words are words affecting classification results corresponding to the first classification feature words;
and extracting word features of the combined first classification feature words as word features of the first classification feature words.
In an alternative embodiment of the first aspect, the method is implemented by a classification model, wherein the classification model is trained by:
acquiring each initial training sample;
determining second classification feature words of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on the second classification feature words contained in each initial training sample, and obtaining each labeled training sample;
based on the labeled training samples and the second classification feature words corresponding to the training samples, training the initial neural network model until the corresponding loss function converges, wherein the value of the loss function characterizes the difference between the classification result of the training samples output by the model and the classification result corresponding to the classification label.
In an optional embodiment of the first aspect, the reference sample text is a sentence, and determining a second classification feature word of the second target object included in each initial training sample includes:
Determining a reference sample text;
determining class sequence rules based on the reference sample text;
based on the class sequence rules, a second class feature word of a second target object contained in each initial training sample is determined.
In an alternative embodiment of the first aspect, determining class sequence rules based on the benchmark sample text includes:
word segmentation processing is carried out on the reference sample text to obtain second words;
determining reference feature words contained in each second segmentation word;
labeling the reference sample text based on the part of speech of each second word and the part of speech of each reference feature word to obtain a labeling sequence of the reference sample text;
class sequence rules are mined based on the labeling sequence of the reference sample text.
In an optional embodiment of the first aspect, mining class sequence rules based on a labeling sequence of the benchmark sample text comprises:
and carrying out class sequence rule mining on the labeling sequence of the reference sample text by adopting a frequent sequence mode to obtain class sequence rules, wherein the support degree in the frequent sequence mode is determined based on the minimum support rate and the number of initial training samples.
In an optional embodiment of the first aspect, when the initial training samples include a specified type of word, labeling a classification label of each initial training sample based on a second classification feature word included in each initial training sample, to obtain labeled training samples, including:
For each initial training sample, merging the appointed type words with the corresponding second classification feature words to obtain merged second classification feature words;
labeling the classification labels of each initial training sample based on the combined second classification feature words to obtain labeled training samples;
training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples, wherein the training comprises the following steps:
and training the initial neural network model based on the labeled training samples and the combined second classification characteristic words corresponding to the training samples.
In an alternative embodiment of the first aspect, the classification model is a convolutional neural network CNN (Convolutional Neural Networks, convolutional neural network) model, where the CNN model includes a text feature extraction module, a classified word feature extraction module, a feature fusion module, and a classification module, where:
the text feature extraction module is used for extracting text features of the text to be classified;
the classified word feature extraction module is used for determining first classified feature words of each first target object contained in the text to be classified and extracting word features of each first classified feature word;
The feature fusion module is used for respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object;
and the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristics corresponding to the first target object for each first target object.
In an alternative embodiment of the first aspect, the classification model is an emotion classification model, and the first classification feature word and the second classification feature word are emotion feature words.
In an optional embodiment of the first aspect, when the word features of the first classification feature word are extracted based on the first classification feature word obtained by merging the first classification feature word with the corresponding specified type word, the first specified word includes at least one of a degree word or a negative word affecting the emotion degree of the first classification feature word.
In a second aspect, embodiments of the present application provide a classification apparatus, including:
the classification feature word determining module is used for determining first classification feature words of each first target object contained in the text to be classified;
the feature extraction module is used for extracting text features of the text to be classified and word features of the first classification feature words;
The feature fusion module is used for respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object;
and the classification result determining module is used for obtaining a classification result corresponding to the first target object based on the combination characteristics corresponding to the first target object for each first target object.
In an optional embodiment of the second aspect, the text to be classified is a sentence, and the feature extraction module is specifically configured to:
word segmentation processing is carried out on the text to be classified, word vectors of first words in the text to be classified are extracted, and the first words comprise words of a first target object;
respectively splicing the word vector of each first word segment in the text to be classified with the word vector of the first target object to obtain a spliced vector corresponding to each first word segment;
and extracting text features of the text to be classified based on the spliced vectors corresponding to the first segmentation words.
In an optional embodiment of the second aspect, the classification feature word determining module is specifically configured to, when determining a first classification feature word of each first target object in the text to be classified:
determining first classification feature words of each first target object in the text to be classified based on the class sequence rule;
The class sequence rule is determined based on a labeling sequence in the benchmark sample text, and the labeling sequence characterizes the part of speech and the class of words of each benchmark feature word contained in the benchmark sample text.
In an optional embodiment of the second aspect, the classification feature word determining module is specifically configured to, when determining, based on a class sequence rule, a first classification feature word of a first target object in each text to be classified:
determining reference feature words contained in each first segmentation word;
labeling the text to be classified based on the part of speech of each first word and the part of speech of each reference feature word to obtain a labeling sequence of the text to be classified;
and determining each first classification characteristic word based on the class sequence rule and the labeling sequence of the text to be classified.
In an optional embodiment of the second aspect, when a specified type of word exists in the text to be classified, the feature extraction module is specifically configured to, when extracting the word feature of the first classification feature word:
combining the specified type words and the corresponding first classification feature words to obtain combined first classification feature words, wherein the first specified words are words affecting classification results corresponding to the first classification feature words;
and extracting word features of the combined first classification feature words as word features of the first classification feature words.
In an optional embodiment of the second aspect, the classification feature word determining module, the feature extracting module and the classification result determining module are included in a classification model, where the classification model is obtained through a model training module, and the model training module is specifically configured to:
acquiring each initial training sample;
determining second classification feature words of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on the second classification feature words contained in each initial training sample, and obtaining each labeled training sample;
based on the labeled training samples and the second classification feature words corresponding to the training samples, training the initial neural network model until the corresponding loss function converges, wherein the value of the loss function characterizes the difference between the classification result of the training samples output by the model and the classification result corresponding to the classification label.
In an alternative embodiment of the second aspect, the model training module is specifically configured to, when determining the second classification feature word of the second target object included in each initial training sample:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
Based on the class sequence rules, a second class feature word of a second target object contained in each initial training sample is determined.
In an alternative embodiment of the second aspect, the reference sample text is a sentence, and the model training module is specifically configured to, when determining the class sequence rule based on the reference sample text:
word segmentation processing is carried out on the reference sample text to obtain second words;
determining reference feature words contained in each second segmentation word;
labeling the reference sample text based on the part of speech of each second word and the part of speech of each reference feature word to obtain a labeling sequence of the reference sample text;
class sequence rules are mined based on the labeling sequence of the reference sample text.
In an alternative embodiment of the second aspect, the model training module is specifically configured to, when mining class sequence rules based on the labeling sequence of the reference sample text:
and carrying out class sequence rule mining on the labeling sequence of the reference sample text by adopting a frequent sequence mode to obtain class sequence rules, wherein the support degree in the frequent sequence mode is determined based on the minimum support rate and the number of initial training samples.
In an optional embodiment of the second aspect, when the initial training samples include a specified type of word, the model training module is specifically configured to, when labeling a classification label of each initial training sample based on a second classification feature word included in each initial training sample, obtain each labeled training sample:
For each initial training sample, merging the appointed type with the corresponding second classification feature word to obtain a merged second classification feature word;
labeling the classification labels of each initial training sample based on the combined second classification feature words to obtain labeled training samples;
the model training module is specifically used for training the initial neural network model based on each labeled training sample and the second classification feature words corresponding to each sample:
and training the initial neural network model based on the labeled training samples and the combined second classification characteristic words corresponding to the training samples.
In an alternative embodiment of the second aspect, the classification model is a CNN model, where the CNN model includes a text feature extraction module, a classified word feature extraction module, a feature fusion module, and a classification module, where:
the text feature extraction module is used for extracting text features of the text to be classified;
the classified word feature extraction module is used for fusing text features and word features of the first classified feature words for each first classified feature word to obtain fused features;
the feature fusion module is used for respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object;
And the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristics corresponding to the first target object for each first target object.
In an alternative embodiment of the second aspect, the classification model is an emotion classification model, and the first classification feature word and the second classification feature word are emotion feature words.
In an optional embodiment of the second aspect, when the word features of the first classification feature word are extracted based on the first classification feature word obtained by combining the classification feature word with a corresponding specified type word, the specified type word includes at least one of a degree word or a negative word that affects the emotion degree of the first classification feature word.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a processor; and a memory configured to store a computer program which, when executed by the processor, causes the processor to perform the method of any of the first aspects.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program, which when run on a computer, causes the computer to perform the method of any one of the first aspects described above.
The beneficial effects that technical scheme that this application embodiment provided brought are:
in the embodiment of the application, when determining the classification result corresponding to the text to be classified, text features in the text to be classified, word features of the first classification feature words, and then determining a final classification result based on the combined features obtained after the text features and the word features are spliced. Correspondingly, as word features of the first classification feature words are fused in the classification process, compared with the method for determining the classification result based on the text features of the text to be classified, the method can better mine information of the classification result, improve the accuracy of feature extraction, improve the accuracy of the text classification result and improve the classification effect.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flow chart of a classification method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of training a classification model according to an embodiment of the present application;
fig. 3 is a schematic flow chart of iterative mining of reference feature words according to an embodiment of the present application;
Fig. 4 is a schematic network structure diagram of a CNN according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a sorting device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of illustrating the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
Machine Learning (ML) is a multi-domain interdisciplinary, involving multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is specially studied how a computer simulates or implements learning behavior of a human to acquire new knowledge or skills, and reorganizes existing knowledge structures to continuously improve own performance. Machine learning is the core of artificial intelligence, a fundamental approach to letting computers have intelligence, which is applied throughout various areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, confidence networks, reinforcement learning, transfer learning, induction learning, teaching learning, and the like.
The scheme provided by the embodiment of the application relates to the technology of artificial intelligence such as machine learning, and the like, and is specifically described through the following embodiment.
As the requirements of text classification applications increase, the granularity of text classification also becomes finer.
In the fine-grained text analysis technique, firstly, an evaluation element is extracted, that is, an evaluation element is mined from a text, the evaluation element generally includes an evaluation object and an evaluation word, for example, in emotion analysis, for a text of "good service", …, the evaluation element to be extracted includes "good service", …, where "good service" is the evaluation object, and "good" is the evaluation word, and then, the evaluation object is scored for emotion based on the extracted evaluation element. However, the extraction effect of the existing extraction scheme of the evaluation element is not ideal, so that the accuracy of the text classification result is to be improved.
Currently, in fine-grained text analysis technology, two main methods are used for extracting evaluation elements: "one is to extract fine-grained evaluation elements based on a dictionary and a template; and the other method converts the mining and extraction of fine-grained elements into sequence labeling problems, and extracts evaluation elements by adopting a sequence labeling method based on a conditional random field, a hidden Markov model and the like. However, the element extraction method based on the dictionary and the template has poor expansibility and generalization capability, and cannot identify network new words and domain new words, so that extracted evaluation elements are incomplete, and the element extraction method based on the sequence labeling cannot solve the problem of long-distance dependence between the evaluation words and the evaluation objects, so that the extraction effect is poor.
Based on this, the embodiment of the application provides a classification method, which aims to solve some or all of the technical problems described in the foregoing. The following describes the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
It should be noted that, in the following description of the embodiments of the present application, the provided classification method will be described by taking emotion text classification as an example, but the present application is equally applicable to application scenarios of other text classifications.
Fig. 1 shows a flow chart of a classification method provided in an embodiment of the present application. As shown in fig. 1, the method includes:
step S101, determining a first classification feature word of each first target object included in the text to be classified.
The text to be classified refers to a text to be classified according to the text content, and the embodiment of the application is not limited to the specific form of the text to be classified, for example, the text to be classified may be a section of article with a plurality of clauses, or may be a single sentence, that is, the embodiment of the application is not limited to the granularity of the text, and may be configured according to the actual application requirement. Alternatively, the text to be classified may be a sentence, and when an article or a text segment needs to be classified, sentence segmentation may be performed on the article or the text segment, and each sentence after the sentence segmentation is used as a text to be classified.
The target object refers to an object to be evaluated in a text to be classified, and the classified feature words refer to words which are related to classification categories and can influence classification results of the object to be evaluated, are feature words of specified categories contained in the text to be classified, and the categories of the classified feature words are also different for different classification application scenes.
For example, assume that the classification application scene is emotion classification, and the classification feature word is emotion feature word. As one example, assuming that the text to be classified is "service-good", a target object in the text to be classified is "service", and a classification feature word of the target object is "good".
It can be understood that in practical application, a situation that a plurality of first target objects and corresponding first classification feature words exist in the text to be classified may also occur, and the first classification feature words of the determined first target objects are the first classification feature words of each first target object contained in the text to be classified. In one example, assume that the classification scene is emotion classification, the text to be classified is "here room very cost effective-! At this time, two first target objects and corresponding first classification feature words exist in the text to be classified, the two first target objects are respectively "room" and "cost performance", the corresponding first classification feature words of the two first target objects are respectively "good" and "high", and at this time, it can be determined that the first classification feature word of one first target object is "good", and the first classification feature word of the other first target object is "high".
Step S102, extracting text features of the text to be classified and word features of the first classification feature words.
The text features refer to features related to classification results corresponding to the text to be classified. In this embodiment of the present application, the extraction manners of the text features and the Word features are not limited, for example, the text features and the Word features may be extracted through a feature extraction network, for example, the extraction may be performed through a convolution network, and for example, the Word features may be corresponding Word vectors, and a Word2vec (Word to vector) model is adopted to obtain the Word feature.
In practical application, the text to be classified may be a sentence or an article or a text fragment, if the text to be classified is an article or a text fragment, the sentence processing may be performed on the article or the text fragment, and there is a high probability that a sentence in which the first target object and/or the first classification feature word does not exist exists, and for such a sentence, since there is no object to be evaluated, or there is no classification feature word of the object to be evaluated, the sentence may not be processed, but the sentence may be skipped, and the processing of the next sentence may be performed.
In one example, assume that the text to be classified obtained is "your good", the hotel's environment is very excellent-! The text to be classified obtained at this time comprises two clauses, namely 'your good' and 'the environment of the hotel is very excellent', wherein the clause 'your good' does not contain the object to be evaluated and the classification feature words of the object to be evaluated, and the processing of the clause 'your good' can be omitted at this time, and the processing of the next clause can be carried out.
In the embodiment of the application, when the to-be-classified text does not exist an object to be evaluated or the classification feature word of the object to be evaluated does not exist, the process of extracting the text features is not executed, so that compared with the mode of extracting the text features of all the to-be-classified texts without considering the factors of the to-be-classified texts, the method can effectively save resources and improve the classification efficiency.
It may be understood that in practical application, there may be a case where there are a plurality of first target objects and corresponding first classification feature words in one clause, and at this time, when extracting the word features of the first classification feature words, the word features of each included first classification feature word may be extracted respectively.
In one example, assume the text to be classified is "here room is very cost effective-! At this time, two first target objects and corresponding first classification feature words exist in the text to be classified, namely a room and a good, and a cost performance and a high; further, text features of the text to be classified can be extracted, and word features of the first classification feature word "good" and the first classification feature word "high" can be extracted respectively.
Step S103, word features of the first classification feature words of the first target objects are spliced with text features respectively to obtain combination features corresponding to the first target objects;
in practical application, after determining the first classification feature words of each first target object contained in the text to be classified and the text features of the text to be classified, for each target object, the first classification feature words corresponding to the target object and the text features of the text to be classified may be spliced, so as to obtain the combination features corresponding to each first target object. That is, the finally determined combination features are respectively in one-to-one correspondence with the first target objects.
In one example, assume the text to be classified is "here room is very cost effective-! At this time, two first target objects and corresponding first classification feature words exist in the text to be classified, namely a room and a good, and a cost performance and a high; further, text features of the text to be classified can be extracted, and word features of the first classification feature word "good" and the first classification feature word "high" can be extracted respectively; further, for the first target object "room", word features of the first classification feature word "good" and text features of the text to be classified can be spliced to obtain combined features corresponding to the first target object "room"; for the cost performance of the first target object, word features of the high word of the first classification feature and text features of the text to be classified can be spliced to obtain combined features corresponding to the cost performance of the first target object.
Optionally, in an embodiment of the present application, a difference between a feature length of a word feature and a feature length of a text feature of each first classification feature word is smaller than a set value.
In this embodiment, the feature length may refer to dimensions of the word feature and the text feature, and a specific value of the set value may be preconfigured, which is not limited in the embodiment of the present application. Optionally, in this embodiment of the present application, for each first classification feature word, a difference between a feature length of a corresponding word feature and a feature length of a text feature is smaller than a set value, that is, a feature length of each first classification feature word is similar to a feature length of a word feature of the first classification feature word. It will be appreciated that if the feature length of the word feature of the first classification feature word is currently desired to be the same as the feature length of the text feature, the set value may be set to 0. For example, when the feature length of the word feature of the first classification feature word is 100 dimensions, the feature length of the text feature is also 100 dimensions, and the difference between the feature lengths is 0.
In the embodiment of the application, since the difference between the feature length of the word feature of the first classification feature word and the feature length of the word feature of the first classification feature word is smaller than the set value, that is, the feature lengths between the word feature and the feature length of the first classification feature word are similar, the situation that one word feature cannot play a role or is not obvious in the classification process due to the fact that the feature length of the word feature is short can be effectively avoided, and the accuracy of the classification result can be further improved.
Step S104, for each first target object, based on the first combination features corresponding to the first target object, obtaining a classification result corresponding to the first target object.
In practical application, after the combination features corresponding to each first target object are obtained, the classification result corresponding to each first target object can be obtained based on the combination features corresponding to each first target object. That is, when there are a plurality of (including two or more) first target objects in the text to be classified, a corresponding number of classification results may be obtained, respectively, and each of the obtained classification results corresponds to one of the first target objects.
The expression forms of the classification results corresponding to the first target objects are different when the classification results correspond to different application scenes, and the expression forms of the classification results are not limited in the embodiment of the application. In an example, assuming that the current application scenario is an emotion-classified application scenario, the corresponding classification result may include sense, detract, and neutral. If the first classification feature word of the first target object of the text to be classified is "good", the classification result corresponding to the first target object is positive, if the first classification feature word of the first target object of the text to be classified is "general", the classification result corresponding to the first target object is neutral, and if the first classification feature word of the first target object of the text to be classified is "bad", the classification result corresponding to the first target object is negative.
Continuing the previous example, for the first target object "room", based on the corresponding combination characteristics, the classification result of the first target object "room" can be obtained as the recognition; for the cost performance of the first target object, based on the corresponding combination characteristics, the classification result of the cost performance of the first target object can be obtained as the recognition.
When the obtained text is a fragment or an article having a plurality of sentences, the obtained text may be subjected to sentence segmentation to obtain each sentence included therein. Correspondingly, each sentence is a text to be classified and corresponds to a text feature, and when word features of the first classification feature words of the first target object are spliced with the text features, the text features corresponding to the sentences where the first target object is located are spliced.
In the embodiment of the application, when determining the classification result corresponding to the text to be classified, text features in the text to be classified, word features of each first classification feature word are extracted, and then the final classification result is determined based on the combined features obtained after the text features and the word features are spliced. Accordingly, since word features of the first classification feature word are fused in the text features in the classification process, the method is equivalent to adding priori knowledge. Therefore, compared with the method for determining the classification result based on the text features of the text to be classified, the method can better mine the information of the classification result, improve the accuracy of feature extraction, reduce the requirements of a classifier and improve the classification effect.
In an alternative embodiment of the present application, the text to be classified is a sentence, and extracting text features of the text to be classified includes:
word segmentation processing is carried out on the text to be classified, word vectors of first words in the text to be classified are extracted, and the first words comprise words of a first target object;
the word vector of each first word segment in the text to be classified is spliced with the word vector of the word segment of the first target object respectively, so that a spliced vector corresponding to each first word segment is obtained;
and extracting text features of the text to be classified based on the spliced vectors corresponding to the first segmentation words.
In practical application, if the obtained text is an article or a fragment with multiple sentences, sentence dividing processing can be performed on the text to be classified to obtain multiple sentences, and each sentence corresponds to one text to be classified in the embodiment of the application. For example, when word segmentation is performed on the text to be classified, each sentence may be segmented with punctuation marks as intervals, so as to obtain each clause included in the text to be classified, where in order to better know each clause, each clause may be labeled with "|".
Further, word segmentation processing can be performed on each clause to obtain each first word segment contained in the text to be classified. For example, assuming that the text to be classified is "comfortable in room, good in service and not cheap in price", three clauses of "comfortable in room, good in service, not cheap in price" can be obtained by dividing the text to be classified based on the text to be classified as a segmentation basis; further, the three clauses may be segmented to obtain the first words "room", "very", "comfortable", "service", "very", "good", "price", "no" and "cheap" respectively.
Correspondingly, word vectors of each first word segment in the text to be classified can be spliced with word vectors of the word segments of the first target object respectively to obtain spliced vectors corresponding to the first word segments, and then feature extraction is carried out on the spliced vectors corresponding to the first word segments to obtain text features of the text to be classified.
In an example, assume that each of the first word "room", "very" and "comfortable" obtained by word segmentation processing of the text to be classified, the word of the first target object is "room". Further, word vectors of "room", "very" and "comfortable" can be extracted respectively, then word vectors of "very" and "comfortable" are spliced with word vectors of "room" respectively, corresponding spliced vectors of "very" and "comfortable" are obtained respectively, and text features of the text to be classified are extracted based on the corresponding spliced vectors of "very" and "comfortable".
In the embodiment of the application, the word vector of each first word in the text to be classified can be spliced with the word vector of the word of the first target object to obtain the spliced vector corresponding to each first word, and the text feature is the feature related to the classification result corresponding to the text to be classified, at this time, each spliced vector corresponding to the first word comprises the feature of the target object, and further, when the text feature of the text to be classified is extracted and obtained based on the spliced vector corresponding to each first word, the subsequent feature extraction structure can be guided to extract better features related to the target object, and the classification effect of the target object is improved.
In an alternative embodiment of the present application, determining a first classification feature word of each first target object included in the text to be classified includes:
determining first classification feature words of each first target object contained in the text to be classified based on the class sequence rule;
the class sequence rule is determined based on a labeling sequence in the benchmark sample text, and the labeling sequence characterizes the part of speech and the class of words of each benchmark feature word contained in the benchmark sample text.
Specifically, the class sequence rule is a rule composed of class labels and sequence data, and the class sequence rule and the sequence data form a mapping relation, and formally expressed as: X-Y, the specific description of the mapping relationship is as follows:
x is a Sequence expressed as < s1x1s2x2..sixi >, wherein S refers to a Sequence database, is a set of a series of tuples < sed, S >, as shown in table 1, sid (Sequence id) is a label of Sequence data, and S (Sequence) refers to Sequence data, xi refers to a category to which the Sequence data may correspond;
table 1, sequence database example
Sequence id Sequence
1 <abdC1gh>
2 <abeghk>
3 <C2kea>
4 <dC2kb>
5 <abC1fgh>
Y is another sequence expressed as<S 1 c 1 S 2 c 2 ...S i c r >Wherein S is as defined above, c r For the determined class label, a value of (c r E C, 1.ltoreq.i.ltoreq.r), and C= { C 1 ,c 2 ,...,c r And is a set of category labels. Thus, the CSR requirements determine class sequence rules must carry specified class information.
Further, after specifying the class information, the CSR mines out the sequence data satisfying the support threshold and the confidence threshold as a class sequence rule. Taking Table 1 as an example, the sequence database contains 5 pieces of sequence data with category information, and the rule of the category sequence which can be mined according to the definition is<<ab>x<gh>>→<<ab>c 1 <gh>>Obviously, the sequence data with sequence numbers 1 and 5 contain the sequence rule, and the designated category information is c 1 While the sequences with sequence numbers 1,2 and 5 all cover this class of sequence rules, the sequence with sequence number 2 does not specify class information. Therefore, in the 5 pieces of sequence data, the support degree of the class sequence rule is 2/5, and the confidence degree is 2/3. Based on the above, it is known from the definition of class sequence rules in the above description that CSR determines specified class information first, and then mines rules according to the specified class information, which is greatly different from conventional sequence pattern mining. Further, in the class sequence rule, since the left side is the sequence pattern and the right side is the corresponding class label, the sequence pattern and the class information can be bound together through the corresponding mapping relation. While the goal of CSR mining is to find a sequence pattern that has a high correlation with the specified category information, mining rules that correspond between the sequence pattern and the category. It follows that class sequence rules are characterized by supervised and pre-given class designation class information.
Further, in the embodiment of the present application, the reference sample text refers to a text used for mining class sequence rules, and the reference feature words are reference words of a pre-specified class in each class of feature words included in the reference sample text, which may be used for labeling the reference sample text, so as to obtain a corresponding labeling sequence. The category included in the reference feature word is not limited in the embodiment of the present application, and may be, for example, a few domain attribute words, emotion words, degree adverbs, negative words, and the like, which are derived from the existing dictionary database.
In practical application, when determining the class sequence rule, a reference sample text can be obtained, then word segmentation processing is performed on the reference sample text, each word segment included in the reference sample text is obtained, and the part of speech of each word segment is marked, for example, nouns are marked as n, adjectives are marked as a, adverbs are marked as d and the like. Further, determining the word segments belonging to the reference feature words in the words included in the reference sample text, and labeling the reference feature words included in the reference sample text based on the word class of the reference feature words, so as to obtain a corresponding labeling sequence. In the labeling process, attribute words can be labeled as #, emotion words as #, degree adverbs as & -! Etc. Further, after the labeling sequence in the reference sample text is obtained, the obtained labeling sequence can be used as sequence data, and then the obtained labeling sequence is mined based on the determined specified category, the support degree and the confidence degree, so that a class sequence rule is obtained.
In an alternative embodiment of the present application, determining, based on a class sequence rule, a first classification feature word of each first target object included in the text to be classified includes:
determining reference feature words contained in each first segmentation word;
labeling the text to be classified based on the part of speech of each first word and the part of speech of each reference feature word to obtain a labeling sequence of the text to be classified;
and determining each first classification characteristic word based on the class sequence rule and the labeling sequence of the text to be classified.
In practical application, the reference feature words can be obtained, the reference feature words contained in each first word segment are determined, and then the text to be classified is marked according to the part of speech of each first word segment and the word class of each reference feature word, so that a marking sequence of the text to be classified is obtained.
In one example, assume that the to-be-classified score is "room-friendly, service-friendly, and price-inexpensive", and that each of the resulting first score words includes "room", "friendly", "comfort", "service", "friendly", "price", "inexpensive", and the reference feature words include "room, price" belonging to the category of attribute words, "comfort, inexpensiveness" belonging to the category of emotion words, and "very" belonging to the category of degree adverbs "and" no "belonging to the category of negatives. Wherein, the attribute word category is marked as "#", the emotion word category is marked as "×", the degree adverb category is marked as "×", and the negation word category is marked as "| -! "; further, the part of speech in each first word segment may be determined and labeled to obtain "/n,/d,/a, |,/n,/d,/a, |,/n,/d,/a", and the first reference feature words included in the first word segment are determined to be "room", "very", "comfortable", "price", "non" and "cheap", and then word class labeling is performed at corresponding positions in the text to be classified according to the word class of each reference feature word included in the first word segment to obtain a labeling sequence "#/n, & gt/d, & lt/a, & gt/n, & lt/n, & gt + & gt & lt/a, & gt! /d,/a).
Further, since the reference feature words are only a few reference words of the category specified in advance from among the respective category feature words included in the reference sample, it is possible that each of the first category feature words included in the first segmentation word cannot be completely determined. Based on this, in the embodiment of the application, after the labeling sequence of the text to be classified is obtained, the obtained labeling sequence can be matched based on the determined class sequence rule, the feature words corresponding to the class sequence rule are extracted to form new reference feature words, then the first segmentation words are labeled again based on the new reference feature words, the steps of obtaining the labeling sequence of the text to be classified and obtaining the new reference feature words are repeated, so that the aim of iteratively mining the reference feature words is fulfilled, and further, each first classification feature word contained in each first segmentation word at present can be identified.
Continuing the above example, assuming that the first classification feature word is an emotion classification feature word, the resulting labeling sequence "#/n, &/d, &/a, &/n, &/d, & a, &, & #/n, & gt ]! "d,/a", and the determined class sequence rule is "#/n, &/d, &/a", and the confidence is set to 0.1, at which time "/n, &/d,/a", and "#/n, & gt! The/d and the/a' meet the requirement and can also be used as a sequence-like rule; further, the obtained labeling sequence can be matched based on the determined class sequence rules, and feature words of corresponding positions of various sequence rules in the labeling sequence are extracted to serve as new reference feature words, namely 'room, price and service' belonging to attribute word categories, 'comfort, cheapness and good' belonging to emotion word categories, and 'quite' belonging to degree adverb categories and 'not' belonging to negation word categories are extracted to serve as new reference feature words; correspondingly, since the new reference feature words are obtained to include all the first classification feature words contained in the text to be classified, the first classification feature words can be obtained to further include "good".
In an alternative embodiment of the present application, when a specified type of word exists in the text to be classified, extracting the word feature of the first classification feature word includes:
combining the specified type words with the corresponding first classification feature words to obtain combined first classification feature words, wherein the specified type words are words affecting classification results corresponding to the first classification feature words;
and extracting word features of the combined first classification feature words as word features of the first classification feature words.
The specified type words are words which can potentially influence the classification result corresponding to the first classification characteristic words. The specified type of word is typically a word preceding the classification feature word that is used to define the classification feature word or to deepen the meaning of the classification feature word, including but not limited to a stop, adjective, or adverb (e.g., a degree adverb) preceding the classification feature word, and the like. The specific type of the specific type word can be specified according to the actual application requirements in different application programs.
In an optional embodiment of the present application, when the word feature of the first classification feature word is extracted based on the first classification feature word obtained by merging the first classification feature word with a corresponding specified type word, the specified type word includes at least one of a degree word or a negative word that affects the emotion degree of the first classification feature word. For example, if the current application scenario is a scenario of text emotion analysis, the first specified word may be at least one of a level word or a negative word affecting emotion level.
In practical application, before extracting the word features of the first classification feature words, it can also be determined whether the text to be classified currently includes the specified type words, if yes, the specified type words and the first classification feature words corresponding to the specified type words can be combined to obtain the combined first classification feature words, and then the word features of the combined first classification feature words are extracted to serve as the word features of the first classification feature words. If the text to be classified currently includes a plurality of specified types of words and a plurality of first classification feature words, the specified types of words and the corresponding first classification feature words need to be combined one by one.
In one example, assuming that the first classification feature word is an emotion feature word, the specified type word is a negative word, and the text to be classified is "uncomfortable room, not inexpensive". At this time, the text to be classified includes two negatives "no", emotion feature words are "comfortable" and "cheap", and then the first negatives "no" and "comfortable" can be combined to obtain a first combined first classification feature word "uncomfortable", and the second negatives "no" and "cheap" are combined to obtain a second combined first classification feature word "not cheap", and then word features of "uncomfortable" and "not cheap" are extracted respectively.
In an alternative embodiment of the present application, the method is implemented by a classification model, wherein the classification model is trained by:
acquiring each initial training sample;
determining second classification feature words of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on the second classification feature words contained in each initial training sample, and obtaining each labeled training sample;
based on the labeled training samples and the second classification feature words corresponding to the training samples, training the initial neural network model until the corresponding loss function converges, wherein the value of the loss function characterizes the difference between the classification result of the training samples output by the model and the classification result corresponding to the classification label.
In an alternative embodiment of the present application, if the classification model is an emotion classification model, the first classification feature word and the second classification feature word may be emotion feature words.
In practical application, the classification method provided in the foregoing embodiments of the present application may be implemented by a classification model, and the classification model is not limited in the embodiments of the present application, for example, the classification model may be a CNN model or the like.
When the classification model is trained in practical application, each initial training sample can be obtained, and each initial sample comprises a second target object and a second classification feature word of the second target object, wherein the class of the second classification feature word is the same as that of the first classification feature word, for example, when the first classification feature word is an emotion feature word, the second classification feature word is also an emotion feature word.
Further, the classification label of each initial training sample can be labeled based on the second classification feature words contained in each initial training sample, and each labeled training sample can be obtained. When different application scenes are adopted, the initial training samples are different, and the labeled classification labels are also different. For example, if the application scenario is an application scenario of emotion analysis, the second classification feature words included in each initial training sample obtained at this time may be emotion feature words, and the classification labels corresponding to each initial training sample may be emotion classification results corresponding to the emotion feature words included in each initial training sample, for example, may be "positive", "neutral" and "negative". And when labeling the classification label of each initial training sample based on the second classification feature words contained in each initial training sample, determining the emotion classification result corresponding to each second classification feature word based on the emotion classification labels labeled by the feature words in the known dictionary database, and taking the determined emotion classification result as the classification label of each initial training sample.
Further, each labeled training sample can be input into the initial neural network model, a classification result corresponding to each training sample is output, then whether a loss function corresponding to the training is converged is determined, if not, the accuracy of the current initial neural network model still does not meet the requirement is indicated, initial neural network parameters can be adjusted, each labeled training sample is input into the adjusted neural network model again, whether the loss function corresponding to the training is converged is judged again, and if not, the initial neural network model parameters are continuously adjusted until the corresponding loss function is converged. The value of the loss function characterizes the difference between the classification result of the training sample output by the model and the classification result corresponding to the classification label, and when the loss function converges, the difference between the classification result of the training sample output by the model and the classification result corresponding to the classification label of the training sample is described to meet the requirement.
In the embodiment of the application, in the neural network training process, because the classification feature words can be mined based on the class sequence rule, each classification feature word in the text to be classified does not need to be manually determined first, and then each classification feature word is labeled, the link of labeling the classification label can be automatically completed, and therefore the classification efficiency can be effectively improved. Meanwhile, the classification labels of the training samples are emotion polarity labels of emotion words in the existing known text database, so that the problem of manual labeling errors is prevented, and the classification accuracy is improved.
In an alternative embodiment of the present application, determining the second classification feature word of the second target object included in each initial training sample includes:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
based on the class sequence rules, a second class feature word of a second target object contained in each initial training sample is determined.
The method for obtaining the reference sample text is not limited in the embodiment of the present application, and may be a part of samples in the training samples, or may be samples independent of each training sample. The class sequence rule is used for determining a second class feature word of the second target object, and may be the same as or different from the first class sequence rule.
In practical application, after determining the reference sample text, a class sequence rule may be determined based on the reference sample text, and then a second class feature word of the second target object may be determined based on the class sequence rule.
In an alternative embodiment of the present application, the reference sample text is a sentence, and determining the second class sequence rule based on the reference sample text includes:
word segmentation processing is carried out on the reference sample text to obtain second words;
Determining reference feature words contained in each second segmentation word;
labeling the reference sample text based on the part of speech of each second word and the part of speech of each reference feature word to obtain a labeling sequence of the reference sample text;
and mining a second class sequence rule based on the labeling sequence of the reference sample text.
In practical application, when determining the class sequence rule, word segmentation processing can be performed on the reference sample text to obtain each second word. The specific implementation manner of performing word segmentation on the standard sample text to obtain each second word may refer to the above-mentioned text to be classified to obtain the specific implementation manner of each first word, which will not be described herein.
It should be noted that the reference sample text may be obtained by processing clauses of a segment or an article having a plurality of sentences, where each clause corresponds to one reference sample text. The specific implementation manner of performing sentence processing on the reference sample text to obtain each sentence can refer to the sentence processing on the text to be classified in the above description, and will not be described herein.
Further, the reference feature words included in each second word segment may be determined, and then the reference sample text may be labeled based on the part of speech of each second word segment and the class of each second reference feature word, to obtain a labeling sequence of the reference sample text. The specific implementation manner of the labeling sequence for obtaining the reference sample text is the same as the specific implementation manner of the labeling sequence for obtaining the text to be classified in the above description, and the detailed description can be referred to the above description, and will not be repeated here. Correspondingly, after the labeling sequence of the reference sample text is obtained, the labeling sequence of the reference sample text can be subjected to mining class sequence rules, and class sequence rules are obtained.
Further, the determined class sequence rule and the labeling sequence of the reference sample text can be matched, feature words at positions corresponding to the class sequence rule in the labeling sequence of the reference sample text are extracted to form new reference feature words, then each second word is labeled again based on the new reference feature words, the steps of obtaining the labeling sequence of the reference sample text and obtaining the new reference feature words are repeatedly executed, the purpose of iteratively mining the reference feature words is achieved, and therefore all second class feature words contained in each initial sample at present are guaranteed to be contained in the reference feature words.
In the embodiment of the application, mining class sequence rules based on the labeling sequence of the reference sample text comprises:
performing class sequence rule mining on the labeling sequence of the reference sample text by adopting a frequent sequence mode to obtain class sequence rules; wherein the support in the frequent sequence pattern is determined based on the minimum support rate and the number of initial training samples.
In practical application, the labeling sequence of the reference sample text can be mined based on the frequent sequence mode, and the class sequence rule is obtained. For example, a sequence (e.g., "#/n, &/d, &/a" in the above example) that contains both pure combination items with labeling categories is extracted as a class sequence rule. Among them, frequent sequence pattern mining algorithms, prefixspan (Prefix-Projected Pattern Growth, pattern mining of Prefix projections), GSP (Generalized Sequential Pattern mining algorithm, generalized sequence pattern mining algorithm), etc. can be used for CSR mining.
In practical application, when frequent sequence patterns meeting minimum support are mined based on a frequent pattern prefixspan algorithm, considering that the difference of sequence lengths in each sequence pattern is large, if single fixed minimum support is used for mining class sequence rules, the method is not suitable. In particular, the support threshold needs to be lowered to mine the low-frequency sequence, but this introduces a large number of rules generated by the high-frequency words, and thus noise. For this reason, in the embodiment of the present application, the minimum support policy is used to determine the support. The method for calculating the minimum support (min_sup) can be obtained by multiplying the minimum support rate a by the number n of initial training samples, and is specifically shown in the following formula:
the value of a can be determined by a large number of experimental tests, for example, can be set to be between 0.01 and 0.1.
In the embodiment of the application, as higher support is set for each round of mining class sequence rules, the accuracy and recall rate of class sequence rules obtained by mining can be ensured, and then the precision and recall rate of the reference feature words obtained by multiple rounds of iterative mining based on the class sequence rules can be ensured. Furthermore, the class sequence rule has good effect on frequent sequence mining, and can extract characteristic words such as attribute words, emotion words, negative words, degree words and the like according to the labeled word class information.
In an optional embodiment of the present application, when the initial training samples include the second specified word, labeling the classification label of each initial training sample based on the second classification feature word included in each initial training sample, to obtain each labeled training sample, including:
for each initial training sample, merging the second specified word with the corresponding second classification feature word to obtain a merged second classification feature word;
labeling the classification labels of each initial training sample based on the combined second classification feature words to obtain labeled training samples;
training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples, wherein the training comprises the following steps:
and training the initial neural network model based on the labeled training samples and the combined second classification characteristic words corresponding to the samples.
The second instruction word refers to a word affecting the classification result corresponding to the second classification feature word. In an alternative embodiment of the present application, if the initial neural network model is a neural network model for emotion classification, the second specified word may include at least one of a degree word or a negative word that affects the emotion degree of the second classification feature word.
In practical application, if the initial training samples include the second specified words, the second specified words and the corresponding second classification feature words can be combined to obtain combined second classification feature words, classification labels of each initial training sample are marked based on the combined second classification feature words, and each marked training sample is obtained. The specific implementation manner of merging the second specified word with the corresponding second classification feature word to obtain the merged second classification feature word is the same as the specific implementation manner of merging the first specified word with the corresponding first classification feature word to obtain the merged first classification feature word, and the description of this part can be referred to the description in the above and will not be repeated here.
Further, the classification label of each initial training sample may be labeled based on the combined second classification feature words to obtain each labeled training sample (i.e., the classification label of each training sample is the classification label corresponding to the combined second classification feature words), and then the initial neural network model is trained based on each labeled training sample and the combined second classification feature words corresponding to each sample.
In one example, assuming that the second category feature word is an emotion feature word and the second specification word is a negative word, the initial training sample includes "room discomfort" and "price not low". At this time, the initial training sample includes two negative words "no", emotion feature words "comfortable" and "cheap", at this time, the first negative word "no" and "comfortable" may be combined to obtain a first combined second classification feature word "uncomfortable", and the classification label of the combined second classification feature word "uncomfortable" is determined to be "devaluation", and the second negative word "no" and "cheap" are combined to obtain a second combined second classification feature word "not cheap", and the classification label of the combined second classification feature word "not cheap" is determined to be "devaluation". At this time, the classification label of the training sample "uncomfortable in the room" is "detraction", and the classification label of the training sample "low-price" is "detraction".
In an optional embodiment of the present application, when the classification model is a CNN model, the CNN model may include a text feature extraction module, a classification word feature extraction module, a feature fusion module, and a classification module, where:
The text feature extraction module is used for extracting text features of the text to be classified;
the classified word feature extraction module is used for determining first classified feature words of each first target object contained in the text to be classified and extracting word features of each first classified feature word;
the feature fusion module is used for respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object;
and the classification module is used for obtaining a classification result corresponding to the target object based on the combination characteristics corresponding to the first target object for each first target object.
If the classification model is a CNN model, the CNN model may include a text feature extraction module, a classification word feature extraction module, a feature fusion module, and a classification module. In practical application, when classifying is performed based on a CNN model, text features of a text to be classified can be extracted through a text feature extraction module, each first classification feature word of each first target object contained in the text to be classified is determined based on the included classification word feature extraction module, and word features of each first classification feature word are extracted; further, word features of the first classification feature words of the first target objects are respectively spliced with text features based on the feature fusion module to obtain combination features corresponding to the first target objects, and then classification results corresponding to the first target objects can be obtained through the classification module based on the combination features corresponding to the first target objects.
It can be understood that the text feature extraction module and the classifying word feature extraction module included in the CNN model may be two separate modules, or may be one module, or may be two modules with a common partial structure.
In an example, assuming that the current application scene is an emotion classification scene, when the text to be classified is an article fragment, the CNN model includes two feature extraction branches, one branch includes a word embedding module, two levels of convolution structures, namely a convolution layer (Convolution layer) and a Pooling layer (Full Connected layer), which are sequentially cascaded, and two levels of full-connection layers (Full Connected layer), and the other branch includes an emotion word embedding module connected with the word embedding module, at this time, the text feature extraction module is equivalent to the word embedding module sequentially cascaded, and the classification word feature extraction module is equivalent to the emotion word embedding module connected with the word embedding module in the other branch. Correspondingly, the text to be classified, word segmentation processing and first classification feature word detection can be completed in the text feature extraction module, and further, the text feature extraction module performs word embedding on the first classification feature word and then outputs the word embedding to the emotion word embedding module (namely the classification word feature extraction module), and then the emotion word embedding module performs word embedding of the first classification feature word to obtain a word vector of the first classification feature word.
Of course, in practical application, if there is no first classification feature word (such as emotion feature word) in the text to be classified, the processing may end, and at this time, the CNN model outputs corresponding prompt information, and if there are first classification feature words of a plurality of first target objects, the CNN model may output classification results corresponding to each of the first target objects respectively.
In order to better understand the classification method provided by the embodiment of the present application, the classification method provided by the embodiment of the present application is described in detail below in conjunction with an application scenario of text emotion analysis, i.e. emotion classification. In this example, assume that the initial training sample is "this hotel is very close in location, air is particularly good, room is very comfortable, cost performance is very high-! "the reference feature words include the attribute words: room, degree word: very, and emotion words: the method is good; and the minimum confidence is set to 0.1, the reference sample text and the initial training sample are the initial training sample, the hotel is very close to the position, the air is particularly good, the room is comfortable-! ".
A schematic diagram of a training process of a classification model for emotion classification in this example is shown in fig. 2, and as shown in fig. 2, the training process may include the following steps:
Step S201, determining a labeling sequence corresponding to the reference sample text, namely performing word segmentation and labeling on the reference sample text to obtain the labeling sequence corresponding to the reference sample text;
in a specific implementation, sentences may be first segmented from the benchmark sample text with punctuation marks as intervals, so as to obtain each clause included in the benchmark sample text. Each clause obtained at this time is "the hotel is very close to the hotel |air is particularly good|room comfort"; then, each sentence is segmented and part of speech marked, and the word segmentation result after the part of speech marking is obtained, so that 'the/r,/the/u of hotel n, the position/n, the very/d, the near/a, |, the air/n, the special/d, the good/a, |, the room/n, the stiff/d and the comfort/a' can be obtained. Where r represents a pronoun, n represents a noun, u represents a helper word, d represents a degree adverb, and a represents an adjective.
Furthermore, the word segmentation result after the part of speech tagging can be subjected to reference feature word tagging, which specifically comprises the following steps: and determining the feature words which are the same as the reference feature words in each word segment of the reference sample text, and marking the word class of the corresponding positions of the same feature words in the marking sequence according to the word class of the reference feature words. For example, attribute words (i.e., evaluation objects) are marked as "#", emotion words are marked as "×", degree adverbs are marked as "++", negative words are marked as "+| -! The labeling sequence of the obtained reference sample text is "/r,/n,/u,/n, &/d,/a, |,/n,/d,/a, |, #/n,/d,/a".
Step S202, class sequence rule mining and reference feature word mining are carried out, namely class sequence rule mining and reference feature word mining are carried out based on a labeling sequence corresponding to a reference sample text;
further, a class sequence rule can be determined based on the labeling sequence of the obtained reference sample text, and the reference feature words are iteratively mined based on the determined class sequence rule, and the specific flow is shown in fig. 3, and the specific flow is as follows:
step S301, determining word class information, namely determining the word class information as emotion feature word class information;
step S302, determining the minimum support, specifically, determining the minimum support through the minimum support rate and the initial training sample number;
step S303, determining a frequent sequence meeting the support degree, for example, "/n,/d,/a" in a labeling sequence corresponding to the reference sample text can be obtained by mining based on a frequent pattern prefixspan algorithm, wherein the frequent sequence meeting the minimum support degree;
step S304, determining a mining rule, and specifically, extracting the sequence "#/n, &/d, &/a" of the pure combination item containing the labeling word category as the mining rule;
step S305, based on the confidence level, the class sequence rule meeting the requirement is met, specifically, because the minimum confidence level is set to 0.1, at least one identical word class label appears in the label sequence at this time to be used as the class sequence rule for excavation, and the support level and the confidence level requirements of "/n, &/d,/a", "/n,/d,/a", "#/n,/d,/a" in the label sequence meet the excavation rules "#/n, &/d,/a";
Step S306, the class sequence rules are added to the rule base, for example, "/n, &/d,/a", "/n,/d,/a", "#/n,/d,/a" can be used as the class sequence rules and added to the rule base;
step S307, performing iterative mining of the reference feature words based on the class sequence rules.
Wherein, an optional implementation manner of performing iterative mining of the reference feature words based on the class sequence rule obtained by mining comprises the following steps: matching the obtained sequence rules with the labeling sequence of the standard sample text, and extracting feature words at positions corresponding to the sequence rules in the labeling sequence to serve as new standard feature words, wherein the new standard feature words obtained at the moment comprise attribute words: location, air, degree word: in particular, very stiff and affective words: near and comfortable. Then based on the new reference feature words and attribute words: position, degree word: very, affective words: and (3) re-labeling word categories for the labeling sequences corresponding to the basic sample texts, and repeatedly executing the process of mining basic feature words based on the class sequence rules so as to achieve the aim of iteratively mining the basic feature words.
Step S203, a training sample set and a test sample set are constructed;
In practical application, the clause of the class sequence rule contained in the clause included in the initial training sample is taken as an independent sample, if the emotion classification result of the emotion feature word included in the sample is marked in the existing dictionary database, the part of sample is taken as a training sample, at the moment, the emotion classification result of the emotion feature word in each training sample is the classification label of each training sample, and if the emotion classification result of the emotion feature word included in the sample cannot be obtained from the fact that the emotion classification result is not marked in the existing dictionary database, the part of sample is taken as a test sample.
In the embodiment of the application, because the training samples are clauses containing class sequence rules, each training sample of the input classification model can be ensured to at least contain one target object (such as an attribute feature word) and one corresponding classification feature word (such as an emotion feature word), so that each training sample is ensured to have a corresponding classification label, and the training and testing of the classification model can be more standard.
Step S204, training an emotion classification model;
the specific network structure of the emotion classification model is not limited in this application, and may be a classification model based on CNN, and based on each labeled training sample and the emotion feature words corresponding to each training sample, the initial CNN is trained until the corresponding loss function converges, so as to obtain the CNN. Further, the obtained CNN is tested based on the test sample, if the CNN meets the test conditions, the final CNN is obtained, otherwise, the obtained CNN is continuously trained, and the final CNN model can be used for emotion classification.
In the embodiment of the application, when the classification model based on the CNN is adopted to classify the text to be classified, the class sequence rule may be utilized to mine the evaluation element, which may mainly include the object to be evaluated (i.e., the target object) in the text to be classified and the classification feature word of the object to be evaluated (e.g., the emotion feature word in emotion classification), then the CNN may be utilized to extract the text feature related to classification of the text to be classified, and the CNN may also be utilized to extract the word feature of the classified feature word of the mined object to be evaluated, and the CNN may be utilized to splice and combine the text feature and the word feature, and the classification result is obtained based on the combined feature output.
As an example, fig. 4 shows a schematic structural diagram of a CNN provided by an embodiment of the present application, as shown in fig. 4, where the CNN may include two feature extraction branches, one branch includes a word embedding module (word embedding 11 shown in the figure), two-level convolution structures, that is, a convolution layer 12 (Convolution layer) and a Pooling layer 13 (Pooling layer), and two-level full-connection layer 14 (Full Connected layer), and the other branch includes an emotion word embedding module (emotion word embedding 15 shown in the figure) connected to the word embedding module, where after the output of the emotion word embedding module is combined with the output of the last full-connection layer, a classification result is obtained through an output layer (Softmax layer 16 in the present example), where the number of nodes of the output layer is the number of classification labels, that is, the emotion classification category (including three types of sense, neutral and descense); and then splicing the two 100-dimensional information to obtain a 200-dimensional feature combination vector, and inputting the feature combination vector to an Output layer for classification. It should be understood that the output layer in this example is described taking the Softmax layer 16 as an example, in practical application, the output layer may not be limited to the Softmax layer, and any classification layer capable of playing a role in classification may be used as the output layer in this example, for example, the Softmax layer may be replaced by xgboost, etc.
In addition, it should be noted that the network structure given in this example is only one alternative applicable to the solution of the present application, and it is easy for those skilled in the art to think of other available network structures and modifications of various existing network structures, which still fall within the protection scope of the embodiments of the present application. For example, in this example, if the dimensions of the word vectors output by the word embedding module and the emotion word embedding module are the same, the word vector of the emotion feature word extracted by the word embedding module may be directly used for concatenation with the last full-connection layer, and for example, the emotion word embedding module may be replaced by another structure, such as a convolution structure.
Specifically, when the emotion classification is performed on the text to be classified based on the final trained CNN, each clause in the text to be classified can be input into the trained CNN (as shown in fig. 4) as an independent text, a word vector of each segmented word included in the text is extracted by a word embedding module, and after passing through each convolution layer, each pooling layer and a full connection layer, deep features, namely text features, of the text to be classified related to the classification label are obtained. And for the emotion feature words in the text to be classified, after the initial word vector is obtained through the word embedding module, the emotion word vector (namely the word feature of the first classification feature word) with the same dimension as the text feature (particularly in the form of a one-dimensional column vector) output by the last full-connection layer is further extracted through the emotion word embedding module, and then the emotion word vector and the text feature output by the last full-connection layer are spliced and output to the Softmax layer to obtain the emotion classification result of the text to be classified.
In the CNN classification model based on the classification principle provided in the embodiments of the present application, the whole classification model may mainly include the following parts:
some of which mainly include an input layer (word embedding as shown in fig. 4), a convolution layer, a pooling layer, and a full-connection layer, some of which are word feature extraction structures of classification feature words (emotion word embedding as shown in fig. 4), and some of which are feature fusion structures. The input layer is used for converting each word included in the text to be classified into a word vector with a fixed length (i.e. dimension), if the text to be classified includes 7 words, each feature word is converted into a word vector with 50 dimensions, then the output of the output layer can be understood as a matrix with 7 rows and 50 columns, each row of data is a word vector of one word, for the convolution layer, in the classification model, each convolution layer generally uses convolution kernels with different dimensions, the height of the convolution kernel is generally the dimension of the word vector, the width of the convolution kernel represents the number of longitudinal words selected during processing, after the convolution processing of each convolution kernel, each convolution kernel corresponds to obtain a one-dimensional feature map (column vector), then the pooling processing is performed through the pooling layer connected with the convolution layer, and the output of the convolution layer is subjected to downsampling processing, wherein the last pooling layer is usually the largest pooling layer, the largest value in the one-dimensional feature map corresponding to each convolution kernel is selected through the largest pooling layer, the largest value in the one-dimensional feature map is obtained, and the largest value in the one-dimensional feature map is obtained through the largest pooling layer, and then the largest-dimensional feature map is converted into the full-linear feature map (after all-dimensional feature map is connected with the flat layer) and the full-dimensional feature map is obtained through the full-level data. For the classified feature words in the text to be classified, after the word vector is obtained through the word embedding layer, the word vector can be subjected to word feature extraction structure to obtain corresponding word features, for example, the word vector of the feature words can be converted into new word vectors with set dimensions (which are close to or equal to the dimensions of the features output by the full-connection layer of the last level) again through the word embedding mode, then the features output by the last full-connection layer and the word features output by the word feature extraction structure are spliced through the feature fusion structure, and classification decision is made through the Softmax layer to obtain the classification labels of the objects to be classified in the text to be classified.
Specifically, for a sentence to be classified, assuming that the dimension of the output vector of the last full-connection layer is 100 dimensions, the dimension of the word vector output by the emotion embedding module is 100 dimensions, then splicing the two 100-dimension information to obtain a 200-dimension feature combination vector, and inputting the feature combination vector to the output layer (namely, softmax layer) for classification to obtain an emotion classification result corresponding to a target object in the sentence. For example, suppose that a sentence requiring emotion classification is "this hotel is located very close-! And if yes, the attribute word (namely the target object) in the sentence is 'position', the corresponding emotion feature word is 'very close', and the emotion classification result corresponding to the 'position' can be obtained through the output of the trained classification model to be positive.
In addition, as another alternative, after the word vector of each word segment is obtained through the word embedding layer, the word vector corresponding to the object to be classified (which may be determined when the classification feature word of each target object is determined, for example, when the classification feature word of the target object is determined through the class sequence rule) may be spliced with the word vector of each word segment, and each spliced word vector is used as the word vector of each word segment and then input into the convolution layer, so as to better guide the extraction of the text feature of each subsequent structure.
In the embodiment of the application, the CNN is utilized to extract the text features related to the classification result to be classified, and the information related to attribute emotion classification can be better mined through the spliced combined features, so that the accuracy of the text features is improved, the requirements of a classifier are reduced, and the classification effect is improved.
It can be understood that, the classification method provided by the embodiment of the application is also applicable to other application scenarios in which the combined feature vector is constructed by combining the class sequence rule with the CNN and classification is performed based on the combined feature vector, that is, the method of sequence labeling by combining the class sequence rule and deep cross feature construction by CNN mining is within the protection scope of the application.
An embodiment of the present application provides a classification device, as shown in fig. 5, the classification device 60 may include: a classification feature word determining module 601, a feature extracting module 602, a feature fusion module 603 and a classification result determining module 604, wherein,
the classification feature word determining module 601 is configured to determine a first classification feature word of each first target object included in the text to be classified;
the feature extraction module 602 is configured to extract text features of the text to be classified and word features of each first classification feature word;
The feature fusion module 603 is configured to splice word features of the first classification feature words of each first target object with text features, respectively, to obtain combined features corresponding to each first target object;
the classification result determining module 604 obtains, for each first target object, a classification result corresponding to the first target object based on the combination feature corresponding to the first target object.
The optional embodiment of the application is characterized in that, when determining the first classification feature words of each first target object in the text to be classified, the classification feature word determining module is specifically configured to:
determining first classification feature words of each first target object in the text to be classified based on the class sequence rule;
the class sequence rule is determined based on a labeling sequence in the benchmark sample text, and the labeling sequence characterizes the part of speech and the class of words of each benchmark feature word contained in the benchmark sample text.
In an optional embodiment of the present application, when determining the first classification feature word of each first target object in the text to be classified based on the class sequence rule, the classification feature word determining module is specifically configured to:
determining reference feature words contained in each first segmentation word;
labeling the text to be classified based on the part of speech of each first word and the part of speech of each reference feature word to obtain a labeling sequence of the text to be classified;
And determining each first classification characteristic word based on the class sequence rule and the labeling sequence of the text to be classified.
In an optional embodiment of the present application, when a specified type of word exists in the text to be classified, the feature extraction module is specifically configured to:
combining the specified type words with the corresponding first classification feature words to obtain combined first classification feature words, wherein the specified type words are words affecting classification results corresponding to the first classification feature words;
and extracting word features of the combined first classification feature words as word features of the first classification feature words.
In an optional embodiment of the present application, the classification feature word determining module, the feature extracting module and the classification result determining module are included in a classification model, the classification model is obtained through a model training module, and the model training module is specifically configured to:
acquiring each initial training sample;
determining second classification feature words of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on the second classification feature words contained in each initial training sample, and obtaining each labeled training sample;
Based on the labeled training samples and the second classification feature words corresponding to the training samples, training the initial neural network model until the corresponding loss function converges, wherein the value of the loss function characterizes the difference between the classification result of the training samples output by the model and the classification result corresponding to the classification label.
In an optional embodiment of the present application, the model training module is specifically configured to, when determining the second classification feature word of the second target object included in each initial training sample:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
based on the class sequence rules, a second class feature word of a second target object contained in each initial training sample is determined.
In an optional embodiment of the present application, the reference sample text is a sentence, and the model training module is specifically configured to:
word segmentation processing is carried out on the reference sample text to obtain second words;
determining reference feature words contained in each second segmentation word;
labeling the reference sample text based on the part of speech of each second word and the part of speech of each reference feature word to obtain a labeling sequence of the reference sample text;
Class sequence rules are mined based on the labeling sequence of the reference sample text.
In an optional embodiment of the present application, when the model training module mines a class sequence rule based on a labeling sequence of a reference sample text, the model training module is specifically configured to:
and carrying out class sequence rule mining on the labeling sequence of the reference sample text by adopting a frequent sequence mode to obtain class sequence rules, wherein the support degree in the frequent sequence mode is determined based on the minimum support rate and the number of initial training samples.
In an optional embodiment of the present application, when the initial training samples include a specified type word, the model training module is specifically configured to, when labeling a classification label of each initial training sample based on a second classification feature word included in each initial training sample, obtain each labeled training sample:
for each initial training sample, merging the appointed type words with the corresponding second classification feature words to obtain merged second classification feature words;
labeling the classification labels of each initial training sample based on the combined second classification feature words to obtain labeled training samples;
the model training module is specifically used for training the initial neural network model based on each labeled training sample and the second classification feature words corresponding to each sample:
And training the initial neural network model based on the labeled training samples and the combined second classification characteristic words corresponding to the training samples.
In an optional embodiment of the present application, the classification model is a CNN model, where the CNN model includes a text feature extraction module, a classification word feature extraction module, a feature fusion module, and a classification module, where:
the text feature extraction module is used for extracting text features of the text to be classified;
the classified word feature extraction module is used for determining first classified feature words of each first target object contained in the text to be classified and extracting word features of each first classified feature word;
the feature fusion module is used for respectively splicing word features of the first classification feature words of each first target object with text features to obtain combination features corresponding to each first target object;
and the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristics corresponding to the first target object for each first target object.
In an alternative embodiment of the present application, the classification model is an emotion classification model, and the first classification feature word and the second classification feature word are emotion feature words.
In an optional embodiment of the present application, when the word feature of the first classification feature word is extracted based on the first classification feature word obtained by combining the classification feature word with the corresponding specified type word, the specified type word includes at least one of a degree word or a negative word that affects the emotion degree of the first classification feature word.
The classification device in the embodiment of the present application may perform a classification method provided in the embodiment of the present application, and its implementation principle is similar, and will not be described herein again.
An embodiment of the present application provides an electronic device, as shown in fig. 6, an electronic device 2000 shown in fig. 6 includes: a processor 2001 and a memory 2003. The processor 2001 is coupled to a memory 2003, such as via a bus 2002. Optionally, the electronic device 2000 may also include a transceiver 2004. It should be noted that, in practical applications, the transceiver 2004 is not limited to one, and the structure of the electronic device 2000 is not limited to the embodiments of the present application.
The processor 2001 is applied to the embodiment of the present application, and is configured to implement the functions of each module shown in fig. 5.
The processor 2001 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 2002 may include a path to transfer information between the components. Bus 2002 may be a PCI bus, an EISA bus, or the like. The bus 2002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 6, but not only one bus or one type of bus.
The memory 2003 may be a ROM or other type of static storage device that can store static information and computer programs, a RAM or other type of dynamic storage device that can store information and computer programs, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disks, laser disks, optical disks, digital versatile disks, blu-ray disks, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store a desired computer program in the form of a data structure and that can be accessed by a computer, but is not limited to such.
The memory 2003 is used for storing a computer program for executing an application program of the present application, and execution is controlled by the processor 2001. The processor 2001 is arranged to execute a computer program of an application program stored in the memory 2003 for implementing the actions of the sorting device provided by the embodiment shown in fig. 5.
The embodiment of the application provides electronic equipment, which comprises: a processor; and a memory configured to store a machine computer program that, when executed by the processor, causes the processor to perform the classification method.
Embodiments of the present application provide a computer-readable storage medium on which a computer program is stored, which when run on a computer, enables the computer to perform a classification method.
The terms and implementation principles of a computer readable storage medium in the present application may refer to a classification method in the embodiments of the present application, which is not described herein.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for a person skilled in the art, several improvements and modifications can be made without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (14)

1. A method of classification, comprising:
determining first classification feature words of each first target object contained in the text to be classified;
extracting text features of the text to be classified and word features of the first classification feature words;
word features of the first classification feature words of the first target objects are spliced with the text features respectively to obtain combination features corresponding to the first target objects;
for each first target object, based on the combination characteristics corresponding to the first target object, obtaining a classification result corresponding to the first target object;
the text to be classified is a sentence, and the extracting the text characteristics of the text to be classified includes:
performing word segmentation processing on the text to be classified, and extracting word vectors of first words in the text to be classified, wherein the first words comprise words of the first target object;
Respectively splicing the word vector of each first word segment in the text to be classified with the word vector of the first target object to obtain a spliced vector corresponding to each first word segment;
and extracting the text characteristics of the text to be classified based on the splicing vectors corresponding to the first segmentation words.
2. The method of claim 1, wherein determining the first classification feature words of each first target object included in the text to be classified comprises:
determining first classification feature words of each first target object in the text to be classified based on the class sequence rule;
the class sequence rule is determined based on a labeling sequence in the benchmark sample text, and the labeling sequence characterizes the part of speech and the class of words of each benchmark feature word contained in the benchmark sample text.
3. The method according to claim 2, wherein determining the first classification feature words of each first target object in the text to be classified based on the class sequence rule comprises:
determining reference feature words contained in each first segmentation word;
labeling the text to be classified based on the part of speech of each first word and the part of speech of each reference feature word to obtain a labeling sequence of the text to be classified;
And determining each first classification characteristic word based on the class sequence rule and the labeling sequence of the text to be classified.
4. The method of claim 1, wherein extracting word features of the first classification feature word when there is a specified type of word in the text to be classified, comprises:
combining the specified type words with the corresponding first classification feature words to obtain combined first classification feature words, wherein the specified type words are words affecting classification results corresponding to the first classification feature words;
extracting word features of the combined first classification feature words as the word features of the first classification feature words.
5. The method according to any one of claims 1 to 4, characterized in that the method is implemented by a classification model, wherein the classification model is trained by:
acquiring each initial training sample;
determining second classification feature words of a second target object contained in each initial training sample;
labeling a classification label of each initial training sample based on second classification feature words contained in each initial training sample, and obtaining labeled training samples;
Based on the labeled training samples and the second classification feature words corresponding to the training samples, training the initial neural network model until the corresponding loss function converges, wherein the value of the loss function characterizes the difference between the classification result of the training samples output by the model and the classification result corresponding to the classification label.
6. The method of claim 5, wherein said determining a second class feature word for a second target object included in each of said initial training samples comprises:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
and determining second classification characteristic words of second target objects contained in the initial training samples based on the class sequence rules.
7. The method of claim 6, wherein the benchmark sample text is a sentence, and wherein the determining class sequence rules based on the benchmark sample text comprises:
word segmentation processing is carried out on the reference sample text to obtain second words;
determining reference feature words contained in each second segmentation word;
labeling the reference sample text based on the part of speech of each second word and the part of speech of each reference feature word to obtain a labeling sequence of the reference sample text;
And mining the class sequence rule based on the labeling sequence of the reference sample text.
8. The method of claim 7, wherein mining the class sequence rule based on the annotation sequence of the benchmark sample text comprises:
and carrying out class sequence rule mining on the labeling sequence of the reference sample text by adopting a frequent sequence mode to obtain the class sequence rule, wherein the support degree in the frequent sequence mode is determined based on the minimum support rate and the number of initial training samples.
9. The method according to claim 5, wherein when the initial training samples include the specified type of words, the labeling the classification label of each initial training sample based on the second classification feature words included in each initial training sample, and obtaining each labeled training sample includes:
for each initial training sample, merging the appointed type words with the corresponding second classification feature words to obtain merged second classification feature words;
labeling the classification labels of each initial training sample based on the combined second classification feature words to obtain labeled training samples;
Training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples, including:
and training the initial neural network model based on the marked training samples and the combined second classification feature words corresponding to the training samples.
10. The method of claim 5, wherein the classification model is a convolutional neural network CNN model, the CNN model comprising a text feature extraction module, a classified word feature extraction module, a feature fusion module, and a classification module, wherein:
the text feature extraction module is used for extracting text features of the text to be classified;
the classified word feature extraction module is used for determining first classified feature words of each first target object contained in the text to be classified and extracting word features of each first classified feature word;
the feature fusion module is used for respectively splicing word features of the first classification feature words of the first target objects with the text features to obtain combination features corresponding to the first target objects;
and the classification module is used for obtaining a classification result corresponding to each first target object based on the combination characteristics corresponding to the first target object.
11. The method of claim 5, wherein the classification model is an emotion classification model and the first classification feature word and the second classification feature word are emotion feature words;
when the word features of the first classification feature words are extracted based on the first classification feature words obtained by combining the first classification feature words with the corresponding specified type words, the specified type words comprise at least one of degree words or negative words affecting the emotion degree of the first classification feature words.
12. A sorting apparatus, comprising:
the classification feature word determining module is used for determining first classification feature words of each first target object contained in the text to be classified;
the feature extraction module is used for extracting text features of the text to be classified and word features of the first classification feature words;
the feature fusion module is used for respectively splicing word features of the first classification feature words of the first target objects with the text features to obtain combination features corresponding to the first target objects;
the classification result determining module is used for obtaining a classification result corresponding to each first target object based on the combination characteristics corresponding to the first target object;
The feature extraction module is specifically used for:
performing word segmentation processing on the text to be classified, and extracting word vectors of first words in the text to be classified, wherein the first words comprise words of the first target object;
respectively splicing the word vector of each first word segment in the text to be classified with the word vector of the first target object to obtain a spliced vector corresponding to each first word segment;
and extracting the text characteristics of the text to be classified based on the splicing vectors corresponding to the first segmentation words.
13. An electronic device comprising a processor and a memory:
the memory is configured to store a computer program which, when executed by the processor, causes the processor to perform the method of any of claims 1-11.
14. A computer readable storage medium, characterized in that the computer storage medium is adapted to store a computer program which, when run on a computer, enables the computer to perform the method of any of the preceding claims 1-11.
CN201911420328.8A 2019-12-31 2019-12-31 Classification method, classification device, electronic equipment and readable storage medium Active CN111159412B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911420328.8A CN111159412B (en) 2019-12-31 2019-12-31 Classification method, classification device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911420328.8A CN111159412B (en) 2019-12-31 2019-12-31 Classification method, classification device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111159412A CN111159412A (en) 2020-05-15
CN111159412B true CN111159412B (en) 2023-05-12

Family

ID=70560407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911420328.8A Active CN111159412B (en) 2019-12-31 2019-12-31 Classification method, classification device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111159412B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111382959B (en) * 2020-05-29 2020-09-01 双胞胎(集团)股份有限公司 Progress control method based on data queue and pig feed production method
CN111813932B (en) * 2020-06-17 2023-11-14 北京小米松果电子有限公司 Text data processing method, text data classifying device and readable storage medium
CN112083806B (en) * 2020-09-16 2021-10-26 华南理工大学 Self-learning emotion interaction method based on multi-modal recognition
CN112487143B (en) * 2020-11-30 2022-11-18 重庆邮电大学 Public opinion big data analysis-based multi-label text classification method
CN112860887B (en) * 2021-01-18 2023-09-05 北京奇艺世纪科技有限公司 Text labeling method and device
CN112860905A (en) * 2021-04-08 2021-05-28 深圳壹账通智能科技有限公司 Text information extraction method, device and equipment and readable storage medium
CN114491040B (en) * 2022-01-28 2022-12-02 北京百度网讯科技有限公司 Information mining method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106557463A (en) * 2016-10-31 2017-04-05 东软集团股份有限公司 Sentiment analysis method and device
CN107193801A (en) * 2017-05-21 2017-09-22 北京工业大学 A kind of short text characteristic optimization and sentiment analysis method based on depth belief network
CN108647205A (en) * 2018-05-02 2018-10-12 深圳前海微众银行股份有限公司 Fine granularity sentiment analysis model building method, equipment and readable storage medium storing program for executing
CN109472018A (en) * 2018-09-26 2019-03-15 深圳壹账通智能科技有限公司 Enterprise's public sentiment monitoring method, device, computer equipment and storage medium
CN110059927A (en) * 2019-03-18 2019-07-26 平安科技(深圳)有限公司 Assessment method, device, equipment and storage medium on performance line
CN110209805A (en) * 2018-04-26 2019-09-06 腾讯科技(深圳)有限公司 File classification method, device, storage medium and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
NO316480B1 (en) * 2001-11-15 2004-01-26 Forinnova As Method and system for textual examination and discovery

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106557463A (en) * 2016-10-31 2017-04-05 东软集团股份有限公司 Sentiment analysis method and device
CN107193801A (en) * 2017-05-21 2017-09-22 北京工业大学 A kind of short text characteristic optimization and sentiment analysis method based on depth belief network
CN110209805A (en) * 2018-04-26 2019-09-06 腾讯科技(深圳)有限公司 File classification method, device, storage medium and computer equipment
CN108647205A (en) * 2018-05-02 2018-10-12 深圳前海微众银行股份有限公司 Fine granularity sentiment analysis model building method, equipment and readable storage medium storing program for executing
CN109472018A (en) * 2018-09-26 2019-03-15 深圳壹账通智能科技有限公司 Enterprise's public sentiment monitoring method, device, computer equipment and storage medium
CN110059927A (en) * 2019-03-18 2019-07-26 平安科技(深圳)有限公司 Assessment method, device, equipment and storage medium on performance line

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Wei Zhang et al..Does government information release really matter in regulating contagion-evolution of negative emotion during public emergencies? From the perspective of cognitive big data analytics.《International Journal of Information Management》.2019,498-514. *
邢昌帅.大规模网络文本的细粒度情感分析技术研究.《中国优秀硕士学位论文全文数据库 信息科技辑》.2019,I138-1840. *

Also Published As

Publication number Publication date
CN111159412A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN111159412B (en) Classification method, classification device, electronic equipment and readable storage medium
CN112115700B (en) Aspect-level emotion analysis method based on dependency syntax tree and deep learning
CN112287670A (en) Text error correction method, system, computer device and readable storage medium
CN110321563B (en) Text emotion analysis method based on hybrid supervision model
JP2010250814A (en) Part-of-speech tagging system, training device and method of part-of-speech tagging model
CN108664512B (en) Text object classification method and device
CN113076739A (en) Method and system for realizing cross-domain Chinese text error correction
CN112100377B (en) Text classification method, apparatus, computer device and storage medium
CN112559734B (en) Brief report generating method, brief report generating device, electronic equipment and computer readable storage medium
CN111339260A (en) BERT and QA thought-based fine-grained emotion analysis method
CN112163092B (en) Entity and relation extraction method, system, device and medium
CN117076653A (en) Knowledge base question-answering method based on thinking chain and visual lifting context learning
US20200364216A1 (en) Method, apparatus and storage medium for updating model parameter
CN113761868B (en) Text processing method, text processing device, electronic equipment and readable storage medium
CN108875743B (en) Text recognition method and device
CN112287100A (en) Text recognition method, spelling error correction method and voice recognition method
CN110489559A (en) A kind of file classification method, device and storage medium
CN111611393A (en) Text classification method, device and equipment
CN112101042A (en) Text emotion recognition method and device, terminal device and storage medium
CN114722832A (en) Abstract extraction method, device, equipment and storage medium
CN117370736A (en) Fine granularity emotion recognition method, electronic equipment and storage medium
CN110210033B (en) Chinese basic chapter unit identification method based on main bit theory
JP6426074B2 (en) Related document search device, model creation device, method and program thereof
CN110874408B (en) Model training method, text recognition device and computing equipment
Jung et al. Improving visual relationship detection using linguistic and spatial cues

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant