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

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

Info

Publication number
CN111159412A
CN111159412A CN201911420328.8A CN201911420328A CN111159412A CN 111159412 A CN111159412 A CN 111159412A CN 201911420328 A CN201911420328 A CN 201911420328A CN 111159412 A CN111159412 A CN 111159412A
Authority
CN
China
Prior art keywords
word
classification
text
feature
words
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.)
Granted
Application number
CN201911420328.8A
Other languages
Chinese (zh)
Other versions
CN111159412B (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 characteristic 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 splicing the word features of the first classification feature words of the first target objects with the text features to obtain combined features corresponding to the first target objects, and obtaining classification results corresponding to the first target objects based on the combined 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 features obtained after the text features and the word features are spliced during classification, and compared with the method for determining the classification result based on the text features of the text to be classified, the information of the classification result can be better mined, the accuracy of feature extraction is improved, and the classification effect is improved.

Description

Classification method and 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, an apparatus, an electronic device, and a readable storage medium.
Background
Text Classification (Text Classification) refers to automatic Classification and marking of texts according to a certain Classification system or standard. As a classic natural language processing task, the text classification technology has been widely applied to various scenes such as emotion analysis and user comment mining. With the improvement of application requirements, the classification granularity is more and more refined, and with emotion analysis as an example, fine-grained emotion analysis, also called attribute-level emotion analysis, belongs to text emotion analysis, and is to mine emotion attributes of an evaluation object in a more specific dimension, so that an analysis result has more reference significance and value, and the method is widely applied to the fields of e-commerce platforms, news recommendation, social platforms and the like.
In the prior art, text classification usually refers to labeling evaluation elements manually on training samples, then performing classification model training on the labeled training samples, and determining a final classification result on the basis of the trained classification model. However, in practical application, the extraction effect of the current classification model on the extraction of the evaluation elements is not ideal, so that the accuracy of the text classification result is to be improved.
Disclosure of Invention
The application aims to provide a classification method, a classification device, an electronic device and a readable storage medium, so as to improve the accuracy of a text classification result.
In a first aspect, an embodiment of the present application provides a classification method, where the method includes:
determining first classification characteristic 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;
splicing the word characteristics of the first classification characteristic words of the first target objects with the text characteristics respectively to obtain the combination characteristics corresponding to the first target objects;
and for each first target object, based on the combined features corresponding to the first target object, the classification result corresponding to the first target object.
In an optional embodiment of the first aspect, the extracting text features of the text to be classified, where the text to be classified is a sentence, includes:
performing word segmentation 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 a first target object;
splicing the word vector of each first word segmentation in the text to be classified with the word vector of the first target object respectively to obtain a spliced vector corresponding to each first word segmentation;
and extracting the text features of the text to be classified based on the splicing vectors corresponding to the first participles.
In an embodiment of the first aspect, determining a first classification feature word of each first target object in a text to be classified includes:
determining a first classification characteristic word of each first target object in the text to be classified based on a Class Sequential Rule (CSR);
the class sequence rule is determined based on a labeling sequence in the reference sample text, and the labeling sequence represents the part of speech and the word category of each reference characteristic word contained in the reference sample text.
In an embodiment of the first aspect, determining, based on a class sequence rule, a first classification feature word of each first target object in a text to be classified includes:
determining reference characteristic 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 word class of each reference characteristic 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 embodiment optional in the first aspect, when there is a specified type of word in the text to be classified, extracting word features of the first classification feature word includes:
combining the specified type words and the corresponding first classification characteristic words to obtain combined first classification characteristic words, wherein the specified type words are words affecting classification results corresponding to the first classification characteristic words;
and extracting the word features of the merged first classification feature words as the 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:
obtaining each initial training sample;
determining a second classification characteristic word of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on a second classification feature word contained in each initial training sample to obtain each labeled training sample;
and training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the training samples until the corresponding loss functions are converged, wherein the values of the loss functions represent the difference between the classification results of the training samples output by the model and the classification results corresponding to the classification labels.
In an optional embodiment of the first aspect, the determining, by the reference sample text being a sentence, a second classification feature word of a 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;
and determining a second classification characteristic word of a second target object contained in each initial training sample based on the class sequence rule.
In an optional embodiment of the first aspect, determining the class sequence rule based on the reference sample text includes:
performing word segmentation processing on the reference sample text to obtain second words;
determining the reference characteristic words contained in each second participle;
labeling the reference sample text based on the part of speech of each second participle and the word category of each reference characteristic word to obtain a labeling sequence of the reference sample text;
and mining class sequence rules based on the labeling sequence of the reference sample text.
In an optional embodiment of the first aspect, mining class sequence rules based on the labeled sequence of the reference sample text includes:
and mining a class sequence rule of 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.
In an embodiment of the first aspect, when the initial training samples include the specified type word, based on the second classification feature word included in each initial training sample, the method for obtaining the labeled training samples includes:
for each initial training sample, combining the specified type word with the corresponding second classification characteristic word to obtain a combined second classification characteristic word;
labeling the classification label of each initial training sample based on the combined second classification feature words to obtain each labeled training sample;
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 feature words corresponding to the training samples.
In an optional embodiment of the first aspect, the classification model is a Convolutional Neural Network (CNN) model, and 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 all first target objects contained in the text to be classified and extracting word features of all the first classified feature words;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristic corresponding to the first target object for each first target object.
In an optional 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 embodiment of the first aspect, when the word feature of the first classification feature word is extracted based on the first classification feature word obtained by combining 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 negation word that affects an emotional degree of the first classification feature word.
In a second aspect, an embodiment of the present application provides a classification apparatus, including:
the classification characteristic word determining module is used for determining a first classification characteristic word of each first target object contained in the text to be classified;
the characteristic extraction module is used for extracting text characteristics of the text to be classified and word characteristics of each first classification characteristic word;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification result determining module is used for obtaining a classification result corresponding to the first target object based on the combination characteristic corresponding to the first target object for each first target object.
In an embodiment of the second aspect, in which the text to be classified is a sentence, the feature extraction module is specifically configured to, when extracting the text feature of the text to be classified:
performing word segmentation 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 a first target object;
splicing the word vector of each first word segmentation in the text to be classified with the word vector of the first target object respectively to obtain a spliced vector corresponding to each first word segmentation;
and extracting the text features of the text to be classified based on the splicing vectors corresponding to the first participles.
In an embodiment of the second aspect, when determining the first classification feature word of each first target object in the text to be classified, the classification feature word determining module is specifically configured to:
determining a first classification characteristic word of each first target object in the text to be classified based on a class sequence rule;
the class sequence rule is determined based on a labeling sequence in the reference sample text, and the labeling sequence represents the part of speech and the word category of each reference characteristic word contained in the reference sample text.
In an embodiment of the second optional aspect, when determining, based on the class sequence rule, the first classification feature word of the first target object in each text to be classified, the classification feature word determining module is specifically configured to:
determining reference characteristic 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 word class of each reference characteristic 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 embodiment of the second optional aspect, when the specified type word exists in the text to be classified, the feature extraction module is specifically configured to:
merging the appointed type words and the corresponding first classification characteristic words to obtain merged first classification characteristic words, wherein the first appointed words are words influencing classification results corresponding to the first classification characteristic words;
and extracting the word features of the merged first classification feature words as the word features of the first classification feature words.
In an 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, the classification model is obtained through a model training module, and the model training module is specifically configured to:
obtaining each initial training sample;
determining a second classification characteristic word of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on a second classification feature word contained in each initial training sample to obtain each labeled training sample;
and training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the training samples until the corresponding loss functions are converged, wherein the values of the loss functions represent the difference between the classification results of the training samples output by the model and the classification results corresponding to the classification labels.
In an embodiment of the second aspect, when determining the second classification feature word of the second target object included in each initial training sample, the model training module is specifically configured to:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
and determining a second classification characteristic word of a second target object contained in each initial training sample based on the class sequence rule.
In an embodiment that is optional in 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:
performing word segmentation processing on the reference sample text to obtain second words;
determining the reference characteristic words contained in each second participle;
labeling the reference sample text based on the part of speech of each second participle and the word category of each reference characteristic word to obtain a labeling sequence of the reference sample text;
and mining class sequence rules based on the labeling sequence of the reference sample text.
In an embodiment of the second aspect, when mining a class sequence rule based on a labeling sequence of a reference sample text, the model training module is specifically configured to:
and mining a class sequence rule of 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.
In an embodiment of the second aspect, when the initial training samples include the specified type word, the model training module is specifically configured to, when obtaining each labeled training sample, label the classification label of each initial training sample based on the second classification feature word included in each initial training sample, and:
for each initial training sample, combining the specified type with the corresponding second classification feature word to obtain a combined second classification feature word;
labeling the classification label of each initial training sample based on the combined second classification feature words to obtain each labeled training sample;
the model training module is specifically configured to, when training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples:
and training the initial neural network model based on the labeled training samples and the combined second classification feature words corresponding to the training samples.
In an optional embodiment of the second aspect, the classification model is a CNN model, and 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 fusing the word features of the text features and the first classified feature words for each first classified feature word to obtain fused features;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristic 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 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 the corresponding specified type word, the specified type word includes at least one of a degree word or a negation 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 that, when executed by the processor, causes the processor to perform the method of any one of the first aspects.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium for storing a computer program, which, when run on a computer, enables the computer to perform the method of any one of the above first aspects.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
in the embodiment of the application, when the classification result corresponding to the text to be classified is determined, the text features in the text to be classified and the word features of the first classification feature words can be extracted, and then the final classification result is determined based on the combined features obtained by splicing the text features and the word features. Correspondingly, because the word features of the first classification feature words are fused in the classification process, compared with the method for determining the classification result only 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, 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 used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of a classification method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a process for training a classification model according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of an iterative mining method for reference feature words according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram of a network structure of a CNN according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a sorting apparatus 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
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining 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 the context clearly indicates otherwise. 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. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
Machine Learning (ML) is a multi-domain cross discipline, and relates to a plurality of disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and the like. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and formal education learning.
The scheme provided by the embodiment of the application relates to the technologies such as machine learning of artificial intelligence, and the like, and is specifically explained by the following embodiment.
As the requirements of text classification applications increase, the granularity of text classification also becomes finer and finer.
In the fine-grained text analysis technology, firstly, evaluation element extraction is carried out, namely, evaluation elements are mined from a text, the evaluation elements usually comprise evaluation objects and evaluation words, for example, in emotion analysis, for a text with 'good service …', the evaluation elements needing to be extracted comprise 'service' and 'good' …, wherein the 'service' is the evaluation object, and the 'good' is the evaluation word, and then emotion scoring is carried out on the evaluation objects based on the extracted evaluation elements. However, the existing evaluation element extraction schemes are not ideal in extraction effect, so that the accuracy of the text classification result is to be improved.
Currently, in the fine-grained text analysis technology, there are two main methods for extracting evaluation elements: one is to extract fine-grained evaluation elements based on a dictionary and a template; and the other method is to convert the excavation and extraction of fine-grained elements into a sequence labeling problem, and extract evaluation elements by adopting a sequence labeling method based on a conditional random field, a hidden Markov model and the like. However, the dictionary and template-based element extraction method has poor expansibility and generalization capability, cannot identify network new words and field new words, and thus results in incomplete extracted evaluation elements, while the sequence labeling-based element extraction method cannot solve the problem of long-distance dependence between the evaluation words and evaluation objects, and thus has poor extraction effect.
Based on this, the embodiments of the present application provide 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 to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated 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 also applicable to application scenarios of other text classifications.
Fig. 1 shows a schematic 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 first classification characteristic words of each first target object contained in the text to be classified.
The text to be classified is a text whose text content needs to be classified, and the specific form of the text to be classified is not limited in the embodiment of the present application, and may be, for example, a section of an article with multiple clauses or a single sentence, that is, the granularity of the text is not limited in the embodiment of the present application, and may be configured according to the actual application needs. As an optional mode, the text to be classified may be a sentence, and when an article or a text fragment needs to be classified, the article or the text fragment may be subjected to clause processing, and each clause after processing is taken as a text to be classified.
The target object refers to an object to be evaluated in the text to be classified, the classification feature words refer to words which are related to classification categories and can affect the classification result of the object to be evaluated, the words are feature words of specified categories contained in the text to be classified, and the categories of the classification feature words are different for different classification application scenes.
For example, if the classification application scenario is emotion classification, the classification feature words are emotion feature words. As an example, assuming that the text to be classified is "good service", the target object in the text to be classified is "service", and the classification characteristic word of the target object is "good".
It can be understood that, in practical applications, there may also be a case where a plurality of first target objects and corresponding first classification feature words exist in the text to be classified, where the determined first classification feature words of the first target objects are the first classification feature words of each first target object included in the text to be classified. In one example, assuming the classification scenario is an emotion classification, the text to be classified is "where rooms are 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 a room and a cost performance, the two first classification feature words corresponding to the two first target objects are respectively a good word and a high word, at this time, it can be determined that the first classification feature word of one first target object is a good word, and the first classification feature word of the other first target object is a high word.
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 texts to be classified. In the embodiment of the present application, the text feature and the Word feature may be extracted through a feature extraction network, such as a convolution network, if not limited, and the Word feature may be a corresponding Word vector and obtained by using a Word2vec (Word vector) model, for example.
In practical application, the text to be classified may be a sentence or an article or a text segment, if the text is an article or a text segment, the sentence division processing may be performed on the article or the text segment, at this time, a sentence in which the first target object and/or the first classification characteristic word does not exist may possibly exist, and for this type of sentence, because the object to be evaluated does not exist or the classification characteristic word of the object to be evaluated does not exist, the sentence may not be processed, that is, the sentence may be skipped, and the next sentence may be processed.
In one example, assume that the retrieved text to be classified is "hello, the context of this hotel is excellent! The text to be classified acquired at this time includes two clauses, namely "hello" and "the hotel environment is very good", wherein the clause "hello" does not have the object to be evaluated and the classification characteristic word of the object to be evaluated, and at this time, the next clause may be processed without processing the clause "hello".
In the embodiment of the application, when the text to be classified does not have the object to be evaluated or the classification characteristic words of the object to be evaluated do not exist, the process of extracting the text characteristics is not executed, so that compared with a mode of extracting the text characteristics of all the texts to be classified without considering the factors of the text to be classified, resources can be effectively saved, and the classification efficiency is improved.
It is understood that, in practical applications, there may be a case where a plurality of first target objects and corresponding first classification feature words exist in one sentence, and in this case, when extracting the word features of the first classification feature words, the word features of each included first classification feature word may be extracted separately.
In one example, assume that the text to be classified is "where rooms are very cost effective! "at this time, there are two first target objects and corresponding first classification feature words in the text to be classified, which are" room "and" good ", and" cost performance "and" high ", respectively; 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, splicing the word characteristics of the first classification characteristic words of the first target objects with the text characteristics respectively to obtain the combination characteristics corresponding to the first target objects;
in practical application, after the first classification feature words of the first target objects included in the text to be classified and the text features of the text to be classified are determined, for each target object, the first classification feature words corresponding to the target object and the text features of the text to be classified can be spliced, so that the combination features corresponding to each first target object are obtained. That is, the finally determined combination features are respectively in one-to-one correspondence with the first target objects.
In one example, assume that the text to be classified is "where rooms are very cost effective! "at this time, there are two first target objects and corresponding first classification feature words in the text to be classified, which are" room "and" good ", and" cost performance "and" high ", respectively; further, text features of the text to be classified can be extracted, and word features of a first classification feature word 'good' and a first classification feature word 'high' are respectively extracted; further, for the first target object "room", the word feature of the first classification feature word "good" may be spliced with the text feature of the text to be classified to obtain a combined feature corresponding to the first target object "room"; for the cost performance of the first target object, the word features of the first classification feature word "high" and the text features of the text to be classified may be spliced to obtain the combination features corresponding to the cost performance of the first target object.
Optionally, in this embodiment of the application, a difference between the feature length of the word feature of each first classification feature word and the feature length of the text feature is smaller than a set value.
The feature length may refer to dimensions of the word feature and the text feature in this example, and a specific value of the setting value may be configured in advance, which is not limited in the embodiment of the present application. Optionally, in this embodiment of the application, for each first classification characteristic word, a difference between a characteristic length of a corresponding word characteristic of the first classification characteristic word and a characteristic length of a text characteristic of the first classification characteristic word is smaller than a set value, that is, the word characteristic length of each first classification characteristic word is similar to the characteristic length of the word characteristic of the first classification characteristic word. It is to be understood that, if it is currently desired that the feature length of the word feature of the first classification feature word is the same as the feature length of the text feature, the setting 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 two feature lengths is 0.
In the embodiment of the application, because the difference value between the characteristic length of the word characteristic of the first classification characteristic word and the characteristic length of the word characteristic of the first classification characteristic word is smaller than the set value, that is, the characteristic lengths between the two are similar, it can be effectively avoided that one of the word characteristics plays no role or plays no obvious role in the classification process because the characteristic length is shorter, and the accuracy of the classification result can be further improved.
Step S104, for each first target object, obtaining a classification result corresponding to the first target object based on the first combination feature corresponding to the first target object.
In practical application, after the combination feature corresponding to each first target object is obtained, the classification result corresponding to each first target object may be obtained based on the combination feature 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 obtained classification result corresponds to one first target object.
The presentation forms of the classification result corresponding to the first target object are different when the classification result corresponds to different application scenes, and the presentation forms of the classification result are not limited in the embodiment of the application. In an example, assuming that the current application scenario is an emotion classified application scenario, its corresponding classification result may include recognition, derogation, and neutrality. If the first classification characteristic 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 characteristic word of the first target object of the text to be classified is "normal", the classification result corresponding to the first target object is neutral, and if the first classification characteristic word of the first target object of the text to be classified is "poor", the classification result corresponding to the first target object is depreciation.
Continuing with the previous example, for the first target object "room", based on its corresponding combined features, a recognition may be obtained as to the classification result of the first target object "room"; for the first target object "cost performance", it is also fair to obtain a classification result of the first target object "cost performance" based on the corresponding combination feature.
It should be noted that, when the obtained text is a fragment or an article in which a plurality of sentences exist, the obtained text may be subjected to clause processing to obtain each clause included in the text. Correspondingly, each sentence is a text to be classified and corresponds to a text feature, and when the word feature of the first classification feature word of the first target object is spliced with the text feature, the text feature corresponding to the sentence where the first target object is located is spliced.
In the embodiment of the application, when the classification result corresponding to the text to be classified is determined, the text features in the text to be classified can be extracted, the word features of the first classification feature words are extracted, and then the final classification result is determined based on the combined features obtained by splicing the text features and the word features. Correspondingly, the word characteristics of the first classification characteristic word are fused in the text characteristics in the classification process, namely, the prior knowledge is equivalently added. Therefore, compared with the method that the classification result is determined only 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 on the classifier and improve the classification effect.
In an optional embodiment of the present application, the text to be classified is a sentence, and extracting text features of the text to be classified includes:
performing word segmentation 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 a first target object;
splicing the word vector of each first word segmentation in the text to be classified with the word vector of the word segmentation of the first target object respectively to obtain a spliced vector corresponding to each first word segmentation;
and extracting the text features of the text to be classified based on the splicing vectors corresponding to the first participles.
In practical application, if the obtained text is an article or a segment with a plurality of sentences, the text to be classified may be subjected to clause processing to obtain a plurality of clauses, and each clause corresponds to one text to be classified in the embodiment of the present application. For example, when performing word segmentation on a text to be classified, each sentence may be segmented at intervals of punctuation marks to obtain each sentence included in the text to be classified, wherein in order to better know each sentence, each sentence may be labeled with "|".
Furthermore, 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 low in price", the text to be classified may be divided into three clauses "comfortable in room, good in service, and low in price" based on "as a division basis; further, the three clauses may be segmented to obtain the first respective phrases "room", "very", "comfortable", "service", "very", "good", "price", "not", and "cheap", respectively.
Correspondingly, the word vector of each first participle in the text to be classified can be spliced with the word vector of the participle of the first target object to obtain a spliced vector corresponding to each first participle, and then feature extraction is performed on the spliced vector corresponding to each first participle to obtain text features of the text to be classified.
In one example, assume that the first terms "room", "very" and "comfortable" resulting from the word segmentation process on the text to be classified, and the term of the first target object is "room". Further, word vectors of 'room', 'very' and 'comfortable' can be extracted respectively, then the word vectors of 'very' and 'comfortable' are spliced with the word vectors of 'room' respectively to obtain corresponding spliced vectors of 'very' and 'comfortable', 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, word vectors of all first participles in a text to be classified can be spliced with word vectors of participles of a first target object respectively to obtain spliced vectors corresponding to all the first participles, and because text features are features related to a classification result corresponding to the text to be classified, the spliced vectors corresponding to all the first participles at the moment all include features of the target object, and further based on the spliced vectors corresponding to all the first participles, when the text features of the text to be classified are extracted, a 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 optional embodiment of the present application, determining a first classification feature word of each first target object included in a text to be classified includes:
determining first classification characteristic words of each first target object contained in the text to be classified based on a class sequence rule;
the class sequence rule is determined based on a labeling sequence in the reference sample text, and the labeling sequence represents the part of speech and the word category of each reference characteristic word contained in the reference sample text.
Specifically, the class sequence rule is a rule composed of a class label and sequence data, and the two form a mapping relationship, and the formalization is expressed as: x → Y, the mapping relationship is described in detail as follows:
x is a sequence expressed as < s1x1s2x2.. Sixi >, wherein S refers to a sequence database and is a set composed of a series of tuples < sid, S >, as shown in table 1, sid (sequence id) is a serial number of sequence data, and S (sequence) refers to sequence data, xi indicates 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<S1c1S2c2...Sicr>Wherein S is as defined above, crFor a certain class label, is (c)rE C,1 ≦ i ≦ r), and C ═ C ≦ C1,c2,...,crIs a set of category labels. Thus, CSR requires that the rule for determining class sequence must carry specified class information.
Further, after specifying the category information, the CSR mines the sequence data satisfying the support degree threshold and the confidence degree threshold as a category sequence rule. Taking Table 1 as an example, the sequence database contains 5 pieces of sequence data with category information, and the category sequence rule that can be mined according to the above definition is<<ab>x<gh>>→<<ab>c1<gh>>It is apparent that the sequence data having sequence numbers 1 and 5 contain the sequence rule of this kind, and the specified category information is c1While the sequences numbered 1, 2 and 5 cover this type of sequence rule, the sequence numbered 2 does not specify category information. Therefore, in these 5 series data, the support degree of class series rule2/5, confidence 2/3. Based on this, as can be seen from the definition of the class sequence rule, the CSR determines the specified class information first, and then mines the rule according to the specified class information, which is greatly different from the traditional 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 relationship. And the goal of CSR mining is to find sequence patterns that have a high degree of correlation with the specified category information, mining rules for correspondence between sequence patterns and categories. It follows that class sequence rules are characterized by supervised and pre-given class designation class information.
Further, in this embodiment of the application, the reference sample text refers to a text for mining class sequence rules, and the reference feature words are pre-specified classes of reference words in the class feature words included in the reference sample text, and may be used for labeling the reference sample text 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 an existing dictionary database.
In practical application, when determining the class sequence rule, a reference sample text may be obtained, then the reference sample text is subjected to word segmentation processing to obtain each word segment included in the reference sample text, and the part of speech of each word segment is labeled, for example, a noun is labeled as n, an adjective is labeled as a, and a adverb is labeled as d. Further, the participles belonging to the reference characteristic words in the participles included in the reference sample text are determined, and the reference characteristic words included in the reference sample text are labeled based on the word categories of the reference characteristic words, so that a corresponding labeling sequence is obtained. In the labeling process, the attribute word may be labeled as #, the emotion word may be labeled as #, the degree adverb may be labeled as &, and the negation word may be labeled as! And the like. Further, after the tagging sequence in the reference sample text is obtained, the obtained tagging sequence can be used as sequence data, and then the obtained tagging sequence is mined based on the determined specified category, support degree and confidence degree to obtain a category sequence rule.
In an optional embodiment of the present application, determining, based on a class sequence rule, a first classification feature word of each first target object included in a text to be classified includes:
determining reference characteristic 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 word class of each reference characteristic 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 participle are determined, and then the text to be classified is labeled according to the part of speech of each first participle and the word category of each reference feature word, so that a labeling sequence of the text to be classified is obtained.
In an example, it is assumed that the classification to be performed is "room is comfortable, service is good, and price is not cheap", and each of the obtained first phrases includes "room", "good", "comfortable", "service", "good", "price", "not", "cheap", and the reference feature word includes "room, price" belonging to the attribute word class, "comfortable, cheap" belonging to the emotion word class, and "good" belonging to the degree adverb class, and "not" belonging to the negative word class. Wherein the attribute word class is labeled "#", the emotion word class is labeled "#", the degree adverb class is labeled "#", and the negation word class is labeled "! "; further, the part of speech in each first participle may be determined and labeled to obtain "/n,/d,/a, |,/n,/d,/a, |,/a,/d,/a", and the first reference feature words included in the first participle are determined to be "room", "very", "comfortable", "price", "not" and "cheap", and then the word class labeling is performed at the corresponding positions in the text to be classified according to the word class of each reference feature word included in the first participle to obtain the labeling sequence "#/n, &/d,/a, |, #/n, | i! And d,/a ".
Further, since the reference feature words are only a few reference words of a pre-specified category from the category feature words included in the reference sample text, all the first category feature words included in the first word may not be determined. Based on this, in the embodiment of the application, after the tagging sequence of the text to be classified is obtained, the tagging sequence obtained based on the matching of the determined class sequence rule can be obtained, the feature words corresponding to the class sequence rule are extracted to form new reference feature words, then, the first sub-words are re-tagged based on the new reference feature words, the steps of obtaining the tagging sequence of the text to be classified and obtaining the new reference feature words are repeated, so that the purpose of iteratively mining the reference feature words is achieved, and further, it can be ensured that all the first classification feature words contained in each current first sub-word can be identified.
Continuing with the above example, assuming that the first classification feature word is an emotion classification feature word, the resulting annotation sequence "#/n, &/d, #/a, |,/n, &/d,/a, |, #/n, | for the text to be classified! 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, |! D,/a' all meet the requirements and can also be used as a class sequence rule; furthermore, a label sequence can be obtained based on the determined class sequence rule matching, and feature words at corresponding positions of various sequence rules in the label sequence are extracted as new reference feature words, namely, room, price and service belonging to an attribute word category, comfort, cheapness and goodness belonging to an emotion word category, extreme belonging to a degree adverb category and nonness belonging to a nonnegative word category are extracted as new reference feature words; correspondingly, the obtained new reference feature words comprise all the first classification feature words contained in the current text to be classified, so that the obtained first classification feature words also comprise 'good'.
In an optional embodiment of the present application, when there is a specified type word in a text to be classified, extracting word features of a first classification feature word, including:
combining the specified type words and the corresponding first classification characteristic words to obtain combined first classification characteristic words, wherein the specified type words are words affecting classification results corresponding to the first classification characteristic words;
and extracting the word features of the merged first classification feature words as the word features of the first classification feature words.
The specified type words refer to words which can potentially influence the classification result corresponding to the first classification characteristic words. The specific type words are generally words which are positioned before the classification characteristic words and are used for limiting the meaning of the classification characteristic words or deepening the meaning of the classification characteristic words, and include but are not limited to fixed words, adjectives or adverbs (such as degree adverbs) and the like positioned before the classification characteristic words. The specific type of the type word is specified, and 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 combining the first classification feature word and the corresponding specified type word, the specified type word includes at least one of a degree word or a negation word that affects an emotion degree of the first classification feature word. For example, if the current application scenario is a text emotion analysis scenario, the first specific word may be at least one of a level word or a negative word affecting the emotion degree.
In practical application, before extracting the word features of the first classification feature words, it may be further determined whether the current text to be classified includes the specified type words, if so, the specified type words and the corresponding first classification feature words may be merged to obtain merged first classification feature words, and then the word features of the merged first classification feature words are extracted as the word features of the first classification feature words. If the current text to be classified comprises a plurality of specified type words and a plurality of first classification characteristic words, the specified type words and the corresponding first classification characteristic words need to be merged one by one.
In an example, it is assumed that the first classification feature word is an emotion class feature word, the specified type word is a negative word, and the text to be classified is "uncomfortable in room and not cheap". At this time, if the text to be classified includes two negatives "not" and the emotion feature words are "comfortable" and "cheap", the first negation word "not" and "comfortable" may be merged to obtain a first merged first classification feature word "uncomfortable", and the second negation word "not" and "cheap" may be merged to obtain a second merged first classification feature word "not cheap", and then the 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:
obtaining each initial training sample;
determining a second classification characteristic word of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on a second classification feature word contained in each initial training sample to obtain each labeled training sample;
and training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the training samples until the corresponding loss functions are converged, wherein the values of the loss functions represent the difference between the classification results of the training samples output by the model and the classification results corresponding to the classification labels.
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 applications, the classification method provided in the embodiment of the present application may be implemented by a classification model, and the classification of the classification model is not limited in the embodiment of the present application, for example, the classification model may be a CNN model.
In practical application, when a classification model is trained, each initial training sample can be obtained, each initial sample comprises a second target object and a second classification feature word of the second target object, wherein the category of the second classification feature word is the same as that of the first classification feature token, and for example, when the first classification feature word is an emotion class feature word, the second classification feature word is also an emotion class feature word.
Furthermore, the classification label of each initial training sample can be labeled based on the second classification feature word included in each initial training sample, so as to obtain each labeled training sample. When different application scenarios are adopted, the initial training samples are different, and the labeled classification labels are also different at the moment. For example, if the application scenario is an application scenario of emotion analysis, the second classification feature words included in the obtained initial training samples may be emotion class feature words, and the classification labels corresponding to the initial training samples may be emotion classification results corresponding to the emotion class feature words included in the initial training samples, such as "positive", "neutral", and "negative". When the classification label of each initial training sample is labeled based on the second classification feature words included in each initial training sample, the emotion classification result corresponding to each second classification feature word may be determined based on the emotion classification label labeled with the feature words in the known dictionary database, and the determined emotion classification result is used 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, whether a loss function corresponding to the current training converges or not is determined, if the loss function does not converge, the precision of the current initial neural network model still does not meet the requirement is shown, the 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 current training converges or not is judged again, and if the loss function does not converge, the initial neural network model parameters are continuously adjusted until the corresponding loss function converges. And when the loss function is converged, 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 satisfied.
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 rules, the link of labeling the classification labels can be automatically completed without manually determining each classification feature word in the text to be classified and labeling each classification feature word, and therefore, the classification efficiency can be effectively improved. Meanwhile, the classification label of the training sample is the emotion polarity label of the existing emotion words in the existing known text database, so that the problem of manual marking errors is solved, and the classification accuracy is improved.
In an alternative embodiment of the present application, determining a second classification feature word of a 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;
and determining a second classification characteristic word of a second target object contained in each initial training sample based on the class sequence rule.
The reference sample text may be a part of the training samples, or may be independent of the samples of the training samples. The class sequence rule is used to determine a second classification feature word of the second target object, which may be the same as or different from the first class sequence rule, and the embodiment of the present application is not limited.
In practical applications, after the reference sample text is determined, the class sequence rule may be determined based on the reference sample text, and then the second classification 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 the determining the second type of sequence rule based on the reference sample text includes:
performing word segmentation processing on the reference sample text to obtain second words;
determining the reference characteristic words contained in each second participle;
labeling the reference sample text based on the part of speech of each second participle and the word category of each reference characteristic word to obtain a labeling sequence of the reference sample text;
and mining a second type of sequence rule based on the labeled sequence of the reference sample text.
In practical application, when the class sequence rule is determined, the reference sample text may be subjected to word segmentation processing to obtain each second word segmentation. The specific implementation manner of performing word segmentation on the reference sample text to obtain each second word segmentation may refer to the above-mentioned specific implementation manner of performing word segmentation on the text to be classified to obtain each first word segmentation, which is not described herein again.
It should be noted that the reference sample text may be obtained by performing sentence segmentation processing on a segment or an article in which a plurality of sentences exist, where each sentence corresponds to one reference sample text. The specific implementation manner of performing clause processing on the reference sample text to obtain each clause may refer to the above-mentioned clause processing on the text to be classified, and is not described herein again.
Further, the reference feature words included in each second participle may be determined, and then the reference sample text is labeled based on the part of speech of each second participle and the word class of each second reference feature word, so as to obtain a labeling sequence of the reference sample text. The specific implementation manner of obtaining the labeling sequence of the reference sample text is the same as that of obtaining the labeling sequence of the text to be classified, and for detailed description, reference may be made to the above description, which is not repeated herein. Correspondingly, after the labeling sequence of the reference sample text is obtained, the similar sequence rule can be mined for the labeling sequence of the reference sample text to obtain the similar sequence rule.
Furthermore, the determined class sequence rule can be matched with the labeling sequence of the reference sample text, the feature words at the 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, the second sub-words are marked again on the basis of the new reference feature words, and the steps of obtaining the labeling sequence of the reference sample text and obtaining the new reference feature words are repeatedly executed, so that the purpose of iteratively mining the reference feature words is achieved, and all the second classification feature words contained in the current initial samples are ensured to be included in the reference feature words.
In the embodiment of the present application, mining class sequence rules based on the labeling sequence of the reference sample text includes:
adopting a frequent sequence mode to carry out class sequence rule mining on the labeling sequence of the reference sample text to obtain a 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.
In practical application, the labeling sequence of the reference sample text can be mined based on the frequent sequence mode to obtain the class sequence rule. For example, a sequence in which the pure combination item simultaneously contains the label category ("#/n, &/d,./a" in the above example) is extracted as the class sequence rule. Among them, a frequent sequence Pattern mining algorithm Prefixspan (Prefix-project Pattern mining, Pattern mining of Prefix projection), GSP (Generalized Sequential Pattern mining algorithm), etc. can be used for mining of CSR.
In practical application, when mining a frequent sequence pattern satisfying the minimum support degree based on the frequent pattern prefix span algorithm, considering that the difference of the sequence lengths in each sequence pattern is large, it is not suitable to use a single fixed minimum support degree to perform class sequence rule mining. In particular, the support threshold needs to be lowered to mine low frequency sequences, but this introduces a large number of rules resulting from high frequency words, and thus noise. For this reason, in the embodiment of the present application, the minimum support degree policy is used to determine the support degree. The method for calculating the minimum support degree (min _ sup) can be obtained by multiplying the minimum support rate a by the number n of the 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, the value can be set to be between 0.01 and 0.1.
In the embodiment of the application, because each round of mining class sequence rule is provided with higher support degree, the accuracy and recall rate of the class sequence rule obtained by mining can be ensured, the precision rate and recall rate of the reference feature word obtained by multiple rounds of iterative mining based on the class sequence rule can be further ensured, and meanwhile, because the class sequence is determined by the part-of-speech rule of the feature word, the universality is realized, and the generalization performance is higher. Furthermore, the class sequence rule has a good effect on frequent sequence mining, and can well extract feature words such as attribute words, emotion words, negative words and degree words according to the labeled word category information.
In an optional embodiment of the present application, when the initial training samples include the second specified word, based on the second classification feature word included in each initial training sample, the method for labeling the classification label of each initial training sample to obtain each labeled training sample includes:
for each initial training sample, combining a second specified word with a corresponding second classification feature word to obtain a combined second classification feature word;
labeling the classification label of each initial training sample based on the combined second classification feature words to obtain each labeled training sample;
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 merged second classification feature words corresponding to the samples.
The second instruction word is a word affecting the classification result corresponding to the second classification characteristic 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 designated word may include at least one of a degree word or a negation word that affects an emotion degree of the second classification feature word.
In practical application, if the initial training samples include the second specified word, the second specified word may be merged with the corresponding second classification feature word to obtain a merged second classification feature word, and the classification label of each initial training sample is labeled based on the merged second classification feature word to obtain each labeled training sample. The specific implementation manner of the merged second classification characteristic word obtained by merging the second designated word with the corresponding second classification characteristic word is the same as the specific implementation manner of the merged first classification characteristic word obtained by merging the first designated word with the corresponding first classification characteristic word, and for the description of this part, reference may be made to the description in the above, and details are not repeated here.
Furthermore, the classification label of each initial training sample may be labeled based on the merged second classification feature word to obtain each labeled training sample (that is, the classification label of each training sample is the classification label corresponding to the merged second classification feature word), and then the initial neural network model is trained based on each labeled training sample and the merged second classification feature word corresponding to each sample.
In one example, assuming that the second classification feature word is an emotion class feature word and the second designation word is a negative word, the initial training sample includes "room uncomfortable" and "not cheap". At this time, the initial training sample includes two negatives "not", the emotion characteristic words "comfortable" and "cheap", at this time, the first negation "not" and the "comfortable" may be merged to obtain the first merged second classification characteristic word "uncomfortable", the classification label of the merged second classification characteristic word "uncomfortable" is determined to be "dereferenced", the second negation "not" and the "cheap" are merged to obtain the second merged second classification characteristic word "inconvenient", and the classification label of the merged second classification characteristic word "not cheap" is determined to be "dereferenced". At this time, the classification label of the training sample "uncomfortable room" is "derogation", and the classification label of the training sample "not cheap price" is "derogation".
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 all first target objects contained in the text to be classified and extracting word features of all the first classified feature words;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification module is used for obtaining a classification result corresponding to the target object based on the combination characteristic 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 classification 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 first classification feature words of each first target object are spliced with text features respectively based on the feature fusion module to obtain combination features corresponding to each first target object, and then classification results corresponding to each target object can be obtained through the classification module based on the combination features corresponding to each first target object.
It can be understood that the text feature extraction module and the classification word feature extraction module included in the CNN model may be two separate modules, may also be one module, and may also be two modules having a common partial structure.
In an example, assuming that the current application scenario is an emotion classification scenario, when a text to be classified is an article fragment, the CNN model includes two feature extraction branches, one branch includes a word embedding module, Convolution layers (Convolution layer) and Pooling layer (Pooling layer) in two levels, and a fully Connected layer (Full Connected layer) in two levels, and the other branch includes an emotion word embedding module Connected to the word embedding module, where the text feature extraction module is equivalent to the word embedding module in sequential cascade, and the classified word feature extraction module is equivalent to the emotion word embedding module Connected to the word embedding module in the other branch. Correspondingly, the text to be classified, the word segmentation processing and the 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 words and outputs the first classification feature words to an emotion word embedding module (namely, a classification word feature extraction module), and then the emotion word embedding module performs word embedding on the first classification feature words to obtain word vectors of the first classification feature words.
Of course, in practical applications, if there is no first classification feature word (e.g., emotion feature word) in the text to be classified, the process may be ended, and at this time, the CNN model outputs corresponding prompt information, and if there are a plurality of first classification feature words of the first target object, the CNN model may output a classification result corresponding to each first target object.
In order to better understand the classification method provided in the embodiment of the present application, the following describes in detail the classification method provided in the embodiment of the present application in conjunction with an application scenario of emotion classification, which is text emotion analysis. In this example, assume an initial training sample of "the hotel is located very close, air is particularly good, the room is tall and comfortable, and cost is very high! ", the baseline feature words include the attribute words: room, degree word: very, and emotional words: good; with the minimum confidence set to 0.1, the reference sample text is "very close to this hotel's location, air is particularly good, room is very comfortable! ".
A schematic of a training process of the 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 a reference sample text, namely performing word segmentation and labeling processing on the reference sample text to obtain a labeling sequence corresponding to the reference sample text;
in a specific implementation, sentences may be segmented for the reference sample text at intervals of punctuation marks to obtain each segment included in the reference sample text. Each sentence obtained at the moment is respectively 'the position of the hotel is very close,' the air is particularly good, 'the room is comfortable'; then, the obtained clauses are subjected to word segmentation and part-of-speech tagging to obtain word segmentation results after part-of-speech tagging, so that the word segmentation results of 'this/r,/hotel n, u, position/n, very/d, near/a, |, air/n, special/d, good/a, |, room/n, stile/d and comfort/a' can be obtained. Wherein r represents pronouns, n represents nouns, u represents auxiliary words, d represents degree adverbs, and a represents adjectives.
Further, the method can perform reference feature word tagging on the word segmentation result after the part of speech tagging, and specifically comprises the following steps: determining the characteristic words which are the same as the reference characteristic words in all the participles of the reference sample text, and performing word category labeling on the corresponding positions of the same characteristic words in the labeling sequence according to the word categories of the reference characteristic words. Such as marking the attribute word (i.e., the evaluation object) as "#", the emotion word as "#", the degree adverb as "&", and the negation word as "! ", the reference sample text obtained at this time has the labeling sequence"/r,/n,/u,/n, &/d,/a, |,/n,/d,/a, |, #/n,/d,/a ".
Step S202, mining class sequence rules and mining reference feature words, namely, mining the class sequence rules and mining the reference feature words based on the labeled sequences corresponding to the reference sample texts;
further, a class sequence rule may be determined based on the obtained labeling sequence of the reference sample text, and a reference feature word is iteratively mined based on the determined class sequence rule, where a specific flow is shown in fig. 3 and includes:
step S301, determining word category information, namely determining the word category information as emotional characteristic word category information;
step S302, determining the minimum support degree, specifically, determining the minimum support degree through the minimum support rate and the number of initial training samples;
step S303, determining a frequent sequence meeting the support degree, for example, obtaining a frequent sequence meeting the minimum support degree, wherein the frequent sequence is ' n ',/d,/a ' in a labeling sequence corresponding to the reference sample text mined based on a frequent pattern prefixspan algorithm;
step S304, determining a mining rule, specifically, extracting a sequence "#/n, &/d, ·/a" of the pure combination item containing the tagged word category at the same time as the mining rule;
step S305, the required class sequence rule is satisfied based on the confidence, specifically, since the minimum confidence is set to 0.1, at this time, at least one identical word class label appears in the label sequence and can be used as the mined class sequence rule, and the support and confidence requirements of the mining rules "#/n, &/d,/a" are satisfied in the label sequence;
step S306, adding the class sequence rules to the rule base, for example, "/n, &/d,/a", "/n,/d,/a", "#/n,/d,/a" can be taken as the class sequence rules and added to the rule base;
and step S307, performing iterative mining on the reference feature words based on the class sequence rule.
An optional implementation manner of performing iterative mining on the basis of the mined class sequence rule on the reference feature word includes: matching the obtained various sequence rules with the labeling sequence of the reference sample text, extracting the feature words at the positions corresponding to the various sequence rules in the labeling sequence as new reference feature words, wherein the new reference feature words obtained at the moment comprise attribute words: position, air, degree word: special, straight, and emotional words: is close and comfortable. Then based on the new reference characteristic words and the attribute words: position, degree word: very much, the emotional words: preferably, the word category is re-labeled to the labeling sequence corresponding to the reference sample text, and the process of mining the reference characteristic words based on the category sequence rule is repeatedly executed, so as to achieve the purpose of iteratively mining the reference characteristic words.
Step S203, constructing a training sample set and a test sample set;
in practical application, a clause including a class sequence rule in a clause included in an initial training sample is used as an individual sample, if the emotion classification result of an emotion feature word included in the sample is labeled in an existing dictionary database, the partial sample is used as the training sample, at this time, 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 acquired from the existing dictionary database without labeling, the partial sample is used as the test sample.
In the embodiment of the application, the training samples are clauses containing class sequence rules, so that each training sample input into the classification model at least contains one target object (such as an attribute feature word) and one corresponding classification feature word (such as an emotion feature word), and thus each training sample is ensured to have a corresponding classification label, and the training and testing of the classification model can be performed more normatively.
Step S204, training an emotion classification model;
the specific network structure of the emotion classification model is not limited in this application, and for example, the classification model may be based on a CNN, and the initial CNN is trained based on the labeled training samples and the emotion feature words corresponding to the training samples until the corresponding loss function converges to obtain the CNN. Further, testing the obtained CNN based on the test sample, if the CNN meets the test condition, obtaining the final CNN, otherwise, continuing to train the obtained CNN, and finally obtaining the CNN model which can be used for emotion classification.
In the embodiment of the application, when a classification model based on CNN is used for classifying a text to be classified, an evaluation element may be first mined by using a class sequence rule, and the evaluation element may mainly include an object to be evaluated (i.e., a target object) in the text to be classified and a classification feature word of the object to be evaluated (e.g., an emotion feature word in emotion classification), and then text features related to classification of the text to be classified and the classification may be extracted by using CNN, word features of the mined classification feature word of the object to be evaluated may also be extracted by using CNN, and the text features and the word features are spliced and combined by using CNN, and a classification result is obtained based on the combined feature output.
As an example, fig. 4 shows a schematic structural diagram of a CNN provided in this embodiment of the present application, as shown in fig. 4, the CNN may include two feature extraction branches, one branch includes a word embedding module (word embedding 11 shown in the figure), two levels of Convolution structures, namely, a Convolution layer 12(Convolution layer) and a Pooling layer 13(Pooling layer), and a fully Connected layer 14(Full Connected layer), which are cascaded in sequence, 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 an output of the emotion word embedding module is merged with an output of the last fully Connected layer, and a classification result is obtained through an output layer (Softmax layer 16 in this example), where the number of nodes of the output layer is the number of classification tags, that is, the category of emotion classification (including sense, positive, negative, and the like), Neutral, derogative categories); and then splicing the two parts of 100-dimensional information to obtain 200-dimensional feature combination vectors, and inputting the 200-dimensional feature combination vectors to an Output layer for classification. It is understood that the output layer in this example is illustrated by taking the Softmax layer 16 as an example, in practical applications, the output layer may not be limited to the Softmax layer, and any classification layer capable of performing a classification function may be used as the output layer in this example, for example, the Softmax layer may be replaced by xgboost or the like.
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 those skilled in the art can easily conceive of other available network structures and various modified structures of the existing network structures based on the solution of the embodiment of the present application, which still fall into the protection scope of the embodiment 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 can be directly used for splicing with the last full-connected layer, and for example, the emotion word embedding module can also be replaced by other structures, such as a convolution structure.
Specifically, when emotion classification is performed on a text to be classified based on a finally trained CNN, each clause in the text to be classified may be input into the trained CNN (as shown in fig. 4) as an independent text, a word vector of each participle included in the text is extracted and obtained by a word embedding module, and deep features, i.e., text features, related to classification labels are obtained from the text to be classified through each convolution layer, each pooling layer and a full connection layer. And for the emotion feature words in the text to be classified, after an initial word vector is obtained through a word embedding module, an emotion word vector (namely the word feature of the first classification feature word) with the dimension being the same as that of the text feature (specifically in a one-dimensional column vector form) output by the last full-connected layer is further extracted and obtained through the emotion word embedding module, and then the emotion word vector and the text feature output by the last full-connected layer are spliced and output to a 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:
one of them mainly includes an input layer (word embedding as shown in fig. 4), a convolutional layer, a pooling layer, and a full-link layer, one is a word feature extraction structure (emotion word embedding as shown in fig. 4) for classifying feature words, and the other is a feature fusion structure. Wherein, the input layer is used to convert each participle contained in the text to be classified into a word vector with fixed length (dimension), if the text to be classified includes 7 words and each feature word is converted into a 50-dimensional word vector, 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 a word, for the convolutional layer, in the classification model, each convolutional layer generally uses convolution kernels with different sizes, the height of the convolution kernels is generally the dimension of the word vector, the width of the convolution kernels represents the number of longitudinal words selected in the process, after the convolution process of each convolution kernel, each convolutional kernel corresponds to obtain a one-dimensional feature map (column vector), then the one-dimensional feature map (column vector) is subjected to the pooling process by the pooling layer connected by the convolution layer, and the down-sampling process is performed on the output of the convolutional layer, 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 to obtain a one-dimensional column vector containing the largest value in each feature map, and then data of all feature maps output by the pooling layer are changed into one-dimensional data through flattening (flattening) through a full connection layer (in practical application, the full connection layer generally has two or more layers to effectively solve the non-linearity problem). For the classified feature words in the text to be classified, after word vectors of the classified feature words are obtained through the word embedding layer, corresponding word features can be obtained through the word feature extraction structure, for example, the word vectors of the feature words can be converted into new word vectors with set dimensions (the dimensions of the features output by the full connection layer of the last hierarchy are close to or equal to those of the features output by the full connection layer of the last hierarchy) through a word embedding mode again, 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 then classification decision is made through the Softmax layer, so that classification labels of objects to be classified in the text to be classified are obtained.
Specifically, for a sentence to be classified, assuming that the dimension of the output vector of the last full-link layer is 100 dimensions, the dimension of the word vector output by the emotion embedding module is also 100 dimensions, then the two parts of 100-dimensional information are spliced to obtain a 200-dimensional feature combination vector, and the 200-dimensional feature combination vector is input to the output layer (namely, the Softmax layer) for classification, so as to obtain an emotion classification result corresponding to a target object in the sentence. For example, assume that the sentence that requires sentiment classification is "the location of the hotel is very close! If the attribute word (i.e. 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 as recognition through the output of the trained classification model.
In addition, as can be seen from the foregoing description, as another optional manner, after the word vectors of the respective segmented words are obtained through the word embedding layer, word vectors corresponding to objects to be classified (which may be determined when the classification feature words of the respective target objects are determined, for example, the target objects and the classification feature words of the target objects are determined through the class sequence rule) may be spliced with the word vectors of the respective segmented words, and each spliced word vector is used as a word vector of the respective segmented word and then input to the convolution layer, so as to better guide subsequent structures to perform text feature extraction.
In the embodiment of the application, the text features to be classified and related to the classification result are extracted by using the CNN, and the combined features are obtained by splicing, so that the information related to attribute emotion classification can be better mined, the accuracy of the text features is improved, the requirements on a classifier are reduced, and the classification effect is improved.
It can be understood that the classification method provided in the embodiment of the present application is also applicable to other application scenarios, in which a combined feature vector is constructed by combining a class sequence rule with a CNN and classification is performed based on the combined feature vector, in addition to the application scenario of emotion classification, that is, the method of constructing deep cross features by combining class sequence rule with sequence labeling and CNN mining is within the scope of the present application.
The present embodiment provides a sorting apparatus, and as shown in fig. 5, the sorting apparatus 60 may include: a classification feature word determining module 601, a feature extracting module 602, a feature fusing module 603, and a classification result determining module 604, wherein,
a classification feature word determining module 601, 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 the text features, respectively, to obtain a combination feature 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 combined feature corresponding to the first target object.
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, the classification feature word determining module is specifically configured to:
determining a first classification characteristic word of each first target object in the text to be classified based on a class sequence rule;
the class sequence rule is determined based on a labeling sequence in the reference sample text, and the labeling sequence represents the part of speech and the word category of each reference characteristic word contained in the reference sample text.
In an optional embodiment of the present application, when determining, based on the class sequence rule, a first classification feature word of each first target object in a text to be classified, the classification feature word determining module is specifically configured to:
determining reference characteristic 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 word class of each reference characteristic 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 there is a specified type word in a text to be classified, the feature extraction module is specifically configured to:
combining the specified type words and the corresponding first classification characteristic words to obtain combined first classification characteristic words, wherein the specified type words are words affecting classification results corresponding to the first classification characteristic words;
and extracting the word features of the merged first classification feature words as the 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:
obtaining each initial training sample;
determining a second classification characteristic word of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on a second classification feature word contained in each initial training sample to obtain each labeled training sample;
and training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the training samples until the corresponding loss functions are converged, wherein the values of the loss functions represent the difference between the classification results of the training samples output by the model and the classification results corresponding to the classification labels.
In an optional embodiment of the present application, when determining the second classification feature word of the second target object included in each initial training sample, the model training module is specifically configured to:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
and determining a second classification characteristic word of a second target object contained in each initial training sample based on the class sequence rule.
In an optional embodiment of the present application, 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:
performing word segmentation processing on the reference sample text to obtain second words;
determining the reference characteristic words contained in each second participle;
labeling the reference sample text based on the part of speech of each second participle and the word category of each reference characteristic word to obtain a labeling sequence of the reference sample text;
and mining class sequence rules based on the labeling sequence of the reference sample text.
In an optional embodiment of the present application, when mining a class sequence rule based on a labeled sequence of a reference sample text, the model training module is specifically configured to:
and mining a class sequence rule of 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.
In an optional embodiment of the present application, when the initial training samples include the specified type word, the model training module is specifically configured to, based on the second classification feature word included in each initial training sample, label the classification label of each initial training sample, and obtain each labeled training sample:
for each initial training sample, combining the specified type word with the corresponding second classification characteristic word to obtain a combined second classification characteristic word;
labeling the classification label of each initial training sample based on the combined second classification feature words to obtain each labeled training sample;
the model training module is specifically configured to, when training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples:
and training the initial neural network model based on the labeled training samples and the combined second classification feature words corresponding to the training samples.
In an optional embodiment of the present application, the classification model is a CNN model, and 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 all first target objects contained in the text to be classified and extracting word features of all the first classified feature words;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification module is used for obtaining a classification result corresponding to the first target object based on the combination characteristic corresponding to the first target object for each first target object.
In an optional 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 negation word that affects an emotion degree of the first classification feature word.
The classification device of the embodiment of the present application can execute the classification method provided by the embodiment of the present application, and the implementation principles thereof are similar, and are not 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. Wherein 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 the transceiver 2004 is not limited to one in practical applications, and the structure of the electronic device 2000 is not limited to the embodiment of the present application.
The processor 2001 is applied in the embodiment of the present application to implement the functions of the modules 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 component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs and microprocessors, and the like.
Bus 2002 may include a path that conveys information between the aforementioned components. The bus 2002 may be a PCI bus or an EISA bus, etc. 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 this is not intended to represent only one bus or type of bus.
The memory 2003 may be, but is not limited to, ROM or other types of static storage devices that can store static information and computer programs, RAM or other types of dynamic storage devices that can store information and computer programs, EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, 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 or in the form of a data structure and that can be accessed by a computer.
The memory 2003 is used for storing computer programs for executing the application programs of the present scheme and is controlled in execution by the processor 2001. The processor 2001 is used to execute a computer program of an application program stored in the memory 2003 to implement the actions of the sorting apparatus provided by the embodiment shown in fig. 5.
An embodiment of the present application provides an electronic device, where the electronic device includes: 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 method for implementing classification.
The terms and implementation principles used in this application for a computer-readable storage medium may refer to a classification method in the embodiments of this application, and are not described herein again.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for those skilled in the art, several modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations should also be regarded as the protection scope of the present application.

