WO2023173541A1 - Text-based emotion recognition method and apparatus, device, and storage medium - Google Patents

Text-based emotion recognition method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2023173541A1
WO2023173541A1 PCT/CN2022/089998 CN2022089998W WO2023173541A1 WO 2023173541 A1 WO2023173541 A1 WO 2023173541A1 CN 2022089998 W CN2022089998 W CN 2022089998W WO 2023173541 A1 WO2023173541 A1 WO 2023173541A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
recognized
emotion
emotion recognition
processing
Prior art date
Application number
PCT/CN2022/089998
Other languages
French (fr)
Chinese (zh)
Inventor
王彦
马骏
王少军
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2023173541A1 publication Critical patent/WO2023173541A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/01Customer relationship services

Definitions

  • This application relates to the field of artificial intelligence decision-making technology, and in particular to a text-based emotion recognition method, device, equipment and storage medium.
  • the negative emotions detected by a single model are often not accurate enough, the detected data need to be further reviewed. Work The amount is large, resulting in the effect of emotion recognition being unsatisfactory.
  • embodiments of the present application provide a text-based emotion recognition method, device, equipment and storage medium, which can simultaneously improve the accuracy and efficiency of emotion recognition in text and take into account the accuracy and efficiency of emotion recognition.
  • the first aspect of the embodiment of the present application provides a text-based emotion recognition method, including:
  • the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
  • a second aspect of the embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the electronic device.
  • the processor executes the computer program, the first
  • the text-based emotion recognition method provided on the one hand:
  • the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium that stores a computer program.
  • the computer program is executed by a processor, the text-based emotion recognition provided by the first aspect is implemented.
  • the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
  • the fourth aspect of the embodiments of the present application provides a text-based emotion recognition device.
  • the text-based emotion recognition device includes:
  • the first-level emotion recognition module is used to extract characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to compare the characteristic keywords.
  • the text to be recognized undergoes first-level emotion recognition processing to determine whether the characteristic keyword hits the pre-identification rule;
  • a secondary emotion recognition module configured to use a first emotion recognition model based on the FastText algorithm to perform secondary emotion recognition processing on the text to be recognized when the text to be recognized does not hit the pre-recognition rule, Determine whether the text to be identified is non-negative emotional text;
  • a three-level emotion recognition module used to perform three-level emotion recognition processing on the text to be recognized using a second emotion recognition model based on the Bert algorithm when the text to be recognized is not judged to be a non-negative emotion text, Identify the emotion classification category corresponding to the text to be recognized, and generate an emotion recognition result of the text to be recognized according to the emotion classification category.
  • This application extracts feature keywords used to characterize the text to be recognized from the text to be recognized, compares the feature keywords with the preset pre-recognition rules, performs first-level emotion recognition processing on the text to be recognized, and determines the key features Whether the word hits the pre-recognition rule; if not, the first emotion recognition model is used to perform secondary emotion recognition processing on the text to be recognized, and it is judged whether the text to be recognized is a non-negative emotion text; if not, the second emotion recognition model is used to process it.
  • the recognized text undergoes three-level emotion recognition processing to identify the emotion classification category corresponding to the text to be recognized, and generates the emotion recognition result of the text to be recognized based on the emotion classification category.
  • Multi-level emotion recognition processing is used to conduct hierarchical detection of the text to be recognized, which combines the dual advantages of the rule engine and the machine learning algorithm model, while improving the accuracy and efficiency of emotion recognition of text, taking into account the accuracy and efficiency of emotion recognition. sex.
  • Figure 1 is an implementation flow chart of a text-based emotion recognition method provided by an embodiment of the present application
  • Figure 2 is a schematic flowchart of a method for performing first-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
  • Figure 3 is a schematic flowchart of a method for performing secondary emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
  • Figure 4 is a schematic flowchart of a method for performing three-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
  • Figure 5 is a schematic flowchart of a method for bidirectional encoding and characterization processing in a text-based emotion recognition method provided by an embodiment of the present application
  • Figure 6 is a basic structural block diagram of a text-based emotion recognition device provided by an embodiment of the present application.
  • Figure 7 is a basic structural block diagram of an electronic device provided by an embodiment of the present application.
  • the text-based emotion recognition method provided by the embodiments of this application is applied in an intelligent customer service robot system.
  • the intelligent customer service robot system will collect the customer's voice data and perform speech and semantic understanding of the voice data, identify and respond to the customer's needs, realize human-computer interaction, and thus provide customers with anthropomorphic services.
  • Figure 1 is an implementation flow chart of a text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
  • S11 Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to conduct a first-level analysis of the text to be recognized. Emotion recognition processing determines whether the characteristic keyword hits the pre-identification rule.
  • the text to be recognized is obtained by text conversion of the customer's voice data collected by the intelligent robot.
  • natural language processing technology is used to perform text feature extraction processing on the text to be recognized, and feature keywords used to characterize the features of the text to be recognized are obtained.
  • a rule list for performing first-level emotion recognition is preset. This rule list stores multiple sets of pre-recognition rules for identifying the emotions corresponding to the text to be recognized. All pre-recognition rules The rules are written and checked manually. Each set of pre-recognition rules contains an emotion label and the applicable conditions set for the emotion label.
  • emotion labels include but are not limited to "non-negative” emotion labels, “slightly negative” emotion labels, “severely negative” emotion labels, etc.
  • the applicable conditions set for emotion labels can be expressed as A characteristic or set of characteristics for this emotion label.
  • the intelligent customer service robot system performs first-level emotion recognition processing, it extracts the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and then compares the characteristic keywords with all pre-set pre-recognition rules one by one. Yes, it is determined whether the feature keyword meets the usage conditions of a certain pre-identification rule record among all pre-identification rules.
  • the feature keyword meets the applicable conditions of a certain pre-identification rule, it is judged that the feature keyword hits the Pre-recognition rule, at this time, the emotion label recorded in the pre-recognition rule hit by the feature keyword is output as the final emotion recognition result. If the feature keyword does not meet the applicable conditions of any of the pre-recognition rules among all pre-recognition rules, it is judged that the feature keyword does not hit the pre-recognition rule, and at this time, the text to be recognized is subjected to further secondary emotion recognition processing.
  • the prefix identification rule may be set as a text matching rule. Specifically, a short text and an emotion label are recorded in a set of text matching rules.
  • the short text is used as an applicable condition to verify whether the emotion label is applicable to the text to be recognized.
  • a set of text matching rules short texts are mapped and associated with emotion labels, such that a short text corresponds to a unique emotion label.
  • the preset rule list for performing first-level emotion recognition can be represented as a list of correspondences between short texts and emotion tags.
  • the pre-identification rule can also be set as a regular matching rule. Specifically, a regular expression and an emotion label are recorded in a set of regular matching rules.
  • the regular expression is used as a verification emotion label. Whether the applicable conditions apply to the text to be recognized.
  • regular expressions are mapped to emotion labels, such that a regular expression corresponds to a unique emotion label.
  • the preset rule list for performing first-level emotion recognition can be represented as a correspondence table between regular expressions and emotion tags.
  • FIG. 2 is a schematic flowchart of a method for performing first-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application. Details are as follows:
  • S21 Calculate the text correlation between the characteristic keywords and the short text recorded in the short text matching rule, and obtain the text correlation value between the characteristic keywords and the short text;
  • the preset pre-identification rules can be set as short text matching rules.
  • a set of short text matching rules is represented as a correspondence between short texts and emotion tags, in which a short text and a short text are recorded. This has emotion tags that map association relationships.
  • the obtained feature keywords and the short text recorded in the short text matching rules can be vectorized in advance to obtain A first vector used to represent feature keywords and a second vector used to represent short text. The text correlation between feature keywords and short text is calculated through the representation vector.
  • a cosine similarity algorithm is used to calculate the cosine value of the angle between the first vector and the second vector, and the calculated cosine value of the angle is used as the text correlation value between the feature keyword and the short text.
  • the calculated text correlation value can be compared with the preset correlation threshold. When the text correlation value is less than the correlation threshold, it is judged Feature keyword misses short text matching rules.
  • the preset pre-identification rules include multiple sets of short text matching rules, the text correlation between the feature keywords and the short texts recorded in each short text matching rule will be calculated one by one, and then one by one.
  • the preset correlation threshold is obtained by the user customizing the setting in the intelligent customer service robot system according to the actual demand for emotion recognition accuracy.
  • vectorization when vectorizing the feature keywords and the short text respectively, vectorization can be performed in combination with the semantic dimension and the literal dimension to obtain the first vector used to represent the feature keywords and
  • the second vector used to represent the short text both the first vector and the second vector contain features of two dimensions: semantic dimension and literal dimension.
  • the preset pre-identification rules can be set as regular matching rules.
  • a set of regular matching rules is expressed as a correspondence between regular expressions and emotion tags, in which a regular expression and a Sentiment tags that are mapped to this regular expression.
  • the regular expression is specifically represented by ASCII (full name: American Standard Code for Information Interchange, American Standard Code for Information Interchange) characters.
  • the feature keywords used to characterize the text to be recognized are extracted from the text to be recognized, the feature keywords can be converted into corresponding ASCII character representations in advance based on the ASCII character encoding table, and then based on the ASCII used to represent regular expressions Characters are compared one-to-one with the ASCII characters corresponding to the feature keywords from left to right to determine whether the ASCII characters used to represent the regular expression are consistent with the ASCII characters corresponding to the feature keywords. If they are inconsistent, the feature is The keyword does not meet the requirements of the regular expression. At this time, it can be judged that the feature keyword does not hit the regular matching rule.
  • the characteristic keywords will be compared one by one with the regular expressions recorded in each regular matching rule. Yes, it is judged whether the characteristic keyword does not satisfy any of the regular matching rules among all the regular matching rules. If so, it is judged that the characteristic keyword hits the regular matching rule.
  • the intelligent customer service robot system can quickly and accurately identify the emotions corresponding to certain texts to be recognized by using pre-recognition rules to perform first-level emotion recognition processing on the text to be recognized.
  • the intelligent customer service robot system fails to recognize the text to be recognized corresponding to the emotion using pre-recognition rules, and further identifies it through two-category processing. Check whether the text to be identified is a text with negative emotions. For example, two-classification training is performed in advance based on the FastText (Fast Text Classification) model to generate a first emotion recognition model for performing secondary emotion recognition processing on the text to be recognized.
  • FastText FastText Text Classification
  • the text to be recognized whose corresponding emotion cannot be recognized by the pre-recognition rule is input into the first emotion recognition model for secondary emotion recognition processing, and the first emotion recognition model outputs whether the text to be recognized is a non-negative emotion.
  • Text results.
  • the proportion of non-negative emotions is much greater than the proportion of negative emotions, and negative emotions require more attention. Therefore, by performing binary classification processing on the text to be recognized through the first emotion recognition model, most of the non-negative emotion texts can be filtered out, and for most of the filtered non-negative emotion texts, the "non-negative" emotion label can be directly output as the final emotion recognition result.
  • the binary classification process in the first emotion recognition model can identify non-negative emotion text simply and with high accuracy.
  • FIG. 3 is a schematic flowchart of a method for performing secondary emotion recognition processing in the text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
  • S31 Use the first emotion recognition model to perform first word vector representation processing on each word in the text to be recognized, and obtain a first word vector set corresponding to the text to be recognized;
  • S32 Input the first word vector set into the sentence representation layer of the first emotion recognition model for sentence vector representation, and obtain the first sentence vector used to characterize the text to be recognized;
  • S33 Input the first sentence vector to the linear layer of the first emotion recognition model for linear transformation processing, and obtain the text to be recognized and the non-negative emotion categories and negative emotions preset in the first emotion recognition model respectively. Match probability value between categories;
  • a network architecture for two classifications is built based on the FastText model, one of which is configured as a non-negative emotion category, and the other is configured as a negative emotion category, and then uses A large number of texts marked with non-negative emotion labels or negative emotion labels are expected to be used as training samples for network training of the network architecture based on the FastText model, and the network architecture is trained to a convergence state, so that the network architecture has judgment based on text content. Whether the text is a non-negative emotional text, thus obtaining the first emotion recognition model.
  • the network architecture trained in the first emotion recognition model includes a sentence representation layer and a linear layer.
  • the text to be recognized when using the first emotion recognition model to perform secondary emotion recognition on the text to be recognized, can be input into the first emotion recognition model, and the first emotion recognition model is first used to identify the text to be recognized. All the words in the text are disassembled, and then the first word vector representation processing is performed on each word in the text to be recognized. Each word is represented by a vector to obtain the word vector corresponding to each word, and then the word vector to be recognized is obtained. The word vectors corresponding to all words in the recognized text are gathered together, thereby obtaining the first set of word vectors corresponding to the text to be recognized.
  • the first word vector set is input into the sentence representation layer of the first emotion recognition model for sentence vector representation, and a first sentence vector used to characterize the text to be recognized is obtained. Specifically, by calculating the mean value of word vectors corresponding to all words in the first word vector set, the mean value is used as the first sentence vector used to characterize the text to be recognized.
  • input the first sentence vector into the linear layer of the first emotion recognition model for linear transformation processing, and obtain the two emotion classification categories of the non-negative emotion category and the negative emotion category in the first emotion recognition model. Probability distribution. Based on the probability distribution, the matching probability values between the text to be recognized and the preset non-negative emotion categories and negative emotion categories in the first emotion recognition model can be obtained. At this time, if the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, it can be determined that the text to be recognized is a non-negative emotion text.
  • the intelligent customer service robot system uses the first emotion recognition model to perform secondary emotion recognition on the text to be recognized that fails to recognize the corresponding emotion according to the recognition rules, and can obtain a small portion of the text that has not been judged by the first emotion recognition model. is the text to be identified that is a non-negative emotion text.
  • the emotion classification category corresponding to the text to be recognized can be identified through bidirectional coding representation.
  • emotion classification category recognition training is performed in advance based on the Bert (full name Bidirectional Encoder Representations from Transformers) model to generate a second emotion recognition model for identifying the emotion classification category corresponding to the text to be recognized.
  • the text to be recognized that is not judged as a non-negative emotion text by the first emotion recognition model is input into the second emotion recognition model for three-level emotion recognition processing, so that the second emotion recognition model outputs the emotion corresponding to the text to be recognized.
  • Classification category results After obtaining the emotion classification category corresponding to the text to be recognized, the emotion classification category is output as the final emotion recognition result, achieving hierarchical and progressive detection of the text using multiple models, while improving the accuracy of emotion recognition of the text. accuracy and efficiency, taking into account the accuracy and efficiency of emotion recognition.
  • the training samples used can be labeled with more detailed emotion classification category information, such as non-negative, slightly negative, severe negative emotions, etc.
  • the judgment results of the first emotion recognition model can be reviewed and more detailed and accurate emotion classification can be made.
  • FIG. 4 is a schematic flowchart of a method for performing three-level emotion recognition processing in the text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
  • S41 Use the second emotion recognition model to perform second sub-vector representation processing on each word in the text to be recognized, and obtain a second set of word vectors corresponding to the text to be recognized;
  • S42 Input the second word vector set into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing, and obtain a second sentence vector used to characterize the text to be recognized;
  • S43 Input the first sentence vector to the linear layer of the second emotion recognition model for linear transformation processing, and obtain the probability distribution data of the text to be recognized in each emotion classification category preset by the second emotion recognition model. ;
  • a network architecture that can perform bidirectional encoding and representation of text is built based on the Bert model.
  • a Transformer layer and a Transformer layer are provided for bidirectional encoding and representation of text.
  • Linear layer It can be understood that the Transformer layer is a network layer containing multiple sets of encoding-decoding layers that utilizes the Self-Attention mechanism.
  • a large number of text predictions marked with various emotion classification categories are used as training texts to perform model training on the network architecture based on the Bert model, and the network architecture is trained to a convergence state, so that the network architecture can recognize based on text content. The ability to classify text corresponding to emotion categories, thereby obtaining a second emotion recognition model.
  • the text to be recognized can be input into the second emotion recognition model.
  • the second emotion recognition model is used to process the text to be recognized. All words in the recognition text are disassembled, and then each word in the text to be recognized is separately processed as a second word vector representation. Specifically, for each word, it is obtained from the three dimensions of word embedding, segment embedding and position embedding. The three sub-vectors of the word are then added to obtain the word vector corresponding to the word. After obtaining the word vector corresponding to each word, the word vectors corresponding to all the words in the text to be recognized are gathered together.
  • the second set of word vectors is input into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing, and a second sentence vector used to characterize the text to be recognized is obtained.
  • the probability distribution data of the text to be recognized in each emotion classification category preset by the first emotion recognition model can be obtained.
  • the emotion classification category corresponding to the maximum probability value in the probability distribution data is selected as the emotion classification category of the text to be recognized.
  • FIG. 5 is a schematic flowchart of a method for performing bidirectional coding representation processing in a text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
  • S51 Perform self-attention calculation on each word vector in the second word vector set, and obtain the self-attention data value corresponding to each word vector in the second word vector set;
  • S52 Normalize the self-attention data value corresponding to each word vector to obtain a second sentence vector used to characterize the text to be recognized.
  • the second set of word vectors is input into the Transformer layer of the second emotion recognition model for bidirectional encoding and representation processing
  • self-attention is performed on each word vector in the second set of word vectors in the Transformer layer. Force calculation is performed to obtain the self-attention data value corresponding to each word vector in the second word vector set. Furthermore, the self-attention data values corresponding to each word vector are normalized to obtain a second sentence vector used to characterize the text to be recognized.
  • the text-based emotion recognition method provided by this embodiment first performs first-level emotion recognition on the text through pre-recognition rules. As long as the rule is hit, the emotion recognition result of the text is generated based on the hit rule, which is fast.
  • the first emotion recognition model built with the FastText algorithm is used to perform secondary emotion recognition on the text, which can quickly identify the non-negative emotion texts that account for the vast majority of customer service scenarios. Improved system throughput and ability to support concurrency.
  • the secondary emotion recognition model based on the Bert algorithm is used to perform third-level emotion recognition on the text to obtain the emotion classification category corresponding to the text and classify it according to the emotion. Emotion recognition results for category generated text.
  • sequence number of each step in the above embodiment does not mean the order of execution.
  • the execution order of each process should be determined by its function and internal logic, and should not constitute any influence on the implementation process of the embodiment of the present application. limited.
  • FIG. 6 is a basic structural block diagram of a text-based emotion recognition device provided by an embodiment of the present application.
  • Each unit included in the device in this embodiment is used to perform each step in the above method embodiment.
  • the text-based emotion recognition device includes: a first-level emotion recognition module 61 , a second-level emotion recognition module 62 , and a third-level emotion recognition module 63 .
  • the first-level emotion recognition module 61 is used to extract characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with preset pre-recognition rules, A first-level emotion recognition process is performed on the text to be recognized to determine whether the characteristic keyword hits the pre-identification rule.
  • the secondary emotion recognition module 62 is used to perform secondary emotion recognition on the text to be recognized by using a first emotion recognition model based on the FastText algorithm when the text to be recognized does not hit the pre-recognition rule. Processing to determine whether the text to be recognized is non-negative emotional text.
  • the three-level emotion recognition module 63 is used to perform three-level emotion recognition on the text to be recognized by using a second emotion recognition model based on the Bert algorithm when the text to be recognized is not judged to be a non-negative emotion text. Processing: identifying the emotion classification category corresponding to the text to be recognized, and generating an emotion recognition result of the text to be recognized according to the emotion classification category.
  • FIG. 7 is a basic structural block diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 7 of this embodiment includes: a processor 71, a memory 72, and a computer program 73 stored in the memory 72 and executable on the processor 71, such as text-based emotion recognition. method procedure.
  • the processor 71 executes the computer program 73, the steps in each embodiment of the above text-based emotion recognition method are implemented.
  • the processor 71 executes the computer program 73, it implements the functions of each module in the corresponding embodiment of the above text-based emotion recognition device.
  • the relevant descriptions in the embodiments and will not be repeated here please refer to the relevant descriptions in the embodiments and will not be repeated here.
  • the computer program 73 can be divided into one or more modules (units), and the one or more modules are stored in the memory 72 and executed by the processor 71 to complete the present invention. Apply.
  • the one or more modules may be a series of computer program instruction segments capable of completing specific functions.
  • the instruction segments are used to describe the execution process of the computer program 73 in the electronic device 7 .
  • the computer program 73 can be divided into a first-level emotion recognition module, a second-level emotion recognition module, and a third-level emotion recognition module. The specific functions of each module are as described above.
  • the electronic device may include, but is not limited to, a processor 71 and a memory 72 .
  • FIG. 7 is only an example of the electronic device 7 and does not constitute a limitation of the electronic device 7. It may include more or fewer components than shown in the figure, or some components may be combined, or different components may be used. , for example, the electronic device may also include input and output devices, network access devices, buses, etc.
  • the processor 71 can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Ready-made field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • CPU Central Processing Unit
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Ready-made field-programmable gate array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the memory 72 may be an internal storage unit of the electronic device 7 , such as a hard disk or memory of the electronic device 7 .
  • the memory 72 may also be an external storage device of the electronic device 7, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), or a secure digital (SD) equipped on the electronic device 7. Card, Flash Card, etc.
  • the memory 72 may also include both an internal storage unit of the electronic device 7 and an external storage device.
  • the memory 72 is used to store the computer program and other programs and data required by the electronic device.
  • the memory 72 can also be used to temporarily store data that has been output or is to be output.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in each of the above method embodiments can be implemented.
  • the computer-readable storage medium may be a non-volatile storage medium or a volatile storage medium.
  • Embodiments of the present application provide a computer program product.
  • the steps in each of the above method embodiments can be implemented when the mobile terminal is executed.
  • Module completion means dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above.
  • Each functional unit and module in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above-mentioned integrated unit can be hardware-based. It can also be implemented in the form of software functional units.
  • the specific names of each functional unit and module are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present application.
  • For the specific working processes of the units and modules in the above system please refer to the corresponding processes in the foregoing method embodiments, and will not be described again here.
  • the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the present application can implement all or part of the processes in the methods of the above embodiments, which can also be completed by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium, and the computer can When the program is executed by the processor, the steps of each of the above method embodiments can be implemented.
  • the computer program includes computer program code, which may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media, etc.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • electrical carrier signals telecommunications signals
  • software distribution media etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Business, Economics & Management (AREA)
  • Economics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

