Dialogue translation method and device, electronic equipment, storage medium and program product

Using graph neural network technology to construct a conversation graph structure and perform emotional prediction and coding, it solves the problem of inaccurate emotional expression in existing conversation translation technology and improves the accuracy of translation and user experience.

CN118734863APending Publication Date: 2024-10-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310379093.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing conversation translation technology is inaccurate in the translation process, resulting in a waste of computing resources and poor user experience, and it is difficult to accurately express the emotions in the conversation.

Method used

By acquiring the original dialogue text and knowledge, constructing a graph structure, performing graph coding and emotion prediction, and combining knowledge graph representation and emotion prediction for translation processing, it ensures the accurate expression of emotions in the translated text.

Benefits of technology

It improves the accuracy and user experience of dialogue translation, and uses graph neural network technology to understand and perceive dialogue emotions from different types of knowledge, significantly improving the consistency and emotion perception of translation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734863A_ABST
    Figure CN118734863A_ABST
Patent Text Reader

Abstract

The invention provides a dialogue translation method and device, electronic equipment, a computer readable storage medium and a computer program product. The artificial intelligence technology is involved; the method comprises the steps of obtaining a first dialogue original text of a current dialogue, and obtaining at least one type of knowledge of the current dialogue; performing graph construction processing based on the first dialogue original text and the at least one type of knowledge to obtain a graph structure of the current dialogue; performing graph coding processing on the graph structure of the current dialogue to obtain knowledge graph representation of the current dialogue; performing emotion prediction processing on the knowledge graph representation of the current dialogue to obtain a predicted emotion of the current dialogue; and performing translation processing based on the knowledge graph representation of the current dialogue and the predicted emotion of the current dialogue to obtain a first dialogue translation of the current dialogue. Through the method and the device, the emotion can be accurately expressed in the dialogue translation, so that the dialogue translation accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular to a conversation translation method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] Artificial Intelligence (AI) is a comprehensive technology in computer science. By studying the design principles and implementation methods of various intelligent machines, it enables machines to have the functions of perception, reasoning and decision-making. Artificial Intelligence technology is a comprehensive discipline that covers a wide range of fields, such as natural language processing technology and machine learning / deep learning. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0003] Conversational translation is one of the important applications in the field of artificial intelligence. It can translate the original text of a conversation in one language into a translated text in another language so that users can communicate smoothly.

[0004] The dialogue translation scheme in the related art mainly generates the dialogue translation of the current dialogue by encoding and decoding the original dialogue of the current dialogue. However, the dialogue translation generated by this encoding and decoding scheme is inaccurate, which wastes a lot of computing resources and leads to a very poor user experience. Summary of the invention

[0005] The embodiments of the present application provide a conversation translation method, device, electronic device, computer-readable storage medium, and computer program product, which can accurately express emotions in conversation translations, thereby improving the accuracy of conversation translation.

[0006] The technical solution of the embodiment of the present application is implemented as follows:

[0007] The present application embodiment provides a conversation translation method, including:

[0008] Acquire a first dialogue original text of a current dialogue, and acquire at least one type of knowledge of the current dialogue;

[0009] Performing graph construction processing based on the first conversation original text and the at least one type of knowledge to obtain a graph structure of the current conversation;

[0010] Performing graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation;

[0011] Performing sentiment prediction processing on the knowledge graph representation of the current conversation to obtain a predicted sentiment of the current conversation;

[0012] A translation process is performed based on the knowledge graph representation of the current dialogue and the predicted sentiment of the current dialogue to obtain a first dialogue translation of the current dialogue.

[0013] The present application provides a conversation translation device, including:

[0014] An acquisition module, used to acquire a first dialogue original text of a current dialogue and acquire at least one type of knowledge of the current dialogue;

[0015] A construction module, configured to perform graph construction processing based on the first conversation original text and the at least one type of knowledge to obtain a graph structure of the current conversation;

[0016] An encoding module, used to perform graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation;

[0017] A prediction module, used to perform sentiment prediction processing on the knowledge graph representation of the current conversation to obtain a predicted sentiment of the current conversation;

[0018] A translation module is used to perform translation processing based on the knowledge graph representation of the current dialogue and the predicted emotion of the current dialogue to obtain a first dialogue translation of the current dialogue.

[0019] An embodiment of the present application provides an electronic device for conversation translation, the electronic device comprising:

[0020] Memory for storing computer programs or computer executable instructions;

[0021] The processor is used to implement the conversation translation method provided in the embodiment of the present application when executing the computer program or computer executable instructions stored in the memory.

[0022] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the conversation translation method provided in the embodiment of the present application is implemented.

[0023] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements the conversation translation method provided in the embodiment of the present application.

[0024] The embodiments of the present application have the following beneficial effects:

[0025] By graph encoding different types of knowledge and performing sentiment prediction on the knowledge graph representation of the current conversation, we can fully understand the current conversation and perceive the emotional tendency of the current conversation from different types of knowledge, so as to accurately express emotions in the conversation translation and improve the accuracy of conversation translation. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a schematic diagram of an application scenario of the conversation translation system provided in an embodiment of the present application;

[0027] Figure 2 is a schematic diagram of the structure of an electronic device for conversation translation provided in an embodiment of the present application;

[0028] Figure 3-Figure 6 It is a flowchart of the conversation translation method provided in the embodiment of the present application;

[0029] Figure 7 It is a schematic diagram of the architecture of a multimodal conversation translation method based on a graph neural network provided in an embodiment of the present application;

[0030] Figure 8 It is a flowchart of a multimodal conversation translation method based on a graph neural network provided in an embodiment of the present application;

[0031] Fig. 9 It is a schematic diagram of a conversation translation including different types of knowledge provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0033] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0035] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0036] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed may be executed.

[0037] 2) Graph Neural Network (GNN): refers to the general term for algorithms that use neural networks to learn graph structure data, extract and discover features and patterns in graph structure data, and meet the needs of graph learning tasks such as clustering, classification, prediction, segmentation, and generation. GNN can be a graph convolutional neural network, a graph autoencoder, a graph generation network, a graph recurrent network, and a graph attention network.

[0038] 3) Feedforward Neural Network (FNN): This is the simplest type of neural network. Neurons are arranged in layers, and each neuron is only connected to neurons in the previous layer. It receives the output of the previous layer and outputs it to the next layer. There is no feedback between layers.

[0039] 4) Knowledge: In a graph neural network, the input data used for graph construction. The knowledge of the graph neural network in the embodiment of the present application can be of various types, and different types of knowledge have different meanings. For example, different types of knowledge can be dialogue text, text used to indicate emotions, text used to indicate speakers, keywords, dialogue pictures, etc.

[0040] The embodiments of the present application provide a conversation translation method, device, electronic device, computer-readable storage medium, and computer program product, which can accurately express emotions in conversation translations, thereby improving the accuracy of conversation translation.

[0041] The conversation translation method provided in the embodiment of the present application can be implemented by the terminal / server alone; it can also be implemented by the terminal and the server in collaboration, for example, the terminal alone undertakes the conversation translation method described below, or the terminal sends a conversation translation request to the server, and the server executes the conversation translation method according to the received conversation translation request.

[0042] The electronic device for dialogue translation provided in the embodiment of the present application can be various types of terminal devices or servers, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms; the terminal can be a laptop, tablet computer, desktop computer, set-top box, mobile device (for example, mobile phone, portable music player, personal digital assistant, dedicated messaging device, portable game device, vehicle-mounted device), smart phone, smart speaker, smart watch, smart TV, vehicle-mounted terminal, etc. Various types of user terminals, but not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and this application does not limit this.

[0043] Taking the server as an example, it can be a server cluster deployed in the cloud, opening artificial intelligence cloud services (AI as a Service, AIaaS) to users. The AIaaS platform will split several common AI services and provide independent or packaged services in the cloud. This service model is similar to an AI theme mall. All users can access one or more artificial intelligence services provided by the AIaaS platform through an application programming interface.