Claims (15)

1. A method of classification, comprising:
determining first classification characteristic 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;
splicing the word characteristics of the first classification characteristic words of the first target objects with the text characteristics respectively to obtain the combination characteristics corresponding to the first target objects;
and for each first target object, obtaining a classification result corresponding to the first target object based on the combination features corresponding to the first target object.
2. The method according to claim 1, wherein the text to be classified is a sentence, and the extracting the text features of the text to be classified comprises:
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;
splicing the word vector of each first word segmentation in the text to be classified with the word vector of the first target object respectively to obtain a spliced vector corresponding to each first word segmentation;
and extracting and obtaining the text features of the text to be classified based on the splicing vectors corresponding to the first word segmentations.
3. The method according to claim 1, wherein the determining the first classification feature word of each first target object included in the text to be classified comprises:
determining a first classification characteristic word of each first target object in the text to be classified based on a class sequence rule;
the class sequence rule is determined based on a tag sequence in the reference sample text, wherein the tag sequence represents the part of speech and the word category of each reference feature word contained in the reference sample text.
4. The method according to claim 3, wherein the determining a first classification feature word of each first target object in the text to be classified based on the class sequence rule comprises:
determining reference characteristic 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 word class of each reference characteristic 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.
5. The method according to any one of claims 1 to 4, wherein when a specified type of word exists in the text to be classified, extracting word features of a first classification feature word comprises:
combining the specified type words and the corresponding first classification characteristic words to obtain combined first classification characteristic words, wherein the specified type words are words affecting classification results corresponding to the first classification characteristic words;
and extracting the word features of the merged first classification feature words as the word features of the first classification feature words.
6. The method according to any one of claims 1 to 5, wherein the method is implemented by a classification model, wherein the classification model is trained by:
obtaining each initial training sample;
determining a second classification characteristic word of a second target object contained in each initial training sample;
labeling the classification label of each initial training sample based on a second classification feature word contained in each initial training sample to obtain each labeled training sample;
and training the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the training samples until the corresponding loss functions are converged, wherein the values of the loss functions represent the difference between the classification results of the training samples output by the model and the classification results corresponding to the classification labels.
7. The method of claim 6, wherein determining the second classification feature words of the second target objects included in each of the initial training samples comprises:
determining a reference sample text;
determining class sequence rules based on the reference sample text;
and determining a second classification characteristic word of a second target object contained in each initial training sample based on the class sequence rule.
8. The method of claim 7, wherein the reference sample text is a sentence, and wherein determining the class sequence rule based on the reference sample text comprises:
performing word segmentation processing on the reference sample text to obtain second words;
determining the reference characteristic words contained in each second participle;
labeling the reference sample text based on the part of speech of each second participle and the word category of each reference characteristic 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.
9. The method of claim 8, wherein mining the class sequence rule based on the annotated sequence of the reference sample text comprises:
and mining a class sequence rule of 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.
10. The method according to claim 6, wherein when the initial training samples include a specified type of word, the 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 includes:
for each initial training sample, combining the specified type word with the corresponding second classification characteristic word to obtain a combined second classification characteristic word;
labeling the classification label of each initial training sample based on the combined second classification feature words to obtain each labeled training sample;
the training of the initial neural network model based on the labeled training samples and the second classification feature words corresponding to the samples comprises the following steps:
and training the initial neural network model based on the labeled training samples and the combined second classification feature words corresponding to the training samples.
11. The method of claim 6, wherein the classification model is a Convolutional Neural Network (CNN) model, and the CNN model comprises a text feature extraction module, a classification 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 first target objects contained in the text to be classified and extracting word features of the first classified feature words;
the feature fusion module is used for splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
the classification module is configured to, for each first target object, obtain a classification result corresponding to the target object based on the combined feature corresponding to the first target object.
12. The method according to claim 6, 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 feature of the first classification feature word is extracted based on the first classification feature word obtained by combining the first classification feature word with the corresponding specified type word, the specified type word comprises at least one of a degree word or a negative word which influences the emotion degree of the first classification feature word.
13. A sorting apparatus, comprising:
the classification characteristic word determining module is used for determining a first classification characteristic word 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 splicing the word features of the first classification feature words of the first target objects with the text features respectively to obtain the combination features corresponding to the first target objects;
and the classification result determining module is used for obtaining a classification result corresponding to the first target object based on the combination characteristic corresponding to the first target object for each first target object.
14. 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-12.
15. A computer-readable storage medium, for storing a computer program which, when run on a computer, causes the computer to perform the method of any of claims 1-12.
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 true CN111159412A (en) 2020-05-15
CN111159412B 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)

