Multilingual translation method, device, electronic device and storage medium

By encoding source language text and using generated translations using multiple target languages, and expanding candidate translations with column search algorithms, the problem that the existing technology cannot generate multiple target languages ​​at the same time is solved, and efficient multilingual translation and translation quality improvement is achieved.

CN114139556BActive Publication Date: 2025-03-21INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111271484.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-03-21
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

The prior art cannot generate multiple target languages ​​efficiently at the same time, and cannot utilize complementary information from multiple target languages.

Method used

By obtaining training data and source language text, encode the source language text to obtain feature vectors, determine the final representation of the current word based on the generated translations of multiple target languages, and use the language-independent column search algorithm to expand the generated optimal candidate translations to obtain the target translations of multiple target languages.

Benefits of technology

It realizes the use of complementary information from multiple target languages ​​to generate multiple target languages ​​at the same time, improving the translation quality of multiple target languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114139556B_ABST
    Figure CN114139556B_ABST
Patent Text Reader

Abstract

The present invention provides a multilingual translation method, device, electronic device and storage medium, the method comprising: obtaining training data and text in a source language; wherein the training data comprises bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages; encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the target language; determining the final representation of the current word in the multiple target languages ​​based on the feature vector and the translations generated in the multiple target languages; based on a language-independent column search algorithm and the final representation of the current word in the multiple target languages, expanding the generated optimal candidate translations in the multiple target languages ​​to obtain target translations in the multiple target languages. The method provided by the present invention can utilize complementary information between multiple target languages ​​to generate target translations in multiple target languages, while improving the translation quality of multiple target languages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a multi-language translation method, device, electronic device and storage medium. Background Art

[0002] Machine translation is a hot topic in the field of natural language processing. Its goal is to use computer technology to automatically translate text in one language into text in other languages. In recent years, machine translation methods based on neural networks have achieved significant improvements compared to traditional statistical machine translation methods. The machine translation model using neural networks expands the language data at the source or target end, establishes a mapping relationship between one language set and another language set, and processes translation between multiple languages ​​in the same model, thereby improving the efficiency of deployed applications.

[0003] In the related art, the research on multilingual machine translation usually uses a single translation model to handle translation between multiple language pairs through full parameter sharing. In this method, all language pairs share the same vocabulary and model parameters, and the target language of the translation is specified only by adding a label before the input source language sentence.

[0004] However, the parameter-sharing multilingual machine translation method only uses the complementary information between different languages ​​in the training phase, while in the decoding phase, different languages ​​are still generated independently, and only one target language can be generated. In the translation scenario where multiple target languages ​​need to be translated, each target is generated independently and serially, and it is impossible to efficiently generate multiple target languages ​​at the same time, and it is impossible to utilize the complementary information of multiple target languages. Summary of the invention

[0005] The present invention provides a multilingual translation method, which is used to solve the defects in the related art that multiple target languages ​​cannot be generated simultaneously and complementary information of multiple target languages ​​cannot be utilized, and realizes the simultaneous generation of multiple target languages ​​by utilizing complementary information of multiple target languages.

[0006] The present invention provides a multilingual translation method, comprising:

[0007] Acquire training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages;

[0008] Encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages;

[0009] determining a final representation of a current word in the plurality of target languages ​​based on the feature vector and the generated translations in the plurality of target languages;

[0010] Based on a language-independent column search algorithm and final representations of current words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

[0011] According to a multilingual translation method provided by the present invention, determining the final representation of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages ​​includes:

[0012] Determining hidden states of the multiple target languages ​​based on the feature vectors and the generated translations in the multiple target languages;

[0013] Determining attention between any two languages ​​based on the hidden states of the plurality of target languages;

[0014] Determining cross-language attention of a current word in the plurality of target languages ​​to the text in the source language and the generated translations in the plurality of target languages ​​based on the attention between the any two languages;

[0015] Based on the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages, the hidden layer states of the multiple target languages ​​are updated through nonlinear transformation to obtain the final representation of the current word in the multiple target languages.

