Machine translation method, apparatus, and storage medium

By adding an interactive layer to the machine translation model and using a word alignment model to associate sentences in different source languages, the problems of low translation efficiency and insufficient accuracy in existing technologies are solved, achieving more efficient and accurate translation results.

CN112183119BActive Publication Date: 2025-10-24BEIJING XIAOMI PINECONE ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010977074.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-16
Publication Date
2025-10-24
Estimated Expiration
2040-09-16

AI Technical Summary

Technical Problem

Existing machine translation technology cannot fully utilize the relationship between sentences in different source languages, resulting in low translation efficiency and inaccurate results.

Method used

By inputting different source language sentences with the same semantics into the encoding layer of the translation model, using the word alignment model to associate words, adding an interaction layer for information interaction, the target encoding result is obtained, and finally the target sentence is generated.

Benefits of technology

It improves the accuracy and efficiency of translation results, reduces the burden of model training, and makes full use of source information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112183119B_ABST
    Figure CN112183119B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a machine translation method, device and storage medium. The method can comprise: inputting M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively to obtain M original encoding results, wherein M is a positive integer; using a word alignment model to associate words with the same semantics in the M source language sentences in different source languages to obtain an alignment result; inputting the M original encoding results into an interaction layer of the translation model, and obtaining M target encoding results according to the alignment result and the M original encoding results; and obtaining a target sentence represented based on a target language based on the M target encoding results. Not only does this greatly enhance the information transmission between each source language sentence, making the source input information more fully utilized to improve the accuracy of the translation result. It also uses the alignment result to guide the semantic interaction between sentences, improving the efficiency of information interaction, while also reducing the training burden of the model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of machine translation, and in particular, to a machine translation method, device and storage medium. BACKGROUND

[0002] Machine translation is a process of automatically translating one language into another language by using a computer, which is one of the frontiers of artificial intelligence natural language processing, and has important academic significance and application value. With the rapid development of economic globalization and the Internet, machine translation technology plays an increasingly important role in promoting political, economic and cultural exchanges, and is increasingly attracting people's attention.

[0003] In real life, there are many application scenarios of multi-source machine translation. For example, a book with different language translations is translated into a new language. For another example, there are also multi-language tool manuals, multi-language web pages and multi-language signs translated into a new language. At present, when using a machine translation model to model a source sentence, different languages are modeled separately, and the relationship between different source language sentences cannot be fully utilized. Even if multiple source language sentences are concatenated into one sentence, due to the fact that this approach is too simple, the source language sentences are difficult to fully and effectively interact with each other, which will result in low translation efficiency and inaccurate translation results. SUMMARY

[0004] The present disclosure provides a machine translation method, device and storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, a machine translation method is provided, comprising:

[0006] inputting M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively, to obtain M original encoding results, wherein M is a positive integer;

[0007] correlating words with the same semantics and different source languages in the M source language sentences by using a word alignment model to obtain an alignment result;

[0008] inputting the M original encoding results into an interaction layer of the translation model, and obtaining M target encoding results according to the alignment result and the M original encoding results;

[0009] obtaining a target sentence based on a target language representation based on the M target encoding results; wherein the target sentence has the same semantics as the M source language sentences.

[0010] Optionally, correlating words with the same semantics and different source languages in the M source language sentences to obtain an alignment result comprises:

[0011] corresponding to the Nth source language sentence in the M source language sentences and the M-1 source language sentences other than the Nth source language sentence, to obtain the alignment result;

[0012] The M original encoding results are input into the interaction layer of the translation model, and M target encoding results are obtained according to the alignment result and the M original encoding results, comprising:

[0013] According to the alignment result, a gating coefficient corresponding to the Nth source language sentence is obtained.

[0014] According to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, the target encoding result of the Nth source language sentence is obtained, wherein N is a positive integer and N is less than or equal to M.

[0015] The gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence.

[0016] Optionally, the original encoding result includes a hidden state representation of each word in the source language sentence in the encoding layer, wherein the hidden state representation is obtained by converting each word based on the attention mechanism of the translation model.

[0017] The association of the Nth source language sentence currently traversed in the M source language sentences and the words in different source languages with the same semantics in the M-1 source language sentences other than the Nth source language sentence to obtain the alignment result comprises:

[0018] From the M-1 source language sentences other than the Nth source language sentence, the words with the same semantics as each word in the Nth source language sentence are determined to obtain a word set.

[0019] The gating coefficient corresponding to the Nth source language sentence is obtained according to the alignment result, comprising:

[0020] Based on the hidden state representation of each word in the Nth source language sentence in the current network layer of the translation model and the hidden state representation of each word in the word set in the current network layer of the translation model, the gating coefficient corresponding to the Nth source language sentence is obtained.

[0021] Optionally, the gating coefficient corresponding to the Nth source language sentence is obtained based on the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set, comprising:

[0022] weighting and summing the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set based on the first preset parameter matrix and the second preset parameter matrix to obtain a sum value;

[0023] normalizing the sum value by using an activation function to obtain the gating coefficient.

[0024] Optionally, the obtaining of the target sentence based on the target language representation based on the M target encoding results comprises:

[0025] splicing the M target encoding results by using a splicing function to obtain a spliced result;

[0026] inputting the spliced result into a decoder of the translation model to obtain the target sentence.

[0027] Optionally, the method further comprises:

[0028] training the translation model based on a preset training corpus to obtain a target translation model;

[0029] The inputting of the M source language sentences with the same semantics into the corresponding encoding layers of the translation model respectively to obtain the M original encoding results comprises:

[0030] inputting the M source language sentences with the same semantics into the corresponding encoding layers of the target translation model respectively to obtain the M original encoding results.

[0031] According to a second aspect of the embodiments of the present disclosure, a machine translation device is provided, comprising:

[0032] An original encoding obtaining module is configured to input M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively to obtain M original encoding results, wherein M is a positive integer;

[0033] An alignment result obtaining module is configured to associate words with the same semantics in different source languages in the M source language sentences by using a word alignment model to obtain an alignment result;

[0034] A target encoding obtaining module is configured to input the M original encoding results into an interaction layer of the translation model, and obtain M target encoding results according to the alignment result and the M original encoding results;

[0035] A sentence obtaining module is configured to obtain a target sentence based on a target language representation based on the M target encoding results; wherein the target sentence has the same semantics as the M source language sentences.

[0036] Optionally, the alignment result obtaining module is further configured to:

[0037] correlate the Nth source language sentence being currently traversed in the M source language sentences with words in different source languages having the same semantics as the Nth source language sentence in the M-1 source language sentences other than the Nth source language sentence, to obtain the alignment result;

[0038] The target encoding obtaining module is further configured to:

[0039] obtain the gating coefficient corresponding to the Nth source language sentence according to the alignment result;

[0040] obtain the target encoding result of the Nth source language sentence according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, wherein N is a positive integer and N is less than or equal to M;

[0041] The gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence.

[0042] Optionally, the original encoding result includes hidden state representations of each word in the source language sentence in the encoding layer, wherein the hidden state representations are obtained by converting each word based on the attention mechanism of the translation model;

[0043] The alignment result obtaining module is further configured to:

[0044] determine words having the same semantics as each word in the Nth source language sentence from the M-1 source language sentences other than the Nth source language sentence, to obtain a word set;

[0045] The target encoding obtaining module is further configured to:

[0046] obtain the gating coefficient corresponding to the Nth source language sentence based on the hidden state representations of each word in the Nth source language sentence in the current network layer of the translation model and the hidden state representations of each word in the word set in the current network layer of the translation model.

[0047] Optionally, the target encoding obtaining module is further configured to:

[0048] weight and sum the hidden state representations of each word in the Nth source language sentence and the hidden state representations of each word in the word set based on a first preset parameter matrix and a second preset parameter matrix, to obtain a sum value;

[0049] The sum value is normalized using an activation function to obtain the gating coefficient.

[0050] Optionally, the sentence acquisition module is further configured to:

[0051] Using a splicing function, splicing the M target encoding results to obtain a splicing result;

[0052] The concatenation result is input into the decoder of the translation model to obtain the target sentence.

[0053] Optionally, the device further includes:

[0054] A training module is configured to train the translation model based on a preset training corpus to obtain a target translation model;

[0055] The original code acquisition module is further configured to:

[0056] M source language sentences with the same semantics are respectively input into the corresponding encoding layers of the target translation model to obtain M original encoding results.

[0057] According to a third aspect of an embodiment of the present disclosure, there is provided a machine translation apparatus, comprising:

[0058] processor;

[0059] a memory configured to store processor-executable instructions;

[0060] The processor is configured to implement the steps of any one of the above-mentioned machine translation methods during execution.

[0061] According to a fourth aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of a machine translation device, the device is enabled to perform any of the above-mentioned machine translation methods.

[0062] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:

[0063] As can be seen from the above embodiments, the present disclosure can input M source language sentences in different source languages ​​into the encoding layer of the translation model to obtain M original encoding results, and use the word alignment model to associate words in different source languages ​​with the same semantics in the M source language sentences to obtain alignment results, and in the interaction layer of the translation model, obtain M target encoding results based on the alignment results and the M original encoding results, and then obtain the target sentence based on the target language representation based on the M target encoding results.

[0064] In this way, on the one hand, by adding an interaction layer in the encoder of the translation model and realizing information interaction between M source language sentences with the same semantics and different source languages in the interaction layer, the information transmission between the sentences is greatly strengthened, so that the source input information is more fully utilized to improve the accuracy of the translation result. On the other hand, by controlling the information transmission only between the aligned words, the alignment result is used to guide the semantic interaction between the sentences, the efficiency of information interaction is improved, and the training burden of the model is also reduced.

[0065] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0066] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the description.

[0067] Figure 1 is a flowchart of a machine translation method according to an exemplary embodiment.

[0068] Figure 2 is an architecture diagram of a translation model according to an exemplary embodiment.

[0069] Figure 3 is a block diagram of a machine translation device according to an exemplary embodiment.

[0070] Figure 4 is a block diagram of a machine translation device according to an exemplary embodiment.