[0044] For example, one of the artificial intelligence cloud services can be a dialogue translation service, that is, the server in the cloud is encapsulated with a dialogue translation program provided by the embodiment of the present application. The user calls the dialogue translation service in the cloud service through a terminal (running a client, such as a video client, a video client, etc.), so that the server deployed in the cloud calls the encapsulated dialogue translation program, obtains the first dialogue original text of the current dialogue, and obtains at least one type of knowledge of the current dialogue; performs a graph construction process based on the first dialogue original text and at least one type of knowledge to obtain the graph structure of the current dialogue; performs a graph encoding process on the graph structure of the current dialogue to obtain a knowledge graph representation of the current dialogue; performs an emotion prediction process on the knowledge graph representation of the current dialogue to obtain the predicted emotion of the current dialogue; performs a translation process based on the knowledge graph representation of the current dialogue and the predicted emotion of the current dialogue to obtain the first dialogue translation of the current dialogue, so as to achieve accurate dialogue translation.

[0045] See also Figure 1 , Figure 1It is a schematic diagram of an application scenario of the dialogue translation system 10 provided in an embodiment of the present application. The terminal 200 is connected to the server 100 via a network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0046] Terminal 200 (running a client, such as a call client, a video client, etc.) can be used to obtain a conversation translation request. For example, a user opens an online classroom client through the terminal, and the terminal automatically obtains a conversation translation request (including the first original text of the current conversation).

[0047] In some embodiments, a conversation translation plug-in may be implanted in the client running in the terminal, and is used to implement the conversation translation method locally on the client. For example, the terminal 200 calls the conversation translation plug-in to implement the conversation translation method, obtains the first conversation original text of the current conversation, and obtains at least one type of knowledge of the current conversation; performs graph construction processing based on the first conversation original text and at least one type of knowledge to obtain the graph structure of the current conversation; performs graph encoding processing on the graph structure of the current conversation to obtain the knowledge graph representation of the current conversation; performs emotion prediction processing on the knowledge graph representation of the current conversation to obtain the predicted emotion of the current conversation; performs translation processing based on the knowledge graph representation of the current conversation and the predicted emotion of the current conversation to obtain the first conversation translation of the current conversation, so as to respond to the conversation translation request and realize accurate conversation translation.

[0048] As an example, for a one-way dialogue translation scenario such as a video application, the language used by the characters in the video is the first language, and the language used by the video viewers is the second language. When the task in the video outputs the first dialogue original text of the current dialogue, the terminal calls the dialogue translation plug-in to implement the dialogue translation method, translates the first dialogue original text in the first language into the first dialogue translation in the second language, and outputs the first dialogue translation in the second language, so that the video viewers can watch the video without obstacles, thereby improving the user experience.

[0049] In some embodiments, after receiving a conversation translation request, the terminal 200 calls the conversation translation interface of the server 100 (which may be provided in the form of a cloud service, i.e., a conversation translation service), and the server 100 obtains the first conversation original text of the current conversation and obtains at least one type of knowledge of the current conversation; performs graph construction processing based on the first conversation original text and at least one type of knowledge to obtain a graph structure of the current conversation; performs graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation; performs emotion prediction processing on the knowledge graph representation of the current conversation to obtain a predicted emotion of the current conversation; performs translation processing based on the knowledge graph representation of the current conversation and the predicted emotion of the current conversation to obtain a first conversation translation of the current conversation, and sends the first conversation translation of the current conversation to the terminal 200 to respond to the conversation translation request and achieve accurate conversation translation.

[0050] As an example, for a two-way conversation translation scenario such as a call application, user A and user B participate in the call, and user A and user B use different languages, for example, user A uses a first language and user B uses a second language. After user A outputs the first conversation original text of the current conversation, the terminal used by user A calls the conversation translation interface of the server to implement a conversation translation method, translates the first conversation original text in the first language into a first conversation translation in the second language, and transmits the first conversation translation in the second language to the terminal used by user B. User B then receives the first conversation translation in the second language and makes a conversation reply based on the first conversation translation in the second language. Similarly, the terminal used by user B calls the conversation translation interface of the server to implement a conversation translation method, translates the conversation reply into a conversation translation in the first language, and transmits it to the terminal used by user A, thereby achieving barrier-free communication between the two parties and improving the user experience.

[0051] In some embodiments, the terminal or server can implement the conversation translation method provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, the computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a video application or an instant messaging application; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.

[0052] In some embodiments, multiple servers may form a blockchain, and server 100 is a node on the blockchain. Information connections may exist between each node in the blockchain, and information may be transmitted between nodes through the above information connections. Among them, data related to the dialogue translation method provided in the embodiment of the present application (such as the logic of dialogue translation, the first dialogue translation) may be stored on the blockchain.

[0053] The structure of the electronic device for conversation translation provided by the embodiment of the present application is described below. Figure 2 , Figure 2 1 is a schematic diagram of the structure of an electronic device 500 for conversation translation provided in an embodiment of the present application. Taking the electronic device 500 as a terminal as an example, Figure 2The electronic device 500 for conversation translation shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .

[0054] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0055] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiment of the present application is intended to include any suitable type of memory. The memory 550 optionally includes one or more storage devices that are physically far away from the processor 510.

[0056] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0057] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0058] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB), etc.;

[0059] In some embodiments, the conversation translation device provided in the embodiments of the present application can be implemented in software. The conversation translation device provided in the embodiments of the present application can be provided as various software embodiments, including various forms including applications, software, software modules, scripts or codes.

[0060] Figure 2 A conversation translation device 555 stored in a memory 550 is shown, which may be software in the form of a program and a plug-in, and includes a series of modules, including an acquisition module 5551, a construction module 5552, an encoding module 5553, a prediction module 5554, and a translation module 5555. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0061] As mentioned above, the conversation translation method provided in the embodiment of the present application can be implemented by various types of electronic devices, such as a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below. Figure 3 , Figure 3 is a flow chart of the conversation translation method provided in the embodiment of the present application, combined with Figure 3 The steps shown are explained.

[0062] In the following steps, the dialogue translation scenario can be a one-way dialogue scenario (i.e., translating the original text in the first language into the translation in the second language), or a two-way dialogue scenario (i.e., translating the original text in the first language into the translation in the second language, and also translating the original text in the second language into the translation in the first language). For example, the one-way dialogue scenario can be a video watching scenario, translating the English video into Chinese; the one-way dialogue scenario can be a speech scenario, translating the speaker's English speech into Chinese speech. For example, the two-way dialogue scenario can be a phone call scenario, translating the English original text into the Chinese translation, and translating the Chinese original text into the English translation.

[0063] In the following steps, is represented as a feature vector, for example, a node is represented as a feature vector of the node.

[0064] In step 101, a first dialogue original text of a current dialogue is obtained, and at least one type of knowledge of the current dialogue is obtained.

[0065] The current conversation is the conversation that currently needs to be translated.

[0066] In step 102, a graph construction process is performed based on the original text of the first conversation and at least one type of knowledge to obtain a graph structure of the current conversation.

[0067] See also Figure 4 , Figure 4is an optional flow chart of the conversation translation method provided in the embodiment of the present application. Figure 4 Show Figure 3 Step 102 in the above method can be implemented by the following steps 1021 to 1023.

[0068] In step 1021, the first conversation original text and at least one type of knowledge are used as nodes of a graph structure.

[0069] For example, the first original text of the current conversation is used as a node of the graph structure, and at least one type (source) of knowledge of the current conversation is considered. Since knowledge from different sources has different meanings, different types of knowledge are also constructed as different nodes in the graph structure. Since knowledge is used as a node of the graph structure, the type of knowledge corresponds to the type of node.

