Emotion recognition processing method and device, storage medium, and electronic device
Through the combination of goal strategy and semantic classification model, text extraction and semantic classification are integrated to generate emotional target words, the problem of poor accuracy in emotion recognition processing in the existing technology is solved, and more flexible and accurate emotion recognition results are achieved.
Patent Information
- Application Number
- CN202210650904.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-09
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-06-09
AI Technical Summary
In the prior art, in the emotion recognition processing, the emotional analysis of text based on natural language processing models has poor accuracy, resulting in stiff emotional recognition results and cannot meet the needs of accuracy and flexibility.
The target strategy is used to extract texts to be processed, and the semantic classification model is combined with the trained semantic classification model. By fusing the matching relationship between the first target word and the second target word, emotional target words are generated and emotional recognition is performed.
It improves the accuracy of emotion recognition processing, reduces the inconsistency of emotion analysis, meets the classification needs of different types of target words, and makes emotional recognition more flexible.
Smart Images

Figure CN114997183B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to an emotion recognition processing method and device, a storage medium, and an electronic device. Background Art
[0002] With the rapid development of natural language processing technology, natural language processing technology has been gradually applied to various Internet smart products to control the intelligent operation of smart products, for example, it is applied to smart homes to realize language processing functions. For example, users' use of smart homes can be fed back to the enterprise in the form of evaluation information, so that the enterprise can conduct sentiment analysis.
[0003] At present, when performing sentiment analysis on texts used as evaluation information, the text classification judgment of the contextual sentiment polarity of the extracted target words is usually performed based on the natural language processing model. However, this method is not accurate enough in extracting the target words and has poor stability, which makes the sentiment recognition processing results too rigid, thereby reducing the accuracy of the sentiment recognition processing. Summary of the invention
[0004] In view of this, the present invention provides an emotion recognition processing method and device, a storage medium, and a terminal, which are used to solve the problem of poor accuracy of emotion recognition processing in the prior art.
[0005] To achieve one, part, or all of the above purposes or other purposes, the present invention provides an emotion recognition processing method, comprising:
[0006] Performing text extraction on the acquired text to be processed according to the target strategy to obtain the first target word;
[0007] Performing semantic classification extraction on the text to be processed based on the trained semantic classification model to obtain a second target word;
[0008] fusing the first target word and the second target word to obtain a sentiment target word;
[0009] Performing emotion recognition processing on the emotion target words to obtain the emotion recognition result of the text to be processed.
[0010] To achieve one, part, or all of the above purposes or other purposes, the present invention provides an emotion recognition processing device, comprising:
[0011] A first extraction module, used to extract text from the acquired text to be processed according to the target strategy to obtain a first target word;
[0012] A second extraction module, used for classifying and extracting the text to be processed based on the trained classification model to obtain a second target word;
[0013] A fusion module, used for fusing the first target word and the second target word to obtain a sentiment target word;
[0014] The processing module is used to perform emotion recognition processing on the emotion target words to obtain the emotion recognition result of the text to be processed.
[0015] In an exemplary embodiment, the fusion module includes:
[0016] an acquiring unit, configured to acquire a first target word position of the first target word and a second target word position of the second target word;
[0017] A fusion unit is used to fuse the first target word and the second target word based on the matching relationship between the first target word position and the second target word position to obtain a target word.
[0018] In an exemplary embodiment, the fusion unit is specifically used to connect the first target word position and the second target word position to determine them as the emotion target word position of the emotion target word if the matching relationship is a sequential relationship; if the matching relationship is an inclusion relationship, the emotion target word position of the emotion target word is determined based on the position lengths of the first target word position and the second target word position; if the matching relationship is an intersection relationship, the first target word position and the second target word position are jointly determined as the emotion target word position of the emotion target word; if the matching relationship is an identical relationship, any one of the first target word position and the second target word position is selected to determine it as the emotion target word position of the emotion target word.
[0019] In an exemplary embodiment, the first extraction module includes:
[0020] A determination unit, used to determine a target strategy that matches the text to be processed;
[0021] The first extraction unit is used to perform text extraction on the to-be-processed text based on the target strategy, determine the starting position and the ending position of the first target word, and obtain the first target word according to the starting position and the ending position.
[0022] In an exemplary embodiment, the second extraction module includes:
[0023] A second extraction unit is used to extract features of the text to be processed by using a trained semantic classification model to obtain text features; the semantic classification model is trained based on text semantic classification samples;
[0024] A processing unit is used to perform semantic classification extraction processing on the text features based on the semantic classification model, and predict the starting position and the ending position of the second target word through the decoding layer of the semantic classification model, and obtain the second target word according to the starting position and the ending position.
[0025] In an exemplary embodiment, the processing module includes:
[0026] An acquisition unit, configured to acquire a feature vector corresponding to the emotion target word based on the emotion target word position of the emotion target word;
[0027] An extraction unit, used for extracting an attention vector corresponding to the feature vector through a trained emotion recognition model;
[0028] A processing unit is used to fuse the attention vector and the feature vector to obtain a semantic representation, and perform sentiment analysis on the semantic representation through the sentiment recognition model to obtain a sentiment recognition result.
[0029] In an exemplary embodiment, the apparatus further includes: a determining module,
[0030] The determination module is used to determine the maximum text length of the text to be processed;
[0031] The processing module is further used to perform text length correction processing on the pre-processed text to be processed based on the maximum text length, so as to extract the first target word and the second target word based on the corrected text to be processed.
[0032] In an exemplary embodiment, the apparatus further comprises:
[0033] An acquisition module is used to perform object recognition on the text to be processed to obtain an emotion recognition object;
[0034] The recognition module is further used to obtain, for a plurality of texts to be processed, emotion recognition results corresponding to each emotion recognition object based on the emotion recognition object and emotion recognition result of each of the texts to be processed;
[0035] A generation module is used to generate problem location information for each emotion recognition object according to the emotion recognition results corresponding to each emotion recognition object; the problem location information is used to generate a problem solving strategy for the located problem.
[0036] In order to achieve one or part or all of the above-mentioned purposes or other purposes, the present invention proposes a storage medium, in which at least one executable instruction is stored, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned emotion recognition processing method.
[0037] To achieve one or part or all of the above purposes or other purposes, the present invention provides an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus;
[0038] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned emotion recognition processing method.
[0039] In order to achieve one or part or all of the above-mentioned purposes or other purposes, the present invention proposes a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; the processor of the computer device reads the computer instructions from the computer-readable storage medium, and when the processor executes the computer instructions, the steps in the emotion recognition processing method of each embodiment of the present application are implemented.
[0040] Implementing the embodiments of the present invention will have the following beneficial effects:
[0041] After adopting the above-mentioned emotion recognition processing method and device, storage medium, and terminal, the present invention extracts the first target word in the text to be processed according to the target strategy, and at the same time extracts the second target word in the text to be processed based on the trained semantic classification model to fuse the emotion target words, thereby performing emotion recognition based on the fused emotion target words, reducing the inconsistency of emotion analysis, meeting the classification requirements of different types of target words, making the emotion recognition processing more flexible, and thus improving the accuracy of emotion analysis of the text to be processed. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] in:
[0044] Figure 1 A schematic diagram of interaction between an emotion recognition server and a terminal provided by an embodiment of the present invention is shown;
[0045] Figure 2 A flow chart of an emotion recognition processing method provided by an embodiment of the present invention is shown;
[0046] Figure 3 A flow chart of another emotion recognition processing method provided by an embodiment of the present invention is shown;
[0047] Figure 4 A flow chart of another emotion recognition processing method provided by an embodiment of the present invention is shown;
[0048] Figure 5 A flow chart of another emotion recognition processing method provided by an embodiment of the present invention is shown;
[0049] Figure 6 A schematic diagram of a semantic classification model structure provided by an embodiment of the present invention is shown;
[0050] Figure 7 A flow chart of another emotion recognition processing method provided by an embodiment of the present invention is shown;
[0051] Figure 8 A flow chart of fine-grained scene text sentiment analysis provided by an embodiment of the present invention is shown;
[0052] Fig. 9 A block diagram of a device for emotion recognition processing provided by an embodiment of the present invention is shown;
[0053] Fig.10 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] The emotion recognition processing method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 001 communicates with the server 002 through the network. Among them, the terminal 001 can obtain the text to be processed for emotional evaluation of different products, and send the text to be processed to the server 002. After receiving the text to be processed, the server 002 extracts the first target word based on the target strategy, and extracts the second target word based on the trained semantic classification model, and fuses the first target word with the second target word to obtain the emotional target word, so as to perform emotional recognition in the server 002 based on the fused emotional target word. The terminal 001 can be, but is not limited to, various smart phones, personal computers, laptops, tablet computers, smart control panels, portable wearable devices or other electronic devices that can be connected to the network, such as smart home products, and the server 002 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0056] When performing sentiment analysis on text that serves as evaluation information, a natural language processing model is usually used to extract target words to perform text classification judgment on the contextual sentiment polarity. However, for different training data, the target words directly extracted based on the natural language processing model are not accurate enough and have poor stability. In addition, the natural language processing model directly cannot meet the needs of accurate and flexible sentiment recognition, making the sentiment recognition processing results too rigid, thereby reducing the accuracy of sentiment recognition processing.
[0057] Based on the above problems, an embodiment of the present invention provides an emotion recognition processing method, which is described by taking the method applied to an electronic device as an example. The electronic device may be a terminal or a server, etc., and this application does not limit this. Figure 2 As shown, the method comprises the following steps:
[0058] 101. Perform text extraction on the acquired text to be processed according to the target strategy to obtain a first target word.
[0059] In an embodiment of the present invention, the text to be processed is text content that describes the emotion of the emotion recognition object, including but not limited to Chinese text to be processed and English text to be processed. For the emotion recognition objects that need to be emotion recognized, including but not limited to various voice assistant products, application products, smart device products, etc., the user can send the product evaluation text content of the emotion recognition object to the electronic device currently performing emotion recognition through the terminal device, so that the electronic device performs emotion recognition processing on the text to be processed.
[0060] After the electronic device obtains the text to be processed, it extracts the text to be processed according to the target strategy to obtain the extracted first target word. The electronic device may first obtain the user's voice information, then perform text recognition on the voice information, and then use the recognized text information as the text to be processed. The electronic device may also directly obtain the text information input by the user and use the text information as the text to be processed.
[0061] For example, users can also input voice content of product evaluation of emotion recognition objects based on voice assistant products, and then perform emotion recognition processing after converting the voice content into text, which is not specifically limited in the embodiments of the present invention. For example, after receiving the voice data fed back by the user, the voice assistant product performs text conversion to obtain the processed text for emotion recognition, such as converting the voice into the data "This light's response ability is too fast", which is not specifically limited in the embodiments of the present invention.
[0062] When emotion recognition processing is triggered, the electronic device can obtain the text to be processed based on a stored text file or table file, or can obtain the text to be processed based on the text obtained by real-time conversion, which is not specifically limited in the embodiment of the present invention.
[0063] It should be noted that, in the embodiments of the present invention, the target strategy may refer to a processing strategy for text extraction, and may specifically represent extraction rules pre-configured according to different emotion recognition requirements. The target strategy may specifically be a pre-set text extraction rule, a text extraction algorithm, etc. For example, the target strategy includes but is not limited to pre-configured regular matching rules, dictionary matching rules, etc.
[0064] Among them, the target strategy includes but is not limited to pre-configured regular matching rules, dictionary matching rules, etc. The dictionary matching rules are rules for matching objects according to natural language technology using commonly used or common emotion-expressing words as a dictionary library, and the regular matching rules are rules for matching according to artificially pre-set rules, so as to achieve flexible applicability based on matching rules when extracting the first target word based on the target strategy to meet different emotion recognition needs. Since the target strategy is an extraction rule pre-configured by humans, the first target word extracted based on the target strategy is used as the word content required by humans to extract, and the embodiment of the present invention does not make specific limitations.
[0065] It can be understood that the first target word refers to a method of extracting text according to a target strategy. The extracted target word can be, for example, extracted according to specific rule content in the target strategy.
[0066] 102. Perform semantic classification extraction on the text to be processed based on the trained semantic classification model to obtain a second target word.
[0067] The second target word refers to the target word extracted by semantic classification extraction using the trained semantic classification model. It can be understood that the first target word and the second target word are target words extracted by two different methods, wherein the first target word and the second target word extracted may be the same or different.
[0068] In the embodiment of the present invention, the semantic classification model is a machine learning model with semantic recognition capability, which can be obtained by training the machine learning model based on text semantic classification samples, for example, it can be obtained by training based on a language machine learning model. Among them, the text semantic classification samples contain a large number of words and the semantic classification labels corresponding to each word, so that the language classification machine learning model is pre-trained. Among them, the machine learning model may include but is not limited to the fully connected neural network model DNN (Deep Neural Networks), the convolutional neural network model CNN (Convolutional Neural Networks), etc., and the embodiment of the present invention does not make specific limitations. In addition, the semantic classification extraction in the embodiment of the present invention, that is, extracting the second target word according to the semantic classification of the massive words, the semantic classification includes but is not limited to nouns, verbs, adjectives, etc., so that the extracted second target word has a semantic classification effect.
[0069] It should be noted that since the semantic classification model is trained based on natural language semantic training samples, when the electronic device performs semantic classification extraction based on the semantic classification model, it uses the semantic classification model to perform semantic classification processing on the text features in the processed text, thereby obtaining the second target word to be extracted.
[0070] It is understandable that the electronic device can first perform text extraction on the acquired text to be processed according to the target strategy, or it can first perform semantic classification extraction on the text to be processed based on the trained semantic classification model, or it can simultaneously process the text to be processed according to the target strategy and through the trained semantic classification model. This application does not limit this.
[0071] 103. Perform fusion processing on the first target word and the second target word to obtain a sentiment target word.
[0072] It can be understood that the emotional target words can represent words with emotional characteristics in the text to be processed, for example, they can be words with emotional attributes determined according to preset rules, words with emotional semantics, etc.
[0073] In the embodiment of the present invention, since the first target word and the second target word are extracted in different ways, the first target word and the second target word may be the same, may be different, or may overlap, therefore, in order to ensure the accuracy of emotion recognition, the first target word and the second target word are fused, and the fused emotion target word is used as the semantic basis for emotion recognition.
[0074] Among them, for the fusion processing of the first target word and the second target word, the electronic device can determine it based on the matching relationship between the first target word and the second target word. For example, if the matching relationship between the first target word and the second target word is an inclusion relationship, and the first target word contains the second target word, then the first target word can be directly used as the emotional target word after the fusion of the text to be processed. The embodiment of the present invention does not make specific limitations.
[0075] 104. Perform emotion recognition processing on the emotion target word to obtain an emotion recognition result of the text to be processed.
[0076] In an embodiment of the present invention, after the emotional target word is obtained by fusion, the electronic device performs emotional recognition processing based on the emotional target word. At this time, the emotional recognition processing can perform recognition prediction based on the emotional recognition model that has completed model training. In the embodiment of the present invention, no specific limitation is made to the language model.
[0077] It should be noted that if the current execution end, that is, the electronic device, is an application server end, a language model that has completed model training can be directly deployed, so that after obtaining the emotional target words of the text to be processed in steps 101-103, emotional recognition processing can be directly performed to obtain the emotional recognition results so that the emotional recognition results can be output or reported. The embodiments of the present invention do not make specific limitations.
[0078] The embodiment of the present invention extracts the first target word in the text to be processed according to the target strategy, and simultaneously extracts the second target word in the text to be processed based on the trained semantic classification model to fuse the emotional target words, thereby performing emotion recognition based on the fused emotional target words, reducing the inconsistency of emotion analysis, meeting the classification requirements of different types of target words, making the emotion recognition processing more flexible, and thus improving the accuracy of the emotion analysis of the text to be processed.
[0079] In an exemplary embodiment, for further definition and description, as Figure 3 As shown, the step of fusing the first target word and the second target word to obtain the emotional target word includes:
[0080] 201. Obtain a first target word position of the first target word and a second target word position of the second target word;
[0081] 202. Based on the matching relationship between the first target word position and the second target word position, the first target word and the second target word are fused to obtain a sentiment target word.
[0082] Since the text to be processed is usually represented by a string, for example, the text to be processed is composed of a string of length n, represented by S = {w1, w2, ..., w nIn order to enhance the accuracy of emotion recognition based on target words, specifically, when extracting the first target word and the second target word, they can be represented by the target word position, such as the set of m first target words is {(s1,e1), (s2,e2), ... (s m ,e m )}, s is the starting position of each word in the first target word, and e is the ending position of each word in the first target word, so that through the set {(s1,e1), (s2,e2), ... (s m ,e m )} represents all words of the first target word, and the representation method of the second target word is the same as that of the first target word, which is not specifically limited in the embodiment of the present invention.
[0083] In a specific text scenario to be processed, the text to be processed is "The energy-saving performance of this lamp is very good, but the network is too poor." If the extracted first target word or second target word is ["energy-saving performance is very good", "network is too poor"], then the corresponding representation set is {(4, 9), (13, 16)}, which is not specifically limited in the embodiment of the present invention.
[0084] It should be noted that since the first target word and the second target word can be represented based on the set of target word positions of the extracted words, when performing fusion, in order to improve the accuracy of sentiment analysis, the electronic device obtains the first target word position of the first target word and the second target word position of the second target word, so as to determine the matching relationship between the first target word and the second target word based on the first target word position and the second target word position, thereby performing corresponding fusion processing.
[0085] It can be understood that the matching relationship can include a sequential relationship, a containment relationship, a cross relationship, and an identical relationship. Among them, the sequential relationship represents that the first target word position and the second target word position are in a relationship that can be connected in sequence. For example, the first target word position is (3, 5), the second target word position is (6, 8), and the second target word position is sequentially connected to the first target word position, that is, it is determined that the first target word and the second target word are in a sequential relationship.
[0086] The inclusion relationship represents a relationship in which the position length of one target word completely includes the position length of another target word position. For example, the first target word position is (3, 4), and the second target word position is (2, 5). The second target word position includes the first target word position, which means that the first target word and the second target word are in an inclusion relationship.
[0087] The intersection relationship represents the relationship in which there is an overlapping intersection between the first target word position and the second target word position. For example, the first target word position is (2, 4), and the second target word position is (3, 5). There is an intersection between the first target word position and the second target word position, that is, it is determined that the first target word and the second target word are in an intersection relationship.
[0088] The same relationship represents the relationship that the first starting, ending and end positions are exactly the same as the second target word positions. For example, the first starting, ending and end positions are (5, 9), and the second target word position is (5, 9). The first starting, ending and end positions are the same as the second target word positions, that is, the first target word and the second target word are in the same relationship.
[0089] At this time, in order to meet the fusion requirements and thus improve the accuracy of sentiment analysis based on the target word, different fusion methods can be used for different matching relationships, thereby obtaining a unique sentiment target word for sentiment recognition.
[0090] In an exemplary embodiment, for further definition and explanation, the step of fusing the first target word and the second target word based on the matching relationship between the first target word position and the second target word position to obtain the emotional target word includes:
[0091] If the matching relationship is a sequential relationship, the first target word position and the second target word position are connected to determine the emotional target word position as the emotional target word;
[0092] If the matched relationship is a containment relationship, determining the sentiment target word position of the sentiment target word based on the position lengths of the first target word position and the second target word position;
[0093] If the matching relationship is a cross relationship, the first target word position and the second target word position are jointly determined as the sentiment target word position of the sentiment target word;
[0094] If the matching relationship is the same relationship, any one of the first target word position and the second target word position is selected to be determined as the emotion target word position of the emotion target word.
[0095] Specifically, if the matching relationship is a sequential relationship, the electronic device connects the first target word position with the second target word position to determine the emotional target word position of the emotional target word, thereby obtaining the position representation of the emotional target word. For example, if the first target word position is (3, 5) and the second target word position is (6, 8), the first target word position is connected with the second target word position to determine the position representation of the emotional target word. At this time, the emotional target word is represented as (3, 8) through the emotional target word position.
[0096] Specifically, if the matching relationship is an inclusion relationship, the emotional target word position of the emotional target word is determined based on the position lengths of the first target word position and the second target word position, thereby obtaining the position representation of the emotional target word. At this time, in order to ensure the integrity of the emotional target word, the emotional target word position of the emotional target word is determined based on the position length, and the target word position with a longer position length can be selected directly as the emotional target word position of the emotional target word. For example, the first target word position is (3, 4), the second target word position is (2, 5), the second target word position includes the first target word position, and the position length of the second target word position is longer, and the position (2, 5) of the second target word position is determined as the emotional target word position of the emotional target word.
[0097] Specifically, if the matching relationship is an intersection relationship, the first target word position and the second target word position are jointly determined as the emotion target word position of the emotion target word, thereby obtaining the position representation of the emotion target word. When there is an intersection relationship, in order to avoid losing any target word, any target word position is not deleted or integrated, that is, the first target word position and the second target word position are directly used as the emotion target word position of the emotion target word. For example, the first target word position is (2, 4), the second target word position is (3, 5), and there is an intersection between the first target word position and the second target word position, then the set containing [(2, 4), (3, 5)] is directly used as the emotion target word position of the emotion target word to represent the emotion target word.
[0098] Specifically, if the matching relationship is the same, then any one of the first target word position and the second target word position is selected to determine the emotional target word position of the emotional target word. At this time, in order to delete redundant target words, the target words of the same target word position have the same representation, and any one can be deleted, and only one can be retained as the target word. For example, the first start and end positions are (5, 9), the second target word position is (5, 9), and the first target word position is the same as the second target word position, then any one can be retained to obtain the emotional target word and the emotional target word position.
[0099] Specifically, in an embodiment scenario, the step further includes: if there is no matching relationship between the first target word and the second target word, the first target word position and the second target word position are jointly determined as the emotional target word position of the emotional target word.
[0100] In order to ensure the integrity of the target word and thus improve the accuracy of emotion recognition based on the emotion target word, if there is no matching relationship between the first target word and the second target word, the first target word position and the second target word position are jointly determined as the emotion target word position of the emotion target word. For example, if the first target word position is (3, 6) and the second target word position is (11, 16), then [(3, 6), (11, 16)] can be used as the emotion target word position of the emotion target word.
[0101] It should be noted that, since the target word can be composed of one word or multiple words, the corresponding target word position can be a corresponding position or a set including multiple positions. At the same time, during the fusion processing, for a position set of the first target word or the second target word, the matching relationship of each word can be judged in turn based on the word position, so as to determine the fusion processing method and obtain the final emotional target word position of the emotional target word. Of course, the final emotional target word can also contain multiple or one words, so as to obtain a corresponding position representation, or a position set including multiple positions, which is not specifically limited in the embodiment of the present invention.
[0102] In an exemplary embodiment, for further definition and description, as Figure 4 As shown, the step extracts the acquired text to be processed according to the target strategy, and obtains the first target word including:
[0103] 301. Determine a target strategy that matches the text to be processed;
[0104] 302. Perform text extraction on the to-be-processed text based on the target strategy, determine the starting position and the ending position of the first target word, and obtain the first target word according to the starting position and the ending position.
[0105] In order to realize the extraction of the first target word according to the extraction rules manually configured according to different business needs, so that the extracted first target word can be used as the basis for emotion recognition that meets business needs, wherein the target strategy includes but is not limited to regular matching rules, dictionary matching rules, etc., so as to realize the flexible applicability of matching rules for different business needs to meet different emotion recognition business needs.
[0106] In addition, before extracting the first target word from the text to be processed, the target strategy can be determined first. Specifically, the electronic device can determine the corresponding target strategy based on different emotion recognition objects, that is, pre-configure matching rules according to different emotion recognition objects. For example, pre-configure regular matching rule 1 for smart home and pre-configure regular matching rule 2 for application products to determine the corresponding target strategy for different business scenarios. Among them, when extracting the first target word based on the target strategy, it can be based on the extraction method of a regular matching rule or a dictionary matching rule, or it can be based on the extraction method of the matching rule and the dictionary matching rule, that is, it is pre-configured by humans according to different business needs, and the embodiment of the present invention does not make specific limitations.
[0107] Specifically, if the matching rule is a dictionary matching rule, that is, a rule that uses natural language technology to match commonly used or common emotion-expressing words as a dictionary library, such as bad (poor emotion classification): ["poor performance", "unresponsive", "not very good", ..., "very poor effect"], good (good emotion classification): ["pretty good", "very good", ...], when extracting the first target word based on the dictionary matching rule, if the words in the dictionary library constructed by the above bad and good are detected in the text to be processed, extraction is performed to determine the starting position and the ending position of the first target word, thereby obtaining the first target word. For example, if the text to be processed is "the performance of this lamp is too poor", then after extraction according to the dictionary matching rule, "poor performance" matching the dictionary batch rule is obtained, and the starting position and the ending position (5, 8) corresponding to "poor performance" can be determined to obtain the first target word, which is not specifically limited in the embodiment of the present invention.
[0108] Specifically, if the matching rule is a regular matching rule, that is, a rule that matches according to a rule set in advance, such as the regular matching rule is (lamp|device)(.+), then as long as this regular matching rule is triggered, (.+) is extracted as the first target word. For example, the text to be processed is "The operation of this device is too unfriendly", which triggers the above regular matching rule, and "the operation is too unfriendly" is extracted as (.+), and the starting position and the end position (5, 10) are determined, thereby determining the first target word, which is not specifically limited in the embodiment of the present invention. It is realized by combining artificial interference to correct the prediction errors of the deep learning model, thereby improving the accuracy of sentiment analysis.
[0109] In an exemplary embodiment, for further definition and description, as Figure 5 As shown, the step classifies and extracts the text to be processed based on the trained semantic classification model, and obtains the second target word including:
[0110] 401. Extracting features of the text to be processed by using a trained semantic classification model to obtain text features;
[0111] 402. Perform semantic classification extraction processing on the text features based on the semantic classification model, predict the starting position and the ending position of the second target word through the decoding layer of the semantic classification model, and obtain the second target word according to the starting position and the ending position.
[0112] In order to extract the second target word according to the semantic classification model, so that the extracted second target word can meet the semantic classification requirements of different languages. Specifically, the electronic device can first extract features of the text to be processed based on the trained semantic classification model to obtain text features required for semantic classification extraction. At this time, the semantic classification model is trained based on text semantic classification samples. The text semantic classification samples contain all natural language corpora stored in text form, such as all Chinese word corpora, and the Chinese word corpora have different semantic classification labels, such as nouns, verbs, etc., so that the semantic classification model is trained based on the text semantic classification samples to extract text features from the text to be processed as the processing object for semantic classification extraction.
[0113] In an embodiment of the present invention, during the model training process, the semantic classification model to be trained can be a machine learning model of the language class, and a fully connected neural network model DNN (Deep Neural Networks) is constructed to perform semantic classification training, extract and determine the starting position and the ending position of the second target word, so as to obtain the second target word position representing the second target word. Wherein, during the model training process of the semantic classification model, the fully connected layer of the fully connected neural network model DNN is connected to the decoding layer, so as to obtain the label sequence of the second target word by decoding prediction, that is, to predict the starting position and the ending position of the second target word by the decoding layer. Wherein, the decoding layer can be a conditional random field CRF layer (RandomConditional Field), when the classified words are output based on the fully connected layer, in order to make the output of each word match the best label, the position representation sequence of the entire word is calculated on the connected CRF layer, such as decoding the best label sequence by the Viterbi algorithm, so as to obtain the label sequence of the initial position and the ending position of the second target word. Among them, a serialization annotation algorithm is embedded in the CRF layer, such as the Viterbi algorithm. When the CRF layer receives a sequence output by a fully connected layer, it performs serialization annotation to obtain an output target sequence. For example, in semantic annotation, the input sequence is the starting position and ending position of a string of multiple words to be labeled, and the output sequence is the starting position and ending position corresponding to the labeled words, so as to determine the extraction of the second target word that meets the label based on the starting position and ending position.
[0114] Specifically, Figure 6 As shown in FIG. 1 , the semantic classification model can be preferably a BERT model based on the Transformer model, that is, the BERT model is a deep bidirectional language model based on the Transformer model. In the embodiment of the present invention, the BERT model outputs to the fully connected layer, and the output of the fully connected layer is configured to be connected to the conditional random field layer (Random ConditionalField), that is, the CRF layer, so that when predicting based on the semantic classification model, the best label sequence can be decoded on the entire text word sequence by the Viterbi algorithm, that is, the following is obtained: Figure 5 The black rectangle in the output layer shown in the figure indicates the starting position and the ending position corresponding to the extracted second target word, thereby determining the second target word. In addition, the semantic classification model can also be configured as other neural network models according to business needs, which is not specifically limited in the embodiment of the present invention. In order to meet business needs and improve the extraction accuracy of the second target word, the label can also be slightly adjusted so that the semantic classification model can extract the second target word more accurately.
[0115] In an exemplary embodiment, for further definition and explanation, the step of performing emotion recognition processing on the emotion target word to obtain the emotion recognition result of the text to be processed includes:
[0116] Based on the sentiment target word position of the sentiment target word, obtaining a feature vector corresponding to the sentiment target word;
[0117] Extracting an attention vector corresponding to the feature vector through a trained emotion recognition model;
[0118] The attention vector and the feature vector are fused to obtain a semantic representation, and the semantic representation is subjected to sentiment analysis through the sentiment recognition model to obtain a sentiment recognition result.
[0119] Since the target word is represented based on the target word position including the start position and the end position, in order to accurately perform emotion recognition processing on the emotion target word, when performing emotion recognition processing based on semantic representation, the emotion target word position of the emotion target word is specifically determined to obtain the feature vector corresponding to the target word. Among them, each arbitrary emotion target word position (s, e) corresponds to a feature vector h = {h1,...,h L}, 1≤s≤e≤L, L is the sentence length, at this time, h can be obtained by word vector conversion based on the sentiment target word, for example, the performance is too poor (performance: h1, ability: h2, too: h3, bad: h4, too: h5), h1, h2, h3, h4, h5 are all array vectors of the same dimension, so we get h = {h1,...,h5}.
[0120] In addition, in order to perform emotion recognition processing based on the contribution of the emotion target word to the analysis of the emotion recognition result, so as to improve the accuracy of emotion analysis, the embodiment of the present invention introduces an attention mechanism, that is, the attention vector corresponding to the feature vector is extracted through the trained emotion recognition model. Specifically, the attention vector α is first calculated, α=softmax(W α h e:s ), where W α is the parameter matrix of the self-attention mechanism for calculating the emotional target word, h e:s is the feature vector corresponding to all emotional target words. Softmax is the normalization of the category. The attention vector corresponding to the feature vector is extracted through the attention layer constructed in the emotion recognition model. After obtaining the attention vector α, the semantic representation of the emotional target word is calculated through vector operations, such as weighted summation. Right now
[0121] After obtaining the semantic representation, when performing sentiment analysis based on the sentiment recognition model, the sentiment polarity is predicted based on this semantic representation: Among them, W p The weights obtained after the emotion recognition model is trained are used to predict and output the emotion recognition results corresponding to each emotion target word, i.e., emotion target word-emotion. The emotion recognition model can be other machine learning models different from the semantic classification model, such as a deep neural network model, so that the model training is performed based on the pre-built emotion recognition training samples, and the emotion prediction and recognition is performed by the emotion recognition model that has completed the model training. The embodiment of the present invention does not specifically limit the emotion recognition training samples.
[0122] In an exemplary embodiment, for further definition and explanation, the step of extracting text from the acquired text to be processed according to the target strategy to obtain the first target word further includes:
[0123] Determining the maximum text length of the text to be processed;
[0124] The preprocessed text to be processed is subjected to text length correction processing based on the maximum text length, so as to extract the first target word and the second target word based on the corrected text to be processed.
[0125] In order to normalize the text of the text to be processed, thereby ensuring more efficient extraction of target words from the text to be processed and improving the efficiency of sentiment analysis, before extracting the target words, the text to be processed can be preprocessed to use the preprocessed text to be processed as the text to be processed for extracting the first target word and the second target word. Wherein, the text preprocessing includes at least one of character processing, symbol processing, expression processing, and redundancy processing, that is, preprocessing is performed for different situations that require preprocessing in the text to be processed. For illegal characters contained in the text to be processed, character processing can be performed to filter illegal label strings, and delete languages and texts other than Chinese and English, which are not specifically limited in the embodiment of the present invention. For different full-width or half-width symbols contained in the text to be processed, symbol processing can be performed to convert some full-width symbols into half-width symbols, which are not specifically limited in the embodiment of the present invention. For simplified and traditional Chinese text contained in the text to be processed, expression processing can be performed to convert all traditional Chinese characters in the text to be processed into simplified Chinese characters to unify the text form, which is not specifically limited in the embodiment of the present invention. For redundant and repeated punctuation marks or meaningless punctuation marks contained in the text to be processed, redundancy processing is performed to merge the repeated punctuation marks and delete the meaningless punctuation marks, which is not specifically limited in the embodiment of the present invention.
[0126] In an embodiment of the present invention, in order to ensure the model processing efficiency when emotion recognition is performed based on an emotion recognition model, a maximum text length can be set for the text to be processed to ensure that the length of the semantic vector of the target word processed by the model is consistent, thereby improving the accuracy of the semantic classification model processing. Specifically, the maximum text length that matches the text to be processed is stored in the current execution end. If the text to be processed exceeds this maximum text length, the text to be processed is truncated, that is, the text content exceeding the maximum text length is deleted from the text to be processed to ensure that the text length is consistent. If the text to be processed is less than the maximum text length, the text to be processed is padded, that is, specific characters are selected and added to the end of the text to be processed until it is equal to the maximum text length, wherein the specific character is preferably 0, and the embodiment of the present invention does not make specific limitations.
[0127] In an exemplary embodiment, for further definition and description, as Figure 7 As shown, the steps also include:
[0128] 501. Perform object recognition on the text to be processed to obtain a sentiment recognition object;
[0129] 502. For a plurality of texts to be processed, based on the emotion recognition objects and emotion recognition results of the texts to be processed, obtaining emotion recognition results corresponding to the emotion recognition objects respectively;
[0130] 503. Generate problem location information for each emotion recognition object according to the emotion recognition results corresponding to each emotion recognition object; the problem location information is used to generate a problem solving strategy for the located problem.
[0131] In an embodiment of the present invention, in a specific application scenario, since the text to be processed is an evaluation text entered by voice or directly entered, in order to identify the object for which the evaluation is being made, the emotion recognition result is specifically combined to perform optimization processing or equipment maintenance on the product.
[0132] It can be understood that the emotion recognition object refers to the object that needs to be emotion recognized, and specifically can be a product object that needs to be emotion evaluated. For example, it can specifically include but is not limited to hardware equipment, software products, network status, system functions and other objects.
[0133] Specifically, the electronic device first identifies the emotion recognition object from the text to be processed. When performing object recognition on the text to be processed, the text to be processed can be matched with the text to be processed based on a word library containing all emotion recognition objects, so as to determine the emotion recognition object from the text to be processed. The text to be processed can also be searched based on a user-defined entity name word library to see whether the text to be processed contains the entity name of the user-defined emotion recognition object, so as to perform recognition, which is not specifically limited in the embodiment of the present invention.
[0134] At the same time, since in the embodiment of the present invention, based on the emotion recognition method such as steps 101-104, multiple texts to be processed can be recognized to obtain emotion recognition results corresponding to emotion recognition objects of different texts to be processed, at this time, the emotion recognition results corresponding to the emotion recognition objects obtained by the completed emotion recognition can be directly obtained, and the embodiment of the present invention does not make specific limitations.
[0135] It should be noted that in order to meet the processing requirements of the emotion recognition object, reduce the generation of negative emotion recognition results of the emotion recognition object, and improve the use efficiency of the emotion recognition object, after determining the request recognition result corresponding to the emotion recognition object, problem location information is generated based on this emotion recognition result, and a problem solving strategy is generated based on this problem location information, that is, the problem location information is used to generate a problem solving strategy for the located problem. Among them, since the request recognition result contains the emotion recognition result of the emotion target word, for example, the emotion recognition object is a network, and the emotion recognition result is poor, when generating the problem location information, the emotion recognition object and the emotion recognition result can be combined to obtain the problem location information, that is, the network is poor. At this time, the problem is located at the network poor, thereby generating a corresponding problem solving strategy.
[0136] For problem-solving strategies, based on the pre-configured problem-strategy correspondence, problem-solving strategies matching different problem location information can be established so as to provide feedback to the client or to the application development end for processing. For example, the problem location information is that the voice recognition of smart lights is slow. The problem-solving strategy matched based on the problem-strategy correspondence is to update the voice version to meet the processing requirements of the emotion recognition results of different emotion recognition objects in the evaluation scenario.
[0137] In an exemplary embodiment, for further definition and description, the steps further include:
[0138] In response to an emotion recognition request, obtaining an emotion recognition object carried in the emotion recognition request, and searching for a to-be-processed text that matches the emotion recognition object;
[0139] If the text to be processed is found, the emotion recognition result of the text to be processed is determined as the emotion recognition result of the emotion recognition object;
[0140] If the text to be processed is not found, an emotion recognition processing request of the emotion recognition object is output to obtain the text to be processed for emotion recognition processing.
[0141] In an embodiment of the present invention, in a specific application scenario, after the current execution end receives an emotion recognition request for an emotion recognition object, it searches for the text to be processed that matches the emotion recognition object, thereby performing the emotion recognition processing in the embodiment of the present application based on the text to be processed. The emotion recognition object is an object for which emotion recognition is requested, including but not limited to hardware products of smart homes, Internet application products, etc. For example, if the emotion recognition object is a sweeping robot, then in response to the emotion recognition request, the carried emotion recognition comparison is obtained as a sweeping robot, and then the text to be processed that matches the sweeping robot is searched. At this time, the text to be processed can be a text content that evaluates the scanning robot, such as "Type A sweeping robot reacts too quickly.
[0142] If the text to be processed is found, the emotion recognition processing step of the text to be processed is performed, that is, the method of steps 101-104 is performed to determine the emotion recognition result, such as "quick response-satisfied".
[0143] If the text to be processed is not found, it means that there is no text to be processed for the emotion recognition object in the current execution end. Therefore, it is necessary to output an emotion recognition processing request to instruct the user to enter the text to be processed for emotion recognition of the emotion recognition object and perform emotion recognition processing. For example, the evaluation text of a sweeping robot is to be found, and the emotion recognition processing request of the sweeping robot is output. When the user views this emotion recognition processing request, he enters the text content that evaluates the sweeping robot as the text to be processed for emotion recognition processing. The embodiment of the present invention does not make specific limitations.
[0144] It should be noted that the current execution end may pre-store multiple to-be-processed texts of different emotion recognition objects, that is, text contents that need to be emotion recognized for different emotion recognition objects and entered by different users, so that when emotion recognition is required, the matching to-be-processed texts can be obtained for emotion recognition. In addition, since the to-be-processed text is the content for evaluating the emotion recognition object, the emotion recognition result can be analyzed. If the emotion recognition result is a positive emotion, it means that the user is relatively satisfied with the emotion recognition object. If the emotion recognition result is a negative emotion, it means that the user is dissatisfied with the emotion recognition object. Therefore, the emotion recognition result for negative emotions can be used as a basis for optimizing or processing the emotion recognition object.
[0145] In a specific application scenario, the following is included: collecting user evaluation information on voice assistant products, such as "your voice assistant's semantic understanding is very good, but the voice recognition algorithm is rubbish", and then converting this evaluation content into a text to be processed, and performing sentiment analysis on the text to be processed. At this time, since the target word in a sentence of text to be processed can contain multiple words, the sentiment polarity of each word can be different. Therefore, if Figure 8 As shown, after text preprocessing and target word extraction, the target word is classified for emotion, and the target word-emotion pair is finally obtained as the result of emotion analysis, that is, semantic understanding: good, speech recognition: bad. Further, after completing the emotion analysis of the evaluation information, it can be applied to different application scenarios based on the emotion analysis results, so that the emotion analysis results can be used as the basis for processing. For example, by analyzing the user's emotions, it can be determined whether the user has a problem with the product at this time. For example, "the network is not working again" determines that the emotion analysis result is (network: bad). At this time, network feedback can be performed to enter the operation system to analyze the specific problem, which is not specifically limited in the embodiment of the present invention.
[0146] In another specific application scenario, it specifically includes: Since the text to be processed is text content, in the case of a smart home scenario, for voice products, such as the "小爱同学" smart voice product, users can input voice data for evaluating the product through the voice product in a voice manner. At this time, the voice product can perform text conversion locally, or upload the voice data to the current execution end for text conversion to obtain the text to be processed, so as to collect the evaluation content of different users for emotional recognition of the language product as the text to be processed and wait for emotional recognition.
[0147] In addition, it should be noted that after obtaining the emotional result of the user for a specific product, in order to improve the usage rate of different business products, an optimization and improvement strategy for the emotional recognition object can be analyzed based on the emotional recognition result, so as to improve the usage efficiency of the emotional recognition object. Considering that the emotional recognition result contains the emotional target word - emotion, different problem-solving strategies for different emotional recognition objects matching different emotional target words and different emotions are pre-configured. Thus, after determining the emotional recognition result, the matching process is called to optimize the emotional recognition object.
[0148] Among them, the problem-solving strategy can be configured as different processing methods based on different emotional recognition objects. For example, for hardware devices in the smart home category, it can be configured as a replacement strategy for the hardware device. For example, if the emotional recognition result of the sweeping robot's brush head being poor is obtained, the matching processing strategy can be to replace the brush head, so as to provide users with high-quality and convenient optimization suggestions. For example, for software programs in the application category, it can be configured as an improvement strategy for software upgrade. For example, if the emotional recognition result of the sweeping robot having a large route error is obtained, the matching processing strategy can be to upgrade the sweeping route, so as to provide users with an intelligent optimization method.
[0149] It should be understood that although Figure 2-5 each step in the flowcharts of Figure 2-5 、7 is shown in sequence according to the arrow indication, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise clearly stated in this article, these steps have no strict order limit and can be executed in other orders. Moreover,
[0150] An embodiment of the present invention provides a method for emotion recognition processing. The present invention extracts a first target word in a text to be processed according to a target strategy, and simultaneously extracts a second target word in the text to be processed based on a trained semantic classification model to fuse the emotion target words, thereby performing emotion recognition based on the fused emotion target words, reducing inconsistencies in emotion analysis, meeting the classification requirements of different types of target words, making emotion recognition processing more flexible, and thus improving the accuracy of emotion analysis of the text to be processed.
[0151] Based on the above problems, an embodiment of the present invention provides an emotion recognition processing device, such as Fig. 9 As shown, the method includes:
[0152] A first extraction module 61 is used to extract the acquired text to be processed according to the target strategy to obtain a first target word;
[0153] A second extraction module 62, configured to classify and extract the text to be processed based on the trained classification model to obtain a second target word;
[0154] A fusion module 63, configured to fuse the first target word and the second target word to obtain a sentiment target word;
[0155] The processing module 64 is used to perform emotion recognition processing on the emotion target word to obtain the emotion recognition result of the text to be processed.
[0156] In an exemplary embodiment, the fusion module includes:
[0157] an acquiring unit, configured to acquire a first target word position of the first target word and a second target word position of the second target word;
[0158] A fusion unit is used to fuse the first target word and the second target word based on the matching relationship between the first target word position and the second target word position to obtain a target word.
[0159] In an exemplary embodiment, the fusion unit is specifically used to connect the first target word position and the second target word position to determine them as the emotion target word position of the emotion target word if the matching relationship is a sequential relationship; if the matching relationship is an inclusion relationship, the emotion target word position of the emotion target word is determined based on the position lengths of the first target word position and the second target word position; if the matching relationship is an intersection relationship, the first target word position and the second target word position are jointly determined as the emotion target word position of the emotion target word; if the matching relationship is an identical relationship, any one of the first target word position and the second target word position is selected to determine it as the emotion target word position of the emotion target word.
[0160] In an exemplary embodiment, the first extraction module includes:
[0161] A determination unit, used to determine a target strategy that matches the text to be processed;
[0162] The first extraction unit is used to perform text extraction on the to-be-processed text based on the target strategy, determine the starting position and the ending position of the first target word, and obtain the first target word according to the starting position and the ending position.
[0163] In an exemplary embodiment, the second extraction module includes:
[0164] A second extraction unit is used to extract features of the text to be processed by using a trained semantic classification model to obtain text features; the semantic classification model is trained based on text semantic classification samples;
[0165] A processing unit is used to perform semantic classification extraction processing on the text features based on the semantic classification model, and predict the starting position and the ending position of the second target word through the decoding layer of the semantic classification model, and obtain the second target word according to the starting position and the ending position.
[0166] In an exemplary embodiment, the processing module includes:
[0167] An acquisition unit, configured to acquire a feature vector corresponding to the emotion target word based on the emotion target word position of the emotion target word;
[0168] An extraction unit, used for extracting an attention vector corresponding to the feature vector through a trained emotion recognition model;
[0169] A processing unit is used to fuse the attention vector and the feature vector to obtain a semantic representation, and perform sentiment analysis on the semantic representation through the sentiment recognition model to obtain a sentiment recognition result.
[0170] In an exemplary embodiment, the apparatus further includes: a determining module,
[0171] The determination module is used to determine the maximum text length of the text to be processed;
[0172] The processing module is further used to perform text length correction processing on the pre-processed text to be processed based on the maximum text length, so as to extract the first target word and the second target word based on the corrected text to be processed.
[0173] In an exemplary embodiment, the apparatus further comprises:
[0174] An acquisition module is used to perform object recognition on the text to be processed to obtain an emotion recognition object;
[0175] The recognition module is further used to obtain, for a plurality of texts to be processed, emotion recognition results corresponding to each emotion recognition object based on the emotion recognition object and emotion recognition result of each of the texts to be processed;
[0176] A generation module is used to generate problem location information for each emotion recognition object according to the emotion recognition results corresponding to each emotion recognition object; the problem location information is used to generate a problem solving strategy for the located problem.
[0177] For the specific definition of the emotion recognition processing device, please refer to the definition of the emotion recognition processing method above, which will not be repeated here. Each module in the above-mentioned emotion recognition processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0178] An embodiment of the present invention provides a sentiment recognition processing device. The present invention extracts a first target word in a text to be processed according to a target strategy, and simultaneously extracts a second target word in the text to be processed based on a trained semantic classification model to fuse the sentiment target words, thereby performing sentiment recognition based on the fused sentiment target words, reducing inconsistencies in sentiment analysis, meeting the classification requirements of different types of target words, making sentiment recognition processing more flexible, and thus improving the accuracy of sentiment analysis of the text to be processed.
[0179] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned emotion recognition processing method.
[0180] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0181] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned emotion recognition processing method.
[0182] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, 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 performs the steps in the above-mentioned method embodiments.
[0183] Fig.10 A schematic diagram of the structure of an electronic device provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.
[0184] like Fig.10 As shown, the terminal may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 , and a communication bus 708 .
[0185] The processor 702 , the communication interface 704 , and the memory 706 communicate with each other via a communication bus 708 .
[0186] The communication interface 704 is used to communicate with other devices such as clients or other servers.
[0187] The processor 702 is used to execute the program 710, and specifically can execute the relevant steps in the above-mentioned emotion recognition processing method embodiment.
[0188] Specifically, the program 710 may include program codes, which include computer operation instructions.
[0189] The processor 702 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0190] The memory 706 is used to store the program 710. The memory 706 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0191] Program 710 can be specifically used to enable processor 702 to execute the emotion recognition processing methods in the above-mentioned embodiments.
[0192] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the process of the embodiment of the above-mentioned method. Among them, any reference to memory, storage, database or other medium used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (ROM), electrically programmable ROM (EPROM), erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0193] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0194] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for emotion recognition processing, characterized in that: include: Performing text extraction on the acquired text to be processed according to the target strategy to obtain the first target word; Performing semantic classification extraction on the text to be processed based on the trained semantic classification model to obtain a second target word; Acquire a first target word position of the first target word and a second target word position of the second target word; Based on the matching relationship between the first target word position and the second target word position, the first target word and the second target word are fused to obtain a sentiment target word; the matching relationship includes at least one of a sequential relationship, an inclusion relationship, a cross relationship and an identical relationship, wherein: If the matching relationship is the sequential relationship, the first target word position and the second target word position are connected to obtain a sentiment target word; If the matching relationship is the inclusion relationship, determining the emotional target word based on the position lengths of the first target word position and the second target word position; If the matching relationship is the intersection relationship, the first target word position and the second target word position are jointly determined as the sentiment target word; If the matching relationship is the same relationship, any one of the first target word position and the second target word position is selected and determined as the emotional target word; Performing emotion recognition processing on the emotion target words to obtain the emotion recognition result of the text to be processed.
2. The method according to claim 1, characterized in that The step of performing text extraction on the acquired text to be processed according to the target strategy to obtain the first target word includes: Determining a target strategy that matches the text to be processed; Based on the target strategy, text extraction is performed on the text to be processed, a starting position and an ending position of the first target word are determined, and the first target word is obtained according to the starting position and the ending position.
3. The method according to claim 1, characterized in that The semantic classification extraction of the text to be processed based on the trained semantic classification model to obtain the second target word includes: Extracting features of the text to be processed by a trained semantic classification model to obtain text features; the semantic classification model is trained based on text semantic classification samples; The text features are subjected to semantic classification extraction processing based on the semantic classification model, and the starting position and the ending position of the second target word are predicted through the decoding layer of the semantic classification model, and the second target word is obtained according to the starting position and the ending position.
4. The method according to claim 1, characterized in that: The performing emotion recognition processing on the emotion target word to obtain the emotion recognition result of the text to be processed includes: Based on the sentiment target word position of the sentiment target word, obtaining a feature vector corresponding to the sentiment target word; Extracting an attention vector corresponding to the feature vector through a trained emotion recognition model; The attention vector and the feature vector are fused to obtain a semantic representation, and the semantic representation is subjected to sentiment analysis through the sentiment recognition model to obtain a sentiment recognition result.
5. The method according to any one of claims 1 to 4, characterized in that: Before extracting the acquired text to be processed according to the target strategy to obtain the first target word, the method further includes: Determining the maximum text length of the text to be processed; The preprocessed text to be processed is subjected to text length correction processing based on the maximum text length, so as to extract the first target word and the second target word based on the corrected text to be processed.
6. The method according to claim 1, characterized in that The method further comprises: Performing object recognition on the text to be processed to obtain a sentiment recognition object; For a plurality of texts to be processed, based on the emotion recognition objects and emotion recognition results of the texts to be processed, obtaining emotion recognition results corresponding to the emotion recognition objects respectively; According to the emotion recognition results corresponding to each of the emotion recognition objects, problem location information for each emotion recognition object is generated; the problem location information is used to generate a problem solving strategy for the located problem.
7. An emotion recognition processing device, characterized in that: include: A first extraction module, used to extract text from the acquired text to be processed according to the target strategy to obtain a first target word; A second extraction module, used for classifying and extracting the text to be processed based on the trained classification model to obtain a second target word; a fusion module, configured to obtain a first target word position of the first target word and a second target word position of the second target word; Based on the matching relationship between the first target word position and the second target word position, the first target word and the second target word are merged to obtain a sentiment target word; the matching relationship includes at least one of a sequential relationship, an inclusion relationship, a cross relationship and an identical relationship, wherein: if the matching relationship is the sequential relationship, the first target word position and the second target word position are connected to obtain a sentiment target word; if the matching relationship is the inclusion relationship, the sentiment target word is determined based on the position lengths of the first target word position and the second target word position; if the matching relationship is the cross relationship, the first target word position and the second target word position are jointly determined as the sentiment target word; if the matching relationship is the identical relationship, any one of the first target word position and the second target word position is selected and determined as the sentiment target word; The processing module is used to perform emotion recognition processing on the emotion target words to obtain the emotion recognition result of the text to be processed.
8. A storage medium, characterized in that: The storage medium stores at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the emotion recognition processing method as described in any one of claims 1-6.
9. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the emotion recognition processing method as described in any one of claims 1-6.
Citation Information
Patent Citations
Emotion estimation device and emotion estimation program
JP2010020390A