[0071] Figure 5 is another block diagram of a machine translation device according to an exemplary embodiment. DETAILED DESCRIPTION

[0072] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers refer to the same or similar elements throughout the drawings, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure. Instead, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0073] A machine translation method is provided in the embodiments of the present disclosure, Figure 1 is a flowchart of a machine translation method according to an exemplary embodiment, as Figure 1 shown, the method mainly includes the following steps:

[0074] In step 101, M source language sentences with the same semantics and different source languages are respectively input into corresponding encoding layers of a translation model to obtain M original encoding results, where M is a positive integer.

[0075] In step 102, a word alignment model is used to associate words with the same semantics in the M source language sentences in different source languages to obtain an alignment result.

[0076] In step 103, the M original encoding results are input into an interaction layer of the translation model, and M target encoding results are obtained according to the alignment result and the M original encoding results.

[0077] In step 104, a target sentence represented in a target language is obtained based on the M target encoding results, where the target sentence has the same semantics as the M source language sentences.

[0078] The machine translation method involved in the embodiments of the present disclosure can be applied to electronic devices, where the electronic devices include mobile terminals and fixed terminals, and the mobile terminals include mobile phones, tablet computers, notebook computers, and the like, and the fixed terminals include personal computers. In other optional embodiments, the machine translation method can also run on network side devices, where the network side devices include servers, processing centers, and the like.

[0079] In some embodiments, the machine translation method in the present disclosure can be applied to different scenarios. For example, it can be applied to book translation, such as translating a book with different language versions into a new language. For another example, it can also be used to translate multilingual tool manuals, multilingual web pages, and multilingual signs into a new language, and the like.

[0080] In the embodiments of the present disclosure, M encoding layers are provided for M source language sentences with the same semantics and different source languages, that is, one source language sentence corresponds to one encoding layer, and the M encoding layers corresponding to the M source language sentences are located at the same level of the encoder. In other embodiments, the M source language sentences can be respectively input into M word embedding layers, the M source language sentences can be converted into M word embedding representations, and the M word embedding representations can be input into M encoding layers to obtain M original encoding results.

[0081] Figure 2 is a schematic diagram of an architecture of a translation model according to an exemplary embodiment, as shown in Figure 2 The architecture of the translation model includes encoding layer 201, encoding layer 202, …, and encoding layer 203. In the implementation process, source language sentence x 1 , source language sentence x 2 , …, and source language sentence xM The word embedding layer of the translation model is inputted to convert the M source language sentences into M word embedding representations, and the M word embedding representations are inputted into the M encoding layers in the translation model, i.e., the word embedding representation 1 of the source language sentence x 1 is inputted into the encoding layer 201, the word embedding representation 2 of the source language sentence x 2 is inputted into the encoding layer 202, …, and the word embedding representation M of the source language sentence x M is inputted into the encoding layer 203. Here, after the M word embedding representations of the M source language sentences are inputted into the M encoding layers for encoding, M original encoding results can be obtained.

[0082] In the embodiments of the present disclosure, the word alignment model can also be used to associate the words of different source languages with the same semantics in the M source language sentences to obtain an alignment result. Although the source languages of the M source language sentences are different, they have the same semantics. In the embodiments of the present disclosure, to improve the interaction efficiency between the source language sentences, the word alignment model (for example, GIZA++) can be used to align the words of different source languages with the same semantics in the M source language sentences to obtain an alignment result. Here, the alignment result can be a set of words of different source languages with the same semantics.

[0083] In some embodiments, the word alignment model can be used to associate the words of different source languages with the same semantics in the M source language sentences before the M source language sentences are inputted into the translation model. The word alignment model can also be used to associate the words of different source languages with the same semantics in the M source language sentences after the M source language sentences are inputted into the translation model, which is not specifically limited here. Here, after the M original encoding results and the alignment result are obtained, the M target encoding results can be obtained based on the alignment result and the M original encoding results, and the target sentence based on the target language representation can be obtained based on the M target encoding results.

[0084] Here, the translation model can include an encoder and a decoder, and the encoding layer and the interaction layer are both arranged in the encoder. In the implementation process, the encoder of the translation model can perform encoding processing on the M source language sentences to obtain M target encoding results, and then the decoder of the translation model receives the M target encoding results inputted by the encoder, decodes the M target encoding results, and inputs the decoded decoding information into the linear layer and the normalization layer to finally obtain the target sentence based on the target language representation. In some other embodiments, the translation model at least includes a Transformer model.

[0085] Still taking Figure 2For example, after obtaining the target encoding result in the interaction layer 204, the target encoding result can be input into the decoder 205, and the target encoding result is decoded based on the decoder 205, and the decoded decoding information is input into the linear layer and the normalization layer, and finally the target sentence (translation) based on the target language representation is obtained.

[0086] In some embodiments, when the encoder of the translation model includes multiple levels of encoding layers, an interaction layer can be respectively arranged between each level, that is, an interaction layer can be arranged at the output end of each level of encoding layer. Here, taking the translation model as the Transformer model, since the encoder of the Transformer model includes six levels of encoding layers, in the embodiments of the present disclosure, an interaction layer can be respectively arranged between each level for information interaction between source language sentences, that is, the six levels of encoding layers can correspond to six interaction layers.