[0016] According to a multilingual translation method provided by the present invention, the language-independent column search algorithm and the final representation of the current word in the multiple target languages ​​are used to expand the generated optimal candidate translations in the multiple target languages ​​to obtain the target translations in the multiple target languages, including:

[0017] Calculating probabilities of candidate words in the plurality of target languages ​​based on the final representations of the current word in the plurality of target languages;

[0018] Based on a language-independent column search algorithm and the probabilities of the candidate words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

[0019] According to a multi-language translation method provided by the present invention, the step of determining the attention between any two languages ​​based on the hidden states of the multiple target languages ​​includes:

[0020] Based on the hidden states of the multiple target languages, the attention between any two languages ​​is calculated using formula (1):

[0021]

[0022] in: is the attention from the i-th language to the j-th language, Q i is the query in the i-th language, K j is the key of the jth language, V j is the value of the jth language; d k represents the dimension of the hidden layer state; i , K j 、V j It is composed of the hidden states of the multiple target languages.

[0023] According to a multilingual translation method provided by the present invention, the step of determining the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​based on the attention between the any two languages ​​includes:

[0024] Based on the attention between any two languages, the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​is calculated using formula (2):

[0025]

[0026] in, is through Obtained by linear transformation.

[0027] According to a multi-language translation method provided by the present invention, when the generated translations in the multiple target languages ​​are empty, the labels in the multiple target languages ​​are used as the first word of the generated translations in the multiple target languages.

[0028] The present invention also provides a multi-language translation device, comprising:

[0029] An acquisition module, used to acquire training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages;

[0030] An encoding module, used for encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages;

[0031] A first determination module, configured to determine a final representation of a current word in the plurality of target languages ​​based on the feature vector and the generated translations in the plurality of target languages;

[0032] The first expansion module is used to expand the generated optimal candidate translations in the multiple target languages ​​based on the language-independent column search algorithm and the final representation of the current word in the multiple target languages ​​to obtain the target translations in the multiple target languages.

[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned multi-language translation methods are implemented.

[0034] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the multi-language translation methods described above are implemented.

[0035] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any of the multi-language translation methods described above are implemented.

[0036] The multilingual translation method provided by the present invention obtains a feature vector corresponding to the text of the source language by encoding the text of the source language, obtains the final representation of the current word in multiple target languages ​​according to the generated translations in multiple target languages, and uses a column search algorithm to expand the generated optimal candidate translations in multiple target languages ​​to obtain target translations in multiple target languages, thereby improving the translation quality of multiple target languages. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 This is one of the flow charts of the multi-language translation method provided by the present invention;

[0039] Figure 2 This is the second flow chart of the multi-language translation method provided by the present invention;

[0040] Figure 3 This is the third flow chart of the multi-language translation method provided by the present invention;

[0041] Figure 4 It is a structural schematic diagram of the multilingual translation model provided by the present invention;

[0042] Figure 5 It is a structural schematic diagram of a multi-language translation device provided by the present invention;

[0043] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] Combine the following Figure 1-Figure 4 The multi-language translation method of the present invention is described.

[0046] Figure 1 One of the flow charts of the multilingual translation method provided by the present invention is as follows: Figure 1 As shown, the method includes:

[0047] Step 110, obtaining training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages.

[0048] Optionally, the multilingual translation method provided by the present invention can be applied to the translation scenario from one language to multiple languages. The execution subject of the multilingual translation method provided by the present invention can be the multilingual translation device provided by the present invention, such as an electronic device, or a control module in the multilingual translation device for executing the multilingual translation method.

[0049] Optionally, the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from a source language to multiple target languages; wherein the source language is the language to be translated, the target language is the language after translation, the bilingual parallel sentence pairs are language sentence pairs from the source language to multiple target languages, and the multilingual parallel sentence pairs are language sentence pairs in multiple target languages ​​selected based on language sentence pairs with the same source language.

[0050] Optionally, the training data and the text in the source language may be obtained by a user inputting the text through a keyboard of an electronic device, or by the electronic device obtaining the text based on a text recognition technology, a speech recognition technology, or the like.

