Method, computer device, apparatus and storage medium for sentiment analysis
Patent Information
- Authority / Receiving Office
- HK · HK
- Patent Type
- Patents
- Current Assignee / Owner
- TENCENT AMERICA LLC
- Filing Date
- 2023-08-28
- Publication Date
- 2026-07-10
AI Technical Summary
Existing end-to-end neural network models suffer from inconsistent multi-turn responses and passive behavior in multi-turn conversation scenarios, and knowledge graphs are difficult to obtain in real-world scenarios, resulting in insufficient accuracy and interpretability of sentiment analysis.
By extracting sentence embeddings from the input dialogue, sentiment expression and polarity values are generated. Target mentions are determined using rich contextual representations. Target mentions in sentiment analysis are determined by combining computational boundaries. Context-sensitive sentence embedding and mention extraction are performed using a pre-trained BERT model and a self-attention layer.
It improves the accuracy and interpretability of multi-turn conversation sentiment analysis, enhances the activity of chatbots in multi-turn conversations, alleviates the data sparsity problem, and simplifies the integration with other knowledge graphs.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
[0001] Cross-references to related applications
[0002] This application claims priority to U.S. Application No. 17 / 503,584, filed with the U.S. Patent and Trademark Office on October 18, 2021, the disclosure of which is incorporated herein by reference in its entirety. Technical Field
[0003] Implementations of this disclosure relate to the field of sentiment analysis. More specifically, this disclosure relates to dialogue understanding, such as dialogue response generation and conversational question answering, and even more particularly to methods, computer devices, apparatuses, and non-transitory computer-readable storage media for sentiment analysis in multi-turn conversations. Background Technology
[0004] Modeling chat dialogues is an important field due to its potential to facilitate human-computer communication. To date, most research has focused on designing end-to-end neural networks that consume only surface features. However, these models are unsatisfactory in multi-turn conversation scenarios. Specifically, these models suffer from problems such as passive behavior during conversations and often disjointed multi-turn responses.
[0005] To generate meaningful responses, the influence of knowledge graphs (KG), common-sense knowledge, personality, and emotion has been investigated. However, such knowledge, such as relevant KG, is often not explicitly expressed in the dialogue and therefore requires human annotation and benchmark datasets to be meaningful. Furthermore, since KG is difficult to obtain in real-world scenarios and often requires entity linking as a prerequisite, using relevant KG may introduce additional errors. Summary of the Invention
[0006] According to an embodiment, a method for sentiment analysis in multi-turn conversations is provided, characterized in that the method includes: obtaining an input dialogue; extracting sentiment expressions based on sentence embeddings corresponding to the input dialogue; generating polarity values based on the sentence embeddings corresponding to the input dialogue; and determining target mentions associated with at least one of the sentiment expressions based on the sentiment expressions and the sentence embeddings, wherein determining the target mentions includes: generating rich contextual representations based on the sentence embeddings and the sentiment expressions; and determining the target mentions based on computational boundaries, wherein the computational boundaries are generated using the rich contextual representations.
[0007] According to an embodiment, a computer device is provided, characterized in that the computer device includes: one or more computer-readable non-transitory storage media configured to store computer program code; and one or more computer processors configured to access the computer program code and execute the above-described method for sentiment analysis for multi-turn conversations as instructed by the computer program code.
[0008] According to an embodiment, an apparatus for sentiment analysis in multi-turn conversations is provided, characterized in that the apparatus comprises: a first obtaining unit configured to obtain an input dialogue; a first extraction unit configured to extract sentiment expressions based on sentence embeddings corresponding to the input dialogue; a first generating unit configured to generate polarity values based on the sentence embeddings corresponding to the input dialogue; and a first determining unit configured to determine target mentions associated with at least one of the sentiment expressions based on the sentiment expressions and the sentence embeddings, wherein the first determining unit comprises: a second generating unit configured to generate rich contextual representations based on the sentence embeddings and the sentiment expressions; and a second determining unit configured to determine the target mentions based on computational boundaries, wherein the computational boundaries are generated using the rich contextual representations.
[0009] According to an embodiment, a non-transitory computer-readable storage medium is provided, the non-transitory computer-readable storage medium storing a program that causes a computer to perform the above-described method for sentiment analysis in multi-turn conversations.
[0010] The present invention provides a method, computer device, apparatus, and non-transitory computer-readable storage medium for sentiment analysis in multi-turn conversations, which extract internal knowledge from dialogues. The extracted knowledge is used to understand fine-grained sentiment information and contributes to dialogue comprehension. Attached Figure Description
[0011] Other features, properties, and various advantages of the disclosed subject matter will become more apparent from the following detailed description and accompanying drawings, in which:
[0012] Figure 1 This is a diagram of an environment in which the methods, apparatus and systems described herein can be implemented according to the embodiments.
[0013] Figure 2 yes Figure 1 A diagram of an example component of one or more devices.
[0014] Figure 3 This is a simplified block diagram illustrating a model for emotion extraction according to an embodiment of the present disclosure.
[0015] Figure 4 This is a simplified block diagram illustrating a model for reference extraction according to an embodiment of the present disclosure.
[0016] Figure 5 This is a simplified flowchart of a conversational sentiment analysis method according to an embodiment of the present disclosure.
[0017] Figure 6 This is a simplified flowchart of a conversational sentiment analysis according to another embodiment of the present disclosure.
[0018] Figure 7 This is a simplified flowchart of a conversational sentiment analysis according to yet another embodiment of the present disclosure. Detailed Implementation
[0019] This disclosure relates to extracting internal knowledge from dialogues that can be used to understand fine-grained sentiment information and contribute to dialogue comprehension. This disclosure applies aspect-based sentiment analysis to conversational sentiment analysis. As an example, according to an implementation of this disclosure, conversational aspect-based sentiment analysis can extract user opinions, polarities, and corresponding mentions from a dialogue. Based on an understanding of the emotions humans frequently express related to the entities they are talking about, extracting sentiment, polarity, and mentions can provide useful features and general domain understanding. More specifically, accurately extracting people's emotions and corresponding entities from their conversations can help chatbots plan subsequent topics and make them more active in multi-turn conversations. Another advantage of explicitly extracting sentiment and mentions includes mitigating data sparsity, as the same sentiment and mention pairs can appear in various texts, and increasing model interpretability, making it easier to combine this knowledge with other knowledge (e.g., KG).
[0020] Consider the example multi-turn sessions in Table 1.
[0021] Table 1:
[0022]
[0023] Accurately extracting emotions and corresponding entities from people's conversations can help chatbots plan subsequent topics and make them more active in multi-turn conversations. For example, if a user mentions that they are a huge fan of football player "Leo Messi," the chatbot might mention recent news about Messi. Furthermore, since explicit emotion, polarity, and / or mention extraction can include understanding the entire conversation history, it's easier to combine the extraction with other knowledge (e.g., external key knowledge), making the model more interpretable. Continuing with the "Leo Messi" example, by combining the parsed results of emotion and model extraction with an external key knowledge, the chatbot could even recommend recent matches of Messi's football club, "FC Barcelona."
[0024] Within the available datasets, sentiment analysis contains a very limited number of instances, and they only cover a few domains (e.g., hotel and restaurant reviews), while everyday conversations are open domains. Furthermore, in these datasets, sentiment expressions are often close to their corresponding aspects or mentions within short sentences. However, in reality, sentiment expressions and their mentions or aspects can be several different statements, where ellipsis and anaphora introduce more complex reasoning. As an example, consider the sentences in Table 1: the mention of “Messi” appears in the third utterance, while the corresponding sentiment word “fantastic” appears in the fifth utterance. Moreover, “Neymar” presents an even greater challenge as a very perplexing candidate nomination. This is only an example of three rounds; not to mention the increasing complexity with more rounds.
[0025] According to one implementation, sentiment extraction can identify all sentiment expressions from the last user utterance and determine the polarity of each extracted sentiment expression. According to another implementation, mention extraction can extract corresponding mentions from the dialogue history for each sentiment expression. Mention extraction may include understanding the entire dialogue history and using rich features, such as information about the speaker and speaker ID of the sentence, to aid in modeling long-distance dependencies.
[0026] In some implementations, example or training datasets can be manually annotated. As an example, the dataset may include many dialogues from multiple datasets, where each dialogue may include multiple sentences. As a first step, human and / or expert annotators may be asked to annotate and / or tag each dialogue. In some implementations, they may be asked to annotate based on guidelines according to existing technology. Annotations may include not only the sentiment expression in the sentences but also the polarity value of each mention. Annotations may follow other guidelines. As an example, annotated mentions must be specific; for multiple mentions corresponding to the same entity, only the most specific mention must be annotated; and only mentions with corresponding sentiment expressions can be annotated to train the model based on explicit user perspectives.
[0027] The features discussed below can be used individually or in any combination in any order. Furthermore, implementations can be carried out using a processing circuitry system (e.g., one or more processors or one or more integrated circuits). In one example, one or more processors execute a program stored on a non-transitory computer-readable medium.
[0028] Figure 1 This is a diagram of an environment 100 in which the methods, apparatus and systems described herein can be implemented according to the embodiments.
[0029] like Figure 1 As shown, environment 100 may include user equipment 110, platform 120, and network 130. The devices in environment 100 may be interconnected via wired connection, wireless connection, or a combination of wired and wireless connection.
[0030] User equipment 110 includes one or more devices capable of receiving, generating, storing, processing, and / or providing information associated with platform 120. For example, user equipment 110 may include computing devices (e.g., desktop computers, laptop computers, tablet computers, handheld computers, smart speakers, servers, etc.), mobile phones (e.g., smartphones, cordless phones, etc.), wearable devices (e.g., smart glasses or smartwatches), or similar devices. In some implementations, user equipment 110 may receive information from platform 120 and / or send information to platform 120.
[0031] Platform 120 includes one or more devices as described elsewhere herein. In some implementations, platform 120 may include a cloud server or a group of cloud servers. In some implementations, platform 120 may be designed to be modular, allowing software components to be swapped in or out. Therefore, platform 120 can be easily and / or quickly reconfigured for different purposes.
[0032] In some implementations, as shown, platform 120 may be hosted in a cloud computing environment 122. It is worth noting that while the implementations described herein depict platform 120 as hosted in a cloud computing environment 122, in some implementations, platform 120 may not be cloud-based (i.e., it may be implemented outside of a cloud computing environment) or may be partially cloud-based.
[0033] The cloud computing environment 122 includes the environment of the hosting platform 120. The cloud computing environment 122 can provide services such as computing, software, data access, and storage, which do not require end users (e.g., user equipment 110) to know the physical location and configuration of the systems and / or devices of the hosting platform 120. As shown, the cloud computing environment 122 may include a set of computing resources 124 (collectively referred to as "computing resources 124" and individually as "computing resources 124").
[0034] Computing resource 124 includes one or more personal computers, workstations, server devices, or other types of computing and / or communication devices. In some implementations, computing resource 124 may host platform 120. Cloud resources may include computing instances executing in computing resource 124, storage devices provided in computing resource 124, data transmission devices provided by computing resource 124, etc. In some implementations, computing resource 124 may communicate with other computing resources 124 via wired connections, wireless connections, or a combination of wired and wireless connections.
[0035] like Figure 1 As further shown, computing resources 124 include a set of cloud resources, such as one or more applications (“Application, APP”) 124-1, one or more virtual machines (“Virtual Machine, VM”) 124-2, virtualized storage devices (“Virtualized Storage, VS”) 124-3, one or more hypervisors (“Hypervisor, HYP”) 124-4, etc.
[0036] Application 124-1 includes one or more software applications that can be provided to or accessed by user device 110 and / or platform 120. Application 124-1 can eliminate the need to install and execute software applications on user device 110. For example, application 124-1 may include software associated with platform 120 and / or any other software that can be provided via cloud computing environment 122. In some implementations, an application 124-1 may send information to or receive information from one or more other applications 124-1 via virtual machine 124-2.
[0037] Virtual machine 124-2 includes a software implementation of a machine (e.g., a computer) that executes programs like a physical machine. Virtual machine 124-2 can be a system virtual machine or a process virtual machine, depending on the extent to which virtual machine 124-2 uses and corresponds to any real machine. A system virtual machine can provide a complete system platform supporting the execution of a full operating system (“OS”). A process virtual machine can execute a single program and can support a single process. In some implementations, virtual machine 124-2 can execute on behalf of a user (e.g., user device 110) and can manage the infrastructure of the cloud computing environment 122, such as data management, synchronization, or long-duration data transfer.
[0038] Virtualized storage device 124-3 includes one or more storage systems and / or one or more devices that utilize virtualization technology within the storage system or device of computing resource 124. In some implementations, the type of virtualization within the context of the storage system may include block virtualization and file virtualization. Block virtualization can refer to the extraction (or separation) of logical storage from physical storage, enabling access to the storage system regardless of physical storage or heterogeneous architecture. Separation allows storage system administrators flexibility in how they manage storage for end users. File virtualization eliminates the dependency between data accessed at the file level and the location where the files are physically stored. This enables performance optimization for storage usage, server consolidation, and / or non-disruptive file migration.
[0039] Hypervisor 124-4 can provide hardware virtualization technology that allows multiple operating systems (e.g., "guest operating systems") to run simultaneously on a host computer such as computing resource 124. Hypervisor 124-4 can present a virtual operating platform to the guest operating system and manage the execution of the guest operating system. Multiple instances of various operating systems can share virtualized hardware resources.
[0040] Network 130 includes one or more wired and / or wireless networks. For example, network 130 may include cellular networks (e.g., fifth-generation (5G) networks, long-term evolution (LTE) networks, third-generation (3G) networks, code division multiple access (CDMA) networks, etc.), public land mobile networks (PLMN), local area networks (LAN), wide area networks (WAN), metropolitan area networks (MAN), telephone networks (e.g., public switched telephone networks (PSTN)), private networks, self-organizing networks, intranets, the Internet, fiber-optic networks, etc., and / or combinations of these or other types of networks.
[0041] Figure 1 The number and arrangement of devices and networks shown are provided as examples. In practice, with Figure 1 Compared to the equipment and network shown, there may be additional equipment and / or networks, fewer equipment and / or networks, different equipment and / or networks, or equipment and / or networks arranged differently. Furthermore, Figure 1 The two or more devices shown can be implemented within a single device, or Figure 1 The single device shown can be implemented as multiple distributed devices. Alternatively, a group of devices in environment 100 (e.g., one or more devices) can perform one or more functions described as being performed by another group of devices in environment 100.
[0042] Figure 2 yes Figure 1 A block diagram of example components of one or more devices.
[0043] Device 200 may correspond to user device 110 and / or platform 120. For example... Figure 2 As shown, device 200 may include bus 210, processor 220, memory 230, storage unit 240, input unit 250, output unit 260 and communication interface 270.
[0044] Bus 210 includes components that allow communication between parts of device 200. Processor 220 is implemented in hardware, firmware, or a combination of hardware and software. Processor 220 is a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Accelerated Processing Unit (APU), microprocessor, microcontroller, Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), Application-Specific Integrated Circuit (ASIC), or other types of processing components. In some implementations, processor 220 includes one or more processors that can be programmed to perform functions. Memory 230 includes Random Access Memory (RAM), Read Only Memory (ROM), and / or another type of dynamic or static storage device (e.g., flash memory, magnetic storage, and / or optical storage) that stores information and / or instructions for use by processor 220.
[0045] Storage component 240 stores information and / or software related to the operation and use of device 200. For example, storage component 240 may include hard disks (e.g., magnetic disks, optical disks, magneto-optical disks, and / or solid-state drives), compact discs (CDs), digital versatile discs (DVDs), floppy disks, cassette tapes, magnetic tapes, and / or other types of non-transitory computer-readable media and corresponding drives.
[0046] Input component 250 includes components that allow device 200 to receive information, such as through user input (e.g., a touchscreen display, keyboard, keypad, mouse, buttons, switches, and / or microphone). Alternatively or additionally, input component 250 may include sensors for sensing information (e.g., a Global Positioning System (GPS) component, accelerometer, gyroscope, and / or actuator). Output component 260 includes components that provide output information from device 200 (e.g., a display, speaker, and / or one or more light-emitting diodes (LEDs)).
[0047] Communication interface 270 includes transceiver-like components (e.g., transceiver and / or separate receiver and transmitter) that enable device 200 to communicate with other devices, for example, via a wired connection, a wireless connection, or a combination of wired and wireless connections. Communication interface 270 may allow device 200 to receive information from and / or provide information to another device. For example, communication interface 270 may include an Ethernet interface, an optical interface, a coaxial interface, an infrared interface, a radio frequency (RF) interface, a universal serial bus (USB) interface, a Wi-Fi interface, a cellular network interface, etc.
[0048] Device 200 can perform one or more of the processes described herein. Device 200 can perform these processes in response to processor 220 executing software instructions stored in a non-transitory computer-readable medium such as memory 230 and / or storage unit 240. Computer-readable medium is defined herein as a non-transitory memory device. Memory devices include memory space within a single physical storage device or memory space distributed across multiple physical storage devices.
[0049] Software instructions can be read into memory 230 and / or storage unit 240 from another computer-readable medium or from another device via communication interface 270. When executed, the software instructions stored in memory 230 and / or storage unit 240 can cause processor 220 to perform one or more processes described herein. Alternatively or alternatively, hardwired circuitry can be used in place of or in combination with software instructions to perform one or more processes described herein. Therefore, the implementations described herein are not limited to any particular combination of hardware circuitry and software.
[0050] Figure 2 The number and arrangement of the components shown are provided as an example. In practice, with Figure 2 Compared to the components shown, device 200 may include additional components, fewer components, different components, or components arranged differently. Alternatively or concurrently, a group of components of device 200 (e.g., one or more components) may perform one or more functions described as being performed by another group of components of device 200.
[0051] Figure 3 This is a simplified diagram illustrating an exemplary model 300 for emotion extraction according to an embodiment of the present disclosure.
[0052] According to implementations, the input for conversational aspect sentiment analysis used to understand multi-turn conversations can be one or more input dialogues. A multi-turn conversation can be a dialogue utterance comprising one or more sentences from one or more speakers. As an example, a multi-turn conversation can be a back-and-forth conversation, where the context of a previous question and / or sentence influences the response or the next question and / or sentence. The input dialogue can include one or more sentences. In some implementations, the input for conversational aspect sentiment analysis used to understand multi-turn conversations can be one or more input dialogues and / or sentences broken down into words. As an example, the list of dialogue utterances can include... ,in It is a sentence in a dialogue and ,in This indicates the input word (310) in the most recent conversation turn and express The length.
[0053] Sentiment extraction may include extracting all sentiment expressions from the input dialogue. Polarity extraction may include extracting the polarity value corresponding to each sentiment. As an example, sentiment and / or polarity extraction (360) may include extracting from... Extract all emotional expressions and its polarity value (Sentiment Extraction, SE). In some implementations, each sentiment expression can be a word and / or phrase from the input dialogue. As an example, sentiment expressions... It can be a turn of events The words or phrases within, and their polarity values Choose from three possible values: -1 (negative), 0 (neutral), and +1 (positive).
[0054] In some implementations, a sentence encoder (320) can be used to identify sentiment expressions and polarities from input dialogue. As an example, a sentence encoder (320) can be used whereby the sentence encoder (320) can be modeled as treating the extraction of sentiment expressions and detection of their polarities as sequence labeling tasks. In some implementations, the sentence encoder (320) can employ a pre-trained model, such as a pre-trained BERT model, for input words (310). Generate context-sensitive sentence embeddings. In some implementations, the sentence encoder (320) may employ multiple self-attention layers to target the input sentence. Generate context-sensitive sentence embeddings (330). The generation of context-sensitive sentence embeddings (330) can be represented by the following equation (1):
[0055]
[0056] In some implementations, the context-sensitive sentence embedding (330) can be fed into a neural network and / or machine learning model (340) to generate multiple labels for each input word, sentence, and / or dialogue. As an example, the context-sensitive sentence embedding (330)... It can be fed into a multi-layer perceptron (MLP) with multiple output units and softmax activation to predict each input word (310) (e.g., The model can then infer the sentence expression and its polarity based on one or more labels (350). As an example, the model should generate the label "OOOOO Pos-B O" for the sentence "His overall performance was fantastic!" in Table 1, and then detect the positive sentiment expression "fantastic" from the label.
[0057] Figure 4 This is a simplified diagram illustrating an exemplary model 400 for reference extraction according to an embodiment of this disclosure.
[0058] In some implementations, the sentiment expression and its polarity can be input into a mention extractor model to extract corresponding mentions for at least one sentiment expression. In some implementations, a mention encoder (420) can be employed to extract mentions for each sentiment expression. Corresponding mentions In some implementations, mention extraction can be based on sentiment expression and context-sensitive sentence embeddings. In some implementations, mention extraction can be based on input links (410) based on sentiment expression and context embeddings. As an example, all dialogue turns... and related expressions The link can be used as input to the mention encoder (420). In some implementations, the mention encoder (420) can be implemented using one or more encoders based on self-attention and / or pre-trained BERT to obtain the context embedding. The generation of the context embedding can be represented by the following equation (2):
[0059]
[0060] in Expressing emotions The tokens are used to separate context and sentiment expression. In some implementations, the vector of the final sub-word unit can be used to obtain a word-level representation.
[0061] Mention extraction may require reasoning over a longer distance throughout the entire dialogue. In some implementations, rich features including turn-wise distance and speaker information can be used to model cross-sentence relevance. In some implementations, a feature extractor (430) can be used to generate rich features including turn-wise distance and speaker information to model cross-sentence relevance. In some implementations, turn-wise distance can be a relative distance of the current turn divided into [0, 1, 2, 3, 4, 5+, 8+, 10+]. Speaker information can be binary features indicating whether lexical units in the dialogue history come from the same speaker as the current turn. Both types of information can be represented by embeddings. As an example, and It can correspond to the word unit Distance embedding (turn-based distance) and speaker embedding (speaker information). Distance embedding, speaker embedding, sentence embedding, and / or context embedding can be used with the encoder output (i.e., ) link to obtain rich contextual representations (440):
[0062]
[0063] Where ⊕ represents a link operation. In some implementations, rich contextual expressions (440) can be used to generate a dialogue history representation of the link. The dialogue history representation of the link can be expressed as a link of rich contextual expressions of all sentences in the input dialogue.
[0064]
[0065] In some implementations, it can be achieved through the expression of emotions. The entire sentiment expression is generated by averaging the contextual representations of all lexical units within the expression. The average vector representation (450) can be expressed using equation (5).
[0066]
[0067] in yes The length of . Using the average vector representation for sentiment expression (450) ( ) and linked dialogue history representation ( As for querying and remembering, one or more attention models (460) can be used to compute the distributions (470) of the start (st) and end (ed) boundaries of the target mentions, respectively. If two attention models are used, the overall distribution (470) of the target mentions can be constrained as the product of the two distributions:
[0068]
[0069]
[0070]
[0071] According to the implementation method, the target mentions You can choose from Boundary of the highest score and It is generated by both, among which and st and ed They can be in the same sentence.
[0072] Figure 5 This is a simplified flowchart illustrating an example process 500 for conversational sentiment analysis according to an embodiment of this disclosure.
[0073] At operation 510, sentiment expression can be extracted from sentence embeddings corresponding to input dialogues, sentences, and / or words. As an example, input words (310) can be used to extract sentiment expression. In some examples, an encoder can be used to extract sentiment expression from input dialogues, sentences, and / or words. As an example, a sentence encoder (320) can be used to extract sentiment expression. In some implementations, a specific sentence encoder can be used. In some implementations, any method and / or model can be used as the encoder.
[0074] In some implementations, prior operations may be performed before sentiment extraction, including obtaining input dialogue, sentences, and / or words. In some implementations, sentiment extraction may include using a pre-trained machine learning model to generate multiple labels and inferring sentiment based on those labels. As an example, sentiment extraction may include using a pre-trained machine learning model (340) to generate one or more labels (350) and inferring sentiment based on those labels. As an example, a pre-trained BERT model and / or attention layers may be used to generate multiple labels and infer sentiment based on those labels.
[0075] At operation 520, polarity values can be extracted from sentence embeddings corresponding to the input dialogue, sentence, and / or word. As an example, input words (310) can be used to extract polarity values. Polarity values can be associated with one or more sentiment expressions. In some implementations, each polarity value can be associated with a sentiment expression. In some examples, an encoder can be used to extract polarity values from the input dialogue, sentence, and / or word. As an example, a sentence encoder (320) can be used to extract polarity values. In some implementations, a specific sentence encoder can be used. In some implementations, any method and / or model can be used as the encoder.
[0076] At operation 530, the target mention can be determined based on sentiment expression, polarity value, and / or sentence embedding. In some implementations, the target mention can be associated with at least one sentiment expression. At operation 540, determining the target mention of the sentiment expression can include generating a rich contextual representation based on the sentence embedding and the sentiment expression. At operation 550, determining the target mention of the sentiment expression can also include determining the target mention based on a computed boundary, wherein the computed boundary is generated using the rich contextual representation. As an example, the rich contextual representation (440) can be generated using distance embedding, speaker embedding, sentence embedding, and / or contextual embedding generated by the mention encoder (420) and / or feature extractor (430). In some implementations, the rich contextual representation (440) and the average vector representation (450) can be used as input to one or more attention models (460) to compute the boundary.
[0077] Figure 6 This is a simplified flowchart illustrating an example process 600 for conversational sentiment analysis according to an embodiment of this disclosure.
[0078] At operation 610, an input dialogue can be obtained. The input dialogue may include one or more sentences and / or words. In some implementations, the input dialogue may include a multi-turn dialogue with one or more speakers.
[0079] At operation 620, a sentence encoder can be used to generate sentence embeddings. As an example, a sentence encoder (320) can be used to generate sentence embeddings. As an example, a sentence encoder (320) can be used whereby the sentence encoder (320) can be modeled as treating the extraction of sentiment expression and detection of its polarity as a sequence labeling task. In some implementations, the sentence encoder (320) can employ a pre-trained model, such as a pre-trained BERT model, for the input word (310). Generate context-sensitive sentence embeddings. In some implementations, the sentence encoder (320) may employ multiple self-attention layers to target the input sentence. Generate context-sensitive sentence embeddings (330).
[0080] In some implementations, at operation 630, a pre-trained model can be used to generate one or more labels based on sentence embeddings. As an example, context-sensitive sentence embeddings (330) can be fed into a neural network and / or machine learning model (340) to generate multiple labels for each input word, sentence, and / or dialogue. In some implementations, context-sensitive sentence embeddings (330) can be fed into a multilayer perceptron (MLP) with multiple output units and softmax activation to predict each input word (310) (e.g., One or more labels (350). Then, the sentence expression and its polarity can be inferred from one or more labels at operations 640 and 650 respectively.
[0081] Figure 7 This is a simplified flowchart illustrating an example process 700 for conversational sentiment analysis according to an embodiment of this disclosure.
[0082] At operation 710, sentiment expression and sentence embedding can be input into one or more models. As an example, sentiment expression and sentence embedding can be input into a mention encoder (420) and / or a feature extractor (430).
[0083] At operation 720, sentiment expression and sentence embeddings can be used to generate rich contextual representations. In some implementations, one or more models can be used to generate rich contextual representations based on sentiment expression and sentence embeddings. As an example, a mention encoder (420) and / or a feature extractor (430) can be used to generate rich contextual representations based on sentiment expression and sentence embeddings.
[0084] In some implementations, generating rich contextual representations based on sentence embeddings and sentiment expressions may include generating turn-taking distance based on sentence embeddings, generating speaker information based on sentence embeddings, and concatenating turn-taking distance, speaker information, and sentiment expressions to generate rich contextual representations. In some implementations, speaker information may indicate whether the input dialogue comes from the same speaker. In some implementations, generating rich contextual information may further include generating an average vector representation of the entire sentiment expression by averaging the contextual representations of all lexical units within the sentiment expression.
[0085] In some implementations, the reference encoder (420) may be implemented using one or more encoders based on self-attention and / or pre-trained BERT to obtain context embeddings. In some implementations, the feature extractor (430) may be implemented using one or more encoders based on self-attention and / or pre-trained BERT to obtain context embeddings.
[0086] At operation 730, distributions can be generated using at least two attention layers and / or attention models based on rich contextual information. As an example, rich contextual representations (440) and average vector representations (450) can be input into one or more attention models (460) to obtain one or more distributions.
[0087] At operation 740, the product of the distributions generated from each of one or more attention layers can be determined. In some implementations, determining the product of the generated distributions may include generating multiple scores.
[0088] At operation 750, a target associated with at least one sentiment expression mention can be determined based on the boundaries of the distribution. In some implementations, determining the target mention may include selecting the boundaries of the distribution based on the highest score among multiple scores. In some implementations, determining the target mention may include selecting the boundaries of the distribution based on the highest score among multiple scores, wherein multiple scores are generated by determining the product of the distributions of each of one or more attention layers. As an example, the target mention can be generated by selecting a boundary from each attention model that yields the highest score from the product of distributions. In some implementations, the selected boundary from one attention model may be smaller than the selected boundary from another attention model. In some implementations, the two boundaries may belong to the same utterance.
[0089] The exemplary advantages of this disclosure can be described as follows.
[0090] Table 2 shows the performance of implementations of this disclosure. As shown in Table 2, this disclosure using the BERT model achieves the best scores in identifying sentiment and citations in multi-turn conversations.
[0091] Table 2
[0092]
[0093] Table 3 shows the performance of implementations of this disclosure. As shown in Table 3, this disclosure using one or more converters provides the best scores in identifying sentiment and references in multi-turn conversations.
[0094] Table 3
[0095]
[0096] As shown in Table 3, the average length of knowledge used is displayed in the column “Avg. KN Len.”. Using a complete news document slightly increases the BLEU score, but reduces the diversity of output, as indicated by the different scores. According to the implementation of this disclosure, taking only selected segments improves the diversity regarding different scores, and comparable BLEU scores are shown. More importantly, the implementation of this disclosure selects an average of only 29 Chinese characters, while the full document baseline uses 765 characters. This indicates that the implementation of this disclosure can save 96% of memory usage for representing relevant knowledge.
[0097] although Figures 5 to 7 Example blocks of processes 500, 600, and 700 are shown, but in implementations, processes 500, 600, and 700 may include... Figures 5 to 7 The blocks depicted may be additional blocks, fewer blocks, different blocks, or blocks arranged differently compared to those blocks. In the implementation, any blocks of processes 500, 600, and 700 may be combined or arranged in any number or order as needed. In the implementation, two or more blocks of processes 500, 600, and 700 may be executed in parallel.
[0098] The aforementioned technology can be implemented as computer software using computer-readable instructions and physically stored on one or more computer-readable media, or it can be implemented through one or more specially configured hardware processors. For example, Figure 1 An environment 100 suitable for implementing various implementation methods is shown.
[0099] Computer software can be coded using any suitable machine code or computer language, which can be assembled, compiled, linked, or similar mechanisms to create code that includes instructions that can be executed directly by a computer central processing unit (CPU), graphics processing unit (GPU), or through interpretation, microcode execution, etc.
[0100] The instructions can be executed on various types of computers or components thereof, including, for example, personal computers, tablet computers, servers, smartphones, gaming devices, Internet of Things devices, etc.
[0101] While this disclosure has described several exemplary embodiments, variations, substitutions, and various alternative equivalents fall within the scope of this disclosure. Therefore, it should be understood that those skilled in the art will be able to conceive of various systems and methods, although not expressly shown or described herein, but embodying the principles of this disclosure and thus within its spirit and scope.
Claims
1. A method for sentiment analysis in multi-turn conversations, characterized in that, The method includes: Get the input dialogue; Emotional expression is extracted based on sentence embeddings corresponding to the input dialogue; A polarity value is generated based on the sentence embedding corresponding to the input dialogue; and Based on the sentiment expression and the sentence embedding, at least one target mention associated with the sentiment expression is determined. The determination of the target mentioned includes: Generate rich contextual representations based on the sentence embedding and the sentiment expression; and The target mention is determined based on the computational boundaries, wherein the computational boundaries are generated using the rich contextual representation; The generation of the rich contextual representation based on the sentence embedding and the sentiment expression includes: The speech wheel distance is generated based on the sentence embedding. Speaker information is generated based on the sentence embedding, wherein the speaker information indicates whether the input dialogue comes from the same speaker; and Connect the turn-taking distance, the speaker information, and the emotional expression.
2. The method according to claim 1, characterized in that, The target references are determined based on the calculated boundaries, including: A distribution is generated using one or more attention layers based on the rich contextual representation and the sentiment expression; and The target mention is determined based on the boundaries of the distribution.
3. The method according to claim 2, characterized in that, The generation of the distribution includes determining the product of the distributions of each of the one or more attention layers.
4. The method according to claim 2, characterized in that, The determination of the target mention includes selecting the boundary of the distribution based on the highest score among a plurality of scores, wherein the plurality of scores are generated by determining the product of the distributions of each of the one or more attention layers.
5. The method according to claim 1, characterized in that, The sentence embedding is generated based on the input dialogue.
6. The method according to claim 1, characterized in that, Extracting the sentiment expression from the sentence embedding includes: Use a pre-trained machine learning model to generate multiple labels; and The emotional expression is inferred based on the multiple tags.
7. The method according to claim 1, characterized in that, Generating the polarity value from the sentence embedding includes: Use a pre-trained machine learning model to generate multiple labels; and The polarity value is inferred based on the multiple labels.
8. The method according to claim 1, characterized in that, The polarity value is one of positive, negative, or neutral.
9. A computer device, characterized in that, The computer device includes: One or more computer-readable non-transitory storage media configured to store computer program code; and One or more computer processors configured to access the computer program code and execute the method according to any one of claims 1 to 8 as instructed by the computer program code.
10. An apparatus for sentiment analysis in multi-turn conversations, characterized in that, The device includes: A first obtaining unit, configured to obtain an input dialogue; A first extraction unit is configured to extract sentiment expression based on sentence embeddings corresponding to the input dialogue; A first generation unit, configured to generate a polarity value based on the sentence embedding corresponding to the input dialogue; and A first determining unit is configured to determine a target mention associated with at least one of the sentiment expressions based on the sentiment expression and the sentence embedding, wherein the first determining unit includes: A second generation unit, configured to generate rich contextual representations based on the sentence embedding and the sentiment expression; and A second determining unit is configured to determine the target mention based on a calculated boundary, wherein the calculated boundary is generated using the rich context representation; The second generation unit includes: A third generation unit is configured to generate turn-taking distances based on the sentence embeddings; A fourth generation unit is configured to generate speaker information based on the sentence embedding, wherein the speaker information indicates whether the input dialogue comes from the same speaker; and A first linking unit is configured to link the turn-taking distance, the speaker information, and the emotional expression.
11. The apparatus according to claim 10, characterized in that, The second determining unit includes: A fifth generation unit, configured to generate a distribution using one or more attention layers based on the rich contextual representation and the sentiment expression; and A third determining unit is configured to determine the target mention based on the boundaries of the distribution.
12. The apparatus according to claim 11, characterized in that, Generating the distribution includes determining the product of the distributions of each of the one or more attention layers.
13. The apparatus according to claim 11, characterized in that, Determining the target mention based on the boundary of the distribution includes selecting the boundary of the distribution based on the highest score among a plurality of scores, wherein the plurality of scores are generated by determining the product of the distributions of each of the one or more attention layers.
14. The apparatus according to claim 10, characterized in that, The first extraction unit includes: A sixth generation unit, configured to generate multiple labels using a pre-trained machine learning model; and A first inference unit is configured to infer the emotion expression based on the plurality of tags.
15. The apparatus according to claim 10, characterized in that, The first generation unit includes: A sixth generation unit, configured to generate multiple labels using a pre-trained machine learning model; and A first inference unit is configured to infer the polarity value based on the plurality of labels.
16. The apparatus according to claim 10, characterized in that, The polarity value is one of positive, negative, or neutral.
17. A non-transitory computer-readable storage medium storing a program that causes a computer to perform the method according to any one of claims 1 to 8.