[0087] In the embodiments of the present disclosure, M source language sentences in different source languages can be input into the encoding layer of the translation model to obtain M original encoding results, and a word alignment model is used to associate words in different source languages with the same semantics in the M source language sentences to obtain an alignment result, and in the interaction layer of the translation model, M target encoding results are obtained according to the alignment result and the M original encoding results, and then a target sentence based on the target language representation is obtained according to the M target encoding results.

[0088] In this way, on the one hand, by adding an interaction layer in the encoder of the translation model and realizing information interaction between M source language sentences with the same semantics and different source languages in the interaction layer, the information transmission between each source language sentence is greatly strengthened, so that the source end input information is more fully utilized to improve the accuracy of the translation result. On the other hand, by controlling the information transmission only between the aligned words, the alignment result is used to guide the semantic interaction between sentences, which improves the efficiency of information interaction and also reduces the training burden of the model.

[0089] In some embodiments, associating words in different source languages with the same semantics in the M source language sentences to obtain an alignment result comprises:

[0090] associating words in different source languages with the same semantics in the M-1 source language sentences except the Nth source language sentence in the Nth source language sentence currently traversed in the M source language sentences to obtain the alignment result;

[0091] The M original encoding results are input into the interaction layer of the translation model, and M target encoding results are obtained according to the alignment result and the M original encoding results, comprising:

[0092] According to the alignment result, a gating coefficient corresponding to the Nth source language sentence is obtained;

[0093] According to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, the target encoding result of the Nth source language sentence is obtained, where N is a positive integer, and N is less than or equal to M.

[0094] The gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence.

[0095] In the embodiments of the present disclosure, the alignment result corresponding to each source language sentence can be obtained in a traversal manner. Taking the traversal to the Nth source language sentence as an example, the Nth source language sentence can be associated with the words of different source languages having the same semantics in the M-1 source language sentences other than the Nth source language sentence to obtain the alignment result. After obtaining the alignment result, the gating coefficient corresponding to the Nth source language sentence can be obtained according to the alignment result, and then the target encoding result of the Nth source language sentence can be obtained according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence.

[0096] For example, the hidden state representation of each word in the Nth source language sentence and the hidden state representation of the word aligned with each word in the Nth source language sentence can be obtained, and the gating coefficient corresponding to the Nth source language sentence can be obtained based on the hidden state representation of each word in the Nth source language sentence and the hidden state representation of the word aligned with each word in the Nth source language sentence.

[0097] In some embodiments, the target encoding result of the Nth source language sentence is obtained according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, including: obtaining an intermediate encoding result of the Nth source language sentence according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence; and obtaining the target encoding result of the Nth source language sentence according to the intermediate encoding result by using a feed forward neural network (FFN). Wherein, the calculation formula of the target encoding result of the Nth source language sentence is as follows:

[0098]

[0099] In formula (1), denotes the target encoding result of the Nth source language sentence, FFN (FFN-1) represents an intermediate encoding result of the Nth source language sentence, and FFN represents a feedforward network layer in the translation model. The calculation formula of the intermediate encoding result of the Nth source language sentence is as follows:

[0100]

[0101] In formula (2), FFN (FFN-1) represents an intermediate encoding result of the Nth source language sentence, FFN (FFN-1) represents an intermediate encoding result of the Nth source language sentence, FFN (FFN-1) represents an intermediate encoding result of the Nth source language sentence, FFN (FFN-1) represents an intermediate encoding result of the Nth source language sentence, and ⊙ represents a Hadamard product, where k, i, and j are positive integers.

[0102] In the embodiments of the present disclosure, since the gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence, the target encoding result of each source language sentence can be determined through the original encoding result and the gating coefficient, and by considering the influence degree between each source language sentence, the objectivity and accuracy of the obtained target encoding result can be improved, and the accuracy of the translation result can be improved.

[0103] In some embodiments, the original encoding result includes a hidden state representation of each word in the source language sentence in the encoding layer, where the hidden state representation is obtained by converting each word based on an attention mechanism of the translation model.

[0104] The association of the Nth source language sentence currently traversed in the M source language sentences with the words in different source languages having the same semantics in the M-1 source language sentences other than the Nth source language sentence to obtain the alignment result includes:

[0105] Determining the words having the same semantics as each word in the Nth source language sentence from the M-1 source language sentences other than the Nth source language sentence to obtain a word set;

[0106] The gating coefficient corresponding to the Nth source language sentence is obtained according to the alignment result, including:

[0107] obtaining a gating coefficient corresponding to the Nth source language sentence based on the hidden state representation of each word in the Nth source language sentence at the current network layer of the translation model and the hidden state representation of each word in the word set at the current network layer of the translation model.

[0108] Here, after the Nth source language sentence is aligned with the M-1 source language sentences other than the Nth source language sentence, a word set containing words with the same semantics as each word in the Nth source language sentence can be obtained.