[0051] Step 120: Encode the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages.

[0052] Optionally, an encoder is used to encode the text in the source language to obtain a feature vector corresponding to the text in the source language, and the encoder is, for example, a Transformer encoder.

[0053] Step 130: determining final representations of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages.

[0054] Optionally, in the process of translating a text in a source language into multiple target languages, the generated translations in the multiple target languages ​​are translated word by word, that is, in the generated translations in the multiple target languages, the first word of the text in the corresponding source language is translated first, and then the second word of the text in the corresponding source language is translated, until all the words in the text in the source language are translated.

[0055] Optionally, when the generated translations in the multiple target languages ​​are empty, the labels in the multiple target languages ​​are used as the first word of the generated translations in the multiple target languages, wherein the labels in the multiple target languages ​​are the start symbols of the multiple target languages.

[0056] Step 140 , based on the language-independent column search algorithm and the final representations of the current words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

[0057] Optionally, the column search algorithm is used to obtain the top k candidate translations of the current word in multiple target languages, where k can be 5 or other integers; the optimal candidate translation is to select the translation with the highest probability from the top k candidate translations as the optimal candidate translation.

[0058] Optionally, according to the column search algorithm and the final representation of the current word in multiple target languages, k candidate translations of the current word in multiple target languages ​​are obtained, and each candidate translation corresponds to k candidate translations, that is, k candidate translations of the current word can be obtained. 2 candidate translations, expand the generated optimal candidate translations in multiple target languages, and thus obtain target translations in multiple target languages.

[0059] The multilingual translation method provided by the present invention obtains a feature vector corresponding to the text of the source language by encoding the text of the source language, obtains the final representation of the current word in multiple target languages ​​according to the generated translations in multiple target languages, and uses a column search algorithm to expand the generated optimal candidate translations in multiple target languages ​​to obtain target translations in multiple target languages, thereby improving the translation quality of multiple target languages.

[0060] Optionally, Figure 2 The second flow chart of the multi-language translation method provided by the present invention is as follows: Figure 2 As shown, the method includes:

[0061] Step 210, obtaining training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages.

[0062] Step 220: Encode the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages.

[0063] Optionally, the description and explanation of steps 210-220 may refer to the above description and explanation of steps 110-120, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0064] Step 230: determining the hidden states of the multiple target languages ​​based on the feature vectors and the generated translations in the multiple target languages.

[0065] Optionally, the hidden states of the multiple target languages ​​are ungenerated translations of the multiple target languages ​​determined based on generated translations during the translation generation process of the multiple target languages.

[0066] Step 240: determining the attention between any two languages ​​based on the hidden states of the multiple target languages.

[0067] Optionally, the attention between any two languages ​​is the correlation between any two languages. A high correlation between two languages ​​indicates a high dependence between the two target languages ​​when translating the source language, and a high weight corresponding to the target language of the final translation.

[0068] Step 250: Determine the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​based on the attention between the any two languages.

[0069] Optionally, cross-lingual attention fuses attention from one target language to all target languages, and uses a dynamic attention fusion method so that each language can select information related to the current translation status in the translations generated in all languages.

[0070] Step 260, based on the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages, the hidden layer states of the multiple target languages ​​are updated through nonlinear transformation to obtain the final representation of the current word in the multiple target languages.

[0071] Optionally, based on the cross-language attention from the current word in multiple target languages ​​to the text in the source language and the translations generated in the multiple target languages, a nonlinear transformation is performed on the cross-language attention to continuously update the hidden states of the current word in the multiple target languages, and the last updated hidden states of the current word in the multiple target languages ​​are used as the final representation of the current word in the multiple target languages, thereby obtaining the final representation of the current word in the multiple target languages.

[0072] Step 270, based on the language-independent column search algorithm and the final representation of the current word in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain the target translations in the multiple target languages.

[0073] Optionally, the description and explanation of step 270 may refer to the above description and explanation of step 140, and the same technical effect can be achieved. To avoid repetition, they will not be repeated here.