A text-based emotion recognition method and apparatus, a device, and a storage medium, applicable to the technical field of artificial intelligence. The method comprises: extracting, from a text to be recognized, a feature keyword for representing the text to be recognized, comparing the feature keyword with a preset pre-recognition rule, performing first-level emotion recognition processing on the text to be recognized, and determining whether the feature keyword satisfies the pre-recognition rule; if not, inputting the text to be recognized into a first emotion recognition model for second-level emotion recognition processing, and determining whether the text to be recognized is a negative emotion text; and if so, inputting the text to be recognized into a second emotion recognition model for third-level emotion recognition processing, recognizing an emotion classification category corresponding to the text to be recognized, and generating, according to the emotion classification category, an emotion recognition result of the text to be recognized. The method employs multi-level emotion recognition to perform hierarchical detection on the text to be recognized, so that the accuracy and efficiency of emotion recognition can be improved simultaneously.

Description

基于文本的情绪识别方法、装置、设备及存储介质Text-based emotion recognition methods, devices, equipment and storage media
本申请要求于2022年03月17日提交中国专利局,申请号为202210262203.2,发明名称为“基于文本的情绪识别方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requests the priority of the Chinese patent application submitted to the China Patent Office on March 17, 2022, with the application number 202210262203.2, and the invention name is "Text-based emotion recognition method, device, equipment and storage medium", and its entire content is approved by This reference is incorporated into this application.
技术领域Technical field
本申请涉及人工智能决策技术领域,尤其涉及一种基于文本的情绪识别方法、装置、设备及存储介质。This application relates to the field of artificial intelligence decision-making technology, and in particular to a text-based emotion recognition method, device, equipment and storage medium.
背景技术Background technique
随着人工智能技术的发展,智能客服机器人得到了广泛的应用。为了使智能客服机器人的客服服务更加人性化,情绪识别作为人机交互的一项关键技术,也成为了热点的研究方向。在客服场景中,与非负面情绪相比,负面情绪占比极低,然而,发明人意识到客户的负面情绪往往更受人们关注,目前现有的情绪识别技术大多并未考虑客服场景的特殊性。而且在客服场景中,现有基于文本的情绪识别技术一般使用单一模型识别负面及非负面情绪,一方面由于非负面情绪样本量远大于负面情绪,模型在绝大部分时间内被用于检测人们并不关心的非负面情绪,耗费大量计算资源,严重影响服务吞吐量,情绪识别效率低,另一方面由于单一模型检测出的负面情绪往往不够准确,需要对检测出的数据做进一步复核,工作量大,从而致使情绪识别的效果并不理想。With the development of artificial intelligence technology, intelligent customer service robots have been widely used. In order to make the customer service services of intelligent customer service robots more humane, emotion recognition, as a key technology in human-computer interaction, has also become a hot research direction. In customer service scenarios, compared with non-negative emotions, the proportion of negative emotions is very low. However, the inventor realized that customers’ negative emotions tend to attract more attention. Most of the current emotion recognition technologies do not consider the special characteristics of customer service scenarios. sex. Moreover, in customer service scenarios, existing text-based emotion recognition technology generally uses a single model to identify negative and non-negative emotions. On the one hand, because the sample size of non-negative emotions is much larger than that of negative emotions, the model is used to detect people most of the time. Non-negative emotions that we don’t care about consume a lot of computing resources, seriously affect service throughput, and have low emotion recognition efficiency. On the other hand, because the negative emotions detected by a single model are often not accurate enough, the detected data need to be further reviewed. Work The amount is large, resulting in the effect of emotion recognition being unsatisfactory.
发明内容Contents of the invention
有鉴于此,本申请实施例提供了一种基于文本的情绪识别方法、装置、设备及存储介质,可以同时提高对文本进行情绪识别的准确度和效率,兼顾情绪识别的准确性和高效性。In view of this, embodiments of the present application provide a text-based emotion recognition method, device, equipment and storage medium, which can simultaneously improve the accuracy and efficiency of emotion recognition in text and take into account the accuracy and efficiency of emotion recognition.
本申请实施例的第一方面提供了一种基于文本的情绪识别方法,包括:The first aspect of the embodiment of the present application provides a text-based emotion recognition method, including:
从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
若否,则将所述待识别文本输入到预先训练好的第一情绪识别模型中进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, input the text to be recognized into the pre-trained first emotion recognition model for secondary emotion recognition processing, and determine whether the text to be recognized is a non-negative emotion text;
若否,则将所述待识别文本输入到预先训练好的第二情绪识别模型中进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,并根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
本申请实施例的第二方面提供了一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在电子设备上运行的计算机程序,所述处理器执行所述计算机程序时实现第一方面提供的基于文本的情绪识别方法的各步骤:A second aspect of the embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the electronic device. When the processor executes the computer program, the first Each step of the text-based emotion recognition method provided on the one hand:
从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
若否,则将所述待识别文本输入到预先训练好的第一情绪识别模型中进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, input the text to be recognized into the pre-trained first emotion recognition model for secondary emotion recognition processing, and determine whether the text to be recognized is a non-negative emotion text;
若否,则将所述待识别文本输入到预先训练好的第二情绪识别模型中进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,并根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现第一方面提供的基于文本的情绪识别方法的各步骤:A fourth aspect of the embodiments of the present application provides a computer-readable storage medium that stores a computer program. When the computer program is executed by a processor, the text-based emotion recognition provided by the first aspect is implemented. Each step of the method:
从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
若否,则将所述待识别文本输入到预先训练好的第一情绪识别模型中进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, input the text to be recognized into the pre-trained first emotion recognition model for secondary emotion recognition processing, and determine whether the text to be recognized is a non-negative emotion text;
若否,则将所述待识别文本输入到预先训练好的第二情绪识别模型中进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,并根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, the text to be recognized is input into the pre-trained second emotion recognition model to perform three-level emotion recognition processing, the emotion classification category corresponding to the text to be recognized is identified, and the emotion classification category is generated according to the emotion classification category The emotion recognition result of the text to be recognized.
本申请实施例的第四方面提供了一种基于文本的情绪识别装置,所述基于文本的情绪识别装置包括:The fourth aspect of the embodiments of the present application provides a text-based emotion recognition device. The text-based emotion recognition device includes:
一级情绪识别模块,用于从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;The first-level emotion recognition module is used to extract characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to compare the characteristic keywords. The text to be recognized undergoes first-level emotion recognition processing to determine whether the characteristic keyword hits the pre-identification rule;
二级情绪识别模块,用于在所述待识别文本未命中所述前置识别规则的情况下,采用基于FastText算法搭建的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;A secondary emotion recognition module, configured to use a first emotion recognition model based on the FastText algorithm to perform secondary emotion recognition processing on the text to be recognized when the text to be recognized does not hit the pre-recognition rule, Determine whether the text to be identified is non-negative emotional text;
三级情绪识别模块,用于在所述待识别文本未被判断为非负面情绪文本的情况下,采用基于Bert算法搭建的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。A three-level emotion recognition module, used to perform three-level emotion recognition processing on the text to be recognized using a second emotion recognition model based on the Bert algorithm when the text to be recognized is not judged to be a non-negative emotion text, Identify the emotion classification category corresponding to the text to be recognized, and generate an emotion recognition result of the text to be recognized according to the emotion classification category.
本申请实施例提供的一种基于文本的情绪识别方法、装置、电子设备及存储介质,具有 以下有益效果:The text-based emotion recognition method, device, electronic device and storage medium provided by the embodiments of this application have the following beneficial effects:
本申请通过从待识别文本中提取出用于表征待识别文本的特征关键词,将特征关键词与预设的前置识别规则进行比对,对待识别文本进行一级情绪识别处理,判断特征关键词是否命中前置识别规则;若否,则采用第一情绪识别模型对待识别文本进行二级情绪识别处理,判断待识别文本是否为非负面情绪文本;若否,则采用第二情绪识别模型对待识别文本进行三级情绪识别处理,识别出待识别文本对应的情绪分类类别,根据情绪分类类别生成待识别文本的情绪识别结果。采用多级情绪识别处理来对待识别文本进行分层检测,融合了规则引擎和机器学习算法模型的双重优势,同时提高对文本进行情绪识别的准确度和效率,兼顾了情绪识别的准确性和高效性。This application extracts feature keywords used to characterize the text to be recognized from the text to be recognized, compares the feature keywords with the preset pre-recognition rules, performs first-level emotion recognition processing on the text to be recognized, and determines the key features Whether the word hits the pre-recognition rule; if not, the first emotion recognition model is used to perform secondary emotion recognition processing on the text to be recognized, and it is judged whether the text to be recognized is a non-negative emotion text; if not, the second emotion recognition model is used to process it. The recognized text undergoes three-level emotion recognition processing to identify the emotion classification category corresponding to the text to be recognized, and generates the emotion recognition result of the text to be recognized based on the emotion classification category. Multi-level emotion recognition processing is used to conduct hierarchical detection of the text to be recognized, which combines the dual advantages of the rule engine and the machine learning algorithm model, while improving the accuracy and efficiency of emotion recognition of text, taking into account the accuracy and efficiency of emotion recognition. sex.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the purpose of the present application. For some embodiments, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.
图1为本申请实施例提供的一种基于文本的情绪识别方法的实现流程图;Figure 1 is an implementation flow chart of a text-based emotion recognition method provided by an embodiment of the present application;
图2为本申请实施例提供的基于文本的情绪识别方法中进行一级情绪识别处理的一种方法流程示意图;Figure 2 is a schematic flowchart of a method for performing first-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
图3为本申请实施例提供的基于文本的情绪识别方法中进行二级情绪识别处理的方法流程示意图;Figure 3 is a schematic flowchart of a method for performing secondary emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
图4为本申请实施例提供的基于文本的情绪识别方法中进行三级情绪识别处理的方法流程示意图;Figure 4 is a schematic flowchart of a method for performing three-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application;
图5为本申请实施例提供的基于文本的情绪识别方法中进行双向编码表征处理的方法流程示意图;Figure 5 is a schematic flowchart of a method for bidirectional encoding and characterization processing in a text-based emotion recognition method provided by an embodiment of the present application;
图6为本申请实施例提供的一种基于文本的情绪识别装置的基础结构框图;Figure 6 is a basic structural block diagram of a text-based emotion recognition device provided by an embodiment of the present application;
图7为本申请实施例提供的一种电子设备的基本结构框图。Figure 7 is a basic structural block diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
本申请实施例提供的基于文本的情绪识别方法应用在智能客服机器人系统中。智能客服机器人系统在运行过程中会通过采集客户的语音数据并对语音数据进行语音和语义理解,识别并响应客户的需求,实现人机交互,从而实现为客户提供拟人化的服务。The text-based emotion recognition method provided by the embodiments of this application is applied in an intelligent customer service robot system. During operation, the intelligent customer service robot system will collect the customer's voice data and perform speech and semantic understanding of the voice data, identify and respond to the customer's needs, realize human-computer interaction, and thus provide customers with anthropomorphic services.
请参阅图1,图1为本申请实施例提供的一种基于文本的情绪识别方法的实现流程图。 详述如下:Please refer to Figure 1, which is an implementation flow chart of a text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
S11:从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则。S11: Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to conduct a first-level analysis of the text to be recognized. Emotion recognition processing determines whether the characteristic keyword hits the pre-identification rule.
本实施例中,待识别文本通过智能机器人采集到的客户的语音数据进行文本转化获得。在本实施例中,采用自然语言处理技术对该待识别文本进行文本特征提取处理,获得用于表征该待识别文本特征的特征关键词。示例性的,在智能客服机器人系统中,预先设置有用于执行一级情绪识别的规则列表,该规则列表中存储有多组用于判别待识别文本对应情绪的前置识别规则,所有前置识别规则由人工编写并核对,每组前置识别规则中记录有情绪标签以及针对该情绪标签设定的适用条件。在本实施例中,情绪标签包括但不限于包含有“非负面”情绪标签、“轻微负面”情绪标签、“严重负面”情绪标签等,针对情绪标签设定的适用条件可以表示为用于表征该情绪标签的特征或特征集。智能客服机器人系统在执行一级情绪识别处理时,通过从待识别文本中提取出用于表征该待识别文本的特征关键词,然后将特征关键词与预先设置的所有前置识别规则逐一进行比对,判别该特征关键词是否满足该所有前置识别规则中某一前置识别规则记录的使用条件,若该特征关键词满足某个前置识别规则的适用条件,则判断该特征关键词命中前置识别规则,此时,将该特征关键词命中的前置识别规则中记录的情绪标签作为最终情绪识别结果进行输出。若特征关键词并未满足所有前置识别规则中任何一个前置识别规则的适用条件,则判断该特征关键词未命中前置识别规则,此时对待识别文本进行进一步的二级情绪识别处理。In this embodiment, the text to be recognized is obtained by text conversion of the customer's voice data collected by the intelligent robot. In this embodiment, natural language processing technology is used to perform text feature extraction processing on the text to be recognized, and feature keywords used to characterize the features of the text to be recognized are obtained. For example, in the intelligent customer service robot system, a rule list for performing first-level emotion recognition is preset. This rule list stores multiple sets of pre-recognition rules for identifying the emotions corresponding to the text to be recognized. All pre-recognition rules The rules are written and checked manually. Each set of pre-recognition rules contains an emotion label and the applicable conditions set for the emotion label. In this embodiment, emotion labels include but are not limited to "non-negative" emotion labels, "slightly negative" emotion labels, "severely negative" emotion labels, etc. The applicable conditions set for emotion labels can be expressed as A characteristic or set of characteristics for this emotion label. When the intelligent customer service robot system performs first-level emotion recognition processing, it extracts the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and then compares the characteristic keywords with all pre-set pre-recognition rules one by one. Yes, it is determined whether the feature keyword meets the usage conditions of a certain pre-identification rule record among all pre-identification rules. If the feature keyword meets the applicable conditions of a certain pre-identification rule, it is judged that the feature keyword hits the Pre-recognition rule, at this time, the emotion label recorded in the pre-recognition rule hit by the feature keyword is output as the final emotion recognition result. If the feature keyword does not meet the applicable conditions of any of the pre-recognition rules among all pre-recognition rules, it is judged that the feature keyword does not hit the pre-recognition rule, and at this time, the text to be recognized is subjected to further secondary emotion recognition processing.
本申请的一些实施例中,示例性的,前置识别规则可以设置为文本匹配规则。具体地,一组文本匹配规则中记录有一个短文本和一个情绪标签,在该文本匹配规则中,短文本作为验证情绪标签是否适用于待识别文本的适用条件。在一组文本匹配规则中,短文本与情绪标签映射关联,使得一个短文本对应一个唯一的情绪标签。在本实施例中,预先设置的用于执行一级情绪识别的规则列表可以表示为短文本与情绪标签之间的对应关系列表。示例性的,前置识别规则还可以设置为正则匹配规则,具体地,一组正则匹配规则中记录有一个正则表达式和一个情绪标签,在该正则匹配规则中,正则表达式作为验证情绪标签是否适用于待识别文本的适用条件。在一组正则匹配规则中,正则表达式与情绪标签映射关联,使得一个正则表达式对应一个唯一的情绪标签。在本实施例中,预先设置的用于执行一级情绪识别的规则列表可以表示为正则表达式与情绪标签之间的对应关系表。In some embodiments of the present application, for example, the prefix identification rule may be set as a text matching rule. Specifically, a short text and an emotion label are recorded in a set of text matching rules. In the text matching rule, the short text is used as an applicable condition to verify whether the emotion label is applicable to the text to be recognized. In a set of text matching rules, short texts are mapped and associated with emotion labels, such that a short text corresponds to a unique emotion label. In this embodiment, the preset rule list for performing first-level emotion recognition can be represented as a list of correspondences between short texts and emotion tags. For example, the pre-identification rule can also be set as a regular matching rule. Specifically, a regular expression and an emotion label are recorded in a set of regular matching rules. In the regular matching rule, the regular expression is used as a verification emotion label. Whether the applicable conditions apply to the text to be recognized. In a set of regular matching rules, regular expressions are mapped to emotion labels, such that a regular expression corresponds to a unique emotion label. In this embodiment, the preset rule list for performing first-level emotion recognition can be represented as a correspondence table between regular expressions and emotion tags.
本申请的一些实施例中,请参阅图2,图2为本申请实施例提供的基于文本的情绪识别方法中进行一级情绪识别处理的一种方法流程示意图。详细如下:In some embodiments of the present application, please refer to FIG. 2 . FIG. 2 is a schematic flowchart of a method for performing first-level emotion recognition processing in the text-based emotion recognition method provided by the embodiment of the present application. Details are as follows:
S21:计算所述特征关键词与所述短文本匹配规则中记录的短文本之间的文本关联度,获取所述特征关键词与所述短文本之间的文本关联度值;S21: Calculate the text correlation between the characteristic keywords and the short text recorded in the short text matching rule, and obtain the text correlation value between the characteristic keywords and the short text;
S22:将所述文本关联度值与预设的关联度阈值进行比较,若所述文本关联度值小于所述关联度阈值,则判断所述特征关键词未命中所述短文本匹配规则。S22: Compare the text relevance value with a preset relevance threshold. If the text relevance value is less than the relevance threshold, it is determined that the feature keyword does not hit the short text matching rule.
本实施例中,预设的前置识别规则可以设置为短文本匹配规则,一组短文本匹配规则表示为短文本与情绪标签之间的对应关系,其中记录有一个短文本和一个与该短文本具有映射关联关系的情绪标签。在本实施例中,从待识别文本中提取到用于表征待识别文本的特征关键词后,可以预先对获得的特征关键词和短文本匹配规则中记录的短文本分别进行向量化表示,获得用于表征特征关键词的第一向量以及用于表征短文本的第二向量。通过表征向量来计算特征关键词与短文本之间的文本关联度。具体地,采用余弦相似度算法计算第一向量与第二向量之间夹角余弦值,将该计算得到的夹角余弦值作为特征关键词与短文本之间的文本关联度值。获得特征关键词与短文本之间的文本关联度值之后,即可通过将该计算获得的文本关联度值与预设的关联度阈值进行比较,当文本关联度值小于关联度阈值时,判断特征关键词未命中短文本匹配规则。需要说明的时,当预设的前置识别规则中包含有多组短文本匹配规则时,则逐一计算特征关键词与各短文本匹配规则中记录的短文本之间的文本关联度,进而逐一比较,判断特征关键词是否并未满足所有短文本匹配规则中任何一个短文本匹配规则,若是,则判断该特征关键词为命中短文本匹配规则。在本实施例中,预设的关联度阈值通过用户根据对情绪识别准确性的实际需求在智能客服机器人系统中自定义设置获得。In this embodiment, the preset pre-identification rules can be set as short text matching rules. A set of short text matching rules is represented as a correspondence between short texts and emotion tags, in which a short text and a short text are recorded. This has emotion tags that map association relationships. In this embodiment, after the feature keywords used to characterize the text to be recognized are extracted from the text to be recognized, the obtained feature keywords and the short text recorded in the short text matching rules can be vectorized in advance to obtain A first vector used to represent feature keywords and a second vector used to represent short text. The text correlation between feature keywords and short text is calculated through the representation vector. Specifically, a cosine similarity algorithm is used to calculate the cosine value of the angle between the first vector and the second vector, and the calculated cosine value of the angle is used as the text correlation value between the feature keyword and the short text. After obtaining the text correlation value between the feature keyword and the short text, the calculated text correlation value can be compared with the preset correlation threshold. When the text correlation value is less than the correlation threshold, it is judged Feature keyword misses short text matching rules. It should be noted that when the preset pre-identification rules include multiple sets of short text matching rules, the text correlation between the feature keywords and the short texts recorded in each short text matching rule will be calculated one by one, and then one by one. Compare and determine whether the feature keyword does not satisfy any short text matching rule among all short text matching rules. If so, determine whether the feature keyword hits the short text matching rule. In this embodiment, the preset correlation threshold is obtained by the user customizing the setting in the intelligent customer service robot system according to the actual demand for emotion recognition accuracy.
示例性的,在本实施例中,在对特征关键词和短文本分别进行向量化表示时,可以结合语义维度和字面维度进行向量化表示,得到获得用于表征特征关键词的第一向量以及用于表征短文本的第二向量,第一向量和第二向量中均包含有语义维度和字面维度两个维度的特征。For example, in this embodiment, when vectorizing the feature keywords and the short text respectively, vectorization can be performed in combination with the semantic dimension and the literal dimension to obtain the first vector used to represent the feature keywords and The second vector used to represent the short text, both the first vector and the second vector contain features of two dimensions: semantic dimension and literal dimension.
本申请的一些实施例中,预设的前置识别规则可以设置为正则匹配规则,一组正则匹配规则表示为正则表达式与情绪标签之间的对应关系,其中记录有一个正则表达式和一个与该正则表达式具有映射关联关系的情绪标签。在本实施例中,正则表达式具体采用ASCII(全称American Standard Code for Information Interchange,美国信息交换标准代码)字符表示。从待识别文本中提取到用于表征待识别文本的特征关键词后,可以基于ASCII字符编码表预先将特征关键词转化为对应的ASCII字符表示,进而,再基于用于表示正则表达式的ASCII字符从左到右按字符与特征关键词对应的ASCII字符进行一对一比对,判断用于表示正则表达式的ASCII字符与特征关键词对应的ASCII字符是否一致,若不一致,则说明该特征关键词并不满足正则表达式要求,此时,可以判断该特征关键词未命中该正则匹配规则。可以理解的是,在本实施例中,若预设的前置识别规则中包含有多组正则匹配规则时,则将该特征关键词逐一与各正则匹配规则中记录的正则表达式分别进行比对,判断特征关键词是否并未满足所有正则匹配规则中任何一个正则匹配规则,若是,则判断该特征关键词为命中正则匹配规则。In some embodiments of the present application, the preset pre-identification rules can be set as regular matching rules. A set of regular matching rules is expressed as a correspondence between regular expressions and emotion tags, in which a regular expression and a Sentiment tags that are mapped to this regular expression. In this embodiment, the regular expression is specifically represented by ASCII (full name: American Standard Code for Information Interchange, American Standard Code for Information Interchange) characters. After the feature keywords used to characterize the text to be recognized are extracted from the text to be recognized, the feature keywords can be converted into corresponding ASCII character representations in advance based on the ASCII character encoding table, and then based on the ASCII used to represent regular expressions Characters are compared one-to-one with the ASCII characters corresponding to the feature keywords from left to right to determine whether the ASCII characters used to represent the regular expression are consistent with the ASCII characters corresponding to the feature keywords. If they are inconsistent, the feature is The keyword does not meet the requirements of the regular expression. At this time, it can be judged that the feature keyword does not hit the regular matching rule. It can be understood that in this embodiment, if the preset pre-identification rules include multiple sets of regular matching rules, the characteristic keywords will be compared one by one with the regular expressions recorded in each regular matching rule. Yes, it is judged whether the characteristic keyword does not satisfy any of the regular matching rules among all the regular matching rules. If so, it is judged that the characteristic keyword hits the regular matching rule.
S12:若否,则采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本。S12: If not, use the first emotion recognition model obtained by training based on the FastText model to perform secondary emotion recognition processing on the text to be recognized, and determine whether the text to be recognized is a non-negative emotion text.
本实施例中,智能客服机器人系统通过采用前置识别规则对待识别文本进行一级情绪识别处理后,可以快速准确地识别出某些待识别文本所对应的情绪。针对前置识别规则识别情绪泛化性差的问题,在本实施例中,智能客服机器人系统对于采用前置识别规则未能识别出 对应情绪的待识别文本,进一步地,通过二分类处理的方式识别出待识别文本是否为负面情绪文本。示例性的,预先基于FastText(快速文本分类)模型进行二分类训练,生成用于对待识别文本进行二级情绪识别处理的第一情绪识别模型。进而,将前置识别规则未能识别出对应情绪的待识别文本输入到该第一情绪识别模型中进行二级情绪识别处理,由该第一情绪识别模型输出该待识别文本是否为非负面情绪文本的结果。在机器人客服场景中,非负面情绪的占比远大于负面情绪的占比,而负面情绪更为需要关注。因而,通过第一情绪识别模型对待识别文本进行二分类处理,可以筛选出大部分非负面情绪文本,并对筛选出的大部分非负面情绪文本,直接输出“非负面”情绪标签作为最终情绪识别结果。第一情绪识别模型中的二分类处理可以简单且准确率较高地识别出非负面情绪文本。In this embodiment, the intelligent customer service robot system can quickly and accurately identify the emotions corresponding to certain texts to be recognized by using pre-recognition rules to perform first-level emotion recognition processing on the text to be recognized. In order to solve the problem of poor generalization of emotion recognition by pre-recognition rules, in this embodiment, the intelligent customer service robot system fails to recognize the text to be recognized corresponding to the emotion using pre-recognition rules, and further identifies it through two-category processing. Check whether the text to be identified is a text with negative emotions. For example, two-classification training is performed in advance based on the FastText (Fast Text Classification) model to generate a first emotion recognition model for performing secondary emotion recognition processing on the text to be recognized. Furthermore, the text to be recognized whose corresponding emotion cannot be recognized by the pre-recognition rule is input into the first emotion recognition model for secondary emotion recognition processing, and the first emotion recognition model outputs whether the text to be recognized is a non-negative emotion. Text results. In robot customer service scenarios, the proportion of non-negative emotions is much greater than the proportion of negative emotions, and negative emotions require more attention. Therefore, by performing binary classification processing on the text to be recognized through the first emotion recognition model, most of the non-negative emotion texts can be filtered out, and for most of the filtered non-negative emotion texts, the "non-negative" emotion label can be directly output as the final emotion recognition result. The binary classification process in the first emotion recognition model can identify non-negative emotion text simply and with high accuracy.
本申请的一些实施例中,请参阅图3,图3为本申请实施例提供的基于文本的情绪识别方法中进行二级情绪识别处理的方法流程示意图。详细如下:In some embodiments of the present application, please refer to FIG. 3 . FIG. 3 is a schematic flowchart of a method for performing secondary emotion recognition processing in the text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
S31:采用所述第一情绪识别模型对所述待识别文本中的每个字分别进行第一字向量表征处理,获得所述待识别文本对应的第一字向量集合;S31: Use the first emotion recognition model to perform first word vector representation processing on each word in the text to be recognized, and obtain a first word vector set corresponding to the text to be recognized;
S32:将所述第一字向量集合输入到所述第一情绪识别模型的句子表示层中进行句子向量表示,获得用于表征所述待识别文本的第一句子向量;S32: Input the first word vector set into the sentence representation layer of the first emotion recognition model for sentence vector representation, and obtain the first sentence vector used to characterize the text to be recognized;
S33:将所述第一句子向量输入到第一情绪识别模型的线性层进行线性变换处理,获得所述待识别文本分别与所述第一情绪识别模型中预设的非负面情绪类别和负面情绪类别之间的匹配概率值;S33: Input the first sentence vector to the linear layer of the first emotion recognition model for linear transformation processing, and obtain the text to be recognized and the non-negative emotion categories and negative emotions preset in the first emotion recognition model respectively. Match probability value between categories;
S34:若所述待识别文本与非负面情绪类别之间的匹配概率值大于所述待识别文本与负面情绪类别之间的匹配概率值,则判断所述待识别文本为非负面情绪文本。S34: If the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, determine that the text to be recognized is a non-negative emotion text.
本实施例中,在构建第一情绪识别模型时,基于FastText模型搭建得到一个用于进行二分类的网络架构,其中一个分类配置为非负面情绪类别,另一个分类配置为负面情绪类别,然后采用大量分别标记有非负面情绪标签或负面情绪标签的文本预料作为训练样本对该基于FastText模型搭建的网络架构进行网络训练,将该网络架构训练至收敛状态,以使得该网络架构具有基于文本内容判断文本是否为非负面情绪文本的能力,从而得到第一情绪识别模型。具体地,第一情绪识别模型中训练好的网络架构包含有句子表示层和线性层。在本实施例中,采用第一情绪识别模型对待识别文本进行二级情绪识别时,可以将该待识别文本输入到该第一情绪识别模型中,首先采用该第一情绪识别模型将该待识别文本中的字全部拆解,进而对该待识别文本中的每个字分别进行第一字向量表征处理,每个字采用一个向量进行表示,获得每个字对应的字向量,进而再将待识别文本中所有字对应的字向量集合到一起,从而获得该待识别文本对应的第一字向量集合。然后,将该第一字向量集合输入到该第一情绪识别模型的句子表示层中进行句子向量表示,获得用于表征所述待识别文本的第一句子向量。具体地,通过计算第一字向量集合中所有字对应的字向量的均值,将该均值作为用于表征所述待识别文本的第一句子向量。获得第一句子向量后,将该第一句子向量输入到第一情绪识别模型的线性层进行线性变换处理,可以获得第一情绪识别模型中非负面情绪类别和负面情 绪类别两个情绪分类类别的概率分布,基于概率分布即可获得该待识别文本分别与第一情绪识别模型中预设的非负面情绪类别和负面情绪类别之间的匹配概率值。此时,若待识别文本与非负面情绪类别之间的匹配概率值大于待识别文本与负面情绪类别之间的匹配概率值,则可以判断待识别文本为非负面情绪文本。In this embodiment, when building the first emotion recognition model, a network architecture for two classifications is built based on the FastText model, one of which is configured as a non-negative emotion category, and the other is configured as a negative emotion category, and then uses A large number of texts marked with non-negative emotion labels or negative emotion labels are expected to be used as training samples for network training of the network architecture based on the FastText model, and the network architecture is trained to a convergence state, so that the network architecture has judgment based on text content. Whether the text is a non-negative emotional text, thus obtaining the first emotion recognition model. Specifically, the network architecture trained in the first emotion recognition model includes a sentence representation layer and a linear layer. In this embodiment, when using the first emotion recognition model to perform secondary emotion recognition on the text to be recognized, the text to be recognized can be input into the first emotion recognition model, and the first emotion recognition model is first used to identify the text to be recognized. All the words in the text are disassembled, and then the first word vector representation processing is performed on each word in the text to be recognized. Each word is represented by a vector to obtain the word vector corresponding to each word, and then the word vector to be recognized is obtained. The word vectors corresponding to all words in the recognized text are gathered together, thereby obtaining the first set of word vectors corresponding to the text to be recognized. Then, the first word vector set is input into the sentence representation layer of the first emotion recognition model for sentence vector representation, and a first sentence vector used to characterize the text to be recognized is obtained. Specifically, by calculating the mean value of word vectors corresponding to all words in the first word vector set, the mean value is used as the first sentence vector used to characterize the text to be recognized. After obtaining the first sentence vector, input the first sentence vector into the linear layer of the first emotion recognition model for linear transformation processing, and obtain the two emotion classification categories of the non-negative emotion category and the negative emotion category in the first emotion recognition model. Probability distribution. Based on the probability distribution, the matching probability values between the text to be recognized and the preset non-negative emotion categories and negative emotion categories in the first emotion recognition model can be obtained. At this time, if the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, it can be determined that the text to be recognized is a non-negative emotion text.
S13:若是,则采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。S13: If yes, use the second emotion recognition model obtained based on Bert model training to perform three-level emotion recognition processing on the text to be recognized, identify the emotion classification category corresponding to the text to be recognized, and generate a The emotion recognition result of the text to be recognized.
本实施例中,智能客服机器人系统通过采用第一情绪识别模型对迁至识别规则未能识别出对应情绪的待识别文本进行二级情绪识别后,可以获得小部分未被第一情绪识别模型判断为是非负面情绪文本的待识别文本。在本实施例中,针对未被第一情绪识别模型判断为是非负面情绪文本的待识别文本,可以通过双向编码表征的方式识别出待识别文本对应的情绪分类类别。在本实施例中,预先基于Bert(全称Bidirectional Encoder Representations from Transformers,双向编码器表示)模型进行情绪分类类别识别训练,生成用于识别待识别文本对应情绪分类类别的第二情绪识别模型。进而将未被第一情绪识别模型判断为是非负面情绪文本的待识别文本输入到该第二情绪识别模型中进行三级情绪识别处理,从而由该第二情绪识别模型输出该待识别文本对应情绪分类类别的结果。获得待识别文本对应的情绪分类类别后,将该情绪分类类别作为作为最终情绪识别结果进行输出,实现采用多模型对文本进行分层、递进式的检测,同时提高对文本进行情绪识别的准确度和效率,兼顾情绪识别的准确性和高效性。其中,第二情绪识别模型在训练时,采用的训练样本可以标记由更为细化的情绪分类类别信息,比如非负面、轻微负面、严重负面情绪等。通过第二情绪识别模型,可以复核第一情绪识别模型的判断结果,并做出更加细致和准确的情绪分类。In this embodiment, the intelligent customer service robot system uses the first emotion recognition model to perform secondary emotion recognition on the text to be recognized that fails to recognize the corresponding emotion according to the recognition rules, and can obtain a small portion of the text that has not been judged by the first emotion recognition model. is the text to be identified that is a non-negative emotion text. In this embodiment, for the text to be recognized that is not judged to be non-negative emotional text by the first emotion recognition model, the emotion classification category corresponding to the text to be recognized can be identified through bidirectional coding representation. In this embodiment, emotion classification category recognition training is performed in advance based on the Bert (full name Bidirectional Encoder Representations from Transformers) model to generate a second emotion recognition model for identifying the emotion classification category corresponding to the text to be recognized. Then, the text to be recognized that is not judged as a non-negative emotion text by the first emotion recognition model is input into the second emotion recognition model for three-level emotion recognition processing, so that the second emotion recognition model outputs the emotion corresponding to the text to be recognized. Classification category results. After obtaining the emotion classification category corresponding to the text to be recognized, the emotion classification category is output as the final emotion recognition result, achieving hierarchical and progressive detection of the text using multiple models, while improving the accuracy of emotion recognition of the text. accuracy and efficiency, taking into account the accuracy and efficiency of emotion recognition. Among them, when training the second emotion recognition model, the training samples used can be labeled with more detailed emotion classification category information, such as non-negative, slightly negative, severe negative emotions, etc. Through the second emotion recognition model, the judgment results of the first emotion recognition model can be reviewed and more detailed and accurate emotion classification can be made.
本申请的一些实施例中,请参阅图4,图4为本申请实施例提供的基于文本的情绪识别方法中进行三级情绪识别处理的方法流程示意图。详细如下:In some embodiments of the present application, please refer to FIG. 4 , which is a schematic flowchart of a method for performing three-level emotion recognition processing in the text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
S41:采用所述第二情绪识别模型对所述待识别文本中的每个字分别进行第二子向量表征处理,获得所述待识别文本对应的第二字向量集合;S41: Use the second emotion recognition model to perform second sub-vector representation processing on each word in the text to be recognized, and obtain a second set of word vectors corresponding to the text to be recognized;
S42:将所述第二字向量集合输入到所述第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征所述待识别文本的第二句子向量;S42: Input the second word vector set into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing, and obtain a second sentence vector used to characterize the text to be recognized;
S43:将所述第一句子向量输入到第二情绪识别模型的线性层进行线性变换处理,获得所述待识别文本在所述第二情绪识别模型预设的各情绪分类类别中的概率分布数据;S43: Input the first sentence vector to the linear layer of the second emotion recognition model for linear transformation processing, and obtain the probability distribution data of the text to be recognized in each emotion classification category preset by the second emotion recognition model. ;
S44:根据所述概率分布数据,选取所述概率分布数据中概率最大值对应的情绪分类类别作为所述待识别文本对饮的情绪分类类别。S44: According to the probability distribution data, select the emotion classification category corresponding to the maximum probability value in the probability distribution data as the emotion classification category of the text to be recognized.
本实施例中,在构建第二情绪识别模型时,基于Bert模型搭建得到一个可以对文本进行双向编码表征的网络架构,在该网络架构中设置有用于对文本进行双向编码表征处理的Transformer层和线性层。可以理解的是,Transformer层为利用了Self-Attention(自注意力)机制的包含有多组编码-解码层的网络层。然后采用大量标记有各类情绪分类类别的文本预 料作为训练文本对该基于Bert模型搭建的网络架构进行模型训练,将该网络架构训练至收敛状态,以使得该网络架构具有可以基于文本内容识别出对文本对应情绪分类类别的能力,从而得到第二情绪识别模型。在本实施例中,采用第二情绪识别模型对待识别文本进行三级情绪识别处理时,可以将该待识别文本输入到该第二情绪识别模型中,首先采用该第二情绪识别模型将该待识别文本中的字全部拆解,进而对该待识别文本中的每个字分别进行第二字向量表征处理,具体地,针对每个字,从字嵌入、段嵌入和位置嵌入三个维度获得该字的三个分向量,进而将该三个分向量进行相加得到该字对应的字向量,获得每个字对应的字向量后,将待识别文本中所有字对应的字向量集合到一起,从而获得该待识别文本对应的第一字向量集合。然后,将该第二字向量集合输入到该第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征该待识别文本的第二句子向量。通过将该第一句子向量输入到第二情绪识别模型的线性层进行线性变换处理,即可获得待识别文本在所述第一情绪识别模型预设的各情绪分类类别中的概率分布数据。最后,根据该概率分布数据,选取该概率分布数据中概率最大值对应的情绪分类类别作为待识别文本对饮的情绪分类类别。In this embodiment, when building the second emotion recognition model, a network architecture that can perform bidirectional encoding and representation of text is built based on the Bert model. In this network architecture, a Transformer layer and a Transformer layer are provided for bidirectional encoding and representation of text. Linear layer. It can be understood that the Transformer layer is a network layer containing multiple sets of encoding-decoding layers that utilizes the Self-Attention mechanism. Then a large number of text predictions marked with various emotion classification categories are used as training texts to perform model training on the network architecture based on the Bert model, and the network architecture is trained to a convergence state, so that the network architecture can recognize based on text content. The ability to classify text corresponding to emotion categories, thereby obtaining a second emotion recognition model. In this embodiment, when using the second emotion recognition model to perform three-level emotion recognition processing on the text to be recognized, the text to be recognized can be input into the second emotion recognition model. First, the second emotion recognition model is used to process the text to be recognized. All words in the recognition text are disassembled, and then each word in the text to be recognized is separately processed as a second word vector representation. Specifically, for each word, it is obtained from the three dimensions of word embedding, segment embedding and position embedding. The three sub-vectors of the word are then added to obtain the word vector corresponding to the word. After obtaining the word vector corresponding to each word, the word vectors corresponding to all the words in the text to be recognized are gathered together. , thereby obtaining the first word vector set corresponding to the text to be recognized. Then, the second set of word vectors is input into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing, and a second sentence vector used to characterize the text to be recognized is obtained. By inputting the first sentence vector into the linear layer of the second emotion recognition model for linear transformation processing, the probability distribution data of the text to be recognized in each emotion classification category preset by the first emotion recognition model can be obtained. Finally, according to the probability distribution data, the emotion classification category corresponding to the maximum probability value in the probability distribution data is selected as the emotion classification category of the text to be recognized.
本申请的一些实施例中,请参阅图5,图5为本申请实施例提供的基于文本的情绪识别方法中进行双向编码表征处理的方法流程示意图。详细如下:In some embodiments of the present application, please refer to FIG. 5 . FIG. 5 is a schematic flowchart of a method for performing bidirectional coding representation processing in a text-based emotion recognition method provided by an embodiment of the present application. Details are as follows:
S51:对所述第二字向量集合中的各字向量分别进行自注意力计算,获取所述第二字向量集合中每个字向量对应的自注意力数据值;S51: Perform self-attention calculation on each word vector in the second word vector set, and obtain the self-attention data value corresponding to each word vector in the second word vector set;
S52:将所述每个字向量对应的自注意力数据值进行归一化处理,获得用于表征所述待识别文本的第二句子向量。S52: Normalize the self-attention data value corresponding to each word vector to obtain a second sentence vector used to characterize the text to be recognized.
本实施例中,将第二字向量集合输入到第二情绪识别模型的Transformer层中进行双向编码表征处理时,具体为再Transformer层中对第二字向量集合中的各字向量分别进行自注意力计算,获取该第二字向量集合中每个字向量各自对应的自注意力数据值。进而,再将每个字向量各自对应的自注意力数据值进行归一化处理,从而获得用于表征该待识别文本的第二句子向量。In this embodiment, when the second set of word vectors is input into the Transformer layer of the second emotion recognition model for bidirectional encoding and representation processing, specifically, self-attention is performed on each word vector in the second set of word vectors in the Transformer layer. Force calculation is performed to obtain the self-attention data value corresponding to each word vector in the second word vector set. Furthermore, the self-attention data values corresponding to each word vector are normalized to obtain a second sentence vector used to characterize the text to be recognized.
以上可以看出,本实施例提供的基于文本的情绪识别方法首先通过前置识别规则对文本进行一级情绪识别,只要命中规则即基于该命中的规则生成文本的情绪识别结果,速度快。在一级情绪识别未检测出负面情绪的情况下,采用FastText算法搭建的第一情绪识别模型对文本进行二级情绪识别,可以快速识别在客服场景中占比绝大多数的非负面情绪文本,提高了系统的吞吐量和支持并发的能力。进而,在二级情绪识别检测出文本为负面情绪文本的情况下,采用基于Bert算法搭建的第二情绪识别模型对文本进行三级情绪识别,获得文本所对应的情绪分类类别,并根据情绪分类类别生成文本的情绪识别结果。以此,通过采用多模型对文本进行分层检测,融合规则引擎和机器学习算法模型的双重优势来对文本进行情绪识别,同时提高对文本进行情绪识别的准确度和效率,兼顾情绪识别的准确性和高效性。It can be seen from the above that the text-based emotion recognition method provided by this embodiment first performs first-level emotion recognition on the text through pre-recognition rules. As long as the rule is hit, the emotion recognition result of the text is generated based on the hit rule, which is fast. When the first-level emotion recognition does not detect negative emotions, the first emotion recognition model built with the FastText algorithm is used to perform secondary emotion recognition on the text, which can quickly identify the non-negative emotion texts that account for the vast majority of customer service scenarios. Improved system throughput and ability to support concurrency. Furthermore, when the secondary emotion recognition detects that the text is a negative emotional text, the second emotion recognition model based on the Bert algorithm is used to perform third-level emotion recognition on the text to obtain the emotion classification category corresponding to the text and classify it according to the emotion. Emotion recognition results for category generated text. In this way, by using multiple models to perform hierarchical detection of text, integrating the dual advantages of rule engines and machine learning algorithm models to perform emotion recognition on text, while improving the accuracy and efficiency of emotion recognition on text, taking into account the accuracy of emotion recognition. sex and efficiency.
可以理解的是,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It can be understood that the sequence number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any influence on the implementation process of the embodiment of the present application. limited.
本申请的一些实施例中,请参阅图6,图6为本申请实施例提供的一种基于文本的情绪识别装置的基础结构框图。本实施例中该装置包括的各单元用于执行上述方法实施例中的各步骤。具体请参阅上述方法实施例中的相关描述。为了便于说明,仅示出了与本实施例相关的部分。如图6所示,基于文本的情绪识别装置包括:一级情绪识别模块61、二级情绪识别模块62以及三级情绪识别模块63。其中:所述一级情绪识别模块61用于从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则。所述二级情绪识别模块62用于在所述待识别文本未命中所述前置识别规则的情况下,采用基于FastText算法搭建的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本。所述三级情绪识别模块63用于在所述待识别文本未被判断为非负面情绪文本的情况下,采用基于Bert算法搭建的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。In some embodiments of the present application, please refer to FIG. 6 , which is a basic structural block diagram of a text-based emotion recognition device provided by an embodiment of the present application. Each unit included in the device in this embodiment is used to perform each step in the above method embodiment. For details, please refer to the relevant descriptions in the above method embodiments. For convenience of explanation, only parts related to this embodiment are shown. As shown in FIG. 6 , the text-based emotion recognition device includes: a first-level emotion recognition module 61 , a second-level emotion recognition module 62 , and a third-level emotion recognition module 63 . Wherein: the first-level emotion recognition module 61 is used to extract characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with preset pre-recognition rules, A first-level emotion recognition process is performed on the text to be recognized to determine whether the characteristic keyword hits the pre-identification rule. The secondary emotion recognition module 62 is used to perform secondary emotion recognition on the text to be recognized by using a first emotion recognition model based on the FastText algorithm when the text to be recognized does not hit the pre-recognition rule. Processing to determine whether the text to be recognized is non-negative emotional text. The three-level emotion recognition module 63 is used to perform three-level emotion recognition on the text to be recognized by using a second emotion recognition model based on the Bert algorithm when the text to be recognized is not judged to be a non-negative emotion text. Processing: identifying the emotion classification category corresponding to the text to be recognized, and generating an emotion recognition result of the text to be recognized according to the emotion classification category.
应当理解的是,上述基于文本的情绪识别装置,与上述的基于文本的情绪识别方法一一对应,此处不再赘述。It should be understood that the above-mentioned text-based emotion recognition device corresponds to the above-mentioned text-based emotion recognition method, and will not be described again here.
本申请的一些实施例中,请参阅图7,图7为本申请实施例提供的一种电子设备的基本结构框图。如图7所示,该实施例的电子设备7包括:处理器71、存储器72以及存储在所述存储器72中并可在所述处理器71上运行的计算机程序73,例如基于文本的情绪识别方法的程序。处理器71执行所述计算机程序73时实现上述各个基于文本的情绪识别方法各实施例中的步骤。或者,所述处理器71执行所述计算机程序73时实现上述基于文本的情绪识别装置对应的实施例中各模块的功能。具体请参阅实施例中的相关描述,此处不赘述。In some embodiments of the present application, please refer to FIG. 7 , which is a basic structural block diagram of an electronic device provided by an embodiment of the present application. As shown in Figure 7, the electronic device 7 of this embodiment includes: a processor 71, a memory 72, and a computer program 73 stored in the memory 72 and executable on the processor 71, such as text-based emotion recognition. method procedure. When the processor 71 executes the computer program 73, the steps in each embodiment of the above text-based emotion recognition method are implemented. Alternatively, when the processor 71 executes the computer program 73, it implements the functions of each module in the corresponding embodiment of the above text-based emotion recognition device. For details, please refer to the relevant descriptions in the embodiments and will not be repeated here.
示例性的,所述计算机程序73可以被分割成一个或多个模块(单元),所述一个或者多个模块被存储在所述存储器72中,并由所述处理器71执行,以完成本申请。所述一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序73在所述电子设备7中的执行过程。例如,所述计算机程序73可以被分割成一级情绪识别模块、二级情绪识别模块以及三级情绪识别模块,各模块具体功能如上所述。Exemplarily, the computer program 73 can be divided into one or more modules (units), and the one or more modules are stored in the memory 72 and executed by the processor 71 to complete the present invention. Apply. The one or more modules may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 73 in the electronic device 7 . For example, the computer program 73 can be divided into a first-level emotion recognition module, a second-level emotion recognition module, and a third-level emotion recognition module. The specific functions of each module are as described above.
所述电子设备可包括,但不仅限于,处理器71、存储器72。本领域技术人员可以理解,图7仅仅是电子设备7的示例,并不构成对电子设备7的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备还可以包括输入输出设备、网络接入设备、总线等。The electronic device may include, but is not limited to, a processor 71 and a memory 72 . Those skilled in the art can understand that FIG. 7 is only an example of the electronic device 7 and does not constitute a limitation of the electronic device 7. It may include more or fewer components than shown in the figure, or some components may be combined, or different components may be used. , for example, the electronic device may also include input and output devices, network access devices, buses, etc.
所述处理器71可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以 是微处理器或者该处理器也可以是任何常规的处理器等。The processor 71 can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), Ready-made field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
所述存储器72可以是所述电子设备7的内部存储单元,例如电子设备7的硬盘或内存。所述存储器72也可以是所述电子设备7的外部存储设备,例如所述电子设备7上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器72还可以既包括所述电子设备7的内部存储单元也包括外部存储设备。所述存储器72用于存储所述计算机程序以及所述电子设备所需的其他程序和数据。所述存储器72还可以用于暂时地存储已经输出或者将要输出的数据。The memory 72 may be an internal storage unit of the electronic device 7 , such as a hard disk or memory of the electronic device 7 . The memory 72 may also be an external storage device of the electronic device 7, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), or a secure digital (SD) equipped on the electronic device 7. Card, Flash Card, etc. Further, the memory 72 may also include both an internal storage unit of the electronic device 7 and an external storage device. The memory 72 is used to store the computer program and other programs and data required by the electronic device. The memory 72 can also be used to temporarily store data that has been output or is to be output.
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information interaction, execution process, etc. between the above-mentioned devices/units are based on the same concept as the method embodiments of the present application. For details of their specific functions and technical effects, please refer to the method embodiments section. No further details will be given.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。在本实施例中,所述计算机可读存储介质可以是非易失性的存储介质,也可以是易失性的存储介质。Embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in each of the above method embodiments can be implemented. In this embodiment, the computer-readable storage medium may be a non-volatile storage medium or a volatile storage medium.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。Embodiments of the present application provide a computer program product. When the computer program product is run on a mobile terminal, the steps in each of the above method embodiments can be implemented when the mobile terminal is executed.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above functional units and modules is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs. Module completion means dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be hardware-based. It can also be implemented in the form of software functional units. In addition, the specific names of each functional unit and module are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present application. For the specific working processes of the units and modules in the above system, please refer to the corresponding processes in the foregoing method embodiments, and will not be described again here.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在 某些司法管辖区,根据立法和专利实践,计算机可读介质不包括是电载波信号和电信信号。If the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application can implement all or part of the processes in the methods of the above embodiments, which can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer can When the program is executed by the processor, the steps of each of the above method embodiments can be implemented. Wherein, the computer program includes computer program code, which may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or deleted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium Excluded are electrical carrier signals and telecommunications signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, each embodiment is described with its own emphasis. For parts that are not detailed or documented in a certain embodiment, please refer to the relevant descriptions of other embodiments.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-described embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still implement the above-mentioned implementations. The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of this application, and should be included in within the protection scope of this application.