[0109] After the word set is obtained, a gating coefficient corresponding to the Nth source language sentence can be obtained based on the hidden state representation of each word in the Nth source language sentence at the current network layer of the translation model and the hidden state representation of each word in the word set at the current network layer of the translation model. For example, the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set can be directly summed to obtain a sum value, and then the gating coefficient can be obtained based on the obtained sum value. For another example, the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set can be weighted and then summed to obtain a sum value, and then the gating coefficient can be obtained based on the obtained sum value.

[0110] In the embodiments of the present disclosure, by considering the influence degree between each source language sentence, the objectivity and accuracy of the obtained target encoding result can be improved, and the accuracy of the translation result can be further improved.

[0111] In some embodiments, the obtaining of the gating coefficient corresponding to the Nth source language sentence based on the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set comprises:

[0112] weighting and then summing the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set based on a first preset parameter matrix and a second preset parameter matrix to obtain a sum value;

[0113] normalizing the sum value by using an activation function to obtain the gating coefficient. Here, the calculation formula of the gating coefficient corresponding to the Nth source language sentence is as follows:

[0114]

[0115] In formula (3), W1 represents the first preset parameter matrix, W2 represents the second preset parameter matrix, denotes the original encoding result of the i-th word in the N-th source language sentence after passing through the encoding layer, where the original encoding result can be the hidden state representation of the i-th word in the N-th source language sentence, denotes the original encoding result of the j-th word in the k-th source language sentence after passing through the encoding layer, where the original encoding result can be the hidden state representation of the j-th word in the k-th source language sentence, and Sigmoid denotes an activation function. In some embodiments, the activation function can also include a softmax function, etc.

[0116] Here, the first preset parameter matrix and the second preset parameter matrix can be a preset parameter matrix, which can be obtained according to empirical values or according to experiments. In the embodiments of the present disclosure, the hidden state representation of each word in the N-th source language sentence and the hidden state representation of each word in the word set can be weighted and summed based on the first preset parameter matrix and the second preset parameter matrix to obtain a sum value, and the sum value can be normalized by using an activation function to obtain the gating coefficient. In this way, the user can adjust the first preset parameter matrix and the second preset parameter matrix as needed, and then adjust the proportion of the original encoding result of each word in the gating coefficient, thereby improving the flexibility of the translation model.

[0117] In some embodiments, the obtaining of the target sentence based on the target language representation based on the M target encoding results comprises:

[0118] The M target encoding results are spliced by using a splicing function to obtain a splicing result.

[0119] The splicing result is input into a decoder of the translation model to obtain the target sentence.

[0120] Here, the M target encoding results can be spliced by using a concat() method to obtain a spliced feature vector. The concat() method does not change the M target encoding results, but only returns the splicing result. For example, the tail of the first target encoding result can be connected with the head of the second target encoding result, the tail of the second target encoding result can be connected with the head of the third target encoding result, and so on, and the tail of the M-1 target encoding result can be connected with the head of the M target encoding result to obtain the splicing result. After obtaining the splicing result, the splicing result can be sent to the decoder of the translation model. After receiving the splicing result, the decoder can decode the splicing result, and input the decoded information into a linear layer and a normalization layer to finally obtain the target sentence based on the target language representation.

[0121] Since different source language sentences can provide different information, which are complementary to each other, in the embodiments of the present disclosure, a new interaction layer is introduced in the traditional multi-source machine translation framework, so that the semantic interaction relationship between the source language sentences can be better utilized, thereby improving the translation effect of the machine translation model. In the interaction layer, a gating unit is obtained by the hidden state representation of the current word and the hidden state representation of the other source language words aligned with it, and then a gating coefficient corresponding to the current word is obtained, which is used to control the influence degree of the other source language words on the hidden state representation of the current word, so as to update the hidden state representation of the current word. By setting the interaction layer at the output end of each encoding layer of the encoder, the information transmission between each source language sentence is greatly strengthened, so that the source input information can be more fully utilized. By controlling the information transmission only between the aligned words, the alignment result is used to guide the semantic interaction between sentences, which improves the efficiency of information interaction and also reduces the training burden of the model.

[0122] In some embodiments, the method further comprises:

[0123] training the translation model based on the preset training corpus to obtain a target translation model;

[0124] the M source language sentences with the same semantics are respectively input into the corresponding encoding layers of the translation model to obtain M original encoding results, comprising:

[0125] the M source language sentences with the same semantics are respectively input into the corresponding encoding layers of the target translation model to obtain M original encoding results.

[0126] Here, the preset training corpus can be preprocessed to obtain a word embedding representation of the preset training corpus, and the word embedding representation of the preset training corpus is input into the translation model to obtain an output result (prediction probability), i.e. the probability distribution of each word. In the implementation process, the training loss value of the translation model on the preset training corpus can be obtained based on the set loss function, and the model parameters of the translation model are updated according to the training loss value until the model converges, and the target translation model is obtained. Here, the set loss function includes a negative log likelihood function, for example, the translation model can be trained by minimizing the negative log likelihood function of the prediction probability of the text information, and the Adam optimizer can also be used to update the model parameters of the translation model during training.