[0074] The multilingual translation method provided by the present invention obtains the final representation of the current word in multiple target languages ​​through attention between any two languages ​​and cross-language attention from the current word in multiple target languages ​​to the text of the source language and the generated translations in multiple target languages, and uses a column search algorithm to expand the generated optimal candidate translations in multiple target languages ​​to obtain target translations in multiple target languages, thereby improving the translation quality of the target translations in multiple target languages.

[0075] Optionally, the implementation of step 240 may include the following steps, wherein:

[0076] Based on the hidden states of the multiple target languages, the attention between any two languages ​​is calculated using formula (1):

[0077]

[0078] in: is the attention from the i-th language to the j-th language, Q i is the query in the i-th language, K j is the key of the jth language, V j is the value of the jth language; d k represents the dimension of the hidden layer state; i , K j 、V j It is composed of the hidden states of the multiple target languages.

[0079] Specifically, multiple target languages ​​are linearly mapped to obtain query Q, key K and value V of multiple target languages. According to the hidden layer states of multiple target languages, the attention between any two languages ​​is calculated using formula (1).

[0080] Optionally, the implementation of step 250 may include the following steps, wherein:

[0081] Based on the attention between any two languages, the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​is calculated using formula (2):

[0082]

[0083] in, is through Obtained by linear transformation.

[0084] Specifically, the attention between any two languages ​​is calculated according to formula (1), and the attention between any two languages ​​is obtained by different linear mappings. Formula (2) is then used to calculate the cross-language attention of the current word in multiple target languages ​​to the text in the source language and the generated translations in multiple target languages.

[0085] Optionally, Figure 3 The third flow chart of the multilingual translation method provided by the present invention is as follows: Figure 3 As shown, the method includes:

[0086] Step 310, obtaining training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages.

[0087] Step 320: Encode the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages.

[0088] Step 330: determining final representations of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages.

[0089] Optionally, the description and explanation of steps 310-330 may refer to the above description and explanation of steps 110-130, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0090] Step 340 , calculating the probabilities of the candidate words in the multiple target languages ​​based on the final representations of the current words in the multiple target languages.

[0091] Optionally, based on a preset vocabulary and final representations of current words in multiple target languages, the probabilities of the current words in multiple target languages ​​are calculated for each word in the vocabulary, and top k words with the highest probabilities are selected as candidates for the current words in multiple target languages.

[0092] Step 350 , based on the language-independent column search algorithm and the probabilities of the candidate words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

[0093] Optionally, based on the candidate words of the current word in multiple target languages ​​and the probabilities of the candidate words, a language-independent column search algorithm is used to obtain the top k candidate words for each candidate word of the k candidate words of the current word in multiple target languages, that is, the generated optimal candidate translations in multiple target languages ​​are expanded, and then the top k candidate words with the highest probabilities are selected from the optimal candidate translations as the target translations in multiple target languages.

[0094] The multilingual translation method provided by the present invention obtains candidate words and their probabilities of the current word in multiple target languages ​​through the final representation of the current word in the target language, uses a column search algorithm and the candidate words and their probabilities of the current word in multiple target languages ​​to expand the generated optimal candidate translations in multiple target languages, obtains the target translations in multiple target languages, thereby improving the translation quality of multiple target languages.

[0095] It should be noted that Figure 4 A schematic diagram of the structure of the multilingual translation model provided by the present invention, such as Figure 4 As shown, the multilingual translation model 400 includes: an encoder 410, a decoder 420 and a translation generator 430, the encoder 410 is connected to the decoder 420, and the decoder 420 is connected to the translation generator; wherein:

[0096] The encoder 410 is used to encode the text in the source language to obtain a feature vector corresponding to the text in the source language. The encoder 410 may be a Transformer encoder or other encoders.

[0097] The decoder 420 is used to determine the final representation of the current word in multiple target languages ​​based on the feature vector and the translations generated in multiple target languages;

[0098] The translation generator 430 is used to expand the generated optimal candidate translations in multiple target languages ​​based on the language-independent column search algorithm and the final representation of the current word in multiple target languages ​​to obtain target translations in multiple target languages.

