Object classification method, device, computer equipment and computer readable storage medium
Through semantic and sequence feature extraction technology, combined with Transformer Encoder and GRU modules, the problem of inaccurate determination of emotion categories in existing multi-label sentiment analysis is solved, and the accurate identification of text emotion categories is achieved, which is suitable for a variety of application scenarios.
Patent Information
- Application Number
- CN202210204715.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-03
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-03-03
AI Technical Summary
Existing multi-label sentiment analysis techniques cannot accurately determine the emotional categories in the text, resulting in low classification accuracy.
By obtaining the text to be classified, semantic feature extraction and sequence feature extraction, combining the training object classification model and Transformer Encoder module, GRU module and other technologies, high-quality text feature information is extracted, and the target emotional category is accurately determined.
It improves the accuracy of emotional categories and can accurately determine the target emotional categories of the object to be evaluated. It is suitable for a variety of application scenarios such as e-commerce, recommendation, logistics and takeaway services.
Smart Images

Figure CN116756306B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an object classification method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] Sentiment analysis is one of the important issues in the field of natural language processing. It aims to discover the emotional tendency in text, which has great research value in both academic and application. Among them, sentiment analysis includes multi-label sentiment analysis.
[0003] At present, multi-label sentiment analysis generally regards the task as a multi-label text classification task, using a neural network model to classify the text to be classified and obtain the sentiment category for the text to be classified. However, the accuracy of the sentiment category obtained by the current multi-label sentiment analysis for text classification is not high.
[0004] In summary, existing multi-label sentiment analysis cannot accurately determine the sentiment category. Summary of the invention
[0005] The embodiments of the present application provide an object classification method, apparatus, computer device, and computer-readable storage medium, which can accurately determine the target emotion category of an object to be evaluated.
[0006] An object classification method, comprising:
[0007] Obtaining text to be classified for the object to be evaluated;
[0008] Extracting semantic features from the text to be classified to obtain first text feature information;
[0009] Performing sequence feature extraction on the first text feature information to obtain second text feature information;
[0010] According to the second text feature information, a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated is determined.
[0011] Accordingly, an embodiment of the present application provides an object classification device, including:
[0012] A first acquisition unit may be used to acquire a text to be classified for an object to be evaluated;
[0013] The first extraction unit can be used to extract semantic features of the text to be classified to obtain first text feature information;
[0014] The second extraction unit may be used to perform sequence feature extraction on the first text feature information to obtain second text feature information;
[0015] The determination unit may be configured to determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information.
[0016] In some embodiments, the first text feature information is information obtained by feature extraction using a trained object classification model; the object classification device also includes a training unit, which can be specifically used to obtain a text sample set, the text sample set includes at least one text sample annotated with a sentiment classification label; the object classification model to be trained is used to extract features from the text samples to obtain target feature information corresponding to the text samples; according to the target feature information and the sentiment classification label, the object classification model to be trained is converged to obtain a trained object classification model.
[0017] In some embodiments, the training unit can be specifically used to obtain reference text feature information corresponding to at least one object to be evaluated; calculate reference weight information of the target feature information relative to the reference text feature information; fuse the target feature information of the text sample according to the reference weight information to obtain the fused feature information of the text sample for the object to be evaluated; converge the classification model of the object to be trained according to the fused feature information and the sentiment classification label to obtain a trained object classification model.
[0018] In some embodiments, the training unit can be specifically used to obtain a set of candidate text samples and sentiment classification labels, the candidate text sample set including at least one candidate text sample; preprocess the candidate text samples to obtain text samples; and annotate the text samples according to the sentiment classification labels to generate a text sample set.
[0019] In some embodiments, the training unit can be specifically used to use the semantic feature extraction layer of the classification model of the object to be trained to extract semantic features from the text sample to obtain first sample feature information corresponding to the text sample; use the sequence feature extraction layer of the classification model of the object to be trained to extract sequence features from the text sample to obtain second sample feature information of the text sample; and use the second sample feature information as target feature information.
[0020] In some embodiments, the object classification device further includes a second acquisition unit, which can be specifically used to acquire template text feature information corresponding to at least one object to be evaluated.
[0021] Correspondingly, the determination unit may be specifically configured to determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
[0022] In some embodiments, the determination unit can be specifically used to calculate the weight information of the second text feature information for the template text feature information; based on the weight information, the second text feature information is fused to obtain the target fused text feature information of the text to be classified for the object to be evaluated; based on the target fused text feature information, the target emotion category corresponding to the target object to be evaluated in the objects to be evaluated is calculated.
[0023] In some embodiments, the determination unit may be specifically configured to calculate target similarity information between the second text feature information and the template text feature information; and calculate weight information of the second text feature information with respect to the template text feature information based on the target similarity information.
[0024] In some embodiments, the determination unit may be specifically configured to calculate classification information of the object to be evaluated based on the second text feature information and the template text feature information; and determine a target emotion category corresponding to the target object to be evaluated based on the classification information.
[0025] In some embodiments, the determination unit can be specifically used to filter out the target object to be evaluated corresponding to the text to be classified from the object to be evaluated based on the second text feature information; and calculate the target emotion category corresponding to the target object to be evaluated based on the template text feature information and the second text feature information corresponding to the target object to be evaluated.
[0026] In some embodiments, the first extraction unit may be specifically configured to perform feature extraction on the text to be classified to obtain initial text feature information; and determine the first text feature information based on the initial text feature information.
[0027] In addition, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any object classification method provided in the embodiment of the present application.
[0028] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for loading by a processor to execute any object classification method provided in the embodiment of the present application.
[0029] In addition, an embodiment of the present application also provides a computer program product, including a computer program, which implements any object classification method provided in the embodiment of the present application when the computer program is executed by a processor.
[0030] The embodiment of the present application can obtain a text to be classified for an object to be evaluated; perform semantic feature extraction on the text to be classified to obtain first text feature information; perform sequence feature extraction on the first text feature information to obtain second text feature information; and determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated based on the second text feature information; because the embodiment of the present application can perform semantic feature extraction on the text to be classified to obtain first text feature information and perform sequence feature extraction on the first text feature information to obtain second text feature information, high-quality second text feature information having text semantic feature information and sequence feature information can be extracted, so that the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated can be accurately determined based on the second text feature information. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0032] Figure 1 is a scene schematic diagram of the object classification method provided in an embodiment of the present application;
[0033] Figure 2 is a flowchart of an object classification method provided in an embodiment of the present application;
[0034] Figure 3 It is a flowchart of training a classification model of an object to be trained to obtain a trained object classification model provided by an embodiment of the present application;
[0035] Figure 4 FIG2 is a second flow chart of the object classification method provided in the embodiment of the present application;
[0036] Figure 5 3 are schematic diagrams of the process of the object classification method provided in the embodiment of the present application;
[0037] Figure 6 is a structural diagram of a classification model of an object to be trained provided in an embodiment of the present application;
[0038] Figure 7 is a structural diagram of a transformer encoder module provided in an embodiment of the present application;
[0039] Figure 8 It is a structural diagram of the GRU module provided in an embodiment of the present application;
[0040] Fig. 9is a structural diagram of the Attention-Pooling module provided in an embodiment of the present application;
[0041] Fig.10 is a structural diagram of a linear classifier provided in an embodiment of the present application;
[0042] Fig.11 is a schematic diagram of the structure of an object classification device provided in an embodiment of the present application;
[0043] Fig.12 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0045] The embodiments of the present application provide an object classification method, apparatus, computer device and computer readable storage medium. The object classification apparatus can be integrated in a computer device, which can be a server or a terminal.
[0046] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.
[0047] Among them, the embodiments of the present application involve artificial intelligence (AI), which is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0048] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0049] For example, see Figure 1 Taking the object classification device integrated in a computer device as an example, the computer device can obtain a text to be classified for an object to be evaluated; perform semantic feature extraction on the text to be classified to obtain first text feature information; perform sequence feature extraction on the first text feature information to obtain second text feature information; and determine a target emotion category corresponding to a target object to be evaluated in the object to be evaluated based on the second text feature information.
[0050] The object to be evaluated may refer to a sub-object on a dimension to be evaluated of the object. The object may include an object to be evaluated and an object to be recommended. The object to be evaluated may be a merchant, a commodity, a delicacy, an app, a film or television work, etc. The object to be evaluated may be a preset object to be evaluated or a determined object to be evaluated.
[0051] For example, when the object is a food merchant, the objects to be evaluated may include the taste of the food, the hygiene of the food merchant, and the service quality of the food merchant; for example, when the object is a film or television work, the objects to be evaluated may include the acting skills of the actors in the film or television work, the special effects of the film or television work, and the plot of the film or television work; and so on.
[0052] The first text feature information may refer to feature information that characterizes the text semantics of the text to be classified. Since the second text feature information is feature information extracted by performing sequence feature extraction on the first text feature information, based on this, the second text feature information may be text semantic feature information arranged in a certain sequence, that is, the second text feature information may be text sequence feature information carrying text semantic feature information.
[0053] The emotion categories may include positive emotion categories, negative emotion categories, and neutral emotion categories. The target emotion category may refer to at least one emotion category among the emotion categories.
[0054] A positive emotion category may refer to a category with a positive emotion tendency toward the object to be evaluated; a negative emotion category may refer to a category with a negative emotion tendency toward the object to be evaluated; and a neutral emotion category may refer to a category with neither a positive emotion tendency nor a negative emotion tendency toward the object to be evaluated. For example, when the object to be evaluated is the taste of food from a gourmet food merchant, the emotion category includes a favorable comment on the taste of the food from the gourmet food merchant and a unfavorable comment on the taste of the food from the gourmet food merchant; a favorable comment on the taste of the food from the gourmet food merchant is a positive emotion category under the taste of the food from the gourmet food merchant, and a unfavorable comment on the taste of the food from the gourmet food merchant is a negative emotion category under the taste of the food from the gourmet food merchant.
[0055] The template text feature information may refer to text information collected in advance and stored according to classification categories. For example, when the classification category is the food taste classification category of a gourmet merchant, the template text feature information may be text information evaluating the food taste, such as, the taste is good; or, the food is unpalatable; etc.
[0056] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0057] This embodiment will be described from the perspective of an object classification device, which can be specifically integrated in a computer device, which can be a server or a terminal. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), a wearable device, a virtual reality device, or other smart devices that can acquire data.
[0058] like Figure 2 As shown, the specific process of the object classification method is as follows: Steps S101-S104:
[0059] S101, obtaining text to be classified for an object to be evaluated.
[0060] The object to be evaluated may refer to a sub-object on a dimension to be evaluated. The object may include an object to be evaluated and an object to be recommended, such as a merchant, a commodity, a delicacy, an app, a film or television work, etc. The object to be evaluated may be a preset object to be evaluated or a determined object to be evaluated.
[0061] The text to be classified in the embodiment of the present application may be text acquired by a computer device in real time, or may be text stored in a database.
[0062] S102: Extract semantic features from the text to be classified to obtain first text feature information.
[0063] The first text feature information may refer to feature information representing the text semantics of the text to be classified.
[0064] In the embodiment of the present application, semantic features are extracted from the text to be classified, and the method of obtaining the first text feature information can be as follows:
[0065] For example, the computer device extracts features from the text to be classified to obtain initial text feature information; and determines the first text feature information based on the initial text feature information.
[0066] Among them, the first text feature information of the embodiment of the present application can be feature information extracted by using a semantic feature extraction model in the related art. The semantic feature extraction model has multiple neural network layers. Based on this, the embodiment of the present application can use the first neural network layer in the semantic feature extraction model to extract features and obtain initial text feature information; then, use at least one neural network layer after the first neural network layer in the semantic feature extraction model to extract semantic features from the initial text feature information to obtain the first text feature information.
[0067] The first text feature information of the embodiment of the present application may be feature information extracted by using a trained object classification model. The computer device may extract features from the text to be classified using a word embedding layer of the trained object classification model to obtain initial text feature information.
[0068] Since the initial text feature information can be represented in the form of a matrix, based on this, the embodiment of the present application can divide the matrix of the initial text feature information into several parts through the trained object classification model to form several sub-initial text feature information; according to the sub-initial text feature information, the attention text feature information corresponding to the sub-initial text feature information is determined. Then, the embodiment of the present application fuses the attention text feature information through the trained object classification model to obtain fused text feature information; fuses the fused text feature information with the initial text feature information to obtain candidate fused text feature information; and determines the first text feature information according to the candidate fused text feature information.
[0069] Among them, when the first text feature information of the embodiment of the present application is feature information extracted by using a trained object classification model, the embodiment of the present application can train the object classification model to be trained to obtain a trained object classification model.
[0070] like Figure 3 As shown, the process of training the object classification model to be trained to obtain the trained object classification model in the embodiment of the present application can be detailed in the following steps A1-A3:
[0071] A1. Obtain a text sample set.
[0072] The text sample set includes at least one text sample marked with a sentiment classification label.
[0073] The embodiment of the present application can label the text sample with a sentiment classification label, so that the text sample labeled with the sentiment classification label can be obtained.
[0074] Before step A1, the computer device may pre-process the data. The computer device may pre-process the data in a manner including cleaning the data and amplifying the data.
[0075] Based on the above, the computer device may preprocess the data in the following ways: the computer device may obtain a set of candidate text samples and sentiment classification labels, wherein the set of candidate text samples includes at least one candidate text sample; preprocess the candidate text samples to obtain text samples; and label the text samples according to the sentiment classification labels to generate a set of text samples.
[0076] When the method of preprocessing the data is to clean the data, the candidate text sample may refer to an initial text sample that has not been preprocessed and has noise. For example, when invalid characters exist in the initial text sample, the initial text sample may be referred to as a candidate text sample; wherein, invalid characters may include emoticons, garbled symbols, consecutively repeated punctuation marks, spaces, etc. For another example, when a font different from a preset font exists in the initial text sample, the initial text sample may be referred to as a candidate text sample; for example, if the preset font is simplified Chinese, when the initial text sample contains traditional Chinese characters, the initial text sample may be referred to as a candidate text sample.
[0077] Based on the above, when the method of preprocessing data is to clean the data, the embodiment of the present application preprocesses the candidate text samples, and the method of obtaining the text samples may include but is not limited to: when there are invalid characters in the candidate text samples, the computer device can delete the invalid characters; when there are fonts different from the preset fonts in the candidate text samples, the computer device can convert the fonts different from the preset fonts into the preset fonts.
[0078] After the embodiment of the present application cleans the data, that is, after the candidate text sample is cleaned, the cleaned candidate text sample is obtained, and the cleaned candidate text sample can also be processed by word segmentation and stop word removal to obtain a processed candidate text sample. For word segmentation, the embodiment of the present application uses an open source word segmentation tool - Jieba word segmenter for word segmentation. For stop word removal, the embodiment of the present application directly stops the word list and deletes the stop words in the sentence.
[0079] When the method for preprocessing data is to amplify data, the embodiment of the present application preprocesses the candidate text sample, and the method for obtaining the text sample may include but is not limited to one of the following methods: (1) Random insertion: the computer device obtains a preset text and randomly inserts the preset text into the candidate text sample to obtain a text sample; wherein the preset text may include non-stop words and stop words. The preset text may be a text in a dictionary. (2) Synonym replacement: the computer device randomly extracts a target text from the candidate text sample; obtains a synonymous text of the target text, and replaces the target text in the candidate text sample with the synonymous text, thereby obtaining a text sample. wherein the target text may be a non-stop word, and the target text may include at least one target text. (3) Random exchange: the computer device randomly extracts different texts from different candidate text samples for exchange, thereby obtaining a text sample. (4) Random deletion: the computer device randomly deletes punctuation marks in the candidate text sample to obtain a deleted candidate text sample; randomly extracts text of a preset length from different deleted candidate text samples for exchange, and repeats multiple times, thereby obtaining a text sample. (5) Data back-translation: The computer device translates the candidate text sample into a first translated candidate text sample in a different language from the candidate text sample; and translates the translated candidate text sample into a second translated candidate text sample in the same language as the candidate text sample, and the second translated candidate text sample and the candidate text sample are the text sample. Among them, data back-translation can maximize the guarantee that the candidate text sample and the second translated candidate text sample are semantically consistent, and the wording and language order are changed, thereby increasing the diversity and amount of data. In the embodiment of the present application, the computer device can call the translation interface to implement data back-translation.
[0080] The embodiment of the present application amplifies the data to prevent the situation of insufficient text samples, thereby improving the accuracy of the object classification model after training. The embodiment of the present application can increase the amount of text samples to 5 times the original amount by amplifying the data as described above.
[0081] Among them, the emotion category label corresponding to the text sample can be obtained by annotating the text sample. However, since the computer device may use different annotation strategies to annotate the text sample, the emotion classification label of the text sample may be different. For example, the annotation strategy includes a first annotation strategy and a second annotation strategy. The same two text samples are a first text sample and a second text sample. The first text sample is annotated with the first annotation strategy to obtain a first emotion classification label, and the second text sample is annotated with the second annotation strategy to obtain a second emotion classification label. Therefore, the embodiment of the present application needs to pre-process the preset emotion classification label corresponding to the text sample to obtain the emotion classification label.
[0082] Based on the above, the method for obtaining the sentiment classification label corresponding to the text sample in the embodiment of the present application can be: the computer device obtains the preset sentiment classification label corresponding to the text sample; and preprocesses the preset sentiment classification label to obtain the sentiment classification label.
[0083] Among them, the method for preprocessing the preset emotion classification label in the embodiment of the present application can be: the computer device obtains the modification instruction of the preset emotion classification label; according to the modification instruction, the preset emotion classification label is modified to obtain the emotion classification label.
[0084] A2. Use the classification model of the object to be trained to extract features from the text sample to obtain target feature information corresponding to the text sample.
[0085] Among them, the embodiment of the present application uses the classification model of the object to be trained to extract features from the text sample, and the method for obtaining the target feature information corresponding to the text sample can be as follows: the computer device extracts semantic features from the text sample to obtain first sample feature information; performs sequence feature extraction on the first sample feature information to obtain second sample feature information; and uses the second sample feature information as the target feature information.
[0086] Specifically, the embodiment of the present application can use the semantic feature extraction layer of the classification model of the object to be trained to perform semantic feature extraction on the text sample to obtain first sample feature information corresponding to the text sample; and use the sequence feature extraction layer of the classification model of the object to be trained to perform sequence feature extraction on the text sample to obtain second sample feature information of the text sample.
[0087] A3. According to the target feature information and sentiment classification labels, the classification model of the object to be trained is converged to obtain the trained object classification model.
[0088] In the embodiment of the present application, there are multiple ways to converge the classification model of the object to be trained according to the target feature information and the sentiment classification label, and obtain the trained object classification model, as detailed below:
[0089] For example, a computer device can predict a text sample based on target feature information to obtain a predicted emotion category corresponding to the text sample; use a loss function to calculate a first loss value between the predicted emotion category and the emotion classification label; and based on the first loss value, converge the classification model of the object to be trained to obtain a trained object classification model.
[0090] For another example, a computer device can obtain reference text feature information corresponding to at least one object to be evaluated; calculate reference weight information of the target feature information relative to the reference text feature information; fuse the target feature information of the text sample according to the reference weight information to obtain fused feature information of the text sample for the object to be evaluated; and converge the classification model of the object to be trained according to the fused feature information and the sentiment classification label to obtain a trained object classification model.
[0091] The target feature information includes several target feature information of the text sample. In the embodiment of the present application, the text sample can be segmented to obtain several segmented texts of the text sample; and features can be extracted from each segmented text to obtain several target feature information corresponding to the text sample.
[0092] Among them, the method for calculating the reference weight information of the target feature information for the reference text feature information in the embodiment of the present application can be: the computer device calculates the candidate similarity information between the target feature information and the reference text feature information; based on the candidate similarity information, determines the reference weight information of the target feature information for the reference text feature information.
[0093] The embodiment of the present application can perform normalization processing on the candidate similarity information to obtain reference weight information.
[0094] S103: Perform sequence feature extraction on the first text feature information to obtain second text feature information.
[0095] Since the second text feature information is feature information obtained by performing sequence feature extraction on the first text feature information, based on this, the second text feature information can be text semantic feature information arranged in a certain sequence, that is, the second text feature information can be text sequence feature information carrying text semantic feature information.
[0096] In the embodiment of the present application, an LSTM neural network can be used to extract sequence features from the first text feature information to obtain the second text feature information. The LSTM neural network can be integrated into the trained object classification model.
[0097] In addition to the above, the embodiment of the present application can also use a GRU neural network to extract sequence features from the first text feature information to obtain the second text feature information. The GRU neural network can be integrated into the trained object classification model.
[0098] S104: Determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information.
[0099] In this embodiment of the present application, before determining the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information, template text feature information corresponding to at least one object to be evaluated may also be obtained.
[0100] In an embodiment of the present application, a computer device may obtain a template text corresponding to a target object to be evaluated, and perform feature extraction on the template text to obtain feature information of the template text corresponding to the target object to be evaluated. The template text in the embodiment of the present application may refer to text that is pre-collected and stored corresponding to the object to be evaluated.
[0101] Based on the above, the embodiment of the present application determines the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information. The method can be: the computer device determines the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
[0102] Based on the above, there are multiple ways for the computer device to determine the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information:
[0103] For example, the computer device can calculate the weight information of the second text feature information for the template text feature information; based on the weight information, the second text feature information is fused to obtain the target fused text feature information of the text to be classified for the object to be evaluated; based on the target fused text feature information, the target emotion category corresponding to the target object to be evaluated in the objects to be evaluated is calculated.
[0104] Among them, the method for calculating the weight information of the second text feature information for the template text feature information in the embodiment of the present application can be: calculating the target similarity information between the second text feature information and the template text feature information; and calculating the weight information of the second text feature information for the template text feature information based on the target similarity information.
[0105] Among them, the embodiment of the present application can normalize the target similarity information to obtain the weight information of the second text feature information with respect to the template text feature information.
[0106] Among them, in the embodiment of the present application, the method of fusing the second text feature information according to the weight information can be weighted summation, thereby realizing fusion processing.
[0107] Based on the above, the computer device can determine the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated based on the second text feature information and the template text feature information as follows: the computer device can calculate the classification information of the object to be evaluated based on the target fused text feature information; and determine the target emotion category corresponding to the target object to be evaluated based on the classification information.
[0108] Among them, the embodiment of the present application uses a classifier to classify the object to be evaluated according to the target fused text feature information to obtain the classification information of the object to be evaluated, and the classification information represents the classification probability of each emotion category in the object to be evaluated. When the classification information is greater than the preset probability threshold, the emotion category corresponding to the classification information is the target emotion category corresponding to the target object to be evaluated.
[0109] For another example, the method for an embodiment of the present application to determine the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated based on the second text feature information and the template text feature information can be: the computer device can filter out the target object to be evaluated corresponding to the text to be classified from the objects to be evaluated based on the second text feature information; and calculate the target emotion category corresponding to the target object to be evaluated based on the template text feature information and the second text feature information corresponding to the target object to be evaluated.
[0110] Among them, the method of the embodiment of the present application for screening out the target object to be evaluated corresponding to the text to be classified from the object to be evaluated according to the second text feature information can be: obtaining a preset evaluation text for the object to be evaluated; performing feature extraction on the preset evaluation text to obtain preset evaluation text feature information; calculating the reference similarity between the preset evaluation text and the text to be classified according to the preset evaluation text feature information and the second text feature information; and taking the object to be evaluated corresponding to the largest reference similarity as the target object to be evaluated.
[0111] The process of calculating the target emotion category corresponding to the target object to be evaluated according to the template text feature information and the second text feature information corresponding to the target object to be evaluated can be referred to above and will not be repeated here.
[0112] The embodiment of the present application can obtain a text to be classified for an object to be evaluated; perform semantic feature extraction on the text to be classified to obtain first text feature information; perform sequence feature extraction on the first text feature information to obtain second text feature information; and determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated based on the second text feature information; because the embodiment of the present application can perform semantic feature extraction on the text to be classified to obtain first text feature information and perform sequence feature extraction on the first text feature information to obtain second text feature information, high-quality second text feature information having text semantic feature information and sequence feature information can be extracted, so that the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated can be accurately determined based on the second text feature information.
[0113] According to the method described in the above embodiment, the following is further described in detail with examples.
[0114] In this embodiment, the object classification device is specifically integrated into a computer device, which may be a server or a terminal.
[0115] First of all, it should be noted that the embodiments of the present application can be applied to e-commerce, recommendations, logistics and takeaway, security audit and other businesses.
[0116] Specifically: (1) In e-commerce business, the embodiments of the present application can be used to analyze users' evaluations of goods, verify the advantages and disadvantages of different merchants and different goods, and give evaluation conclusions for each object to be evaluated, so as to start from the negative emotion category of the object to be evaluated to improve the user experience. (2) In the recommendation business, the embodiments of the present application can be used to mark out the content that different users are interested in, such as the targeted recommendation of merchants with the evaluation of taste as a positive emotion category and price as a positive emotion category in food recommendation. (3) In the logistics and takeaway business, the embodiments of the present application can be used to mark different responsible persons, such as the evaluation of takeaway with the emotion category of taste as a positive emotion category and the emotion category of delivery as a negative emotion category, so as to improve the service quality. (4) In the security review business, the embodiments of the present application can be used to analyze barrage comments, article comments, etc., such as extracting negative insults and other information for blocking.
[0117] like Figure 4 As shown, an object classification method, the specific process is as follows: step S201 to step S207:
[0118] S201. A computer device obtains a text sample set.
[0119] The text sample set includes at least one text sample marked with a sentiment classification label.
[0120] In the embodiment of the present application, sentiment classification labels can be marked on text samples, so that text samples corresponding to the sentiment classification labels can be obtained.
[0121] In the embodiment of the present application, before the computer device obtains the text sample set, the computer device may preprocess the data. Specifically, the computer device may preprocess the data as follows: the computer device may obtain a candidate text sample set and a sentiment classification label, wherein the candidate text sample set includes at least one candidate text sample; preprocess the candidate text sample to obtain a text sample; and annotate the text sample according to the sentiment classification label to generate a text sample set.
[0122] Among them, the computer equipment pre-processes data in the following ways: cleaning the data and amplifying the data.
[0123] like Figure 5 As shown, the embodiment of the present application can first clean the data and then amplify the data.
[0124] Specifically, the embodiment of the present application can clean the candidate text sample to obtain a cleaned candidate text sample; and amplify the cleaned candidate text sample to obtain a text sample.
[0125] Among them, the embodiment of the present application can clean the candidate text samples. The cleaning method can refer to the aforementioned cleaning process when invalid characters exist in the candidate text samples, and when a font different from the preset font exists in the candidate text sample, which will not be repeated here.
[0126] Among them, the embodiment of the present application can amplify the cleaned candidate text samples. The amplification method can refer to the aforementioned random insertion, synonym replacement, random exchange, random deletion, data back translation and other processes, which will not be repeated here.
[0127] The sentiment classification label corresponding to the text sample can be obtained by annotating the text sample. However, since computer devices may use different annotation strategies to annotate text samples, which may lead to differences in the sentiment classification labels of the text samples, the embodiment of the present application needs to pre-process the preset sentiment classification label corresponding to the text sample to obtain the sentiment classification label.
[0128] Based on the above, if Figure 5 As shown, before preprocessing the data, the embodiment of the present application can preprocess the preset sentiment classification label, that is, the method for the embodiment of the present application to obtain the sentiment classification label corresponding to the text sample can be: the computer device obtains the preset sentiment classification label corresponding to the text sample; preprocesses the preset sentiment classification label to obtain the sentiment classification label.
[0129] Among them, the method for preprocessing the preset emotion classification label in the embodiment of the present application can be: the computer device obtains the modification instruction for the preset emotion classification label; according to the modification instruction, the preset emotion classification label is modified to obtain the emotion classification label.
[0130] S202: The computer device uses the classification model of the object to be trained to extract features from the text sample to obtain target feature information corresponding to the text sample.
[0131] Among them, the embodiment of the present application can use the semantic feature extraction layer of the classification model of the object to be trained to extract semantic features of the text sample to obtain first sample feature information corresponding to the text sample; and use the sequence feature extraction layer of the classification model of the object to be trained to extract sequence features of the text sample to obtain second sample feature information of the text sample.
[0132] Among them, Figure 6 As shown, the object classification model to be trained in the embodiment of the present application includes: a TransformerEncoder module, a GRU module, an Attention-Pooling module, and a linear classifier module.
[0133] Among them, the above-mentioned semantic feature extraction layer is the neural network layer in the Transformer Encoder module, and the sequence feature extraction layer is the neural network layer in the GRU module.
[0134] In the embodiment of the present application, the word embedding layer of the classification model of the object to be trained can be used to extract features from the text sample to obtain the initial text sample feature information. For example, the text sample in the embodiment of the present application includes "The food in this restaurant is delicious, but the service quality is poor". The word embedding layer can be integrated into the semantic feature extraction layer.
[0135] Then, the embodiment of the present application can use the Transformer Encoder module to extract semantic features from the initial text sample feature information to obtain first sample feature information; use the GRU module to extract sequence features from the first sample feature information to obtain second sample feature information; and use the second sample feature information as the target feature information.
[0136] Among them, the Transformer Encoder module is taken from the Encoder part of Transformer, and its structure is as follows Figure 7As shown. The Transformer Encoder module includes Multi-head self-attention (i.e., multi-head attention layer), Add&Norm (i.e., residual and normalization layer), and FFW (i.e., feedforward network layer). Add&Norm has two layers, and in the embodiment of the present application, the two layers of Add&Norm are respectively referred to as the first Add&Norm and the second Add&Norm. The calculation formula for each layer of the Transformer Encoder module is as follows:
[0137] In the embodiment of the present application, the calculation formula of Multi-head self-attention is detailed in formula (1) and formula (2):
[0138] In the embodiment of the present application, the initial text sample feature information can be represented in the form of a matrix. Multi-head self-attention can divide the matrix of the initial text sample feature information into several parts to form several sub-initial text sample feature information. For each sub-initial text sample feature information, the embodiment of the present application can use formula (1) to calculate and obtain the attention text sample feature information corresponding to each sub-initial text sample feature information:
[0139]
[0140] Where Q refers to the Query (i.e., query feature) corresponding to the feature information of the initial text sample; K T It refers to the transposition of the Key (i.e., key feature) corresponding to the feature information of the initial text sample; V refers to the Value (i.e., value item feature) corresponding to the feature information of the initial text sample; It is used to convert QK T The calculation result of becomes the parameter of normal distribution; Att i It refers to the attention text sample feature information corresponding to the i-th sub-initial text sample feature information.
[0141] In the embodiment of the present application, all the attention text sample feature information calculated by formula (1) is fused to obtain the fused text sample feature information, as shown in formula (2):
[0142] MH(QKV)=Concat(Att 1 , Att 2 ,...) Formula (2)
[0143] Among them, MH(QKV) refers to the fused text sample feature information; the Concat function is used to concatenate the feature information of all attention text samples.
[0144] In the embodiment of the present application, the initial text sample feature information and the fused text sample feature information are fused through the first Add&Norm to obtain the target fused text sample feature information, as shown in formula (3):
[0145]
[0146] in, refers to the feature information of the text sample after the target fusion; X refers to the feature information of the initial text sample; norml function is the activation function.
[0147] In the embodiment of the present application, FFW is used to process the feature information of the target fused text sample to obtain the feature information of the processed text sample. The calculation formula of FFW is shown in formula (4):
[0148]
[0149] in, It refers to the feature information of the processed text sample; the Linear function is the activation function of FFW.
[0150] In the embodiment of the present application, the second Add&Norm fuses the target fused text sample feature information and the processed text sample feature information to obtain the first sample feature information, as shown in formula (5):
[0151]
[0152] in, Refers to the first sample feature information.
[0153] The GRU module of the embodiment of the present application is taken from the GUR recurrent neural network in the existing related technology. The GRU module can solve the problems of gradient explosion and gradient disappearance in long-term memory and back propagation to a certain extent. Compared with LSTM, the use of the GRU module can make it easier to train the classification model of the training object, and can greatly improve the training efficiency of the classification model of the training object.
[0154] Of course, in the embodiment of the present application, the LSTM neural network can be used to replace the GRU module.
[0155] The embodiment of the present application uses a GRU module to extract sequence features from the first sample feature information to obtain the second sample feature information.
[0156] Among them, the structure of the GRU module in the embodiment of the present application is as follows Figure 8As shown in the figure, the GRU module has an update gate and a reset gate. The update gate is used to control the extent to which the state information of the previous moment is brought into the current state. The larger the value of the update gate, the more state information of the previous moment is brought in. The reset gate controls how much information of the previous state is written to the current candidate set. The smaller the reset gate, the less information of the previous state is written.
[0157] S203. The computer device converges the classification model of the object to be trained according to the target feature information and the sentiment classification label to obtain a trained object classification model.
[0158] In the embodiment of the present application, according to the target feature information and the sentiment classification label, the classification model of the object to be trained is converged, and the method of obtaining the trained object classification model can be as follows:
[0159] For example, a computer device can obtain reference text feature information corresponding to at least one object to be evaluated; calculate reference weight information of the target feature information relative to the reference text feature information; fuse the target feature information of the text sample according to the reference weight information to obtain fused feature information of the text sample for the object to be evaluated; and converge the classification model of the object to be trained according to the fused feature information and the sentiment classification label to obtain a trained object classification model.
[0160] Among them, in an embodiment of the present application, when the target feature information is the second sample feature information, the Attention-Pooling module of the embodiment of the present application can be used to associate the second sample feature information obtained by the GRU module with the reference text feature information, thereby increasing the accuracy of text classification of the trained object classification model.
[0161] Among them, the method for obtaining reference text feature information corresponding to at least one object to be evaluated in the embodiment of the present application can be: the embodiment of the present application obtains a reference text of at least one object to be evaluated; uses a word embedding layer to extract features from the reference text to obtain reference text feature information corresponding to at least one object to be evaluated.
[0162] Among them, the embodiment of the present application can modify the candidate reference text to obtain the reference text, so that the reference texts of different objects to be evaluated are different, and the reference text is associated with the object to be evaluated.
[0163] The target feature information includes several target feature information of the text sample. In the embodiment of the present application, the text sample can be segmented to obtain several segmented texts of the text sample; and features can be extracted from each segmented text to obtain several target feature information corresponding to the text sample.
[0164] Among them, the method for calculating the reference weight information of the target feature information for the reference text feature information in the embodiment of the present application can be: the computer device calculates the candidate similarity information between the target feature information and the reference text feature information; based on the candidate similarity information, determines the reference weight information of the target feature information for the reference text feature information.
[0165] The embodiment of the present application can perform normalization processing on the candidate similarity information to obtain reference weight information.
[0166] For example, the structure of the Attention-Pooling module in the embodiment of the present application is as follows: Fig. 9 As shown. The Attention-Pooling module of the embodiment of the present application uses the target feature information as the Key (i.e., key feature) and Value (i.e., value item feature) of the Attention-Pooling module, and uses the reference text feature information as the Query (i.e., query feature). First, the Query and the Key are dot-producted to obtain the candidate similarity information between the Query and the Key, and then the candidate similarity information is input into the Softmax layer. The Softmax function is used to calculate and obtain the probability weights of the normalized target feature information and the reference text feature information. The probability weights are the reference weight information.
[0167] Among them, when the object is a food merchant, the reference text feature information may include reference text feature information that the object to be evaluated is the taste of the food, reference text feature information that the object to be evaluated is hygiene, and reference text feature information that the object to be evaluated is service quality.
[0168] Then, for the reference text feature information corresponding to each object to be evaluated, the Attention-Pooling module performs weighted summation on several target feature information of the text sample according to the reference weight information corresponding to the reference text feature information to obtain reference classification information. The reference classification information represents the reference classification information corresponding to each object to be evaluated.
[0169] Based on the above, after the reference classification information corresponding to each object to be evaluated passes through the Attention layer of the Attention-Pooling module, a tensor of dimension m×n can be obtained, where m is the number of labels and n is the hidden layer dimension.
[0170] Based on the tensor of dimension m×n obtained by the Attention-Pooling module based on the reference classification information, the embodiment of the present application classifies the text sample through the linear classifier module. The structure of the linear classifier module is as follows: Fig.10 As shown, the linear classifier module includes a linear layer and a softmax layer.
[0171] According to the reference classification information, the linear layer of the linear classifier module outputs the number of sentiment categories of each object to be evaluated, and then, through the softmax layer of the linear classifier module, the classification probability of the sentiment category of each object to be evaluated is output; for each object to be evaluated, the reference sentiment category of the text sample is selected according to the classification probability of the sentiment category of the object to be evaluated. When the classification probability of the sentiment category under the object to be evaluated is the largest, the sentiment category is the reference sentiment category of the object to be evaluated.
[0172] Among them, the number of emotion categories under each object to be evaluated output by the linear layer of the linear classifier module in the embodiment of the present application can be set according to demand. For example, when the number of emotion categories is 3, the emotion categories include positive emotion categories, negative emotion categories, and neutral emotion categories for the object to be evaluated; when the number of emotion categories is 2, the emotion categories include positive emotion categories and negative emotion categories for the object to be evaluated.
[0173] Based on the above, the embodiment of the present application calculates the second loss value between the reference emotion category and the emotion classification label; the classification model of the object to be trained is converged according to the second loss value to obtain the trained object classification model.
[0174] In addition, if Figure 5 As shown, in the embodiment of the present application, after the linear classifier module of the classification model of the object to be trained outputs the reference emotion category of the text sample, the computer device obtains the text sample corresponding to the reference emotion category, and performs sampling review on the text sample corresponding to the reference emotion category, that is, the target text sample can be randomly extracted from the text sample corresponding to the reference emotion category, and the processes of data cleaning, data amplification and training the classification model of the object to be trained are repeated for the target text sample.
[0175] S204: The computer device obtains the text to be classified for the object to be evaluated.
[0176] Among them, the text to be classified in the embodiment of the present application can be text acquired by a computer device in real time, such as barrage in a video, text reviews of a food merchant, etc.
[0177] S205: The computer device uses the trained object classification model to extract semantic features from the text to be classified to obtain first text feature information.
[0178] The first text feature information of the embodiment of the present application may be feature information extracted by using the semantic feature extraction layer of the trained object classification model. The computer device extracts features from the text to be classified using the word embedding layer of the trained object classification model to obtain initial text feature information.
[0179] Since the initial text feature information can be represented in the form of a matrix, based on this, the embodiment of the present application can divide the matrix of the initial text feature information into several parts through the semantic feature extraction layer of the trained object classification model to form several sub-initial text feature information; according to the sub-initial text feature information, determine the attention text feature information corresponding to the sub-initial text feature information. Then, the embodiment of the present application fuses the attention text feature information through the trained object classification model to obtain fused text feature information; fuses the fused text feature information with the initial text feature information to obtain candidate fused text feature information; and determines the first text feature information based on the candidate fused text feature information. The specific process here can be found in the training part of the Transformer Encoder module in the aforementioned object classification model to be trained, which will not be repeated here.
[0180] S206: The computer device uses the trained object classification model to perform sequence feature extraction on the first text feature information to obtain second text feature information.
[0181] In the embodiment of the present application, a sequence feature extraction layer can be used to extract sequence features from the first text feature information to obtain the second text feature information. The sequence feature extraction layer is a neural network layer in the GRU module of the trained object classification model. The specific process here can be referred to the training part of the GRU module in the aforementioned object classification model to be trained, which will not be repeated here.
[0182] S207: The computer device determines a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information.
[0183] In this embodiment of the present application, before determining the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information, template text feature information corresponding to at least one object to be evaluated may also be obtained.
[0184] In an embodiment of the present application, a computer device may obtain a template text corresponding to a target object to be evaluated, and perform feature extraction on the template text to obtain feature information of the template text corresponding to the target object to be evaluated. The template text in the embodiment of the present application may refer to text that is pre-collected and stored corresponding to the object to be evaluated.
[0185] Based on the above, the embodiment of the present application determines the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information. The method can be: the computer device determines the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
[0186] Based on the above, the computer device may determine the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information as follows:
[0187] For example, the computer device can calculate the weight information of the second text feature information for the template text feature information; based on the weight information, the second text feature information is fused to obtain the target fused text feature information of the text to be classified for the object to be evaluated; based on the target fused text feature information, the target emotion category corresponding to the target object to be evaluated in the objects to be evaluated is calculated.
[0188] Among them, the method for calculating the weight information of the second text feature information for the template text feature information in the embodiment of the present application can be: calculating the target similarity information between the second text feature information and the template text feature information; and calculating the weight information of the second text feature information for the template text feature information based on the target similarity information.
[0189] Among them, the embodiment of the present application can normalize the target similarity information to obtain the weight information of the second text feature information with respect to the template text feature information.
[0190] Among them, in the embodiment of the present application, the method of fusing the second text feature information according to the weight information can be weighted summation, thereby realizing fusion processing.
[0191] Based on the above, the computer device can determine the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated based on the second text feature information and the template text feature information as follows: the computer device can calculate the classification information of the object to be evaluated based on the target fused text feature information; and determine the target emotion category corresponding to the target object to be evaluated based on the classification information.
[0192] Among them, the embodiment of the present application uses a linear classifier to classify the object to be evaluated according to the target fused text feature information to obtain the classification information of the object to be evaluated, and the classification information represents the classification probability of each emotion category in the object to be evaluated. When the classification information is greater than the preset probability threshold, the emotion category corresponding to the classification information is the target emotion category corresponding to the target object to be evaluated.
[0193] The specific content of step S207 can be found in the training part of the Attention-Pooling module and the linear classifier module in the aforementioned classification model of the object to be trained, and will not be repeated here.
[0194] Based on the above, the embodiment of the present application can combine the Transformer Encoder module and the GRU module, retaining the advantages of both the Transformer Encoder module and the GRU module, so that the trained object classification model can not only extract text sequence feature information as well as the recurrent neural network, preventing the gradient vanishing and gradient explosion problems of long texts, but also better extract text semantic feature information. The subsequent Attention-Pooling module calculates the reference text feature information and the second sample feature information extracted by the GRU module, and introduces the semantic information of the reference text feature information, which can improve the accuracy and reliability of the trained object classification model in predicting the emotion category.
[0195] In addition to the above, the embodiments of the present application can meet different business logic requirements for high recall rate and high accuracy in different business scenarios by changing the network parameters of the classification model of the object to be trained, as well as the number of objects to be evaluated and reference text feature information of the reference text feature information. For example, the embodiments of the present application can be applied to the services of insult shielding, live broadcast interaction, sentiment analysis, targeted recommendation, etc. in image and text security review, which can increase business processing efficiency, thereby reducing manual operations and avoiding business risks.
[0196] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0197] The embodiment of the present application can obtain a text to be classified for an object to be evaluated; perform semantic feature extraction on the text to be classified to obtain first text feature information; perform sequence feature extraction on the first text feature information to obtain second text feature information; and determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated based on the second text feature information; because the embodiment of the present application can perform semantic feature extraction on the text to be classified to obtain first text feature information and perform sequence feature extraction on the first text feature information to obtain second text feature information, high-quality second text feature information having text semantic feature information and sequence feature information can be extracted, so that the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated can be accurately determined based on the second text feature information.
[0198] In order to better implement the above method, an embodiment of the present application also provides an object classification device, which can be integrated into a computer device, such as a server or a terminal. The terminal may include a tablet computer, a laptop computer and / or a personal computer.
[0199] For example, Fig.11As shown, the object classification device may include a first acquisition unit 301, a first extraction unit 302, a second extraction unit 303, a determination unit 304, a training unit 305, and a second acquisition unit 306, as follows:
[0200] (1) a first acquisition unit 301;
[0201] The first acquisition unit 301 may be used to acquire a text to be classified for an object to be evaluated.
[0202] (2) a first extraction unit 302;
[0203] The first extraction unit 302 may be used to extract semantic features from the text to be classified to obtain first text feature information.
[0204] In some embodiments, the first extraction unit 302 may be specifically configured to perform feature extraction on the text to be classified to obtain initial text feature information; and determine the first text feature information based on the initial text feature information.
[0205] (3) a second extraction unit 303;
[0206] The second extraction unit 303 may be used to perform sequence feature extraction on the first text feature information to obtain second text feature information.
[0207] (4) determining unit 304;
[0208] The determination unit 304 may be configured to determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information.
[0209] In some embodiments, the determination unit 304 may be specifically configured to determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
[0210] In some embodiments, the determination unit 304 can be specifically used to calculate the weight information of the second text feature information for the template text feature information; based on the weight information, the second text feature information is fused to obtain the target fused text feature information of the text to be classified for the object to be evaluated; based on the target fused text feature information, the target emotion category corresponding to the target object to be evaluated in the objects to be evaluated is calculated.
[0211] In some embodiments, the determination unit 304 may be specifically configured to calculate target similarity information between the second text feature information and the template text feature information; and calculate weight information of the second text feature information with respect to the template text feature information based on the target similarity information.
[0212] In some embodiments, the determination unit 304 may be specifically configured to calculate classification information of the object to be evaluated based on the target fused text feature information; and determine a target emotion category corresponding to the target object to be evaluated based on the classification information.
[0213] In some embodiments, the determination unit 304 can be specifically used to filter out a target object to be evaluated corresponding to the text to be classified from the objects to be evaluated based on the second text feature information; and calculate the target emotion category corresponding to the target object to be evaluated based on the template text feature information and the second text feature information corresponding to the target object to be evaluated.
[0214] (5) training unit 305;
[0215] The first text feature information is the information obtained by feature extraction using the trained object classification model; the training unit 305 can be used to obtain a text sample set, the text sample set includes at least one text sample annotated with a sentiment classification label; the object classification model to be trained is used to extract features from the text samples to obtain target feature information corresponding to the text samples; according to the target feature information and the sentiment classification label, the object classification model to be trained is converged to obtain the trained object classification model.
[0216] In some embodiments, the training unit 305 can be specifically used to obtain reference text feature information corresponding to at least one object to be evaluated; calculate reference weight information of the target feature information relative to the reference text feature information; fuse the target feature information of the text sample according to the reference weight information to obtain the fused feature information of the text sample for the object to be evaluated; and converge the classification model of the object to be trained according to the fused feature information and the sentiment classification label to obtain a trained object classification model.
[0217] In some embodiments, the training unit 305 can be specifically used to obtain a set of candidate text samples and sentiment classification labels, where the candidate text sample set includes at least one candidate text sample; preprocess the candidate text samples to obtain text samples; and annotate the text samples according to the sentiment classification labels to generate a set of text samples.
[0218] In some embodiments, the training unit 305 can be specifically used to perform semantic feature extraction on the text sample using the semantic feature extraction layer of the classification model of the object to be trained to obtain first sample feature information corresponding to the text sample; perform sequence feature extraction on the text sample using the sequence feature extraction layer of the classification model of the object to be trained to obtain second sample feature information of the text sample; and use the second sample feature information as the target feature information.
[0219] (6) a second acquisition unit 306;
[0220] The second acquisition unit 306 may be used to acquire template text feature information corresponding to at least one object to be evaluated.
[0221] As can be seen from the above, the first acquisition unit 301 of the embodiment of the present application can be used to acquire the text to be classified for the object to be evaluated; the first extraction unit 302 can be used to perform semantic feature extraction on the text to be classified to obtain first text feature information; the second extraction unit 303 can be used to perform sequence feature extraction on the first text feature information to obtain second text feature information; the determination unit 304 can be used to determine the target emotion category corresponding to the target object to be evaluated in the object to be evaluated based on the second text feature information; since the embodiment of the present application can perform semantic feature extraction on the text to be classified to obtain the first text feature information and perform sequence feature extraction on the first text feature information to obtain the second text feature information, high-quality second text feature information with text semantic feature information and sequence feature information can be extracted, so that the target emotion category corresponding to the target object to be evaluated in the object to be evaluated can be accurately determined based on the second text feature information.
[0222] The present application also provides a computer device, such as Fig.12 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0223] The computer device may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will appreciate that Fig.12 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0224] The processor 401 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the computer device and processes data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and computer programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0225] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0226] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0227] The computer device may further include an input unit 404, which may be used to receive input digital or character information communications and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0228] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 402 according to the following instructions, and the processor 401 will run the computer programs stored in the memory 402, thereby realizing various functions, as follows:
[0229] Obtain a text to be classified for an object to be evaluated; perform semantic feature extraction on the text to be classified to obtain first text feature information; perform sequence feature extraction on the first text feature information to obtain second text feature information; and determine a target sentiment category corresponding to a target object to be evaluated among the objects to be evaluated based on the second text feature information.
[0230] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0231] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0232] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute any object classification method provided in the embodiment of the present application.
[0233] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0234] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0235] Since the instructions stored in the computer-readable storage medium can execute the steps in any object classification method provided in the embodiments of the present application, the beneficial effects that can be achieved by any object classification method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0236] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementations provided in the above embodiments.
[0237] The above is a detailed introduction to an object classification method, device, computer equipment, and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for object classification, characterized in that: include: Acquire a text sample set, wherein the text sample set includes at least one text sample annotated with a sentiment classification label; Using the classification model of the object to be trained to extract features from the text sample to obtain target feature information corresponding to the text sample; According to the target feature information and the sentiment classification label, the classification model of the object to be trained is converged to obtain a trained object classification model; wherein, it includes: obtaining reference text feature information corresponding to at least one object to be evaluated; calculating reference weight information of the target feature information with respect to the reference text feature information; according to the reference weight information, the target feature information of the text sample is fused to obtain fused feature information of the text sample with respect to the object to be evaluated; according to the fused feature information and the sentiment classification label, the classification model of the object to be trained is converged to obtain the trained object classification model; Obtaining text to be classified for the object to be evaluated; Extract semantic features from the text to be classified to obtain first text feature information; wherein, the method includes: extracting features from the text to be classified using the word embedding layer of the trained object classification model to obtain initial text feature information; dividing the initial text feature information into a plurality of sub-initial text feature information using the trained object classification model; determining the attention text feature information corresponding to the sub-initial text feature information according to the sub-initial text feature information; fusing the attention text feature information through the trained object classification model to obtain fused text feature information; fusing the fused text feature information with the initial text feature information to obtain candidate fused text feature information; determining the first text feature information according to the candidate fused text feature information; the first text feature information is information extracted by feature extraction using the trained object classification model; Performing sequence feature extraction on the first text feature information to obtain second text feature information; wherein, the method includes: performing sequence feature extraction on the first text feature information using a GRU neural network to obtain the second text feature information, wherein the GRU neural network is integrated into the trained object classification model; Obtaining template text feature information corresponding to at least one of the objects to be evaluated; Determining a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information includes: determining a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
2. The object classification method according to claim 1, characterized in that: Before obtaining the text sample set, the method further includes: Acquire a candidate text sample set and the sentiment classification label, wherein the candidate text sample set includes at least one candidate text sample; Preprocessing the candidate text sample to obtain a text sample; The text samples are labeled according to the sentiment classification labels to generate a text sample set.
3. The object classification method according to claim 1, characterized in that: The method of extracting features from the text sample using the classification model of the object to be trained to obtain target feature information corresponding to the text sample includes: Using the semantic feature extraction layer of the classification model of the object to be trained to extract semantic features from the text sample, to obtain first sample feature information corresponding to the text sample; Using the sequence feature extraction layer of the classification model of the object to be trained to extract sequence features from the text sample to obtain second sample feature information of the text sample; The second sample characteristic information is used as the target characteristic information.
4. The object classification method according to claim 1, characterized in that: The step of determining a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information includes: Calculating weight information of the second text feature information with respect to the template text feature information; According to the weight information, the second text feature information is fused to obtain target fused text feature information of the to-be-classified text for the to-be-evaluated object; The target emotion category corresponding to the target object to be evaluated among the objects to be evaluated is calculated according to the target fused text feature information.
5. The object classification method according to claim 4, characterized in that: The calculating weight information of the second text feature information with respect to the template text feature information includes: Calculating target similarity information between the second text feature information and the template text feature information; The weight information of the second text feature information relative to the template text feature information is calculated according to the target similarity information.
6. The object classification method according to claim 4, characterized in that: The step of calculating the target emotion category corresponding to the target object to be evaluated among the objects to be evaluated based on the target fused text feature information comprises: Calculate the classification information of the object to be evaluated according to the target fused text feature information; According to the classification information, a target emotion category corresponding to the target object to be evaluated is determined.
7. The object classification method according to claim 1, characterized in that: The step of determining a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information includes: According to the second text feature information, a target object to be evaluated corresponding to the text to be classified is screened out from the objects to be evaluated; The target emotion category corresponding to the target object to be evaluated is calculated based on the template text feature information corresponding to the target object to be evaluated and the second text feature information.
8. The object classification method according to claim 1, characterized in that: The step of extracting semantic features from the text to be classified to obtain first text feature information includes: Extracting features of the text to be classified to obtain initial text feature information; The first text feature information is determined according to the initial text feature information.
9. An object classification device, characterized in that: include: The device is used to obtain a text sample set, wherein the text sample set includes at least one text sample marked with a sentiment classification label; Using the classification model of the object to be trained to extract features from the text sample to obtain target feature information corresponding to the text sample; According to the target feature information and the sentiment classification label, the classification model of the object to be trained is converged to obtain a trained object classification model; wherein, it includes: obtaining reference text feature information corresponding to at least one object to be evaluated; calculating reference weight information of the target feature information with respect to the reference text feature information; according to the reference weight information, the target feature information of the text sample is fused to obtain fused feature information of the text sample with respect to the object to be evaluated; according to the fused feature information and the sentiment classification label, the classification model of the object to be trained is converged to obtain the trained object classification model; A first acquisition unit is used to acquire a text to be classified for an object to be evaluated; A first extraction unit is used to extract semantic features from the text to be classified to obtain first text feature information; the first extraction unit is specifically used to extract features from the text to be classified using the word embedding layer of the trained object classification model to obtain initial text feature information; the initial text feature information is divided into a plurality of sub-initial text feature information by the trained object classification model; the attention text feature information corresponding to the sub-initial text feature information is determined according to the sub-initial text feature information; the attention text feature information is fused by the trained object classification model to obtain fused text feature information; the fused text feature information is fused with the initial text feature information to obtain candidate fused text feature information; the first text feature information is determined according to the candidate fused text feature information; the first text feature information is information extracted by feature extraction using the trained object classification model; A second extraction unit is used to perform sequence feature extraction on the first text feature information to obtain second text feature information; the second extraction unit is specifically used to perform sequence feature extraction on the first text feature information using a GRU neural network to obtain the second text feature information, and the GRU neural network is integrated into the trained object classification model; The device is also used to obtain template text feature information corresponding to at least one of the objects to be evaluated; A determination unit is used to determine a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information, comprising: determining a target emotion category corresponding to a target object to be evaluated among the objects to be evaluated according to the second text feature information and the template text feature information.
10. A computer device, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the object classification method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the object classification method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product stores a computer program, and the computer program is suitable for being loaded by a processor to execute the object classification method according to any one of claims 1 to 8.
