Emotional data recognition method, device, storage medium and electronic device
By obtaining the dialogue data and its prior emotional features in the game script, and identifying these features and sentence encoding vectors, the problem in the existing technology that the text content of each non-player character needs to be re-observed, resulting in low game development efficiency, is solved. More efficient game development and better game quality.
Patent Information
- Application Number
- CN202111348709.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2041-11-15
AI Technical Summary
The method of identifying emotional data in the prior art requires re-observing the text content of each non-player character, resulting in inefficient game development.
By obtaining the dialogue data in the game script and its corresponding prior emotional features, the sentence coding vector of the dialogue data is determined, and the prior emotional features and sentence coding vectors are identified to obtain the emotion recognition result of the dialogue data.
It meets the psychological expectations of game producers, improves game development efficiency, saves time costs, and improves game quality.
Smart Images

Figure CN113926198B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for identifying emotion data. Background Art
[0002] With the advancement of natural language processing technology, in the gaming industry, for example, in role-playing games (RPGs), in order to enhance interactivity and players' sense of immersion, non-player characters (NPCs) have changes in facial expressions when speaking; most RPG games require game developers to re-observe the text content of each NPC after writing the game script, and mark the text content with emotions, and then create corresponding expressions after marking.
[0003] However, existing emotion tagging technologies focus too much on the information in the text itself, ignoring the prior emotion information that script writers preset for each character when writing each script; it does not meet the psychological expectations of game makers, and re-observing the text content of each NPC will also reduce the efficiency of game development.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method, device, storage medium and electronic device for identifying emotion data, so as to at least solve the technical problem that the method for identifying emotion data in the prior art needs to re-observe the text content of each non-player character, resulting in low game development efficiency.
[0006] According to one aspect of an embodiment of the present invention, there is provided a method for identifying emotion data, comprising: obtaining dialogue data in a game script, and prior emotion features corresponding to the dialogue data, wherein the prior emotion features are pre-set based on a game scene in which the dialogue data is located; determining a sentence encoding vector of the dialogue data, wherein the sentence encoding vector is used to characterize semantic feature information corresponding to the dialogue data; identifying the prior emotion features and the sentence encoding vector to obtain an emotion recognition result of the dialogue data.
[0007] According to another aspect of an embodiment of the present invention, there is also provided an emotion data recognition device, comprising: an acquisition module, used to acquire dialogue data in a game script, and prior emotion features corresponding to the dialogue data, wherein the prior emotion features are pre-set based on a game scene in which the dialogue data is located; a determination module, used to determine a sentence encoding vector of the dialogue data, wherein the sentence encoding vector is used to characterize semantic feature information corresponding to the dialogue data; and an identification module, used to identify the prior emotion features and the sentence encoding vector to obtain an emotion recognition result of the dialogue data.
[0008] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein the program is configured to execute any one of the above-mentioned emotion data recognition methods when running.
[0009] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for recognizing emotion data.
[0010] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the above-mentioned emotion data recognition methods.
[0011] In an embodiment of the present invention, by obtaining dialogue data in a game script and a priori emotional features corresponding to the dialogue data, wherein the prior emotional features are pre-set based on a game scene in which the dialogue data is located; determining a sentence encoding vector of the dialogue data, wherein the sentence encoding vector is used to characterize semantic feature information corresponding to the dialogue data; identifying the prior emotional features and the sentence encoding vector to obtain an emotion recognition result of the dialogue data, the purpose of meeting the psychological expectations of a game maker is achieved, thereby realizing the technical effect of improving the efficiency of game development, and further solving the technical problem in the prior art that the method for identifying emotional data requires re-observing the text content of each non-player character, resulting in low game development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0013] Figure 1 is a flow chart of a method for identifying emotion data according to an embodiment of the present invention;
[0014] Figure 2 is a flow chart of an optional emotion recognition method according to an embodiment of the present invention;
[0015] Figure 3 is a flow chart of an optional emotion recognition model according to an embodiment of the present invention;
[0016] Figure 4 It is a structural schematic diagram of a device for identifying emotion data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0018] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0019] According to an embodiment of the present invention, a method embodiment for identifying emotion data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0020] The technical solution of the embodiment of the method can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, and a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD and other terminal devices. The mobile terminal may include one or more processors (the processor may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory for storing data. Optionally, the mobile terminal may also include a transmission device, an input and output device, and a display device for communication functions. It can be understood by those of ordinary skill in the art that the above structural description is only illustrative and does not limit the structure of the above mobile terminal. For example, the mobile terminal may also include more or fewer components than the above structural description, or have a configuration different from the above structural description.
[0021] The memory can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for identifying emotional data in the embodiment of the present invention. The processor executes various functional applications and data processing by running the computer program stored in the memory, that is, the above-mentioned method for identifying emotional data is realized. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0022] The transmission device is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly. The technical solution of the embodiment of the method can be applied to various communication systems, such as: Global System of Mobile communication (GSM) system, Code Division Multiple Access (CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, LTE Frequency Division Duplex (FDD) system, LTE Time Division Duplex (TDD), Universal Mobile Telecommunication System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) communication system or 5G system. Optionally, multiple mobile terminals can perform device-to-device (D2D) communication. Optionally, the 5G system or 5G network is also called the New Radio (NR) system or NR network.
[0023] The display device may be, for example, a touch screen type liquid crystal display (LCD) and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above human-computer interaction functions are configured / stored in a computer program product executable by one or more processors or a readable computer-readable storage medium.
[0024] The method for identifying emotion data in one embodiment of the present disclosure may be run on a terminal device or a server. The terminal device may be a local terminal device, and the server may be a cloud server, a server of a distributed system, or a server combined with a blockchain. When the method for identifying emotion data is run on a server, the method may be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0025] In an optional implementation, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the emotion data recognition method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for information processing is a cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0026] In an optional embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0027] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0028] In a possible implementation, an embodiment of the present invention provides a method for identifying emotion data, providing a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.
[0029] Figure 1 is a flow chart of a method for identifying emotion data according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0030] Step S102, obtaining dialogue data in the game script and a priori emotional features corresponding to the dialogue data, wherein the a priori emotional features are pre-set based on the game scene in which the dialogue data is located;
[0031] Step S104, determining a sentence encoding vector of the conversation data, wherein the sentence encoding vector is used to represent semantic feature information corresponding to the conversation data;
[0032] Step S106, identifying the a priori emotional features and the sentence encoding vector to obtain an emotion recognition result of the dialogue data.
[0033] In an embodiment of the present disclosure, a terminal device or a server may be used to obtain dialogue data in a game script, wherein the dialogue data includes a priori emotional features corresponding to the dialogue data; sentences in the obtained dialogue data are used as input, and a sentence encoding module is used to encode the sentences, and the sentence encoding vector is output; and the prior emotional features and the sentence encoding vector are identified to obtain an emotion recognition result of the dialogue data.
[0034] It should be noted that the above-mentioned terminal device and the above-mentioned server can be used to run the above-mentioned emotion data recognition method; the above-mentioned acquisition of dialogue data in the game script can simultaneously acquire multiple dialogue data to obtain a dialogue data set; the above-mentioned prior emotion features are pre-set based on the game scene in which the above-mentioned dialogue data is located; the above-mentioned sentence encoding vector is used to represent the semantic feature information corresponding to the above-mentioned dialogue data, so that the model can understand the meaning of the current sentence.
[0035] As an optional embodiment, the game script writer will preset prior emotional features for each character in each script according to the above game scenes. The above prior emotional features imply the information that the author wants to convey to the players; however, the existing text emotion recognition technology mainly includes two methods: single sentence modeling and dialogue modeling. Single sentence modeling only focuses on the text information of the current sentence. It is migrated from sentiment analysis technology. It extracts the features of the sentence by designing an encoder, and then uses a fully connected layer mapping for classification and output. Dialogue modeling also incorporates the context of the current sentence into the modeling, that is, considering the entire dialogue; by temporally encoding the sentences in the dialogue, extracting features for all sentences, and classifying them, or expanding and splicing the sentences in the dialogue into a long sentence, and then encoding and classifying them after splicing. However, whether it is single sentence modeling or multi-sentence modeling, it only focuses on the information of the text itself, and ignores the influence of prior emotional features.
[0036] Through the technical solution of the disclosed embodiment, the game maker can freely adjust the preset emotions of each game character, and return emotions that are more in line with the game maker's ideal for each game character in the script dialogue. The above-mentioned terminal device or server can pre-set the above-mentioned dialogue data, as well as the prior emotion characteristics corresponding to the above-mentioned dialogue data; according to the preset prior emotion information given by the game maker, the above-mentioned terminal device and the above-mentioned server return reasonable emotions from the script dialogue text after processing, so that it is more in line with the psychological expectations of the game maker. With this solution, through artificial intelligence technology, emotions can be automatically marked for each sentence in the script, greatly speeding up the efficiency of game development and saving time costs. At the same time, the producer can have more time to focus on the writing of the script and the modeling of expressions, improve the quality of the game, and attract more players.
[0037] In an optional embodiment, the above method further includes:
[0038] Step S202, obtaining pre-training corpus, wherein the pre-training corpus is corpus obtained based on the script type of the game script;
[0039] Step S204, using the pre-training corpus to train the initial recognition model to obtain a language model, wherein the initial recognition model is a masked language model using full-word masking recognition processing.
[0040] In the embodiments of the present disclosure, Figure 2 The emotion recognition method flow chart shown in the figure obtains the above-mentioned pre-training corpus based on the script type of the above-mentioned game script; and uses the above-mentioned pre-training corpus to train the initial recognition model to obtain a language model.
[0041] It should be noted that Figure 2 As shown in the figure, in the training phase, a language model is first trained using pre-training corpus, and then the language model is trained using a game dialogue dataset with labeled data. The pre-training corpus can be obtained from a large-scale domain corpus similar to the game style. For example, if the game script is in the style of martial arts, the pre-training corpus can be obtained from one's own scripts and other martial arts novels and games. The form of the pre-training corpus is not limited to dialogues, so that the language model can obtain more domain knowledge. During the training of the language model, the prior emotion distribution characteristics can be obtained through the emotion label information; the initial recognition model is a masked language model (Whole Word Masking Masked Language Model, WWMMLM) using whole word masking recognition processing.
[0042] As an optional embodiment, by acquiring the above-mentioned pre-training corpus on a large scale from other games with similar game styles, the trained language model can have better recognition and training effects.
[0043] In an optional embodiment, the determining of the sentence encoding vector of the conversation data includes:
[0044] Step S302: Use the language model to perform sentence encoding on the conversation data to obtain the sentence encoding vector.
[0045] In the embodiments of the present disclosure, Figure 3 The flowchart of the emotion recognition model shown in the figure uses an encoder to perform sentence encoding processing on the above conversation data to obtain the above sentence encoding vector.
[0046] It should be noted that the encoder receives the dialogue data as input and outputs a sentence encoding vector after encoding the dialogue data. In the disclosed embodiment, the language model is used as the encoder; the model is pre-trained on a large-scale corpus with similar game styles to obtain training parameters, and the parameters are used for initialization processing, so that useful information can be directly obtained from the dialogue data, so that the model does not focus entirely on the prior emotion distribution part.
[0047] In an optional embodiment, the identifying the a priori emotion feature and the sentence encoding vector to obtain the emotion recognition result of the dialogue data includes:
[0048] Step S402, concatenating the a priori emotion feature with the sentence encoding vector to obtain data to be recognized;
[0049] Step S404, inputting the above-mentioned data to be recognized into the emotion recognition model, and receiving the above-mentioned emotion recognition result output by the above-mentioned emotion recognition model, wherein the above-mentioned emotion recognition model is used to perform emotion recognition on the above-mentioned data to be recognized and determine the above-mentioned emotion recognition result, and the above-mentioned emotion recognition model is obtained by training the above-mentioned language model with a pre-acquired label data set.
[0050] In the embodiment of the present disclosure, Figure 3 As shown, the above-mentioned prior emotion feature is concatenated with the above-mentioned sentence encoding vector to obtain the data to be recognized; the above-mentioned data to be recognized is input into the emotion recognition model, and the above-mentioned emotion recognition result output by the above-mentioned emotion recognition model is received.
[0051] It should be noted that the above-mentioned emotion recognition model is used to perform emotion recognition on the above-mentioned data to be recognized and determine the above-mentioned emotion recognition results. The above-mentioned emotion recognition model is obtained by training the above-mentioned language model using a pre-acquired labeled data set; the above-mentioned labeled data set is a conversation data set with emotion annotations, which can be used to train the above-mentioned language model, that is, the above-mentioned labeled data set is also a training set.
[0052] In the disclosed embodiment, the above-mentioned emotion recognition model can also be used as an emotion prediction module. The above-mentioned emotion recognition model is a multi-layer perceptron (MLP), which takes the concatenation processing result of the above-mentioned sentence encoding vector and the above-mentioned prior emotion feature as input, and outputs the final emotion recognition result after recognition processing.
[0053] In the embodiments of the present disclosure, the construction of the above-mentioned prior emotion features is the core of the present disclosure. Under normal circumstances, each of the above-mentioned dialogue data will only have one emotion, and the prior emotion features preset by the creator do not exist in the existing dialogue data sets. Therefore, the emotion distribution of each character in this dialogue can be obtained by statistical methods to approximately simulate the prior emotion distribution preset by the author; in addition, the obtained emotion distribution of each character needs to be smoothed; first, all the obtained emotions are evenly distributed, and then the statistical emotion distribution is added, and two decimal places are retained by rounding, so as to suppress the risk of overfitting of the model and improve the generalization ability of the model; after obtaining the smoothed prior emotion distribution, it is spliced to the sentence encoding vector of each sentence said by the speaker, and the model is allowed to continuously reduce the difference between the predicted emotion and the real emotion, so as to train the model.
[0054] In the embodiment of the present disclosure, Figure 2 As shown, in the prediction stage, since it is impossible to obtain the emotional distribution through statistical methods, and in order to reduce manual operations, the prior emotional feature distribution in the prediction stage is set to a one-hot vector, and the creator can decide the most important emotion of the character in this conversation. A one-hot distribution is used during prediction, so the above language model that obtains emotional information from the above conversation data is very important. In the above prediction stage, the new dialogue data set is input (the dialogue data set at this time has no emotional labels), as well as the prior emotions set in advance by the game maker (no smoothing is required at this time), and the above language model is used to predict the corresponding emotion of the sentence of dialogue data. As shown Figure 3 As shown, in the prediction stage, the producer only needs to simply pre-set a speaker's prior emotion as joy according to the current scene, then the above language model will automatically determine the corresponding emotions of the speaker's different dialogue data according to different sentences and prior emotions.
[0055] In an optional embodiment, the above method further includes:
[0056] Step S502, obtaining a label data set, wherein the label data set includes: multiple sets of label data, each set of data in the multiple sets of label data includes: sample dialogue data and sample game characters in a sample game script, and performing language analysis on different sample dialogue data related to the same game character, to obtain the emotion distribution characteristics of each of the game characters;
[0057] Step S504: Use the label data set to train the language model to obtain the emotion recognition model.
[0058] In an embodiment of the present disclosure, a conversation dataset with emotion annotations, i.e., the above-mentioned label dataset, is obtained; and the above-mentioned label dataset is used to train the above-mentioned language model to obtain the above-mentioned emotion recognition model.
[0059] It should be noted that the above-mentioned labeled data set includes: multiple groups of labeled data, each group of data in the above-mentioned multiple groups of labeled data includes: sample dialogue data and sample game characters in sample game scripts, and language analysis and processing of different above-mentioned sample dialogue data related to the same game character, to obtain the emotion distribution characteristics of each of the above-mentioned game characters; the above-mentioned labeled data set is a dialogue data set with emotion annotations, which can be used to train the above-mentioned language model, that is, the above-mentioned labeled data set is also a training set.
[0060] In an optional embodiment, the above-mentioned use of the above-mentioned label data set to train the above-mentioned language model to obtain the emotion recognition model includes:
[0061] Step S602, performing smoothing processing on the emotion distribution feature of each of the game characters in the tag data set to obtain smoothed emotion distribution features;
[0062] Step S604, determining a sample coding vector of the sample conversation data, wherein the sample coding vector is used to represent semantic feature information corresponding to the sample conversation data;
[0063] Step S606, concatenating the smoothed emotion distribution feature with the sample coding vector to obtain a sample concatenation result;
[0064] Step S608: Use the sample concatenation result to train the language model to obtain the emotion recognition model.
[0065] In the disclosed embodiment, it is necessary to smooth the obtained emotion distribution characteristics of each character; first, all the obtained emotions are evenly distributed, and then the statistical emotion distribution is added, and two decimal places are retained by rounding, so as to suppress the risk of overfitting of the model and improve the generalization ability of the model; the smoothed emotion distribution characteristics are obtained and spliced to the above sentence encoding vector of each sentence said by the speaker to obtain a sample splicing result; the above sample splicing result is used to train the above language model, and the model is allowed to continuously reduce the difference between the predicted emotion and the real emotion, so as to train the model and finally obtain the above emotion recognition model.
[0066] It should be noted that the above sample encoding vector is used to represent the semantic feature information corresponding to the above sample conversation data.
[0067] Through the disclosed embodiments, it is possible to return reasonable emotions from the script dialogue text according to the pre-set prior emotion characteristics given by the game maker, so that it is more in line with the psychological expectations of the game maker. At the same time, it can greatly improve the efficiency of game development, save time, and allow game makers to pay more attention to the writing of scripts and the modeling of expressions, improve the quality of games, and attract more players.
[0068] In addition, it is still necessary to explain that the optional or preferred implementation modes of this embodiment can refer to the relevant descriptions in the method embodiments, which will not be repeated here.
[0069] According to an embodiment of the present invention, there is also provided an embodiment of a device for implementing the above-mentioned method for identifying emotion data. Figure 4 is a schematic diagram of a structure of an emotion data recognition device according to an embodiment of the present invention. Figure 4 As shown, the above-mentioned emotion data recognition device includes: an acquisition module 40, a determination module 42 and a recognition module 44, wherein:
[0070] An acquisition module 40 is used to acquire dialogue data in a game script and a priori emotional features corresponding to the dialogue data, wherein the priori emotional features are pre-set based on a game scene in which the dialogue data is located;
[0071] A determination module 42, configured to determine a sentence encoding vector of the conversation data, wherein the sentence encoding vector is used to represent semantic feature information corresponding to the conversation data;
[0072] The recognition module 44 is used to recognize the a priori emotional features and the sentence encoding vector to obtain the emotion recognition result of the dialogue data.
[0073] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0074] It should be noted that the acquisition module 40, the determination module 42 and the identification module 44 correspond to steps S102 to S106 in the method embodiment, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the method embodiment. It should be noted that the modules as part of the device can be run in a computer terminal.
[0075] It should be noted that the optional or preferred implementation modes of this embodiment can refer to the relevant description in the method embodiment, which will not be repeated here.
[0076] The above-mentioned emotion data recognition device may further include a processor and a memory. The above-mentioned emotion data recognition and the like are stored in the memory as a program unit, and the processor executes the above-mentioned program unit stored in the memory to realize the corresponding function.
[0077] The processor includes a kernel, which retrieves the corresponding program unit from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.
[0078] According to an embodiment of the present application, a computer-readable storage medium embodiment is also provided. Optionally, in this embodiment, the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned emotion data recognition methods.
[0079] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group, and the computer-readable storage medium includes a stored program.
[0080] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: obtain dialogue data in the game script, and prior emotion features corresponding to the above dialogue data, wherein the above prior emotion features are pre-set based on the game scene in which the above dialogue data is located; determine the sentence encoding vector of the above dialogue data, wherein the above sentence encoding vector is used to characterize the semantic feature information corresponding to the above dialogue data; identify the above prior emotion features and the above sentence encoding vector to obtain the emotion recognition result of the above dialogue data.
[0081] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: obtaining pre-training corpus, wherein the pre-training corpus is corpus obtained based on the script type of the above-mentioned game script; using the above-mentioned pre-training corpus to train the initial recognition model to obtain a language model, wherein the above-mentioned initial recognition model is a masked language model using full-word masking recognition processing.
[0082] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: use the above language model to perform sentence encoding processing on the above dialogue data to obtain the above sentence encoding vector.
[0083] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: concatenate the above-mentioned prior emotion features with the above-mentioned sentence encoding vector to obtain the data to be recognized; input the above-mentioned data to be recognized into the emotion recognition model, and receive the above-mentioned emotion recognition result output by the above-mentioned emotion recognition model, wherein the above-mentioned emotion recognition model is used to perform emotion recognition on the above-mentioned data to be recognized and determine the above-mentioned emotion recognition result, and the above-mentioned emotion recognition model is obtained by training the above-mentioned language model using a pre-acquired label data set.
[0084] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: obtaining a label data set, wherein the label data set includes: multiple groups of label data, each group of the multiple groups of label data includes: sample dialogue data and sample game characters in a sample game script, and performing language analysis on different sample dialogue data related to the same game character to obtain emotion distribution characteristics of each of the above game characters; using the above label data set to train the above language model to obtain the above emotion recognition model.
[0085] Optionally, when the program is running, the device where the computer-readable storage medium is located is controlled to perform the following functions: smoothing the emotion distribution characteristics of each of the above-mentioned game characters in the above-mentioned label data set to obtain the smoothed emotion distribution characteristics; determining the sample coding vector of the above-mentioned sample dialogue data, wherein the above-mentioned sample coding vector is used to characterize the semantic feature information corresponding to the above-mentioned sample dialogue data; splicing the above-mentioned smoothed emotion distribution characteristics and the above-mentioned sample coding vector to obtain a sample splicing result; using the above-mentioned sample splicing result to train the above-mentioned language model to obtain the above-mentioned emotion recognition model.
[0086] According to an embodiment of the present application, a processor embodiment is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein the program executes any one of the emotion data recognition methods described above when it is run.
[0087] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the above-mentioned emotion data recognition methods.
[0088] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: obtaining dialogue data in a game script, and prior emotion features corresponding to the above dialogue data, wherein the above prior emotion features are pre-set based on the game scene in which the above dialogue data is located; determining a sentence encoding vector of the above dialogue data, wherein the above sentence encoding vector is used to characterize semantic feature information corresponding to the above dialogue data; identifying the above prior emotion features and the above sentence encoding vector to obtain an emotion recognition result of the above dialogue data.
[0089] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: obtaining pre-training corpus, wherein the pre-training corpus is corpus obtained based on the script type of the above-mentioned game script; using the pre-training corpus to train an initial recognition model to obtain a language model, wherein the initial recognition model is a masked language model using full-word masking recognition processing.
[0090] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: using the above-mentioned language model to perform sentence encoding processing on the above-mentioned dialogue data to obtain the above-mentioned sentence encoding vector.
[0091] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: concatenating the above-mentioned prior emotion features with the above-mentioned sentence encoding vector to obtain data to be recognized; inputting the above-mentioned data to be recognized into an emotion recognition model, and receiving the above-mentioned emotion recognition result output by the above-mentioned emotion recognition model, wherein the above-mentioned emotion recognition model is used to perform emotion recognition on the above-mentioned data to be recognized and determine the above-mentioned emotion recognition result, and the above-mentioned emotion recognition model is obtained by training the above-mentioned language model using a pre-acquired label data set.
[0092] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that is initialized with the following method steps: obtaining a label data set, wherein the label data set includes: multiple groups of label data, each group of data in the multiple groups of label data includes: sample dialogue data and sample game characters in a sample game script, and performing language analysis on different sample dialogue data related to the same game character to obtain emotion distribution characteristics of each of the above game characters; using the above label data set to train the above language model to obtain the above emotion recognition model.
[0093] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: smoothing the emotion distribution characteristics of each of the above-mentioned game characters in the above-mentioned label data set to obtain the smoothed emotion distribution characteristics; determining the sample coding vector of the above-mentioned sample dialogue data, wherein the above-mentioned sample coding vector is used to characterize the semantic feature information corresponding to the above-mentioned sample dialogue data; splicing the above-mentioned smoothed emotion distribution characteristics with the above-mentioned sample coding vector to obtain a sample splicing result; using the above-mentioned sample splicing result to train the above-mentioned language model to obtain the above-mentioned emotion recognition model.
[0094] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0095] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0096] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0097] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0098] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0099] If the integrated 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 computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0100] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for identifying emotional data, characterized in that: include: Acquire dialogue data in a game script, and a priori emotional features corresponding to the dialogue data, wherein the priori emotional features are pre-set based on a game scene in which the dialogue data is located; Determining a sentence encoding vector of the conversation data, wherein the sentence encoding vector is used to represent semantic feature information corresponding to the conversation data; Identify the prior emotion feature and the sentence encoding vector to obtain an emotion recognition result of the dialogue data; The method further comprises: obtaining pre-training corpus based on the script type of the game script; using the pre-training corpus to train an initial recognition model to obtain a language model, wherein the initial recognition model is a masked language model using full-word masking recognition processing; The determining the sentence encoding vector of the dialogue data includes: performing sentence encoding processing on the dialogue data using the language model to obtain the sentence encoding vector.
2. The method according to claim 1, characterized in that The identifying the prior emotion feature and the sentence encoding vector to obtain the emotion recognition result of the dialogue data includes: Concatenate the prior emotion feature with the sentence encoding vector to obtain data to be recognized; The data to be recognized is input into an emotion recognition model, and the emotion recognition result output by the emotion recognition model is received, wherein the emotion recognition model is used to perform emotion recognition on the data to be recognized and determine the emotion recognition result, and the emotion recognition model is obtained by training the language model using a pre-acquired label data set.
3. The method according to claim 2, characterized in that The method further comprises: Acquire a label data set, wherein the label data set includes: multiple sets of label data, each set of data in the multiple sets of label data includes: sample dialogue data and sample game characters in a sample game script, and emotion distribution characteristics of each game character obtained by performing language analysis on different sample dialogue data related to the same game character; The language model is trained using the label data set to obtain the emotion recognition model.
4. The method according to claim 3, characterized in that The adopting the label data set to train the language model to obtain the emotion recognition model comprises: Smoothing the emotion distribution feature of each of the game characters in the label data set to obtain smoothed emotion distribution features; Determining a sample coding vector of the sample conversation data, wherein the sample coding vector is used to represent semantic feature information corresponding to the sample conversation data; Concatenating the smoothed emotion distribution feature with the sample encoding vector to obtain a sample concatenation result; The sample concatenation result is used to train the language model to obtain the emotion recognition model.
5. A device for identifying emotional data, characterized in that: include: An acquisition module, used to acquire dialogue data in a game script and a priori emotional features corresponding to the dialogue data, wherein the priori emotional features are pre-set based on a game scene in which the dialogue data is located; A determination module, used to determine a sentence encoding vector of the dialogue data, wherein the sentence encoding vector is used to represent semantic feature information corresponding to the dialogue data; A recognition module, used to recognize the prior emotion feature and the sentence encoding vector, and obtain an emotion recognition result of the dialogue data; The device is further used to perform the following steps: based on the script type of the game script, obtaining pre-training corpus; using the pre-training corpus to train an initial recognition model to obtain a language model, wherein the initial recognition model is a masked language model using full-word masking recognition processing; The determining the sentence encoding vector of the dialogue data includes: performing sentence encoding processing on the dialogue data using the language model to obtain the sentence encoding vector.
6. A processor, characterized in that: The processor is used to run a program, wherein the program is configured to execute the method for identifying emotion data according to any one of claims 1 to 4 when running.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for identifying emotion data according to any one of claims 1 to 4.
8. An electronic device, comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the method for identifying emotion data according to any one of claims 1 to 4.
Citation Information
Patent Citations
Emotion analysis method and device in game field and model training method and device thereof
CN111125360A
Emotion recognition method and device in interactive dialogue
CN112100337A