[0099] Optionally, the decoder 420 includes a cross-lingual attention module (Cross Lingual Attention) 4201, a multi-head attention layer (Multi-Head Inter-Attention) 4202 and a feed forward network layer (Feed Forward Network) 4203; wherein the cross-lingual attention module 4201 is connected to the multi-head attention layer 4202, the multi-head attention layer 4202 is connected to the feed forward network layer 4203, and the number of decoders 420 is N.

[0100] First, the user obtains training data and source language text through keyboard input of an electronic device, or based on text recognition technology, speech recognition technology, etc. The text of the source language is input into the encoder of the multilingual translation model, and the encoder encodes the text of the source language. It should be noted that before using the encoder to encode the text of the source language, the label of the text of the source language is removed first, wherein the label of the source language is used to indicate that the text of the source language is translated into the corresponding target language. Then the sentences in the text of the source language are vectorized by word embedding to obtain the feature vector corresponding to the text of the source language, and the feature vector corresponding to the text of the source language is stacked into a matrix representation, which is input into the multi-head attention layer of the decoder in the multilingual translation model; wherein the word embedding method is to pre-set a word list, which contains the text of the source language and all words in multiple target languages, as well as the vector representation corresponding to each word, so the vector corresponding to each word in multiple target languages ​​can be found based on the word list, and the vector corresponding to each word in multiple target languages ​​can be stacked into a matrix.

[0101] Next, the final representation of the current word in multiple target languages ​​is determined. The cross-language attention module is used to obtain the cross-language attention of the current word in multiple target languages ​​to the text in the source language and the generated translations in multiple target languages. The module input of the cross-language attention is the query Q, key K and value V composed of the hidden states of multiple target languages. The cross-language attention module obtains the feature vector of the text in the source language and the generated translations in multiple target languages, determines the hidden states of multiple target languages, and then obtains the attention between any two languages ​​based on the hidden states of multiple target languages ​​using formula (1). Then, based on the attention between any two languages, the dynamic attention fusion method of formula (2) is used to obtain the cross-language attention of the current word in multiple target languages ​​to the text in the source language and the generated translations in multiple target languages. It should be noted that the cross-language attention uses the dynamic attention fusion method so that each language can select information related to the current translation state in the generated translations of all target languages. The output of the cross-language attention module and the output of the encoder are simultaneously used as the input of the multi-head attention layer, which is used to calculate the feature vector corresponding to the text of the source language and the final representation of the current word corresponding to multiple target languages ​​to obtain the attention between the text of the source language and multiple target languages. The output of the multi-head attention layer is input into the feedforward network layer, which is used to perform nonlinear transformation on the attention between the text of the source language and multiple target languages, update the hidden layer states of multiple target languages, and thus obtain the final representation of the current word in multiple target languages.

[0102] Then, the translation generator uses the vocabulary to calculate the candidate words of the current word in each target language and the probability of each candidate word according to the final representation of the current word in multiple target languages. Specifically, according to the pre-set vocabulary and the final representation of the current word in multiple target languages, the probability of the current word in multiple target languages ​​is calculated according to each word in the vocabulary, and the top k words with the largest probability are selected as the candidate words of the current word in multiple target languages. The translation generator then uses the language-independent column search algorithm to obtain the top k candidate words of each candidate word for the k candidate words of the current word in multiple target languages, that is, to expand the generated optimal candidate translations in multiple target languages, and then select the top k candidate words with the largest probability from the optimal candidate translations as the target translations in multiple target languages.

[0103] The multi-language translation device provided by the present invention is described below. The multi-language translation device described below and the multi-language translation method described above can be referred to each other.

[0104] Figure 5 The schematic diagram of the structure of the multi-language translation device provided by the present invention is as follows: Figure 5As shown, the multi-language translation device 500 includes: an acquisition module 501, an encoding module 502, a first determination module 503, and a first expansion module 504; wherein

[0105] The acquisition module 501 is used to acquire training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages;

[0106] An encoding module 502 is used to encode the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages;

[0107] A first determination module 503 is used to determine the final representation of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages;