Cited By (7)

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

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050108001A1 (en) * 2001-11-15 2005-05-19 Aarskog Brit H. Method and apparatus for textual exploration discovery
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050108001A1 (en) * 2001-11-15 2005-05-19 Aarskog Brit H. Method and apparatus for textual exploration discovery
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" *
邢昌帅: "大规模网络文本的细粒度情感分析技术研究" *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111382959A (en) * 2020-05-29 2020-07-07 双胞胎(集团)股份有限公司 Progress control method based on data queue and pig feed production method
CN111382959B (en) * 2020-05-29 2020-09-01 双胞胎(集团)股份有限公司 Progress control method based on data queue and pig feed production method
CN111813932A (en) * 2020-06-17 2020-10-23 北京小米松果电子有限公司 Text data processing method, text data classification device and readable storage medium
CN111813932B (en) * 2020-06-17 2023-11-14 北京小米松果电子有限公司 Text data processing method, text data classifying device and readable storage medium
CN112083806A (en) * 2020-09-16 2020-12-15 华南理工大学 Self-learning emotion interaction method based on multi-modal recognition
CN112083806B (en) * 2020-09-16 2021-10-26 华南理工大学 Self-learning emotion interaction method based on multi-modal recognition
CN112487143A (en) * 2020-11-30 2021-03-12 重庆邮电大学 Public opinion big data analysis-based multi-label text classification method
CN112860887A (en) * 2021-01-18 2021-05-28 北京奇艺世纪科技有限公司 Text labeling method and device
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
CN114491040A (en) * 2022-01-28 2022-05-13 北京百度网讯科技有限公司 Information mining method and device