[0070] Among them, different types of knowledge include at least one of the following: N pairs of historical dialogues in dialogue translation (wherein the second dialogue original text and the second dialogue translation of the historical dialogue are a pair, and each dialogue corresponds to a node), keywords in the dialogue, emotional tags corresponding to each historical dialogue, pictures corresponding to each dialogue (including the current dialogue and historical dialogues), and the speaker of each dialogue.

[0071] In step 1022 , based on the associations between the nodes, edges between the nodes of the graph structure are determined.

[0072] In some embodiments, step 1022 can be implemented in the following manner: perform the following processing for any two nodes: query the node correspondence between nodes of different types based on the types of the two nodes; when the node correspondence is queried, determine that the two nodes are associated, and construct an edge between the two nodes in the graph structure.

[0073] Among them, when the types of the two nodes are both dialogue texts (i.e. original text or translation), the node correspondence is that the same keyword exists in both dialogue texts; when the types of the two nodes are keywords and the first dialogue original text respectively, the node correspondence is that the first dialogue original text contains keywords. Therefore, by connecting keyword modeling, the consistency of translation can be explicitly improved.

[0074] Taking the above five types of knowledge as an example, the following node correspondence relationship is considered to construct a graph structure. Of course, the embodiment of the present application is not limited to the following node correspondence relationship:

[0075] 1) The meanings of the dialogue translations are the same, or the dialogue is between the same speaker;

[0076] 2) The correspondence between dialogues and corresponding emotions, dialogues and corresponding pictures, and dialogues and corresponding speakers;

[0077] 3) Pictures are adjacent, and emotions correspond to the same speaker;

[0078] 4) The correspondence between pictures and corresponding emotions, and the correspondence between pictures and corresponding speakers;

[0079] 5) The correspondence between emotion labels and speakers;

[0080] 6) The association between keywords in different dialogues to explicitly promote consistent translation;

[0081] 7) The association between the keywords and the original text of the current conversation.

[0082] If any of the above node correspondences is found through the types of the two nodes, the two nodes are associated, an edge between the two nodes is established, and the values ​​corresponding to the two nodes in the adjacency matrix A are set to 1; if the above node correspondence cannot be found through the types of the two nodes, the two nodes are not associated, an edge between the two nodes is not established, and the values ​​corresponding to the two nodes in the adjacency matrix A are set to 0. Among them, the graph structure constructed in the embodiment of the present application can be a directed graph or an undirected graph.

[0083] In step 1023, the nodes are initialized to obtain node representations of the nodes of the graph structure.

[0084] The nodes corresponding to the above five types of knowledge are described below.

[0085] In some embodiments, since knowledge is used as a node of a graph structure, the type of knowledge corresponds to the type of node one-to-one. Therefore, when the type of knowledge includes historical conversations, and the historical conversations include the second original conversation text and the second translated conversation text, the corresponding node type is the second original conversation text and the second translated conversation text. When the node type is any of the first original conversation text, the second original conversation text, and the second translated conversation text, the node initialization process is as follows: bidirectional encoding is performed on the conversation text to obtain a hidden layer representation of the conversation text; text encoding is performed based on the hidden layer representation of the conversation text to obtain a node representation (i.e., sentence representation) of the conversation text.

[0086] The text encoding processing method may be to directly perform attention processing on the latent representation of the dialogue text. The text encoding processing method may also be as follows: determine the position representation of the dialogue text; perform fusion processing on the latent representation of the dialogue text and the position representation of the dialogue text to obtain the sentence representation of the dialogue text; perform attention processing on the sentence representation of the dialogue text to obtain the node representation of the dialogue text.

[0087] As an example of initializing the dialogue text type node, for the node of the i-th dialogue text (referred to as dialogue, which can be the original text or the translation), firstly, a long short-term memory network (LSTM) is used for bidirectional encoding processing to obtain the hidden layer representation of this dialogue. For example, through LSTM encoding learning, the last word of the sentence can be used as the global information representation, so the hidden layer representation of the last word is used as the hidden layer representation h of the i-th dialogue. ui , then the representation of all dialogues is {h u1 ,…,h uN}, where uN represents the total number of conversations. To distinguish the order of conversations, the position information (i.e., position representation) is incorporated into the latent representation of the conversation, and the latent representation H fused with position information is obtained. ui ={h ui PE N+1-i}, that is, the sentence representation of the dialogue text, where PE N+1-i Indicates the position information of the i-th sentence (calculated from the current N-th sentence to the 1st sentence). The position of the translation and the corresponding original text are the same. In order to obtain the representation of the entire dialogue level, a self-attention mechanism is used to pay attention to the hidden layer representation of the dialogue, and finally a more abstract sentence representation X is obtained. ui =MultiHead(H ui ,H ui , H ui ), which is the node representation of the conversation text, where MultiHead represents the multi-head self-attention mechanism.

[0088] It should be noted that attention processing is achieved through the attention mechanism. In cognitive science, the attention mechanism is used to selectively focus on part of all information while ignoring other information. The attention mechanism can enable the neural network to have the ability to focus on part of the input, that is, to select specific inputs. In the case of limited computing power, the attention mechanism is a resource allocation scheme that is the main means to solve the problem of information overload, allocating computing resources to more important tasks. Among them, the embodiments of the present application are not limited to the form of the attention mechanism. For example, the attention mechanism can be multi-head attention, self-attention, key-value pair attention, structured attention, etc.

[0089] In some embodiments, since knowledge is used as a node of a graph structure, the type of knowledge corresponds to the type of node one-to-one. Therefore, when the type of knowledge includes pictures corresponding to historical conversations and pictures corresponding to current conversations, the type of the corresponding node is pictures corresponding to historical conversations and pictures corresponding to current conversations. When the type of the node is any one of the pictures corresponding to historical conversations and pictures corresponding to current conversations (pictures for short), the initialization process of the node is as follows: image feature extraction processing is performed on the conversation picture to obtain the picture features of the conversation picture; the picture features of the conversation picture are mapped to obtain the node representation of the conversation picture (i.e., picture representation).

[0090] As an example of initializing the image type node, for each dialogue (historical dialogue or current dialogue) corresponding to the image node, first use the FastRCNN tool to extract image features and obtain the image features Among them, g fi represents the representation information of the i-th object in the picture, N represents the number of objects, and then the picture features are mapped through the feedforward network layer in the feedforward neural network to obtain the mapped picture representation X f , i.e., the node representation of the conversation picture. The embodiment of the present application is not limited to implementing the mapping process through a feedforward neural network.

[0091] In some embodiments, since knowledge is used as a node of a graph structure, the type of knowledge corresponds to the type of node one-to-one, so when the type of knowledge includes the emotion corresponding to the historical conversation, the type of the corresponding node is the emotion corresponding to the historical conversation. When the type of the node is the emotion corresponding to the historical conversation, the initialization process of the node is as follows: querying the emotion parameter lookup table based on the emotion corresponding to the historical conversation, wherein the emotion parameter lookup table includes the correspondence between different emotions and different emotion representations; using the queried emotion representation as the node representation of the emotion corresponding to the historical conversation (i.e., the emotion representation).

[0092] As an example of initializing the emotion type node, the embodiment of the present application maintains a trainable parameter lookup table EMB1 (i.e., the emotion parameter lookup table), and then queries the parameter lookup table EMB1 through the emotion node to obtain the emotion representation X of the conversation. e , which is the node representation of the emotion corresponding to the historical dialogue.

[0093] In some embodiments, since knowledge is used as a node of a graph structure, the type of knowledge corresponds to the type of node one-to-one, so when the type of knowledge includes the speaker corresponding to the historical conversation, the type of the corresponding node is the speaker corresponding to the historical conversation. When the type of the node is the emotion corresponding to the historical conversation, the initialization process of the node is as follows: based on the speaker corresponding to the historical conversation, the speaker parameter lookup table is queried, wherein the speaker parameter lookup table includes the correspondence between different speakers and different speaker representations; the queried speaker representation is used as the node representation of the speaker corresponding to the historical conversation (i.e., the speaker representation).