[0127] In some embodiments, in the process of using the target translation model, since the output is the generated sequence of each word and the prediction probability of each generated sequence, in the implementation process, the generated sequence with the maximum prediction probability can be found by using a search algorithm (beam search) algorithm, and the target word of the target sentence, i.e. the translation of the source language sentence, is output.

[0128] Figure 3 is a machine translation device block diagram shown according to an exemplary embodiment, as Figure 3 shown, the machine translation device 300 mainly comprises:

[0129] An original encoding obtaining module 301, configured to input M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively, to obtain M original encoding results, wherein M is a positive integer;

[0130] An alignment result obtaining module 302, configured to associate words with the same semantics in different source languages in the M source language sentences by using a word alignment model, to obtain an alignment result;

[0131] A target encoding obtaining module 303, configured to input the M original encoding results into an interaction layer of the translation model, and obtain M target encoding results according to the alignment result and the M original encoding results;

[0132] A sentence obtaining module 304, configured to obtain a target sentence represented in a target language based on the M target encoding results; wherein the target sentence has the same semantics as the M source language sentences.

[0133] In some embodiments, the alignment result obtaining module 302 is further configured to:

[0134] associate words with the same semantics in a current Nth source language sentence in the M source language sentences and M-1 source language sentences other than the Nth source language sentence in different source languages, to obtain the alignment result;

[0135] The target encoding obtaining module 303 is further configured to:

[0136] obtain a gating coefficient corresponding to the Nth source language sentence according to the alignment result;

[0137] obtain the target encoding result of the Nth source language sentence according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, wherein N is a positive integer and N is less than or equal to M;

[0138] wherein the gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence.

[0139] In some embodiments, the original encoding result comprises: hidden state representations of each word in the source language sentence in an encoding layer, wherein the hidden state representations are obtained by converting each word based on an attention mechanism of the translation model;

[0140] The alignment result obtaining module 302 is further configured to:

[0141] determine, from M-1 source language sentences other than the Nth source language sentence, words having the same semantics as each word in the Nth source language sentence, to obtain a word set;

[0142] The target encoding obtaining module 303 is further configured to:

[0143] obtain a gating coefficient corresponding to the Nth source language sentence based on the hidden state representations of each word in the Nth source language sentence in the current network layer of the translation model and the hidden state representations of each word in the word set in the current network layer of the translation model.

[0144] In some embodiments, the target encoding obtaining module 303 is further configured to:

[0145] weight and sum the hidden state representations of each word in the Nth source language sentence and the hidden state representations of each word in the word set based on a first preset parameter matrix and a second preset parameter matrix, to obtain a sum value;

[0146] normalize the sum value by using an activation function, to obtain the gating coefficient.

[0147] In some embodiments, the sentence obtaining module 304 is further configured to:

[0148] perform splicing processing on the M target encoding results by using a splicing function, to obtain a splicing result;

[0149] input the splicing result into a decoder of the translation model, to obtain the target sentence.

[0150] In some embodiments, the apparatus 300 further comprises:

[0151] a training module configured to train the translation model based on a preset training corpus, to obtain a target translation model;

[0152] The original encoding obtaining module 301 is further configured to:

[0153] input the M source language sentences having the same semantics into corresponding encoding layers of the target translation model respectively, to obtain M original encoding results.

[0154] With regard to the apparatuses in the above-described embodiments, a specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and thus will not be described in detail here.

[0155] Figure 4 is a block diagram of a machine translation apparatus 1200 according to an exemplary embodiment. The apparatus 1200 can be, for example, a mobile phone, a computer, a digital broadcasting terminal, a message receiver, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.

[0156] Referring to Figure 4 The apparatus 1200 can include one or more of the following components: a processing component 1202, a memory 1204, a power supply component 1206, a multimedia component 1208, an audio component 1210, an input / output (I / O) interface 1212, a sensor component 1214, and a communication component 1216.

[0157] The processing component 1202 usually controls overall operations of the apparatus 1200, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 1202 can include one or more processors 1220 to execute instructions to complete all or part of steps of the above-described methods. In addition, the processing component 1202 can include one or more modules to facilitate interaction between the processing component 1202 and other components. For example, the processing component 1202 can include a multimedia module to facilitate the interaction between the multimedia component 1208 and the processing component 1202.

[0158] The memory 1204 is configured to store various types of data to support operations of the apparatus 1200. Examples of these data include instructions for any application or method operating on the apparatus 1200, contact data, phonebook data, messages, pictures, videos, and the like. The memory 1204 can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0159] The power supply component 1206 supplies electric power for various components of the apparatus 1200. The power supply component 1206 can include a power supply management system, one or more power supplies, and other components associated with generating, managing, and distributing electric power for the apparatus 1200.

[0160] The multimedia component 1208 includes a screen providing an output interface between the device 1200 and a user. In some embodiments, the screen includes a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping, and gestures on the touch panel. The touch sensors can not only sense a boundary of a touching or swiping action, but also detect duration and pressure related to the touching or swiping action. In some embodiments, the multimedia component 1208 includes a front camera and / or a rear camera. When the device 1200 is in an operation mode, such as a camera mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zooming capability.