Claims (20)

  1. 一种基于文本的情绪识别方法,其中,包括:A text-based emotion recognition method, including:
    从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
    若否,则采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, use the first emotion recognition model obtained by training based on the FastText model to perform secondary emotion recognition processing on the text to be recognized, and determine whether the text to be recognized is a non-negative emotion text;
    若否,则采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, use the second emotion recognition model obtained based on Bert model training to perform three-level emotion recognition processing on the text to be recognized, identify the emotion classification category corresponding to the text to be recognized, and generate the emotion classification category according to the emotion classification category. Describe the emotion recognition results of the text to be recognized.
  2. 根据权利要求1所述的基于文本的情绪识别方法,其中,所述预设的前置识别规则包括短文本匹配规则和/或正则匹配规则,所述短文本匹配规则表示为短文本与情绪标签之间的对应关系,所述短文本为用于验证所述情绪标签是否适用于所述待识别文本的适用条件;The text-based emotion recognition method according to claim 1, wherein the preset pre-recognition rules include short text matching rules and/or regular matching rules, and the short text matching rules are expressed as short text and emotion tags The corresponding relationship between the short text is the applicable condition for verifying whether the emotion label is applicable to the text to be recognized;
    所述正则匹配规则表示为正则表达式与情绪标签之间的对应关系,所述正则表达式为用于验证所述情绪标签是否适用于所述待识别文本的适用条件。The regular matching rule is expressed as a correspondence between a regular expression and an emotion tag, and the regular expression is an applicable condition for verifying whether the emotion tag is applicable to the text to be recognized.
  3. 根据权利要求2所述的基于文本的情绪识别方法,其中,若所述前置识别规则为短文本匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则,包括:The text-based emotion recognition method according to claim 2, wherein if the pre-identification rule is a short text matching rule, then comparing the characteristic keywords with a pre-set pre-identification rule, Perform first-level emotion recognition processing on the text to be recognized to determine whether the characteristic keywords hit the pre-recognition rule, including:
    计算所述特征关键词与所述短文本匹配规则中记录的短文本之间的文本关联度,获取所述特征关键词与所述短文本之间的文本关联度值;Calculate the text correlation between the characteristic keywords and the short text recorded in the short text matching rule, and obtain the text correlation value between the characteristic keywords and the short text;
    将所述文本关联度值与预设的关联度阈值进行比较,若所述文本关联度值小于所述关联度阈值,则判断所述特征关键词未命中所述短文本匹配规则。The text relevance value is compared with a preset relevance threshold. If the text relevance value is less than the relevance threshold, it is determined that the characteristic keyword does not hit the short text matching rule.
  4. 根据权利要求2所述的基于文本的情绪识别方法,其中,若所述前置识别规则为正则匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则,包括:The text-based emotion recognition method according to claim 2, wherein if the pre-identification rule is a regular matching rule, then the characteristic keywords are compared with a pre-set pre-identification rule to determine Perform first-level emotion recognition processing on the text to be recognized, and determine whether the characteristic keywords hit the pre-recognition rules, including:
    将所述特征关键词与所述正则匹配规则中记录的正则表达式进行比对,判断所述特征关键词是否与所述正则表达式一致,若不一致,则判断所述特征关键词未命中所述正则匹配规则。Compare the characteristic keyword with the regular expression recorded in the regular matching rule to determine whether the characteristic keyword is consistent with the regular expression. If not, determine that the characteristic keyword does not hit the target. The regular matching rules described above.
  5. 根据权利要求1所述的基于文本的情绪识别方法,其中,所述采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本,包括:The text-based emotion recognition method according to claim 1, wherein the first emotion recognition model obtained by training based on the FastText model is used to perform secondary emotion recognition processing on the text to be recognized, and determine whether the text to be recognized is For non-negative sentiment text, include:
    采用所述第一情绪识别模型对所述待识别文本中的每个字分别进行第一字向量表征处理,获得所述待识别文本对应的第一字向量集合;Using the first emotion recognition model to perform first word vector representation processing on each word in the text to be recognized, and obtaining a first word vector set corresponding to the text to be recognized;
    将所述第一字向量集合输入到所述第一情绪识别模型的句子表示层中进行句子向量表 示,获得用于表征所述待识别文本的第一句子向量;Input the first word vector set into the sentence representation layer of the first emotion recognition model for sentence vector representation, and obtain the first sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第一情绪识别模型的线性层进行线性变换处理,获得所述待识别文本分别与所述第一情绪识别模型中预设的非负面情绪类别和负面情绪类别之间的匹配概率值;The first sentence vector is input to the linear layer of the first emotion recognition model for linear transformation processing to obtain the text to be recognized and the non-negative emotion category and the negative emotion category preset in the first emotion recognition model. The matching probability value between;
    若所述待识别文本与非负面情绪类别之间的匹配概率值大于所述待识别文本与负面情绪类别之间的匹配概率值,则判断所述待识别文本为非负面情绪文本。If the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, the text to be recognized is determined to be a non-negative emotion text.
  6. 根据权利要求1所述的基于文本的情绪识别方法,其中,所述采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,包括:The text-based emotion recognition method according to claim 1, wherein the second emotion recognition model obtained by training based on the Bert model is used to perform three-level emotion recognition processing on the text to be recognized, and the text to be recognized is recognized Corresponding emotion classification categories include:
    采用所述第二情绪识别模型对所述待识别文本中的每个字分别进行第二子向量表征处理,获得所述待识别文本对应的第二字向量集合;Using the second emotion recognition model to perform second sub-vector representation processing on each word in the text to be recognized, and obtaining a second set of word vectors corresponding to the text to be recognized;
    将所述第二字向量集合输入到所述第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征所述待识别文本的第二句子向量;Input the second set of word vectors into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing to obtain a second sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第二情绪识别模型的线性层进行线性变换处理,获得所述待识别文本在所述第二情绪识别模型预设的各情绪分类类别中的概率分布数据;Input the first sentence vector into the linear layer of the second emotion recognition model for linear transformation processing to obtain probability distribution data of the text to be recognized in each emotion classification category preset by the second emotion recognition model;
    根据所述概率分布数据,选取所述概率分布数据中概率最大值对应的情绪分类类别作为所述待识别文本对饮的情绪分类类别。According to the probability distribution data, the emotion classification category corresponding to the maximum probability value in the probability distribution data is selected as the emotion classification category of the text to be recognized.
  7. 根据权利要求6所述的基于文本的情绪识别方法,其中,所述将所述第二字向量集合输入到所述第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征所述待识别文本的第二句子向量,包括:The text-based emotion recognition method according to claim 6, wherein the second set of word vectors is input into the Transformer layer of the second emotion recognition model to perform bidirectional encoding and characterization processing to obtain a representation of the second word vector set. Describe the second sentence vector of the text to be recognized, including:
    对所述第二字向量集合中的各字向量分别进行自注意力计算,获取所述第二字向量集合中每个字向量对应的自注意力数据值;Perform self-attention calculation on each word vector in the second word vector set respectively, and obtain the self-attention data value corresponding to each word vector in the second word vector set;
    将所述每个字向量对应的自注意力数据值进行归一化处理,获得用于表征所述待识别文本的第二句子向量。The self-attention data value corresponding to each word vector is normalized to obtain a second sentence vector used to characterize the text to be recognized.
  8. 一种基于文本的情绪识别装置,其中,所述基于文本的情绪识别装置包括:A text-based emotion recognition device, wherein the text-based emotion recognition device includes:
    一级情绪识别模块,用于从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;The first-level emotion recognition module is used to extract characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to compare the characteristic keywords. The text to be recognized undergoes first-level emotion recognition processing to determine whether the characteristic keyword hits the pre-identification rule;
    二级情绪识别模块,用于在所述待识别文本未命中所述前置识别规则的情况下,采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;A secondary emotion recognition module, configured to perform secondary emotion recognition processing on the text to be recognized using the first emotion recognition model obtained based on FastText model training when the text to be recognized does not hit the pre-recognition rule. , determine whether the text to be recognized is a non-negative emotional text;
    三级情绪识别模块,用于在所述待识别文本未被判断为非负面情绪文本的情况下,采用基于Bert算法搭建的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。A three-level emotion recognition module, used to perform three-level emotion recognition processing on the text to be recognized using a second emotion recognition model based on the Bert algorithm when the text to be recognized is not judged to be a non-negative emotion text, Identify the emotion classification category corresponding to the text to be recognized, and generate an emotion recognition result of the text to be recognized according to the emotion classification category.
  9. 一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
    从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
    若否,则采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, use the first emotion recognition model obtained by training based on the FastText model to perform secondary emotion recognition processing on the text to be recognized, and determine whether the text to be recognized is a non-negative emotion text;
    若否,则采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, use the second emotion recognition model obtained based on Bert model training to perform three-level emotion recognition processing on the text to be recognized, identify the emotion classification category corresponding to the text to be recognized, and generate the emotion classification category according to the emotion classification category. Describe the emotion recognition results of the text to be recognized.
  10. 根据权利要求9所述的电子设备,其中,所述预设的前置识别规则包括短文本匹配规则和/或正则匹配规则,所述短文本匹配规则表示为短文本与情绪标签之间的对应关系,所述短文本为用于验证所述情绪标签是否适用于所述待识别文本的适用条件;The electronic device according to claim 9, wherein the preset pre-identification rules include short text matching rules and/or regular matching rules, and the short text matching rules are represented as correspondences between short texts and emotion tags. Relationship, the short text is an applicable condition used to verify whether the emotion label is applicable to the text to be recognized;
    所述正则匹配规则表示为正则表达式与情绪标签之间的对应关系,所述正则表达式为用于验证所述情绪标签是否适用于所述待识别文本的适用条件。The regular matching rule is expressed as a correspondence between a regular expression and an emotion tag, and the regular expression is an applicable condition for verifying whether the emotion tag is applicable to the text to be recognized.
  11. 根据权利要求10所述的电子设备,其中,在若所述前置识别规则为短文本匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则时,所述处理器执行所述计算机程序时实现以下步骤:The electronic device according to claim 10, wherein if the prefix identification rule is a short text matching rule, the characteristic keyword is compared with a preset prefix identification rule to match the prefix identification rule. When the text to be recognized is subjected to first-level emotion recognition processing and it is judged whether the characteristic keyword hits the pre-recognition rule, the processor implements the following steps when executing the computer program:
    计算所述特征关键词与所述短文本匹配规则中记录的短文本之间的文本关联度,获取所述特征关键词与所述短文本之间的文本关联度值;Calculate the text correlation between the characteristic keywords and the short text recorded in the short text matching rule, and obtain the text correlation value between the characteristic keywords and the short text;
    将所述文本关联度值与预设的关联度阈值进行比较,若所述文本关联度值小于所述关联度阈值,则判断所述特征关键词未命中所述短文本匹配规则。The text relevance value is compared with a preset relevance threshold. If the text relevance value is less than the relevance threshold, it is determined that the characteristic keyword does not hit the short text matching rule.
  12. 根据权利要求10所述的电子设备,其中,在若所述前置识别规则为正则匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则时,所述处理器执行所述计算机程序时实现以下步骤:The electronic device according to claim 10, wherein if the prefix identification rule is a regular matching rule, the characteristic keyword is compared with a preset prefix identification rule to compare the When the text to be recognized is subjected to first-level emotion recognition processing and it is judged whether the characteristic keyword hits the pre-recognition rule, the processor implements the following steps when executing the computer program:
    将所述特征关键词与所述正则匹配规则中记录的正则表达式进行比对,判断所述特征关键词是否与所述正则表达式一致,若不一致,则判断所述特征关键词未命中所述正则匹配规则。Compare the characteristic keyword with the regular expression recorded in the regular matching rule to determine whether the characteristic keyword is consistent with the regular expression. If not, determine that the characteristic keyword does not hit the target. The regular matching rules described above.
  13. 根据权利要求9所述的电子设备,其中,在所述采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本时,所述处理器执行所述计算机程序时实现以下步骤:The electronic device according to claim 9, wherein the first emotion recognition model obtained by training based on the FastText model is used to perform secondary emotion recognition processing on the text to be recognized, and it is determined whether the text to be recognized is non-negative. When writing emotional text, the processor implements the following steps when executing the computer program:
    采用所述第一情绪识别模型对所述待识别文本中的每个字分别进行第一字向量表征处理,获得所述待识别文本对应的第一字向量集合;Using the first emotion recognition model to perform first word vector representation processing on each word in the text to be recognized, and obtaining a first word vector set corresponding to the text to be recognized;
    将所述第一字向量集合输入到所述第一情绪识别模型的句子表示层中进行句子向量表示,获得用于表征所述待识别文本的第一句子向量;Input the first word vector set into the sentence representation layer of the first emotion recognition model for sentence vector representation, and obtain the first sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第一情绪识别模型的线性层进行线性变换处理,获得所述待识别文本分别与所述第一情绪识别模型中预设的非负面情绪类别和负面情绪类别之间的匹配概率值;The first sentence vector is input to the linear layer of the first emotion recognition model for linear transformation processing to obtain the text to be recognized and the non-negative emotion category and the negative emotion category preset in the first emotion recognition model. The matching probability value between;
    若所述待识别文本与非负面情绪类别之间的匹配概率值大于所述待识别文本与负面情绪类别之间的匹配概率值,则判断所述待识别文本为非负面情绪文本。If the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, the text to be recognized is determined to be a non-negative emotion text.
  14. 根据权利要求9所述的电子设备,其中,在所述采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别时,所述处理器执行所述计算机程序时实现以下步骤:The electronic device according to claim 9, wherein the second emotion recognition model obtained by training based on the Bert model is used to perform a three-level emotion recognition process on the text to be recognized, and the emotion corresponding to the text to be recognized is identified. When classifying categories, the processor implements the following steps when executing the computer program:
    采用所述第二情绪识别模型对所述待识别文本中的每个字分别进行第二子向量表征处理,获得所述待识别文本对应的第二字向量集合;Using the second emotion recognition model to perform second sub-vector representation processing on each word in the text to be recognized, and obtaining a second set of word vectors corresponding to the text to be recognized;
    将所述第二字向量集合输入到所述第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征所述待识别文本的第二句子向量;Input the second set of word vectors into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing to obtain a second sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第二情绪识别模型的线性层进行线性变换处理,获得所述待识别文本在所述第二情绪识别模型预设的各情绪分类类别中的概率分布数据;Input the first sentence vector into the linear layer of the second emotion recognition model for linear transformation processing to obtain probability distribution data of the text to be recognized in each emotion classification category preset by the second emotion recognition model;
    根据所述概率分布数据,选取所述概率分布数据中概率最大值对应的情绪分类类别作为所述待识别文本对饮的情绪分类类别。According to the probability distribution data, the emotion classification category corresponding to the maximum probability value in the probability distribution data is selected as the emotion classification category of the text to be recognized.
  15. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium, the computer-readable storage medium stores a computer program, wherein the following steps are implemented when the computer program is executed by a processor:
    从待识别文本中提取出用于表征所述待识别文本的特征关键词,将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则;Extract the characteristic keywords used to characterize the text to be recognized from the text to be recognized, and compare the characteristic keywords with the preset pre-recognition rules to perform first-level emotion recognition on the text to be recognized. Processing to determine whether the feature keyword hits the pre-identification rule;
    若否,则采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本;If not, use the first emotion recognition model obtained by training based on the FastText model to perform secondary emotion recognition processing on the text to be recognized, and determine whether the text to be recognized is a non-negative emotion text;
    若否,则采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别,根据所述情绪分类类别生成所述待识别文本的情绪识别结果。If not, use the second emotion recognition model obtained based on Bert model training to perform three-level emotion recognition processing on the text to be recognized, identify the emotion classification category corresponding to the text to be recognized, and generate the emotion classification category according to the emotion classification category. Describe the emotion recognition results of the text to be recognized.
  16. 根据权利要求15所述的存储介质,其中,所述预设的前置识别规则包括短文本匹配规则和/或正则匹配规则,所述短文本匹配规则表示为短文本与情绪标签之间的对应关系,所述短文本为用于验证所述情绪标签是否适用于所述待识别文本的适用条件;The storage medium according to claim 15, wherein the preset pre-identification rules include short text matching rules and/or regular matching rules, and the short text matching rules are represented as correspondences between short texts and emotion tags. Relationship, the short text is an applicable condition used to verify whether the emotion label is applicable to the text to be recognized;
    所述正则匹配规则表示为正则表达式与情绪标签之间的对应关系,所述正则表达式为用于验证所述情绪标签是否适用于所述待识别文本的适用条件。The regular matching rule is expressed as a correspondence between a regular expression and an emotion tag, and the regular expression is an applicable condition for verifying whether the emotion tag is applicable to the text to be recognized.
  17. 根据权利要求16所述的存储介质,其中,在若所述前置识别规则为短文本匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一 级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则时,所述计算机程序被处理器执行时实现以下步骤:The storage medium according to claim 16, wherein if the prefix identification rule is a short text matching rule, the characteristic keyword is compared with a preset prefix identification rule to match the prefix identification rule. When the text to be recognized is subjected to first-level emotion recognition processing and it is judged whether the characteristic keyword hits the pre-recognition rule, the following steps are implemented when the computer program is executed by the processor:
    计算所述特征关键词与所述短文本匹配规则中记录的短文本之间的文本关联度,获取所述特征关键词与所述短文本之间的文本关联度值;Calculate the text correlation between the characteristic keywords and the short text recorded in the short text matching rule, and obtain the text correlation value between the characteristic keywords and the short text;
    将所述文本关联度值与预设的关联度阈值进行比较,若所述文本关联度值小于所述关联度阈值,则判断所述特征关键词未命中所述短文本匹配规则。The text relevance value is compared with a preset relevance threshold. If the text relevance value is less than the relevance threshold, it is determined that the characteristic keyword does not hit the short text matching rule.
  18. 根据权利要求16所述的存储介质,其中,在若所述前置识别规则为正则匹配规则,则所述将所述特征关键词与预设的前置识别规则进行比对,以对所述待识别文本进行一级情绪识别处理,判断所述特征关键词是否命中所述前置识别规则时,所述计算机程序被处理器执行时实现以下步骤:The storage medium according to claim 16, wherein if the prefix identification rule is a regular matching rule, the characteristic keyword is compared with a preset prefix identification rule to compare the When the text to be recognized undergoes first-level emotion recognition processing and it is judged whether the characteristic keyword hits the pre-recognition rule, the computer program implements the following steps when executed by the processor:
    将所述特征关键词与所述正则匹配规则中记录的正则表达式进行比对,判断所述特征关键词是否与所述正则表达式一致,若不一致,则判断所述特征关键词未命中所述正则匹配规则。Compare the characteristic keyword with the regular expression recorded in the regular matching rule to determine whether the characteristic keyword is consistent with the regular expression. If not, determine that the characteristic keyword does not hit the target. The regular matching rules described above.
  19. 根据权利要求15所述的存储介质,其中,在所述采用基于FastText模型训练获得的第一情绪识别模型对所述待识别文本进行二级情绪识别处理,判断所述待识别文本是否为非负面情绪文本时,所述计算机程序被处理器执行时实现以下步骤:The storage medium according to claim 15, wherein the first emotion recognition model obtained by training based on the FastText model is used to perform secondary emotion recognition processing on the text to be recognized, and it is determined whether the text to be recognized is non-negative. When writing emotional text, the computer program implements the following steps when executed by the processor:
    采用所述第一情绪识别模型对所述待识别文本中的每个字分别进行第一字向量表征处理,获得所述待识别文本对应的第一字向量集合;Using the first emotion recognition model to perform first word vector representation processing on each word in the text to be recognized, and obtaining a first word vector set corresponding to the text to be recognized;
    将所述第一字向量集合输入到所述第一情绪识别模型的句子表示层中进行句子向量表示,获得用于表征所述待识别文本的第一句子向量;Input the first word vector set into the sentence representation layer of the first emotion recognition model for sentence vector representation, and obtain the first sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第一情绪识别模型的线性层进行线性变换处理,获得所述待识别文本分别与所述第一情绪识别模型中预设的非负面情绪类别和负面情绪类别之间的匹配概率值;The first sentence vector is input to the linear layer of the first emotion recognition model for linear transformation processing to obtain the text to be recognized and the non-negative emotion category and the negative emotion category preset in the first emotion recognition model. The matching probability value between;
    若所述待识别文本与非负面情绪类别之间的匹配概率值大于所述待识别文本与负面情绪类别之间的匹配概率值,则判断所述待识别文本为非负面情绪文本。If the matching probability value between the text to be recognized and the non-negative emotion category is greater than the matching probability value between the text to be recognized and the negative emotion category, the text to be recognized is determined to be a non-negative emotion text.
  20. 根据权利要求15所述的存储介质,其中,在所述采用基于Bert模型训练获得的第二情绪识别模型对所述待识别文本进行三级情绪识别处理,识别出所述待识别文本对应的情绪分类类别时,所述计算机程序被处理器执行时实现以下步骤:The storage medium according to claim 15, wherein the second emotion recognition model obtained by training based on the Bert model is used to perform three-level emotion recognition processing on the text to be recognized, and the emotion corresponding to the text to be recognized is identified. When classifying categories, the computer program implements the following steps when executed by the processor:
    采用所述第二情绪识别模型对所述待识别文本中的每个字分别进行第二子向量表征处理,获得所述待识别文本对应的第二字向量集合;Using the second emotion recognition model to perform second sub-vector representation processing on each word in the text to be recognized, and obtaining a second set of word vectors corresponding to the text to be recognized;
    将所述第二字向量集合输入到所述第二情绪识别模型的Transformer层中进行双向编码表征处理,获得用于表征所述待识别文本的第二句子向量;Input the second set of word vectors into the Transformer layer of the second emotion recognition model for bidirectional encoding and characterization processing to obtain a second sentence vector used to characterize the text to be recognized;
    将所述第一句子向量输入到第二情绪识别模型的线性层进行线性变换处理,获得所述待识别文本在所述第二情绪识别模型预设的各情绪分类类别中的概率分布数据;Input the first sentence vector into the linear layer of the second emotion recognition model for linear transformation processing to obtain probability distribution data of the text to be recognized in each emotion classification category preset by the second emotion recognition model;
    根据所述概率分布数据,选取所述概率分布数据中概率最大值对应的情绪分类类别作为 所述待识别文本对饮的情绪分类类别。According to the probability distribution data, the emotion classification category corresponding to the maximum probability value in the probability distribution data is selected as the emotion classification category of the text to be recognized.