[0094] As an example of initializing a node of the speaker type, the embodiment of the present application maintains a trainable parameter lookup table EMB2 (i.e., a speaker parameter lookup table), and then queries the parameter lookup table EMB2 through the speaker node to obtain the emotion representation X of the conversation. s , which is the node representation of the speaker corresponding to the historical conversation.

[0095] In some embodiments, since knowledge is used as a node of a graph structure, the type of knowledge corresponds to the type of node one by one, so when the type of knowledge includes a keyword, the type of the corresponding node is a keyword. When the type of the node is a keyword, the initialization process of the node is as follows: the keyword is word-embedded to obtain a node representation of the keyword (i.e., a keyword representation).

[0096] It should be noted that when the node type is a keyword, step 101 can be implemented in the following way: perform the following processing on any word in the current conversation and historical conversations: determine the word frequency and reverse file frequency of the word; when the product of the word frequency and the reverse file frequency is greater than the set threshold, use the word as a keyword.

[0097] Among them, the term frequency (TF) of a word indicates the frequency of the word appearing in the text (including the current conversation and historical conversations). The inverse document frequency (IDF) of a word is used to characterize the importance of a word. For example, the fewer texts containing word t, the greater the IDF of word t, indicating that word t has a good ability to distinguish categories. The inverse document frequency of word t is determined in the following way: determining a first number of files (including the current conversation and historical conversations) and a second number of files containing word t; determining the ratio of the first number to the second number; performing logarithmic processing on the ratio with a base of 10 to obtain the inverse document frequency of word t.

[0098] As an example of initializing the keyword type node, various keywords are extracted from the conversation using the tf-idf algorithm, that is, the following processing is performed on any word in the conversation: the word frequency and reverse document frequency are determined; when the product of the word frequency and reverse document frequency is greater than the set threshold, the word is used as a keyword. The keyword is then embedded to obtain the keyword representation X k . Among them, the keywords in different languages ​​can be aligned by a fast-align algorithm. It should be noted that the function of the fast-align algorithm is to align different languages, such as aligning "course" and "direction"; "apple" and "apple", so as to establish a connection between keywords in different languages. Among them, the embodiments of the present application are not limited to the alignment of keywords through fast-align.

[0099] In step 103, graph encoding processing is performed on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation.

[0100] See also Figure 5 , Figure 5 is an optional flow chart of the conversation translation method provided in the embodiment of the present application. Figure 5 Show Figure 3 Step 103 in the method can be implemented by the following steps 1031 to 1033.

[0101] In step 1031, based on the edges of the graph structure of the current conversation, an adjacency matrix of the graph structure is determined.

[0102] For example, when there is an edge between two nodes in the graph structure, the values ​​corresponding to the two nodes in the adjacency matrix A are set to 1; when there is no edge between the two nodes in the graph structure, the values ​​corresponding to the two nodes in the adjacency matrix A are set to 0.

[0103] In step 1032, based on the adjacency matrix of the graph structure, the node representations in the graph structure are aggregated to obtain aggregate features.

[0104] Step 1032 is explained by taking the above-mentioned various types of knowledge as an example. Different types of knowledge have different meanings. In order to fully perceive different types of knowledge, the embodiment of the present application uses a graph neural network (GNN) to aggregate information, thereby better aggregating various types of knowledge. The aggregation method is: Among them, σ represents the activation function (such as ReLU), A τ represents the adjacency matrix of the current type τ, A τ It is constructed by multiplying the adjacency matrix A by the mask matrix of the respective type. Get, Mτ H represents a heterogeneous mask matrix of type τ (a heterogeneous mask matrix only includes the relationships between nodes of type τ and nodes of other types). l represents the node representation of the lth layer of the graph neural network, where H 0 represents the set of all node representations, W τ l and is the type parameter to be learned. Among them, the nodes in the last layer of the graph neural network represent is the aggregated feature, and Lg represents the total number of layers of the graph neural network.

[0105] In step 1033, the aggregated features are encoded based on a neural network to obtain a knowledge graph representation of the current conversation.

[0106] For example, after the aggregation processing of the graph neural network, the node representation of the last layer of the graph neural network is Through a feedforward neural network, a neural network-based encoding process is performed to obtain the final representation H of the encoder. enc (That is, the knowledge graph representation of the current conversation, also known as multi-source knowledge graph representation).

[0107] In step 104, sentiment prediction processing is performed on the knowledge graph representation of the current conversation to obtain the predicted sentiment of the current conversation.

[0108] In some embodiments, step 104 may be implemented in the following manner: performing feature conversion processing on the knowledge graph representation of the current conversation to obtain conversion features, and performing mapping processing on the conversion features to obtain the predicted emotion of the current conversation.

[0109] As an example of step 104, the present embodiment first represents the knowledge graph of the current conversation H enc Perform feature transformation to obtain a fixed vector H max =Maxpooling(H enc ), that is, the conversion feature, where Maxpooling means maximum pooling, which can be replaced by mean pooling, self-attention mechanism, etc. Then, through full connection and Softmax function, the conversion feature is mapped to obtain the predicted emotion of the current conversation P = softmax (W p H max ), where W p Represents learnable parameters, and the form of predicted emotion can be the probability distribution of emotion or the specific emotion entity.

[0110] Through step 104, sentiment prediction is performed on the knowledge graph representation of the current conversation, so as to fully understand the current conversation and perceive the sentiment tendency of the current conversation from different types of knowledge, and introduce the predicted sentiment in the subsequent translation process, so as to accurately express the sentiment in the conversation translation and improve the accuracy of the conversation translation.

[0111] In step 105, translation processing is performed based on the knowledge graph representation of the current conversation and the predicted sentiment of the current conversation to obtain a first conversation translation of the current conversation.

[0112] See also Figure 6 , Figure 6 is an optional flow chart of the conversation translation method provided in the embodiment of the present application. Figure 6 Show Figure 3 Step 1051 in can be implemented by the following steps 1051-1053.

[0113] In step 1051, decoding processing is performed based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the trigger word to obtain the first word corresponding to the original text part of the first conversation.

[0114] In some embodiments, step 1051 can be implemented in the following ways: perform attention processing on the start word to obtain the start word representation; perform interactive encoding processing on the knowledge graph representation of the current conversation and the start word representation to obtain the knowledge graph representation of the current conversation and the interactive representation of the start word representation; perform fusion processing based on the predicted emotion of the current conversation and the interactive representation to obtain a comprehensive representation; perform mapping processing on the comprehensive representation to obtain the first word corresponding to the original text part of the first conversation.

[0115] As an example of step 1051, when generating the first word y1 of the translation, the self-attention mechanism is first used to encode the start word and obtain the start word representation H r Afterwards, another self-attention mechanism is used to represent the knowledge graph H of the current dialogue. enc With the start word H r Perform interactive encoding processing to obtain the knowledge graph representation H of the current dialogue enc With the start word H r Then, the fusion process can be any of the following: introducing the predicted emotion into the interaction representation to obtain a comprehensive representation; introducing the predicted emotion and the speaker representation of the current conversation into the interaction representation to obtain a comprehensive representation O es Finally, the comprehensive representation O es Mapping is performed to obtain the first word y1, for example, by the formula P(y1)=Softmax(W O O es) is mapped to obtain the probability distribution P(y1) of the first word y1, and the word with the maximum probability in the probability distribution is taken as the first word y1, where W O represents the parameters to be learned, Represents the constructed graph structure.

[0116] In step 1052, decoding processing is performed based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the t-1th word to obtain the tth word corresponding to the original part of the first conversation.

[0117] Where t is a positive integer that increases in sequence, 2≤t≤N, and N is the total number of words generated;