[0161] The audio component 1210 is configured to output and / or input audio signals. For example, the audio component 1210 includes a microphone (MIC) to receive an external audio signal when the device 1200 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 1204 or transmitted via the communication component 1216. In some embodiments, the audio component 1210 further includes a speaker for outputting audio signals.

[0162] The I / O interface 1212 provides an interface between the processing component 1202 and peripheral interface modules, such as a keypad, a click wheel, buttons, and so on. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0163] The sensor component 1214 includes one or more sensors to provide various state assessments for the device 1200. For example, the sensor component 1214 can detect an open / closed state of the device 1200, relative positioning of components, such as a display and a keypad of the device 1200, a change in position of the device 1200 or a component of the device 1200, presence or absence of user contact with the device 1200, an orientation or acceleration / deceleration of the device 1200, and a temperature change of the device 1200. The sensor component 1214 can include a proximity sensor configured to detect presence of a nearby object without any physical touch. The sensor component 1214 can further include a light sensor, such as a CMOS or CCD image sensor, for use in an imaging application. In some embodiments, the sensor component 1214 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0164] The communication component 1216 is configured to facilitate wired or wireless communication between the device 1200 and other devices. The device 1200 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1216 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1216 further includes a Near Field Communication (NFC) module to facilitate close proximity communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra-WideBand (UWB) technology, Bluetooth (BT) technology and other technologies.

[0165] In an exemplary embodiment, the device 1200 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic elements, for performing the above-described methods.

[0166] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 1204 including instructions, is also provided, which can be executed by the processor 1220 of the device 1200 to complete the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.

[0167] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a machine translation device, enables the machine translation device to perform a machine translation method, the method comprising:

[0168] inputting M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively, to obtain M original encoding results, wherein M is a positive integer;

[0169] correlating words with the same semantics and different source languages in the M source language sentences using a word alignment model, to obtain an alignment result;

[0170] inputting the M original encoding results into an interaction layer of the translation model, and obtaining M target encoding results according to the alignment result and the M original encoding results;

[0171] obtaining a target sentence based on target language representation based on the M target encoding results; wherein the target sentence has the same semantics as the M source language sentences.

[0172] Figure 5 is another block diagram of a machine translation device 1300 according to an example embodiment. For example, the device 1300 can be provided as a server. Referring to Figure 5 , the device 1300 includes a processing component 1322, which is further comprised of one or more processors, and memory resources represented by the memory 1332 for storing instructions, such as applications, executable by the processing component 1322. The applications stored in the memory 1332 can include one or more than one module each corresponding to a set of instructions. Further, the processing component 1322 is configured to execute the instructions to perform the machine translation method described above, the method comprising:

[0173] inputting M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively, to obtain M original encoding results, wherein M is a positive integer;

[0174] correlating words with the same semantics and different source languages in the M source language sentences using a word alignment model, to obtain an alignment result;

[0175] inputting the M original encoding results into an interaction layer of the translation model, and obtaining M target encoding results according to the alignment result and the M original encoding results;

[0176] obtaining a target sentence represented based on a target language based on the M target encoding results; wherein the target sentence has the same semantics as the M source language sentences.

[0177] The device 1300 can also include a power supply component 1326 configured to perform power management for the device 1300, a wired or wireless network interface 1350 configured to connect the device 1300 to a network, and an input output (I / O) interface 1358. The device 1300 can operate based on an operating system stored in the memory 1332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0178] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the features disclosed herein. The present disclosure is intended to cover any and all variations of the present disclosure that come within the scope of the features set forth in the claims and that fall within the true spirit and scope of the disclosure. The specification and examples given are intended as illustrative only and no limitation of the true scope and spirit of the present disclosure as set forth in the following claims is intended.

[0179] It should be understood that the present disclosure is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the present disclosure. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method of machine translation, characterized by, The method comprises the following steps: inputting M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively to obtain M original encoding results, wherein M is a positive integer; the original encoding result comprises hidden state representations of each word in the source language sentence in the encoding layer, wherein the hidden state representations are obtained by converting each word based on an attention mechanism of the translation model; using a word alignment model to associate a current Nth source language sentence in the M source language sentences with words in M-1 source language sentences other than the Nth source language sentence and having the same semantics and different source languages to obtain an alignment result; obtaining a gating coefficient corresponding to the Nth source language sentence based on the alignment result; inputting the M original encoding results into an interaction layer of the translation model, and obtaining hidden state representations of each word in the Nth source language sentence and hidden state representations of words respectively aligned with each word in the Nth source language sentence; the gating coefficient corresponding to the Nth source language sentence is obtained based on the hidden state representations of each word in the Nth source language sentence and the hidden state representations of the words respectively aligned with each word in the Nth source language sentence; obtaining a target encoding result of the Nth source language sentence according to the original encoding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, wherein N is a positive integer and N is less than or equal to M; the gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence; obtaining a target sentence represented in a target language based on the M target encoding results; the target sentence has the same semantics as the M source language sentences.