PCT/CN2022/089998 2022-03-17 2022-04-28 Text-based emotion recognition method and apparatus, device, and storage medium WO2023173541A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210262203.2A CN114662499A (en) 2022-03-17 2022-03-17 Text-based emotion recognition method, device, equipment and storage medium
CN202210262203.2 2022-03-17

Publications (1)

Publication Number Publication Date
WO2023173541A1 true WO2023173541A1 (en) 2023-09-21

Family

ID=82029999

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/089998 WO2023173541A1 (en) 2022-03-17 2022-04-28 Text-based emotion recognition method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN114662499A (en)
WO (1) WO2023173541A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705807A (en) * 2017-08-24 2018-02-16 平安科技(深圳)有限公司 Voice quality detecting method, device, equipment and storage medium based on Emotion identification
CN109003624A (en) * 2018-06-29 2018-12-14 北京百度网讯科技有限公司 Emotion identification method, apparatus, computer equipment and storage medium
CN112163419A (en) * 2020-09-23 2021-01-01 南方电网数字电网研究院有限公司 Text emotion recognition method and device, computer equipment and storage medium
CN114120978A (en) * 2021-11-29 2022-03-01 中国平安人寿保险股份有限公司 Emotion recognition model training and voice interaction method, device, equipment and medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109242020A (en) * 2018-09-07 2019-01-18 苏州亭云智能科技有限公司 A kind of music field order understanding method based on fastText and CRF
CN110364185B (en) * 2019-07-05 2023-09-29 平安科技(深圳)有限公司 Emotion recognition method based on voice data, terminal equipment and medium
CN110910901B (en) * 2019-10-08 2023-03-28 平安科技(深圳)有限公司 Emotion recognition method and device, electronic equipment and readable storage medium
CN112765937A (en) * 2020-12-31 2021-05-07 平安科技(深圳)有限公司 Text regularization method and device, electronic equipment and storage medium
CN113990352B (en) * 2021-10-22 2023-05-30 平安科技(深圳)有限公司 User emotion recognition and prediction method, device, equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705807A (en) * 2017-08-24 2018-02-16 平安科技(深圳)有限公司 Voice quality detecting method, device, equipment and storage medium based on Emotion identification
CN109003624A (en) * 2018-06-29 2018-12-14 北京百度网讯科技有限公司 Emotion identification method, apparatus, computer equipment and storage medium
CN112163419A (en) * 2020-09-23 2021-01-01 南方电网数字电网研究院有限公司 Text emotion recognition method and device, computer equipment and storage medium
CN114120978A (en) * 2021-11-29 2022-03-01 中国平安人寿保险股份有限公司 Emotion recognition model training and voice interaction method, device, equipment and medium