[0118] In some embodiments, step 1052 can be implemented in the following ways: perform attention processing on the first t-1 words generated to obtain a translation history representation; perform interactive encoding processing on the knowledge graph representation and the translation history representation of the current conversation to obtain an interactive representation of the knowledge graph representation and the translation history representation of the current conversation; perform fusion processing based on the predicted emotion of the current conversation and the interactive representation to obtain a comprehensive representation; perform mapping processing on the comprehensive representation to obtain the tth word corresponding to the original text part of the first conversation.

[0119] As an example of step 1052, when generating the tth word y of the translation t When y is used, the self-attention mechanism is first used to focus on the historical part of the translation 1:t-1 (i.e. the first t-1 words) are processed with attention to obtain the translation history representation H r =MultiHead(R r ,R r ,R r ), where R r Represents y 1:t-1 The word embedding vector representation of . Among them, the attention processing of the embodiment of the present application is not limited to multi-head self-attention processing (MultiHead).

[0120] Afterwards, another self-attention mechanism is used to represent the knowledge graph H of the current dialogue enc H r Perform interactive encoding processing to obtain the knowledge graph representation H of the current dialogue enc H r The interactive representation O = FNN (MultiHead (H r ,H enc ,H enc )), where MultiHead represents the multi-head self-attention mechanism and FNN represents the feedforward neural network.

[0121] Then, the fusion process can be any of the following: Method 1) introduces the predicted emotion into the interaction representation to obtain a comprehensive representation; Method 2) introduces the predicted emotion and the speaker representation of the current conversation into the interaction representation to obtain a comprehensive representation. Taking method 2) as an example, through a gating mechanism, the predicted emotion and the speaker representation are introduced into the interaction representation to obtain a comprehensive representation O that combines the character characteristics and emotions in the interaction representation O. es , as shown in the following formula:

[0122] O es =O+g⊙E g +(1-g)⊙S g

[0123] g=σ([O;E g ; S g ]W g +b g )

[0124] E p =∑(P·EMB1) (8)

[0125] Among them, E g and S g are the emotion representation and speaker representation after repeated operations, E p represents the predicted sentiment, S p Indicates the speaker of the current conversation. E g =[E p ;…;E p ], E g It refers to the fusion of E with the sentence representation of the generated translation. p The vector representation obtained by repeated operations is E g The same length as the sentence representation of the generated translation;

[0126] S g =[S p ;…;S p ],S g It refers to the fusion of S with the sentence representation of the generated translation. p The vector representation obtained by repeated operation, S g The same length as the sentence representation of the generated translation. g and b g is a parameter to be learned. Since human emotions are not unique but multiple, E in the embodiment of the present application is p It is a complex emotion, not a single emotion. For example, in the probability distribution P of predicting emotions, the probability of 0.5 is happiness and the probability of 0.5 is surprise. Then E pIt is a combination of 0.5*happy emotion expression + 0.5*surprise emotion expression, E p It is a comprehensive emotion.

[0127] Finally, for the comprehensive representation O es Perform mapping processing to obtain the tth word y t , for example, through the formula Perform mapping processing to obtain the tth word y t The probability distribution of Take the word with the highest probability in the probability distribution as the tth word y t , where W O represents the parameters to be learned, Represents the constructed graph structure.

[0128] In step 1053, the N words are arranged in the order in which they are generated to obtain the first dialogue translation of the current dialogue.

[0129] In summary, the dialogue translation method provided in the embodiment of the present application performs graph encoding on different types of knowledge and performs sentiment prediction on the knowledge graph representation of the current dialogue, so as to fully understand the current dialogue and perceive the emotional tendency of the current dialogue from different types of knowledge, thereby accurately expressing emotions in the dialogue translation and improving the accuracy of dialogue translation.

[0130] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0131] The embodiments of the present application can be applied to various dialogue translation scenarios, such as one-way dialogue translation scenarios (such as watching talk show videos, watching speech videos, etc.), two-way dialogue translation scenarios (such as multi-person conference scenarios, call scenarios, etc.). The following is an example of a two-way dialogue translation scenario.

[0132] The embodiment of the present application proposes a method for dialogue translation, which is implemented by a multimodal dialogue translation method based on a graph neural network. The multimodal dialogue translation method based on a graph neural network can fully understand the dialogue content and perceive the emotional tendency of the dialogue from different types of knowledge, thereby enhancing the ability of emotional perception and accurately expressing the corresponding emotions in the translation, and explicitly improving the consistency of the translation by connecting keyword modeling. Among them, the keywords are calculated for the first N pairs of historical dialogues of the current dialogue, so each time a dialogue translation is performed, there will be keywords for connection modeling.

[0133] Combine the following Figure 7 The multimodal dialogue translation method based on graph neural network in the embodiment of the present application is described as follows: Figure 8The multimodal dialogue translation method based on graph neural network shown includes steps 201 to 205.

[0134] Step 201: construct a graph of knowledge of different types (sources) and initialize it accordingly.

[0135] like Figure 7 As shown in the left part, the original text of the current conversation is used as a node to construct a graph structure, and various types of knowledge (sources) of the current conversation are considered. Since knowledge from different sources has different meanings, various types of knowledge are also constructed as different nodes in the graph structure. Among them, different types of knowledge are: N pairs of historical conversations in the conversation translation (such as Figure 7 The “U” shown in the figure, where the original dialogue and the translated dialogue are a pair, and each dialogue corresponds to a node), keywords in the dialogue (such as Figure 7 The “K” shown in the figure, such as course, direction), the sentiment label corresponding to each historical dialogue (such as Figure 7 The "E" shown in the figure), the pictures corresponding to each sentence of dialogue (such as Figure 7 The "F" shown in the figure) and the speaker of each dialogue (such as Figure 7 The following node correspondence is considered to construct the graph structure:

[0136] 1) The meaning of the dialogue translation is the same, or the dialogue is between the same speaker;

[0137] 2) The correspondence between dialogues and corresponding emotions, dialogues and corresponding pictures, and dialogues and corresponding speakers;

[0138] 3) Pictures are adjacent, and emotions correspond to the same speaker;

[0139] 4) The correspondence between pictures and corresponding emotions, and the correspondence between pictures and corresponding speakers;

[0140] 5) The correspondence between emotion labels and speakers;

[0141] 6) The association between keywords in different dialogues to explicitly promote consistent translation;

[0142] 7) The association between the keywords and the original text of the current conversation.

[0143] If any of the above node correspondence exists between the two nodes, the two nodes are associated, an edge is established between the two nodes, and the values ​​corresponding to the two nodes in the adjacency matrix A are set to 1; if the two nodes do not have the above node correspondence, the two nodes are not associated, an edge is not established between the two nodes, and the values ​​corresponding to the two nodes in the adjacency matrix A are set to 0. Among them, the graph structure constructed in the embodiment of the present application is a directed graph, and the opposite direction of the above node correspondence is also 1.

[0144] It should be noted that the edges in the graph structure indicate whether there is a connection between nodes. If there is a connection between nodes, during the graph neural network update, the current node can focus on the node representations related to it, thereby better learning the current node. If there is no connection between nodes, other node representations will not be considered in the current node update.

[0145] The following is an explanation of the node initialization, that is, initializing each node to obtain the node representation of each node.

[0146] For the node of the i-th dialogue (which can be the original text or the translation), firstly, a long short-term memory network (LSTM) is used to learn the hidden layer representation of this dialogue. For example, through LSTM encoding learning, the last word of the sentence can be used as the global information representation, so the hidden layer representation of the last word is used as the hidden layer representation h of the i-th dialogue. ui , then the representation of all dialogues is {h u1 , ..., h uN}, where uN represents the total number of conversations. To distinguish the order of conversations, the position information is integrated into the latent representation of the conversation, and the latent representation H with the position information integrated is obtained. ui ={h ui PE N+1-i}, where PE N+1-i Indicates the position information of the i-th sentence (calculated from the current N-th sentence to the 1st sentence). The position of the translation and the corresponding original text are the same. In order to obtain the representation of the entire dialogue level, a self-attention mechanism is used to encode the hidden layer representation of the dialogue again, and finally a more abstract sentence representation X is obtained. ui , the calculation formula is shown in formula (1):