[0108] The first expansion module 504 is used to expand the generated optimal candidate translations in the multiple target languages ​​based on the language-independent column search algorithm and the final representations of the current words in the multiple target languages ​​to obtain target translations in the multiple target languages.

[0109] The multilingual translation device provided by the present invention obtains a feature vector corresponding to the text of the source language by encoding the text of the source language, obtains the final representation of the current word in multiple target languages ​​according to the generated translations in multiple target languages, and uses a column search algorithm to expand the generated optimal candidate translations in multiple target languages ​​to obtain target translations in multiple target languages, thereby improving the translation quality of multiple target languages.

[0110] Optionally, the first determining module 503 is specifically configured to:

[0111] Determining hidden states of the multiple target languages ​​based on the feature vectors and the generated translations in the multiple target languages;

[0112] Determining attention between any two languages ​​based on the hidden states of the plurality of target languages;

[0113] Determining cross-language attention of a current word in the plurality of target languages ​​to the text in the source language and the generated translations in the plurality of target languages ​​based on the attention between the any two languages;

[0114] Based on the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages, the hidden layer states of the multiple target languages ​​are updated through nonlinear transformation to obtain the final representation of the current word in the multiple target languages.

[0115] Optionally, the first expansion module 504 is specifically configured to:

[0116] Calculating probabilities of candidate words in the plurality of target languages ​​based on the final representations of the current word in the plurality of target languages;

[0117] Based on a language-independent column search algorithm and the probabilities of the candidate words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

[0118] Optionally, the first determining module 503 is specifically configured to:

[0119] Based on the hidden states of the multiple target languages, the attention between any two languages ​​is calculated using formula (1):

[0120]

[0121] in: is the attention from the i-th language to the j-th language, Q i is the query in the i-th language, K j is the key of the jth language, V j is the value of the jth language; d k represents the dimension of the hidden layer state; i , K j 、V j It is composed of the hidden states of the multiple target languages.

[0122] Optionally, the first determining module 503 is specifically configured to:

[0123] Based on the attention between any two languages, the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​is calculated using formula (2):

[0124]

[0125] in, is through Obtained by linear transformation.

[0126] Optionally, when the generated translations in the multiple target languages ​​are empty, the tags in the multiple target languages ​​are used as the first words of the generated translations in the multiple target languages.

[0127] Figure 6 A schematic diagram of the physical structure of the electronic device provided by the present invention, such as Figure 6As shown, the electronic device 600 may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the multi-language translation method, which includes: obtaining training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multi-lingual parallel sentence pairs from the source language to multiple target languages; encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages; determining the final representation of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages; and expanding the generated optimal candidate translations in the multiple target languages ​​based on the language-independent column search algorithm and the final representation of the current word in the multiple target languages ​​to obtain the target translations in the multiple target languages.

[0128] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0129] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the multilingual translation method provided by the above methods, which method includes: obtaining training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages; encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages; based on the feature vector and the generated translations in the multiple target languages, determining the final representation of the current word in the multiple target languages; based on the language-independent column search algorithm and the final representation of the current word in the multiple target languages, expanding the generated optimal candidate translations in the multiple target languages ​​to obtain the target translations in the multiple target languages.

[0130] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the multilingual translation method provided by the above-mentioned methods, the method comprising: obtaining training data and a text in a source language; wherein the training data comprises bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages; encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages; determining a final representation of a current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages; and expanding the generated optimal candidate translations in the multiple target languages ​​based on a language-independent column search algorithm and the final representation of the current word in the multiple target languages ​​to obtain target translations in the multiple target languages.