Also Published As

Publication number Publication date
CN114662499A (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN110096570B (en) Intention identification method and device applied to intelligent customer service robot
WO2021042503A1 (en) Information classification extraction method, apparatus, computer device and storage medium
WO2021253904A1 (en) Test case set generation method, apparatus and device, and computer readable storage medium
WO2020224213A1 (en) Sentence intent identification method, device, and computer readable storage medium
CN109992664B (en) Dispute focus label classification method and device, computer equipment and storage medium
WO2021114840A1 (en) Scoring method and apparatus based on semantic analysis, terminal device, and storage medium
WO2022142041A1 (en) Training method and apparatus for intent recognition model, computer device, and storage medium
CN113094578B (en) Deep learning-based content recommendation method, device, equipment and storage medium
CN110502610A (en) Intelligent sound endorsement method, device and medium based on text semantic similarity
CN111274371B (en) Intelligent man-machine conversation method and equipment based on knowledge graph
CN112699686B (en) Semantic understanding method, device, equipment and medium based on task type dialogue system
CN112632226B (en) Semantic search method and device based on legal knowledge graph and electronic equipment
CN112686022A (en) Method and device for detecting illegal corpus, computer equipment and storage medium
CN113742733B (en) Method and device for extracting trigger words of reading and understanding vulnerability event and identifying vulnerability type
WO2024109619A1 (en) Sensitive data identification method and apparatus, device, and computer storage medium
CN113360582B (en) Relation classification method and system based on BERT model fusion multi-entity information
CN112417132B (en) New meaning identification method for screening negative samples by using guest information
CN114298035A (en) Text recognition desensitization method and system thereof
CN111984780A (en) Multi-intention recognition model training method, multi-intention recognition method and related device
CN113919366A (en) Semantic matching method and device for power transformer knowledge question answering
CN112395421A (en) Course label generation method and device, computer equipment and medium
CN115687934A (en) Intention recognition method and device, computer equipment and storage medium
CN113486178B (en) Text recognition model training method, text recognition method, device and medium
WO2022267454A1 (en) Method and apparatus for analyzing text, device and storage medium
CN112100360B (en) Dialogue response method, device and system based on vector retrieval

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22931568

Country of ref document: EP

Kind code of ref document: A1