[0147] X ui =MultiHead(H ui , H ui , H ui ) (1)

[0148] Among them, MultiHead represents the multi-head self-attention mechanism.

[0149] The original text and the translation are explained below.

[0150] For the i-th sentence in the N original sentences, the hidden layer representation of the last word of the i-th sentence is used as the hidden layer representation h of the i-th original sentence oui , then all original texts are represented as {h ou1 , ..., h ouN}, where ouN represents the total number of original texts. Then the position information is integrated into the hidden layer representation of the original text to obtain the hidden layer representation H that incorporates the position information oui ={h oui PE N+1-i}, where PE N+1-i Represents the position information of the original text of the i-th sentence. A self-encoding attention mechanism is used to encode the hidden layer representation of the original text again, and finally a more abstract sentence representation X of the original text is obtained. oui =MultiHead(H oui , H oui , H oui ).

[0151] For the i-th sentence in N translations, the hidden representation of the last word of the i-th sentence is used as the hidden representation h of the i-th translation. tui , then all translations are represented by {h tu1 , ..., h tuN}, where tuN represents the total number of translations. Then the position information (i.e., position representation) is integrated into the hidden layer representation of the translation, and the hidden layer representation H with integrated position information is obtained. tui ={h tui PE N+1-i}, where PE N+1-i Represents the position representation of the i-th sentence translation. A self-encoding attention mechanism is used to encode the hidden layer representation of the translation again, and finally a more abstract sentence representation X is obtained. tui =MultiHead(H tui , H tui , H tui ).

[0152] For each dialogue corresponding to the picture node, first use the FastRCNN tool to extract the picture features Among them, g fi represents the representation information of the i-th object in the picture, N represents the number of objects, and then the picture features are mapped through the feedforward network layer to obtain the mapped picture representation X f , the calculation formula is as follows:

[0153] X f=FNN(G f ) (2)

[0154] Among them, FNN represents the feed-forward network layer.

[0155] For the emotion node, the embodiment of the present application maintains a trainable parameter lookup table EMB1, and then queries the parameter lookup table EMB1 through the emotion node to obtain the emotion representation X of the conversation. e .

[0156] For the speaker node, the embodiment of the present application maintains a trainable parameter lookup table EMB2, and then queries the parameter lookup table EMB2 through the speaker node to obtain the speaker representation X of the conversation. s .

[0157] For the keyword node, various keywords are extracted from the conversation through the tf-idf algorithm, and the keywords are embedded to obtain the keyword representation X k Among them, the keywords in different languages ​​can be aligned by the fast-align algorithm. It should be noted that the function of the fast-align algorithm is to align different languages, such as aligning "course" and "direction"; "apple" and "apple", so as to establish a connection between keywords in different languages.

[0158] Step 202: perform graph encoding on the constructed graph structure, that is, first learn to aggregate different types of knowledge to obtain aggregate features, and then obtain a multi-source knowledge graph representation after the aggregate features are processed by a feed-forward network layer.

[0159] It should be noted that different types of knowledge have different meanings. In order to fully perceive different types of knowledge, the embodiment of the present application uses graph neural networks (GNN) to aggregate information, so as to better aggregate various types of knowledge. The aggregation method is shown in formula (3):

[0160]

[0161] Among them, σ represents the activation function (such as ReLU), A τ represents the adjacency matrix of the current type τ, A τ It is constructed by multiplying the adjacency matrix A by the mask matrix of the respective type. So, Mτ represents the heterogeneous mask matrix of type τ. l represents the node representation of the lth layer of the graph neural network, where H 0 represents the set of all node representations, W τ l and is the type parameter to be learned. Then, through a feedforward neural network, the final representation H of the encoder is obtained. enc (i.e., multi-source knowledge graph representation), as shown in formula (4):

[0162]

[0163] in, It represents the representation after Lg layer graph encoding (i.e., aggregated features), and Lg represents the total number of layers of the graph neural network.

[0164] Step 203: Perform sentiment prediction based on the multi-source knowledge graph representation to obtain predicted sentiment.

[0165] For example, first convert the final representation H of the encoder enc It is converted into a fixed vector and then processed by the full connection and Softmax function to obtain the probability distribution P of the predicted emotion, as shown in formula (5):

[0166] H max =Maxpooling(H enc )

[0167] P = softmax(W p H max ) (5)

[0168] Among them, W p Represents a learnable parameter, and Maxpooling represents maximum pooling. Maxpooling can be replaced by mean pooling, self-attention, etc.

[0169] Step 204: Perform dialogue translation by combining the multi-source knowledge graph representation and predicted emotions through a decoder to obtain a translation containing emotions.

[0170] In some embodiments, the decoder encodes and learns the historical part of the translation through a self-attention mechanism to obtain a historical representation of the translation, and then encodes and learns the historical representation of the translation and the multi-source knowledge graph representation through a self-attention mechanism to obtain an interactive representation, and then introduces the predicted emotion and the personality characteristics of the current speaker into the interactive representation through a gating mechanism, and finally generates a translation containing emotion.

[0171] The decoder is described below.

[0172] In generating the tth word y of the translation t When y is used, the self-attention mechanism is first used to focus on the historical part of the translation 1:t-1 Perform encoding learning to obtain the translation history representation H r, where when the first word is generated, the historical part of the translation (i.e. the 0th generated word) is the start word (bos), as shown in formula (6):

[0173] H r =MultiHead(R r , R r , R r ) (6)

[0174] Among them, R r Represents y 1:t-1 The word embedding vector representation of .

[0175] Afterwards, the encoder’s final representation H is processed through another self-attention mechanism enc H r Perform encoding learning to obtain the final representation H of the encoder enc H r The interaction representation O is shown in formula (7):

[0176] O=FNN(MultiHead(H r , H enc , H enc )) (7)

[0177] Then, through a gating mechanism, the predicted emotion representation (i.e., the probability distribution of predicted emotion) and the speaker representation are introduced into the interaction representation, and a comprehensive representation O that combines the role characteristics and emotions in the interaction representation O is obtained. es , as shown in formula (8):

[0178] O es =O+g⊙Eg+(1-g)⊙S g

[0179] g=σ([O;E g ; S g ]W g +b g )

[0180] E p =∑(P·EMB1) (8)