[0131] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multilingual translation method, characterized in that: include: Acquire training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages; Encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages; determining a final representation of a current word in the plurality of target languages ​​based on the feature vector and the generated translations in the plurality of target languages; Based on a language-independent column search algorithm and final representations of current words in the plurality of target languages, the generated optimal candidate translations in the plurality of target languages ​​are expanded to obtain target translations in the plurality of target languages; The step of determining final representations of the current word in the multiple target languages ​​based on the feature vector and the generated translations in the multiple target languages ​​comprises: Determining hidden states of the multiple target languages ​​based on the feature vectors and the generated translations in the multiple target languages; Determining attention between any two languages ​​based on the hidden states of the plurality of target languages; Determining cross-language attention of a current word in the plurality of target languages ​​to the text in the source language and the generated translations in the plurality of target languages ​​based on the attention between the any two languages; Based on the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages, the hidden layer states of the multiple target languages ​​are updated by nonlinear transformation to obtain the final representation of the current word in the multiple target languages; The step of determining the attention between any two languages ​​based on the hidden states of the multiple target languages ​​comprises: Based on the hidden states of the multiple target languages, the attention between any two languages ​​is calculated using formula (1): in: is the attention from the i-th language to the j-th language, Q i is the query in the i-th language, K j is the key of the jth language, V j is the value of the jth language; d k represents the dimension of the hidden layer state; i , K j 、V j consisting of latent states of the plurality of target languages; The step of determining the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​based on the attention between the any two languages ​​includes: Based on the attention between any two languages, the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​is calculated using formula (2): in, is through Obtained by linear transformation.

2. The multilingual translation method according to claim 1, characterized in that: The language-independent column search algorithm and the final representation of the current word in the multiple target languages ​​are used to expand the generated optimal candidate translations in the multiple target languages ​​to obtain the target translations in the multiple target languages, including: Calculating probabilities of candidate words in the plurality of target languages ​​based on the final representations of the current word in the plurality of target languages; Based on a language-independent column search algorithm and the probabilities of the candidate words in the multiple target languages, the generated optimal candidate translations in the multiple target languages ​​are expanded to obtain target translations in the multiple target languages.

3. The multilingual translation method according to claim 1, characterized in that: When the generated translations in the multiple target languages ​​are empty, the labels in the multiple target languages ​​are used as the first words of the generated translations in the multiple target languages.

4. A multi-language translation device, characterized in that: include: An acquisition module, used to acquire training data and text in a source language; wherein the training data includes bilingual parallel sentence pairs and multilingual parallel sentence pairs from the source language to multiple target languages; An encoding module, used for encoding the text in the source language to obtain a feature vector corresponding to the text in the source language; wherein the feature vector is independent of the multiple target languages; A first determination module, configured to determine a final representation of a current word in the plurality of target languages ​​based on the feature vector and the generated translations in the plurality of target languages; A first expansion module, configured to expand the generated optimal candidate translations in the plurality of target languages ​​based on a language-independent column search algorithm and final representations of current words in the plurality of target languages ​​to obtain target translations in the plurality of target languages; The first determining module is specifically configured to: Determining hidden states of the multiple target languages ​​based on the feature vectors and the generated translations in the multiple target languages; Determining attention between any two languages ​​based on the hidden states of the multiple target languages; Determining cross-language attention of a current word in the plurality of target languages ​​to the text in the source language and the generated translations in the plurality of target languages ​​based on the attention between the any two languages; Based on the cross-language attention of the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages, the hidden layer states of the multiple target languages ​​are updated by nonlinear transformation to obtain the final representation of the current word in the multiple target languages; The first determining module is further specifically configured to: Based on the hidden states of the multiple target languages, the attention between any two languages ​​is calculated using formula (1): in: is the attention from the i-th language to the j-th language, Q i is the query in the i-th language, K j is the key of the jth language, V j is the value of the jth language; d k represents the dimension of the hidden layer state; i , K j 、V j consisting of latent states of the plurality of target languages; Based on the attention between any two languages, the cross-language attention from the current word in the multiple target languages ​​to the text in the source language and the generated translations in the multiple target languages ​​is calculated using formula (2): in, is through Obtained by linear transformation.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the multi-language translation method according to any one of claims 1 to 3 are implemented.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the multi-language translation method according to any one of claims 1 to 3 are implemented.

7. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the multi-language translation method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Word forecasting method and system based on nerve machine translation system

    CN106844352A

  • Decoding method based on deep neural network translation model

    CN108647214A