Also Published As

Publication number Publication date
CN111159412B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN111159412B (en) Classification method, classification device, electronic equipment and readable storage medium
CN110968700B (en) Method and device for constructing domain event map integrating multiple types of affairs and entity knowledge
CN108363790B (en) Method, device, equipment and storage medium for evaluating comments
CN108446271B (en) Text emotion analysis method of convolutional neural network based on Chinese character component characteristics
CN110427623A (en) Semi-structured document Knowledge Extraction Method, device, electronic equipment and storage medium
RU2679988C1 (en) Extracting information objects with the help of a classifier combination
US20190392035A1 (en) Information object extraction using combination of classifiers analyzing local and non-local features
CN117076653B (en) Knowledge base question-answering method based on thinking chain and visual lifting context learning
CN111143569A (en) Data processing method and device and computer readable storage medium
CN112183094A (en) Chinese grammar debugging method and system based on multivariate text features
CN107832297B (en) Feature word granularity-oriented domain emotion dictionary construction method
CN108875743B (en) Text recognition method and device
CN113761868B (en) Text processing method, text processing device, electronic equipment and readable storage medium
CN111611393A (en) Text classification method, device and equipment
CN114840685A (en) Emergency plan knowledge graph construction method
CN111178080A (en) Named entity identification method and system based on structured information
CN112380844A (en) Weapon equipment attribute synonym expansion method
CN111950281A (en) Demand entity co-reference detection method and device based on deep learning and context semantics
CN110874408B (en) Model training method, text recognition device and computing equipment
Mir et al. Multi-Level Knowledge Engineering Approach for Mapping Implicit Aspects to Explicit Aspects.
Suriyachay et al. Thai named entity tagged corpus annotation scheme and self verification
CN114201957A (en) Text emotion analysis method and device and computer readable storage medium
Poetsch et al. A Word Embedding Analysis towards Ontology Enrichment.
Gayen et al. Automatic identification of Bengali noun-noun compounds using random forest
Xu et al. Understanding the semantic intent of natural language query

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