2. The method of claim 1, wherein, The method comprises the following steps: determining words in M-1 source language sentences other than the Nth source language sentence that have the same semantics as each word in the Nth source language sentence to obtain a word set; the gating coefficient corresponding to the Nth source language sentence is obtained based on the hidden state representations of each word in the Nth source language sentence and the hidden state representations of the words respectively aligned with each word in the Nth source language sentence; and the gating coefficient corresponding to the Nth source language sentence is obtained based on the hidden state representations of each word in the Nth source language sentence and the hidden state representations of the words respectively aligned with each word in the Nth source language sentence.

3. The method of claim 2, wherein, The gating coefficient corresponding to the Nth source language sentence is obtained based on the hidden state representation of each word in the Nth source language sentence at the current network layer of the translation model and the hidden state representation of each word in the word set at the current network layer of the translation model, and includes the following steps: Based on the first preset parameter matrix and the second preset parameter matrix, the hidden state representation of each word in the Nth source language sentence and the hidden state representation of each word in the word set are weighted and summed to obtain a sum value; The sum value is normalized by using an activation function to obtain the gating coefficient.

4. The method of claim 1, wherein, The target sentence based on the target language representation is obtained based on the M target encoding results, and includes the following steps: The M target encoding results are spliced by using a splicing function to obtain a splicing result; The splicing result is input into the decoder of the translation model to obtain the target sentence.

5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: The translation model is trained based on a preset training corpus to obtain a target translation model; The M source language sentences with the same semantics are input into the corresponding encoding layers of the target translation model respectively to obtain M original encoding results, and include the following steps: The M source language sentences with the same semantics are input into the corresponding encoding layers of the target translation model respectively to obtain M original encoding results.

6. A machine translation apparatus characterized by comprising: It includes: An original encoding acquisition module is configured to input M source language sentences with the same semantics and different source languages into corresponding encoding layers of a translation model respectively to obtain M original encoding results, wherein M is a positive integer; the original encoding result includes the hidden state representation of each word in the source language sentence at the encoding layer, wherein the hidden state representation is obtained by converting each word based on the attention mechanism of the translation model; An alignment result acquisition module is configured to use a word alignment model to associate the Nth source language sentence currently traversed in the M source language sentences with the words of different source languages with the same semantics in the M-1 source language sentences other than the Nth source language sentence to obtain an alignment result; The target coding obtaining module is configured to obtain a gating coefficient corresponding to the Nth source language sentence based on the alignment result; input the M original coding results into the interaction layer of the translation model, and obtain hidden state representations of each word in the Nth source language sentence and hidden state representations of words respectively aligned with each word in the Nth source language sentence; and further configured to obtain the gating coefficient corresponding to the Nth source language sentence based on the hidden state representations of each word in the Nth source language sentence and the hidden state representations of the words respectively aligned with each word in the Nth source language sentence; and obtain a target coding result of the Nth source language sentence according to the original coding result of the Nth source language sentence and the gating coefficient corresponding to the Nth source language sentence, wherein N is a positive integer and N is less than or equal to M; wherein the gating coefficient corresponding to the Nth source language sentence is used to represent the influence degree of the M-1 source language sentences other than the Nth source language sentence on the Nth source language sentence. The sentence obtaining module is configured to obtain a target sentence based on the target language representation based on the M target coding results; wherein the target sentence has the same semantics as the M source language sentences.

7. The apparatus of claim 6, wherein, The alignment result obtaining module is further configured to: determine words having the same semantics as each word in the Nth source language sentence from the M-1 source language sentences other than the Nth source language sentence to obtain a word set; The target coding obtaining module is further configured to: obtain the gating coefficient corresponding to the Nth source language sentence based on the hidden state representations of each word in the Nth source language sentence at the current network layer of the translation model and the hidden state representations of each word in the word set at the current network layer of the translation model.

8. The apparatus of claim 7, wherein, The target coding obtaining module is further configured to: weight and sum the hidden state representations of each word in the Nth source language sentence and the hidden state representations of each word in the word set based on a first preset parameter matrix and a second preset parameter matrix to obtain a sum value; normalize the sum value by using an activation function to obtain the gating coefficient.

9. The apparatus of claim 6, wherein, The sentence obtaining module is further configured to: splice the M target coding results by using a splicing function to obtain a splicing result; input the splicing result into the decoder of the translation model to obtain the target sentence.

10. The device of any one of claims 6 to 9, wherein, The apparatus further comprises: a training module configured to train the translation model based on a preset training corpus to obtain a target translation model; The original coding obtaining module is further configured to: input the M source language sentences having the same semantics into corresponding coding layers of the target translation model respectively to obtain M original coding results.

11. A machine translation apparatus, characterized by, comprise: a processor; a memory configured to store processor-executable instructions; wherein the processor is configured to implement the steps in any one of the machine translation methods in claims 1 to 5 when executed.

12. A non-transitory computer readable storage medium, when instructions in the storage medium are executed by a processor of a machine translation apparatus, enable the apparatus to perform the machine translation method of any of claims 1 to 5.

Citation Information

Patent Citations

  • Machine translation method for semantic vector based on multilingual parallel corpus

    CN106202068A

  • Word alignment with bridge languages

    US8185375B1