[0181] Among them, E g and S g are the emotion representation and speaker representation after repeated operations, E p represents the predicted sentiment representation, S p Represents the vector representation of the current speaker. E g =[E p ;...;E p ], E gRefers to the vector representation obtained by repeating the operation on E p in order to integrate with the sentence length representation of the generated translation; S g = [S p ;...; S p , where S g refers to the vector representation obtained by repeating the operation on S p in order to integrate with the sentence length representation of the generated translation. W g and b g are parameters to be learned. Among them, since human emotions are not unique but multiple, the E p in the embodiments of the present application is a complex emotion rather than a single emotion. For example, if the probability of 0.5 in P is happy and the probability of 0.5 is surprised, then E p is the integration of the emotional representation of 0.5 * happy + the emotional representation of 0.5 * surprised, and E p is a comprehensive emotion.

[0182] Finally, decode the comprehensive representation O es to generate the t-th word y t , as shown in formula (9):

[0183]

[0184] where W O represents the parameter to be learned, represents the constructed graph structure.

[0185] Arrange the generated words in the order of the generated words to obtain the final translation. As Fig. 9 shown, fully understand the conversation content and perceive the emotional tendency of the conversation from different types of knowledge, so as to accurately express the corresponding emotion in the translation, such as "Negative".

[0186] In summary, referring to Figure 7 , during the process of graph construction, integrate emotions into the graph structure, then perform emotion prediction on the current conversation, and finally introduce the corresponding predicted emotion during the decoding process by the decoder, so as to accurately express the corresponding emotion in the translation; taking Figure 7 the keyword "course" in as an example, "course_" in the current conversation is connected to "course_heading" in the historical conversation, which can explicitly improve the consistency of translation and ensure that "course" will not be translated into other meanings, such as "course".

[0187] Next, the effect of the multi-modal dialogue translation method based on graph neural network in the embodiments of the present application will be described with reference to Table 1.

[0188] As shown in Table 1, the bilingual evaluation understudy (BLEU) values ​​of the multimodal conversation translation method based on graph neural network in the embodiment of the present application in both language directions (En->De, Zh->En) exceed the neural conversation translation (NCT) model in the related art. Therefore, the translation of the embodiment of the present application is more consistent with the conversation history, which ultimately makes the translated translation more in line with the source language.

[0189] Table 1

[0190]

[0191]

[0192] In summary, the multimodal dialogue translation method based on graph neural network in the embodiment of the present application shows better translation effect, and can effectively understand the content of the dialogue and perceive the emotional tendency of the dialogue from different types of knowledge, thereby enhancing the ability of emotion perception and accurately expressing the corresponding emotions in the translation. It also explicitly improves the consistency of the translation by connecting keyword modeling, making it more practical and significantly improving the user experience.

[0193] So far, the conversation translation method provided by the embodiment of the present application has been described in combination with the exemplary application and implementation of the electronic device provided by the embodiment of the present application. The embodiment of the present application also provides a conversation translation device. In actual applications, each functional module in the conversation translation device can be implemented by hardware resources of an electronic device (such as a terminal device, a server or a server cluster), such as computing resources such as a processor, communication resources (such as for supporting various communication methods such as optical cables and cellular), and memory. Figure 2 A conversation translation device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, for example, a software module designed in a programming language such as C / C++ or Java, an application software designed in a programming language such as C / C++ or Java, or a dedicated software module in a large software system, an application program interface, a plug-in, a cloud service, and the like. Different implementations are described below with examples.

[0194] The conversation translation device 555 includes a series of modules, including an acquisition module 5551, a construction module 5552, an encoding module 5553, a prediction module 5554, and a translation module 5555. The following is a description of the scheme for implementing conversation translation by cooperating among the modules in the conversation translation device 555 provided in the embodiment of the present application.

[0195] An acquisition module 5551 is used to acquire the first original text of the current conversation and acquire at least one type of knowledge of the current conversation; a construction module 5552 is used to perform graph construction processing based on the first original text of the conversation and the at least one type of knowledge to obtain the graph structure of the current conversation; an encoding module 5553 is used to perform graph encoding processing on the graph structure of the current conversation to obtain the knowledge graph representation of the current conversation; a prediction module 5554 is used to perform emotion prediction processing on the knowledge graph representation of the current conversation to obtain the predicted emotion of the current conversation; a translation module 5555 is used to perform translation processing based on the knowledge graph representation of the current conversation and the predicted emotion of the current conversation to obtain the first translated text of the current conversation.

[0196] In some embodiments, the construction module 5552 is also used to use the first conversation original text and the at least one type of knowledge as nodes of the graph structure; based on the relationship between the nodes, determine the edges between the nodes of the graph structure; initialize the nodes to obtain node representations of the nodes of the graph structure.

[0197] In some embodiments, the type of knowledge includes historical conversations, and the historical conversations include a second conversation original text and a second conversation translation; when the type of the node is any one of the first conversation original text, the second conversation original text, and the second conversation translation, the construction module 5552 is also used to perform bidirectional encoding processing on the conversation text to obtain a latent representation of the conversation text; and perform text encoding processing based on the latent representation of the conversation text to obtain a node representation of the conversation text.

[0198] In some embodiments, the construction module 5552 is also used to determine the position representation of the dialogue text; fuse the latent layer representation of the dialogue text and the position representation of the dialogue text to obtain the sentence representation of the dialogue text; and perform attention processing on the sentence representation of the dialogue text to obtain the node representation of the dialogue text.

[0199] In some embodiments, the type of knowledge includes pictures corresponding to historical conversations and pictures corresponding to the current conversation; when the type of the node is any one of the pictures corresponding to the historical conversations and the pictures corresponding to the current conversation, the construction module 5552 is also used to perform image feature extraction processing on the conversation picture to obtain the picture features of the conversation picture; and perform mapping processing on the picture features of the conversation picture to obtain the node representation of the conversation picture.

[0200] In some embodiments, the type of knowledge includes at least one of the following: emotions corresponding to historical conversations, speakers corresponding to the historical conversations; when the type of the node is the emotion corresponding to the historical conversation, the construction module 5552 is also used to query an emotion parameter lookup table based on the emotion corresponding to the historical conversation, wherein the emotion parameter lookup table includes the correspondence between different emotions and different emotion representations; the queried emotion representation is used as the node representation of the emotion corresponding to the historical conversation; when the type of the node is the speaker corresponding to the historical conversation, the construction module 5552 is also used to query a speaker parameter lookup table based on the speaker corresponding to the historical conversation, wherein the speaker parameter lookup table includes the correspondence between different speakers and different speaker representations; the queried speaker representation is used as the node representation of the speaker corresponding to the historical conversation.

[0201] In some embodiments, the type of knowledge includes keywords; the acquisition module 5551 is also used to perform the following processing on any word in the current conversation and the historical conversation: determine the word frequency and the reverse file frequency of the word; when the product of the word frequency and the reverse file frequency is greater than a set threshold, use the word as the keyword; when the type of the node is the keyword, the construction module 5552 is also used to perform word embedding processing on the keyword to obtain the node representation of the keyword.

[0202] In some embodiments, the construction module 5552 is also used to perform the following processing for any two of the nodes: querying the node correspondence between nodes of different types based on the types of the two nodes; when the node correspondence is queried, determining that there is the association between the two nodes, and constructing an edge between the two nodes in the graph structure.

[0203] In some embodiments, when the types of the two nodes are both conversation texts, the node correspondence relationship is that the same keyword exists in the two conversation texts at the same time; when the types of the two nodes are keywords and the first conversation original text respectively, the node correspondence relationship is that the first conversation original text contains the keyword.

[0204] In some embodiments, the encoding module 5553 is also used to determine the adjacency matrix of the graph structure based on the edges of the graph structure of the current conversation; based on the adjacency matrix of the graph structure, perform aggregation processing on the node representations in the graph structure to obtain aggregate features; perform neural network-based encoding processing on the aggregate features to obtain the knowledge graph representation of the current conversation.

[0205] In some embodiments, the prediction module 5554 performs feature conversion processing on the knowledge graph representation of the current conversation to obtain conversion features; and performs mapping processing on the conversion features to obtain the predicted emotion of the current conversation.

[0206] In some embodiments, the translation module 5555 is also used to perform decoding processing based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the start-up word to obtain the first word corresponding to the original part of the first conversation; perform decoding processing based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the t-1th word to obtain the tth word corresponding to the original part of the first conversation; wherein t is a positive integer that increases successively, 2≤t≤N, and N is the total number of generated words; the N words are arranged in the order in which they are generated to obtain the first conversation translation of the current conversation.

[0207] In some embodiments, the translation module 5555 is also used to perform attention processing on the first t-1 words generated to obtain a translation history representation; perform interactive encoding processing on the knowledge graph representation of the current conversation and the translation history representation to obtain an interactive representation of the knowledge graph representation of the current conversation and the translation history representation; perform fusion processing based on the predicted emotion of the current conversation and the interactive representation to obtain a comprehensive representation; perform mapping processing on the comprehensive representation to obtain the tth word corresponding to the original text part of the first conversation.

[0208] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer executable instruction from the computer-readable storage medium, and the processor executes the computer program or the computer executable instruction, so that the electronic device performs the above-mentioned conversation translation method of the embodiment of the present application.

[0209] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the conversation translation method provided by the present application embodiment, for example, Figure 3-6 The dialogue translation method shown.

[0210] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0211] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0212] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0213] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0214] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0215] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A method for dialogue translation, characterized in that: The method comprises: Acquire a first dialogue original text of a current dialogue, and acquire at least one type of knowledge of the current dialogue; Performing graph construction processing based on the first conversation original text and the at least one type of knowledge to obtain a graph structure of the current conversation; Performing graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation; Performing sentiment prediction processing on the knowledge graph representation of the current conversation to obtain a predicted sentiment of the current conversation; A translation process is performed based on the knowledge graph representation of the current dialogue and the predicted sentiment of the current dialogue to obtain a first dialogue translation of the current dialogue.

2. The method according to claim 1, characterized in that The performing graph construction processing based on the first conversation original text and the at least one type of knowledge to obtain the graph structure of the current conversation includes: Using the first original conversation text and the at least one type of knowledge as nodes of the graph structure; Based on the associations between the nodes, determining edges between the nodes of the graph structure; The nodes are initialized to obtain node representations of the nodes of the graph structure.

3. The method according to claim 2, characterized in that When the type of the node is any one of the first original dialogue text, the second original dialogue text in the historical dialogue, and the second translated dialogue text in the historical dialogue, the initialization processing of the node to obtain the node representation of the node of the graph structure includes: Performing bidirectional encoding processing on the dialogue text to obtain a latent layer representation of the dialogue text; Text encoding processing is performed based on the latent layer representation of the dialogue text to obtain the node representation of the dialogue text.

4. The method according to claim 3, characterized in that The step of performing text encoding processing based on the latent layer representation of the conversation text to obtain the node representation of the conversation text includes: determining a positional representation of the dialogue text; fusing the latent layer representation of the dialogue text and the position representation of the dialogue text to obtain a sentence representation of the dialogue text; Attention processing is performed on the sentence representation of the dialogue text to obtain a node representation of the dialogue text.

5. The method according to claim 2, characterized in that: When the type of the node is any one of the pictures corresponding to the historical conversation and the pictures corresponding to the current conversation, the node is initialized to obtain the node representation of the node of the graph structure, including: Performing image feature extraction processing on the conversation picture to obtain image features of the conversation picture; Mapping processing is performed on the image features of the conversation image to obtain a node representation of the conversation image.

6. The method according to claim 2, characterized in that When the type of the node is the emotion corresponding to the historical conversation, the node is initialized to obtain the node representation of the node of the graph structure, including: Querying an emotion parameter lookup table based on the emotion corresponding to the historical conversation, wherein the emotion parameter lookup table includes corresponding relationships between different emotions and different emotion expressions; Using the queried emotion representation as a node representation of the emotion corresponding to the historical conversation; When the type of the node is the speaker corresponding to the historical conversation, the node is initialized to obtain a node representation of the node of the graph structure, including: Querying a speaker parameter lookup table based on the speaker corresponding to the historical conversation, wherein the speaker parameter lookup table includes correspondences between different speakers and different speaker representations; The queried speaker representation is used as the node representation of the speaker corresponding to the historical conversation.

7. The method according to claim 2, characterized in that The types of knowledge include keywords; The acquiring of at least one type of knowledge of the current conversation includes: The following processing is performed for any word in the current conversation and the historical conversation: Determining the term frequency and inverse document frequency of the term; When the product of the word frequency and the reverse file frequency is greater than a set threshold, the word is used as the keyword; When the type of the node is the keyword, the initialization processing of the node to obtain the node representation of the node of the graph structure includes: Perform word embedding processing on the keyword to obtain a node representation of the keyword.

8. The method according to claim 2, characterized in that: The determining, based on the associations between the nodes, the edges between the nodes of the graph structure includes: The following processing is performed for any two of the nodes: Querying the node correspondence between nodes of different types based on the types of the two nodes; When the node correspondence is found, it is determined that the two nodes are associated with each other, and an edge between the two nodes is constructed in the graph structure.

9. The method according to claim 8, characterized in that When the types of the two nodes are both dialogue texts, the node correspondence relationship is that the same keyword exists in the two dialogue texts at the same time; When the types of the two nodes are respectively a keyword and the first original text of the conversation, the node correspondence relationship is that the first original text of the conversation contains the keyword.

10. The method according to claim 1, characterized in that The performing graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation includes: Determining an adjacency matrix of the graph structure based on the edges of the graph structure of the current conversation; Based on the adjacency matrix of the graph structure, performing aggregation processing on the node representations in the graph structure to obtain aggregate features; The aggregated features are encoded based on a neural network to obtain a knowledge graph representation of the current conversation.

11. The method according to claim 1, characterized in that: The performing sentiment prediction processing on the knowledge graph representation of the current conversation to obtain the predicted sentiment of the current conversation includes: Performing feature conversion processing on the knowledge graph representation of the current conversation to obtain conversion features; Mapping is performed on the conversion features to obtain the predicted emotion of the current conversation.

12. The method according to claim 1, characterized in that The performing translation processing based on the knowledge graph representation of the current dialogue and the predicted emotion of the current dialogue to obtain a first dialogue translation of the current dialogue includes: Performing decoding processing based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the start word to obtain a first word corresponding to the original text of the first conversation; Performing decoding processing based on the knowledge graph representation of the current conversation, the predicted sentiment of the current conversation, and the t-1th word to obtain the tth word corresponding to the original text of the first conversation; Where t is a positive integer that increases in sequence, 2≤t≤N, and N is the total number of words generated; The N words are arranged in the order in which they are generated to obtain a first dialogue translation of the current dialogue.

13. The method according to claim 12, characterized in that The decoding process based on the knowledge graph representation of the current conversation, the predicted emotion of the current conversation, and the t-1th word is performed to obtain the tth word corresponding to the original text of the first conversation, including: Perform attention processing on the first t-1 words generated to obtain the translation history representation; Performing interactive encoding processing on the knowledge graph representation of the current conversation and the translation history representation to obtain an interactive representation of the knowledge graph representation of the current conversation and the translation history representation; Performing fusion processing based on the predicted emotion of the current conversation and the interaction representation to obtain a comprehensive representation; The comprehensive representation is mapped to obtain the tth word corresponding to the first original part of the conversation.

14. A conversation translation device, characterized in that: The device comprises: An acquisition module, used to acquire a first dialogue original text of a current dialogue and acquire at least one type of knowledge of the current dialogue; A construction module, configured to perform graph construction processing based on the first conversation original text and the at least one type of knowledge to obtain a graph structure of the current conversation; An encoding module, used to perform graph encoding processing on the graph structure of the current conversation to obtain a knowledge graph representation of the current conversation; A prediction module, configured to perform sentiment prediction processing on the knowledge graph representation of the current conversation to obtain a predicted sentiment of the current conversation; A translation module is used to perform translation processing based on the knowledge graph representation of the current dialogue and the predicted emotion of the current dialogue to obtain a first dialogue translation of the current dialogue.

15. An electronic device, characterized in that: The electronic device comprises: Memory for storing computer programs or computer executable instructions; A processor, configured to implement the conversation translation method according to any one of claims 1 to 13 when executing the computer program or computer executable instructions stored in the memory.

16. A computer-readable storage medium, characterized in that: A computer program or a computer executable instruction is stored, and when the computer program or the computer executable instruction is executed by a processor, the conversation translation method according to any one of claims 1 to 13 is implemented.

17. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instructions are executed by a processor, the conversation translation method according to any one of claims 1 to 13 is implemented.

Citation Information

Cited By

  • Information processing method, information processing program, and information processing device

    JP2026139276A

  • Information processing method, information processing program, and information processing device

    JP7841630B1

  • Information processing method, information processing program, and information processing device

    WO2026176782A1