Translation method, device, readable medium and electronic device

By determining the correlation degree and adjacent characters of the pending characters in multilingual translation, the translation accuracy is improved and the cost is reduced, and the problem of low efficiency and accuracy of the non-autoregressive model is solved.

CN115409044BActive Publication Date: 2024-11-05BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211034229.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-26
Publication Date
2024-11-05
Estimated Expiration
2042-08-26

AI Technical Summary

Technical Problem

In multilingual translation, the existing non-autoregressive model has high translation efficiency but low accuracy, and high knowledge distillation cost, especially in multilingual environments. high.

Method used

The target translation model determines the correlation degree of each pending character after translation, and determines the adjacent characters of each pending character, so that the final target text accuracy is higher. While ensuring the efficiency and accuracy of the translation model, Reduces the cost of translation models.

Benefits of technology

It improves the accuracy of multilingual translation, reduces the cost of the translation model, and achieves the high accuracy of the target translation model generated based on the non-autoregressive model without knowledge distillation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409044B_ABST
    Figure CN115409044B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a translation method, device, readable medium and electronic device. The method comprises: obtaining a source text to be translated and a target language; inputting the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language; the target translation model is used to determine a plurality of pending characters after the source text is translated into the target language, and for each pending character, the pending character is used as a current character to determine a correlation degree corresponding to the current character, wherein the correlation degree is used to characterize a probability that the current character and the remaining characters are adjacent characters, wherein the remaining characters include the pending characters after the current character among the plurality of pending characters, and according to the plurality of correlation degrees, a plurality of target pending characters are determined from the plurality of pending characters, and a text composed of the plurality of target pending characters is used as the target text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of machine translation, and in particular, to a translation method, device, readable medium and electronic device. 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, with the development of deep learning technology, machine translation methods based on neural networks have significantly improved translation quality and have been widely used. Multilingual translation uses a single model to achieve multiple translation directions. Currently, multilingual translation can be achieved through non-autoregressive models. However, since the multiple target characters predicted by the non-autoregressive model are independent of each other, the accuracy of the target text obtained is relatively low. Summary of the invention

[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0004] In a first aspect, an embodiment of the present disclosure provides a translation method, including:

[0005] Obtain the source text and target language to be translated;

[0006] Inputting the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language;

[0007] The target translation model is used to determine multiple pending characters after the source text is translated into the target language. For each of the pending characters, the pending character is used as the current character to determine the association degree corresponding to the current character. The association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters. The remaining characters include the pending characters after the current character among the multiple pending characters. According to the multiple association degrees, multiple target pending characters are determined from the multiple pending characters, and a text composed of the multiple target pending characters is used as the target text.

[0008] In a second aspect, an embodiment of the present disclosure provides a translation device, including:

[0009] An acquisition module, used to acquire the source text and target language to be translated;

[0010] A translation module, configured to input the source text and the target language into a target translation model generated in advance based on a non-autoregressive model, to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language;

[0011] The target translation model is used to determine multiple pending characters after the source text is translated into the target language. For each of the pending characters, the pending character is used as the current character to determine the association degree corresponding to the current character. The association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters. The remaining characters include the pending characters after the current character among the multiple pending characters. According to the multiple association degrees, multiple target pending characters are determined from the multiple pending characters, and a text composed of the multiple target pending characters is used as the target text.

[0012] In a third aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.

[0013] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, including:

[0014] a storage device having at least one computer program stored thereon;

[0015] At least one processing device is used to execute the at least one computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.

[0016] Through the above technical scheme, by obtaining the source text and the target language to be translated; inputting the source text and the target language into the target translation model generated in advance based on the non-autoregressive model, the target text output by the target translation model is obtained, and the target text is the text after the source text is translated according to the target language; the target translation model is used to determine the multiple pending characters after the source text is translated according to the target language, for each pending character, the pending character is used as the current character, and the association degree corresponding to the current character is determined, and the association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, and the remaining characters include the pending characters after the current character in the multiple pending characters, and according to the multiple association degrees, multiple target pending characters are determined from the multiple pending characters, and the text composed of the multiple target pending characters is used as the target text. That is to say, the target translation model of the embodiment of the present disclosure determines the association degree of each pending character after translation, determines the adjacent characters of each pending character, so that the accuracy of the target text finally obtained is higher, so that the cost of the translation model is reduced while ensuring the efficiency and accuracy of the translation model.

[0017] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0019] Figure 1 is a flowchart of a translation method according to an exemplary embodiment of the present disclosure;

[0020] Figure 2 is a schematic diagram of a translation method according to an exemplary embodiment of the present disclosure;

[0021] Figure 3 is a flowchart of a model training method according to an exemplary embodiment of the present disclosure;

[0022] Figure 4 is a flowchart of another model training method according to an exemplary embodiment of the present disclosure;

[0023] Figure 5 is a block diagram of a translation device according to an exemplary embodiment of the present disclosure;

[0024] Figure 6 is a block diagram of another translation device according to an exemplary embodiment of the present disclosure;

[0025] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0032] First, the application scenario of the present disclosure is described. At present, the neural network models used in the field of multilingual translation include autoregressive models and non-autoregressive models. The accuracy of the target text obtained by the autoregressive model is relatively high because the dependency relationship between multiple characters after translation is taken into account. However, the translation efficiency of the autoregressive model is relatively low. Correspondingly, the translation efficiency of the non-autoregressive model is relatively high because the dependency relationship between multiple characters after translation is not taken into account. However, the accuracy of the target text obtained by the translation is relatively high. In the related art, the introduction of knowledge distillation in the non-autoregressive model can improve the translation accuracy while ensuring the translation efficiency of the model. However, the cost of knowledge distillation is relatively high, especially for a multilingual environment. For each translation direction, a knowledge distillation process is required, resulting in a relatively high translation cost of the model.

[0033] In order to solve the above-mentioned problems, the present disclosure provides a translation method, device, readable medium and electronic device, which determine the correlation of each pending character after translation through a target translation model, and determine the adjacent characters of each pending character, so that the accuracy of the final target text is higher. In this way, while ensuring the efficiency and accuracy of the translation model, the cost of the translation model is reduced.

[0034] The present disclosure is described below in conjunction with specific embodiments.

[0035] Figure 1 is a flowchart of a translation method according to an exemplary embodiment of the present disclosure. Figure 1As shown, the method may include:

[0036] S101: Obtain a source text to be translated and a target language.

[0037] S102: Input the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model.

[0038] The target text may be a text translated from the source text into the target language. The target translation model may be used to determine a plurality of pending characters translated from the source text into the target language, and for each of the pending characters, the pending character is used as the current character, and the correlation degree corresponding to the current character is determined, and the correlation degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, and the remaining characters include the pending characters after the current character among the plurality of the pending characters, and according to the plurality of the correlation degrees, a plurality of target pending characters are determined from the plurality of the pending characters, and a text composed of the plurality of the target pending characters is used as the target text.

[0039] In this step, after the source text and the target language are obtained, the source text and the target language may be input into the target translation model, and the target translation model is used to determine a plurality of pending characters after the source text is translated into the target language.

[0040] For example, Figure 2 is a schematic diagram of a translation method according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the source text is "Iamreadytogo", and the target language is Chinese. After the source text and the target language are input into the target translation model, the target translation model can determine multiple pending characters ("I", "hit", "accurate", "calculate", "prepare", "walk") and target pending characters among the multiple pending characters. For example, the pending character "I" can be determined as the first target pending character. For the pending character "I", the probabilities of the pending characters "hit", "accurate", "calculate", "prepare" and "walk" being adjacent characters of the pending character "I" can be determined respectively, and the five association degrees corresponding to the pending character "I" ( Figure 2Only non - zero correlation degrees are shown. For example, the correlation degree between the to - be - determined character "我" and the to - be - determined character "打" is 0.3, the correlation degree between the to - be - determined character "我" and the to - be - determined character "准" is 0.7, the correlation degree between the to - be - determined character "我" and the to - be - determined character "算" is 0, the correlation degree between the to - be - determined character "我" and the to - be - determined character "备" is 0, and the correlation degree between the to - be - determined character "我" and the to - be - determined character "走" is 0. After obtaining the five correlation degrees corresponding to the to - be - determined character "我", the to - be - determined character with the highest correlation degree can be used as the target to - be - determined character corresponding to the to - be - determined character "我". According to the above five correlation degrees, it can be determined that the correlation degree between the to - be - determined character "我" and the to - be - determined character "准" is the highest (the correlation degree is 0.7), and the to - be - determined character "准" can be used as the target to - be - determined character corresponding to the to - be - determined character "我".

[0041] Referring to the method of determining the correlation degree corresponding to the to - be - determined character "我" above, the correlation degree corresponding to the to - be - determined character "准" can also be determined synchronously. For example, if the correlation degree between the to - be - determined character "准" and the to - be - determined character "算" is 0.2, the correlation degree between the to - be - determined character "准" and the to - be - determined character "备" is 0.8, and the correlation degree between the to - be - determined character "准" and the to - be - determined character "走" is 0, then it can be determined that the target to - be - determined character corresponding to the to - be - determined character "准" is the to - be - determined character "备".

[0042] Referring to the method of determining the correlation degree corresponding to the to - be - determined character "我" above, the correlation degree corresponding to the to - be - determined character "备" can also be determined synchronously. If the correlation degree between the to - be - determined character "备" and the to - be - determined character "走" is 1, then it can be determined that the target to - be - determined character corresponding to the to - be - determined character "备" is the to - be - determined character "走".

[0043] After determining multiple target to - be - determined characters "我", "准", "备", "走", "我", "准", "备", "走" can be combined to obtain the target text "我准备走".

[0044] It should be noted that as Figure 2 shown, in the embodiments of the present disclosure, the correlation degrees corresponding to the to - be - determined characters "打" and "算" are also determined synchronously. Since the target to - be - determined character corresponding to the to - be - determined character "我" is "准", the determination of the correlation degrees corresponding to the to - be - determined characters "打" and "算" is not described in detail in the above steps of determining the target text.

[0045] In a possible implementation, after inputting the source text and the target language into the target translation model, multiple undetermined characters after translating the source text according to the target language can be determined by the target translation model. For each undetermined character, the undetermined character can be used as the current character, and the character position corresponding to each undetermined character can be determined from multiple preset character positions. For each remaining character, according to the current character, the remaining character, the character position corresponding to the current character, and the character position corresponding to the remaining character, the probability that the current character and the remaining character are adjacent characters is determined to obtain the correlation degree corresponding to the current character. According to multiple such correlation degrees, multiple target undetermined characters are determined from multiple undetermined characters, and the text composed of multiple target undetermined characters is used as the target text.

[0046] Among them, the preset character positions can be determined according to the number of source characters included in the source text and a preset multiple. The preset multiple can be set in advance according to experience. For example, for a model with higher accuracy requirements and lower real-time requirements, a larger preset multiple can be set. For example, the preset multiple can be 8. For a model with lower accuracy requirements and higher real-time requirements, a smaller preset multiple can be set. For example, the preset multiple can be 6. For example, if the source text is "Iamreadytogo" and the preset multiple is 8, then it can be determined that the number of source characters included in the source text is 5, and the preset character positions can include 40 character positions.

[0047] For example, continuing to illustrate with the source text "Iamreadytogo" and the target language being Chinese, after inputting the source text and the target language into the target translation model, the multiple undetermined characters corresponding to the source text determined by the target translation model are "我", "打", "准", "算", "备", "走". If the preset character positions include 40 character positions, then the character position corresponding to each undetermined character can be determined by the target translation model. For example, the character position corresponding to the undetermined character "我" can be the 1st position, the character position corresponding to the undetermined character "打" can be the 2nd character position, the character position corresponding to the undetermined character "准" can be the 3rd character position, the character position corresponding to the undetermined character "算" can be the 4th character position, the character position corresponding to the undetermined character "备" can be the 5th character position, and the character position corresponding to the undetermined character "走" can be the 6th character position. After determining the character position corresponding to each undetermined character, the undetermined character can be used as the current character. For each remaining character, according to the current character, the remaining character, the character position corresponding to the current character, and the character position corresponding to the remaining character, the probability that the current character and the remaining character are adjacent characters is determined to obtain the correlation degree corresponding to the current character.

[0048] It should be noted that the present disclosure embodiment does not limit the sequence of the processing flow of the above target translation model. The target translation model can simultaneously determine multiple to-be-determined characters, the character positions corresponding to each to-be-determined character, and the multiple relevance degrees corresponding to each to-be-determined character.

[0049] After obtaining the relevance degree corresponding to each to-be-determined character, for each such to-be-determined character, the remaining character with the highest relevance degree among the multiple relevance degrees corresponding to the to-be-determined character can be used as the target to-be-determined character, and multiple such target to-be-determined characters are combined into the target text in sequence. By way of example, if it is determined that multiple target to-be-determined characters include "我 (I)", "准 (ready)", "备 (prepare)", "走 (go)", then multiple target to-be-determined characters can be combined into the target text according to the sequence of the character positions corresponding to each target to-be-determined character. For example, the target text is "我准备走 (I am ready to go)".

[0050] By using the above method, the relevance degree of each to-be-determined character after translation is determined through the target translation model, and the adjacent characters of each to-be-determined character are determined, so that the accuracy of the finally obtained target text is higher. In this way, while ensuring the efficiency and accuracy of the translation model, the cost of the translation model is reduced.

[0051] Figure 3 is a flowchart of a model training method shown according to an exemplary embodiment of the present disclosure, as Figure 3 shown, the method may include:

[0052] S31. Obtain multiple sample sets.

[0053] Among them, the sample set may include a sample source text, a sample source language, a sample target language, and a sample target text obtained by translating the sample source text according to the sample target language. The sample source language and the sample target language may be any language, and the present disclosure embodiment does not limit this.

[0054] S32. Input multiple such sample sets into a non-autoregressive model, and through the non-autoregressive model, determine multiple predicted texts obtained by translating the sample source text according to the sample target language. According to the predicted text and the sample target text, determine the predicted probability corresponding to the predicted text, and update the parameters of the non-autoregressive model according to the predicted probability to obtain the target translation model.

[0055] In this step, after obtaining multiple sample sets, the model training step can be repeatedly executed until the predicted probability corresponding to the predicted text is determined to be greater than or equal to a preset probability threshold according to the predicted text and the sample target text, and the trained non-autoregressive model is used as the target translation model; the predicted text is the text output after the sample set is input into the non-autoregressive model. The preset probability threshold can be set in advance according to experience. By way of example, the preset probability threshold may be 0.8.

[0056] The model training steps include:

[0057] Inputting a plurality of the sample sets into the non-autoregressive model, and outputting a predicted text corresponding to each sample source text;

[0058] When it is determined based on the predicted text and the sample target text that the predicted probability corresponding to the predicted text is less than or equal to the preset probability threshold, the parameters of the non-autoregressive model are updated according to the predicted probability to obtain a trained non-autoregressive model, and the trained non-autoregressive model is used as a new non-autoregressive model.

[0059] In a possible implementation, for each predicted character in the predicted text, the character prediction probability and the position prediction probability corresponding to the predicted character can be determined, and the prediction probability corresponding to the predicted text can be determined based on multiple character prediction probabilities and multiple position prediction probabilities.

[0060] Among them, the character position of the predicted character is a t +1, the position prediction probability is used to characterize the t The predicted position a t +1 probability.

[0061] For example, the predicted probability of the position can be calculated by the following formula:

[0062]

[0063] in, Predict the probability for this location, The last layer of the target neural network is at position a t The eigenvector at The last layer of the target neural network is at position a t The eigenvector at +1, The last layer of the target neural network is at position The eigenvector at k and W q is the learnable matrix determined during model training, S is the number of the preset character positions. Taking step S102 as an example, the value of S is 48.

[0064] The character prediction probability is used to characterize position a t The probability of the predicted character can be determined by the method of the prior art, which will not be described in detail here.

[0065] After determining the position prediction probability and character prediction probability corresponding to each predicted character, the prediction probability corresponding to the predicted text can be determined by the following formula:

[0066]

[0067] Among them, p(y1:T y ) is the prediction probability corresponding to the predicted text y1, is at position a t Predicted character y t The probability of is at position a t -1 predicted position a t probability.

[0068] It should be noted that and All can be predicted independently, which makes the inference speed of the trained target translation model faster, further improving the efficiency of translation.

[0069] Through the above model training method, the prediction of characters and positions is taken into account during the training process, which can reflect the correlation between multiple characters. In this way, the accuracy of the target translation model generated based on the non-autoregressive model can be guaranteed without the need for knowledge distillation, thereby reducing the cost of the translation model.

[0070] Figure 4 is a flowchart of another model training method according to an exemplary embodiment of the present disclosure, such as Figure 4 As shown, the implementation of step S31 may include:

[0071] S1. Acquire multiple first sample sets.

[0072] The first sample set may include a first sample source text, a first sample source language, a first sample target language, and a first sample target text translated from the first sample source text into the first sample target language. For example, the first sample set may be represented as (x, l src ,y,l tgt ), x is the first sample source text, l src is the first sample source language, y is the first sample target language, l tgt is the first sample target text.

[0073] S2. Determine at least one first target sample set from the plurality of first sample sets.

[0074] The first target sample set may be any first sample set among multiple first sample sets.

[0075] S3. Randomly determine a target preset sample language from a plurality of preset sample languages.

[0076] The preset sample language may include multiple languages ​​that the target translation model is expected to support.

[0077] S4. For each of the first target sample sets, when the target preset sample language does not belong to the multiple first sample target languages, or the first sample target language of the first target sample set does not belong to the multiple first sample source languages, determine a sample intermediate language, and generate a second sample set according to the first target sample set, the sample intermediate language and the target preset sample language.

[0078] The plurality of first sample source languages ​​and the plurality of first sample target languages ​​all include the sample intermediate language.

[0079] Wherein, the plurality of first sample source languages ​​and the plurality of first sample target languages ​​all include the sample intermediate language. For example, if the plurality of first sample source languages ​​include Chinese, English, Japanese, French, and German, and the plurality of first sample target languages ​​include Chinese and Italian, then Chinese can be used as the sample intermediate language.

[0080] After determining the target preset sample language, for each first target sample set, it can be determined whether the target preset sample language belongs to multiple first sample target languages. If the target preset sample language belongs to multiple first sample target languages, it can be determined whether the first sample target language of the first target sample set belongs to multiple first sample source languages. If the first sample target language of the first target sample set belongs to multiple first sample source languages, it means that the translation direction from the first sample target language of the first target sample set to the target preset sample language is included in multiple first sample sets. If the target preset sample language does not belong to multiple first sample target languages, or the first sample target language of the first target sample set does not belong to multiple first sample source languages, it means that the translation direction from the first sample target language of the first target sample set to the target preset sample language is not included in multiple first sample sets.

[0081] For example, the first target sample set is (x, l src ,y,l tgt ), the target preset sample language is l aug For example, when the target preset sample language does not belong to the plurality of first sample target languages, or the first sample target language of the first target sample set does not belong to the plurality of first sample source languages, it means that l aug ->l tgt The translation direction is not included in the first sample sets.

[0082] In a possible implementation, when it is determined that the translation direction from the first sample target language of the first target sample set to the target preset sample language is not included in the plurality of first sample sets, a sample intermediate source text may be determined according to the original sample target text, the original sample target language, and the sample intermediate language of the first target sample set; a sample intermediate target text may be determined according to the sample intermediate source text, the sample intermediate language, and the target preset sample language; and the second sample set may be generated according to the target preset sample language, the original sample target language, the sample intermediate source text, and the sample intermediate target text.

[0083] For example, the original sample target language can be used as the first expanded source language, the original sample target text can be used as the first expanded source text, and the sample intermediate language can be used as the first expanded target language. The intermediate text corresponding to the first expanded source text can be determined through multiple first sample sets. After that, the intermediate text can be used as the second expanded source text, the sample intermediate language can be used as the second expanded source language, and the target preset sample language can be used as the second expanded target language. The second expanded target text corresponding to the second expanded source text can be determined through multiple first sample sets. In this way, a sample of the translation direction from the original sample target language to the target preset sample language can be obtained, and the sample can be used as the second sample set.

[0084] For example, the first target sample set is (x, l src ,y,l tgt ), the target preset sample language is l aug , the intermediate language of this sample is l pivot Take the following as an example to illustrate: tgt As the first extended source language, y as the first extended source text, and l pivot As the first expanded target language, we get y according to l pivot Translated intermediate text Afterwards, you can As the second extended source text, l pivot As the first extended source language, l aug As the second expanded target language, we get According to l aug The second expanded target text after translation Thus, the second sample set is obtained

[0085] Through the above method, more sample sets can be obtained in a reverse translation manner, and the training data used to train the target translation model can be enhanced, thereby making the accuracy of the target translation model higher.

[0086] Figure 5is a block diagram of a translation device according to an exemplary embodiment of the present disclosure. Figure 5 As shown, the device may include:

[0087] An acquisition module 501 is used to acquire a source text and a target language to be translated;

[0088] A translation module 502, configured to input the source text and the target language into a target translation model generated in advance based on a non-autoregressive model, and obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language;

[0089] The target translation model is used to determine multiple pending characters after the source text is translated into the target language. For each of the pending characters, the pending character is used as the current character to determine the correlation degree corresponding to the current character. The correlation degree is used to characterize the probability that the current character and the remaining characters are adjacent characters. The remaining characters include the pending characters after the current character among the multiple pending characters. According to the multiple correlation degrees, multiple target pending characters are determined from the multiple pending characters, and the text composed of the multiple target pending characters is used as the target text.

[0090] Optionally, the translation module 502 is further used for:

[0091] Determine the character position corresponding to each of the pending characters from a plurality of preset character positions;

[0092] For each of the remaining characters, the probability that the current character and the remaining characters are adjacent characters is determined based on the current character, the remaining characters, the character position corresponding to the current character, and the character position corresponding to the remaining characters to obtain the correlation degree corresponding to the current character.

[0093] Optionally, the translation module 502 is further used for:

[0094] For each of the pending characters, the remaining character with the highest correlation degree among the multiple correlation degrees corresponding to the pending character is used as the target pending character;

[0095] The target text is composed of a plurality of target pending characters in sequence.

[0096] Optionally, Figure 6 is a block diagram of another translation device according to an exemplary embodiment of the present disclosure, such as Figure 6 As shown, the device also includes:

[0097] The model training module 503 is used to obtain multiple sample sets, which include sample source texts, sample source languages, sample target languages, and sample target texts translated from the sample source texts into the sample target languages; input the multiple sample sets into a non-autoregressive model, determine multiple predicted texts translated from the sample source texts into the sample target languages ​​through the non-autoregressive model, determine the predicted probability corresponding to the predicted text based on the predicted texts and the sample target texts, update the parameters of the non-autoregressive model based on the predicted probability, and obtain the target translation model.

[0098] Optionally, the model training module 503 is further used to:

[0099] For each predicted character in the predicted text, determining a character prediction probability and a position prediction probability corresponding to the predicted character;

[0100] The prediction probability corresponding to the predicted text is determined according to the multiple character prediction probabilities and the multiple position prediction probabilities.

[0101] Optionally, the model training module 503 is further used to:

[0102] Acquire a plurality of first sample sets, the first sample sets comprising a first sample source text, a first sample source language, a first sample target language, and a first sample target text obtained by translating the first sample source text into the first sample target language;

[0103] Determine at least one first target sample set from the plurality of first sample sets;

[0104] randomly determining a target preset sample language from a plurality of preset sample languages;

[0105] For each of the first target sample sets, when the target preset sample language does not belong to the multiple first sample target languages, or the first sample target language of the first target sample set does not belong to the multiple first sample source languages, a sample intermediate language is determined, and a second sample set is generated according to the first target sample set, the sample intermediate language and the target preset sample language, wherein the multiple first sample source languages ​​and the multiple first sample target languages ​​all include the sample intermediate language.

[0106] Optionally, the model training module 503 is further used to:

[0107] Determine a sample intermediate source text according to the original sample target text, the original sample target language and the sample intermediate language of the first target sample set;

[0108] Determining a sample intermediate target text according to the sample intermediate source text, the sample intermediate language, and the target preset sample language;

[0109] The second sample set is generated according to the target preset sample language, the original sample target language, the sample intermediate source text and the sample intermediate target text.

[0110] Through the above device, the target translation model determines the relevance of each pending character after translation, and determines the adjacent characters of each pending character, so that the final target text has a higher accuracy. In this way, while ensuring the efficiency and accuracy of the translation model, the cost of the translation model is reduced.

[0111] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0112] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0113] like Figure 7 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0114] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0115] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0116] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0117] In some embodiments, any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) can be used for communication, and can be interconnected with any form or medium of digital data communication (e.g., communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.

[0118] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0119] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a source text to be translated and a target language; inputs the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language; the target translation model is used to determine a plurality of pending characters after the source text is translated into the target language, and for each of the pending characters, the pending character is used as a current character to determine a correlation degree corresponding to the current character, wherein the correlation degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, wherein the remaining characters include the pending characters after the current character among the plurality of pending characters, and according to the plurality of correlation degrees, a plurality of target pending characters are determined from the plurality of pending characters, and a text composed of the plurality of target pending characters is used as the target text.

[0120] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0121] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0122] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, an acquisition module may also be described as a "module for acquiring source text to be translated and a target language".

[0123] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0124] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0125] According to one or more embodiments of the present disclosure, Example 1 provides a translation method, including: obtaining a source text to be translated and a target language; inputting the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language; the target translation model is used to determine a plurality of pending characters after the source text is translated into the target language, and for each of the pending characters, the pending character is used as the current character to determine the association degree corresponding to the current character, wherein the association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, wherein the remaining characters include the pending characters after the current character among the plurality of the pending characters, and according to the plurality of the association degrees, a plurality of target pending characters are determined from the plurality of the pending characters, and a text composed of the plurality of the target pending characters is used as the target text.

[0126] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein determining the degree of association corresponding to the current character includes: determining the character position corresponding to each of the pending characters from a plurality of preset character positions; for each of the remaining characters, determining the probability that the current character and the remaining characters are adjacent characters based on the current character, the remaining characters, the character position corresponding to the current character, and the character position corresponding to the remaining characters, so as to obtain the degree of association corresponding to the current character.

[0127] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, which determines multiple target pending characters from multiple pending characters based on multiple association degrees, and uses the text composed of the multiple target pending characters as the target text, including: for each of the pending characters, using the remaining characters with the highest association degree among the multiple association degrees corresponding to the pending characters as the target pending characters; and composing the target text with the multiple target pending characters in order of precedence.

[0128] According to one or more embodiments of the present disclosure, Example 4 provides a method of any one of Examples 1-3, wherein the target translation model is pre-generated by the following method: obtaining multiple sample sets, wherein the sample sets include sample source texts, sample source languages, sample target languages, and sample target texts after the sample source texts are translated into the sample target languages; inputting the multiple sample sets into a non-autoregressive model, determining multiple predicted texts after the sample source texts are translated into the sample target languages ​​through the non-autoregressive model, determining a predicted probability corresponding to the predicted text based on the predicted texts and the sample target texts, and updating the parameters of the non-autoregressive model based on the predicted probability to obtain the target translation model.

[0129] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 4, wherein determining the prediction probability corresponding to the predicted text includes: for each predicted character in the predicted text, determining the character prediction probability and the position prediction probability corresponding to the predicted character; and determining the prediction probability corresponding to the predicted text based on multiple character prediction probabilities and multiple position prediction probabilities.

[0130] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, wherein obtaining multiple sample sets includes: obtaining multiple first sample sets, the first sample set including a first sample source text, a first sample source language, a first sample target language, and a first sample target text after the first sample source text is translated into the first sample target language; determining at least one first target sample set from the multiple first sample sets; randomly determining a target preset sample language from multiple preset sample languages; for each of the first target sample sets, if the target preset sample language does not belong to the multiple first sample target languages, or the first sample target language of the first target sample set does not belong to the multiple first sample source languages, determining a sample intermediate language; and generating a second sample set according to the first target sample set, the sample intermediate language, and the target preset sample language, wherein the multiple first sample source languages ​​and the multiple first sample target languages ​​all include the sample intermediate language.

[0131] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 6, wherein generating the second sample set according to the first target sample set, the sample intermediate language, and the target preset sample language comprises: determining a sample intermediate source text according to the original sample target text, the original sample target language, and the sample intermediate language of the first target sample set; determining a sample intermediate target text according to the sample intermediate source text, the sample intermediate language, and the target preset sample language; and generating the second sample set according to the target preset sample language, the original sample target language, the sample intermediate source text, and the sample intermediate target text.

[0132] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0133] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0134] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A translation method, characterized in that: include: Obtain the source text and target language to be translated; Inputting the source text and the target language into a target translation model generated in advance based on a non-autoregressive model to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language; The target translation model is used to determine a plurality of pending characters after the source text is translated into the target language, and for each of the pending characters, the pending character is used as the current character to determine the association degree corresponding to the current character, wherein the association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, wherein the remaining characters include the pending characters after the current character among the plurality of pending characters, and according to the plurality of association degrees, a plurality of target pending characters are determined from the plurality of pending characters, and a text composed of the plurality of target pending characters is used as the target text; The step of determining a plurality of target characters to be determined from the plurality of characters to be determined according to the plurality of association degrees, and using a text composed of the plurality of target characters to be determined as the target text comprises: For each of the pending characters, taking the remaining characters with the highest correlation among the multiple correlations corresponding to the pending characters as the target pending characters; The target text is composed of a plurality of the target characters to be determined in sequence.

2. The method according to claim 1, characterized in that Determining the association degree corresponding to the current character includes: Determining a character position corresponding to each of the pending characters from a plurality of preset character positions; For each of the remaining characters, the probability that the current character and the remaining characters are adjacent characters is determined based on the current character, the remaining characters, the character position corresponding to the current character, and the character position corresponding to the remaining characters to obtain the correlation degree corresponding to the current character.

3. The method according to claim 1 or 2, characterized in that: The target translation model is pre-generated by the following method: Acquire a plurality of sample sets, the sample sets comprising sample source texts, sample source languages, sample target languages, and sample target texts obtained by translating the sample source texts into the sample target languages; Inputting a plurality of the sample sets into a non-autoregressive model, determining a plurality of predicted texts after the sample source texts are translated into the sample target language through the non-autoregressive model, determining the predicted probabilities corresponding to the predicted texts according to the predicted texts and the sample target texts, updating the parameters of the non-autoregressive model according to the predicted probabilities, and obtaining the target translation model.

4. The method according to claim 3, characterized in that Determining the prediction probability corresponding to the predicted text includes: For each predicted character in the predicted text, determining a character prediction probability and a position prediction probability corresponding to the predicted character; The prediction probability corresponding to the predicted text is determined according to the plurality of character prediction probabilities and the plurality of position prediction probabilities.

5. The method according to claim 3, characterized in that: The obtaining of multiple sample sets comprises: Acquire a plurality of first sample sets, wherein the first sample sets include a first sample source text, a first sample source language, a first sample target language, and a first sample target text obtained by translating the first sample source text into the first sample target language; Determine at least one first target sample set from the plurality of first sample sets; randomly determining a target preset sample language from a plurality of preset sample languages; For each of the first target sample sets, when the target preset sample language does not belong to the plurality of the first sample target languages, or the first sample target language of the first target sample set does not belong to the plurality of the first sample source languages, a sample intermediate language is determined, and a second sample set is generated according to the first target sample set, the sample intermediate language and the target preset sample language, wherein the plurality of the first sample source languages ​​and the plurality of the first sample target languages ​​all include the sample intermediate language.

6. The method according to claim 5, characterized in that The generating a second sample set according to the first target sample set, the sample intermediate language and the target preset sample language comprises: Determine a sample intermediate source text according to the original sample target text, the original sample target language and the sample intermediate language of the first target sample set; Determining a sample intermediate target text according to the sample intermediate source text, the sample intermediate language and the target preset sample language; The second sample set is generated according to the target preset sample language, the original sample target language, the sample intermediate source text and the sample intermediate target text.

7. A translation device, characterized in that: include: An acquisition module, used to acquire the source text and target language to be translated; A translation module, configured to input the source text and the target language into a target translation model generated in advance based on a non-autoregressive model, to obtain a target text output by the target translation model, wherein the target text is a text after the source text is translated into the target language; The target translation model is used to determine a plurality of pending characters after the source text is translated into the target language, and for each of the pending characters, the pending character is used as the current character to determine the association degree corresponding to the current character, wherein the association degree is used to characterize the probability that the current character and the remaining characters are adjacent characters, wherein the remaining characters include the pending characters after the current character among the plurality of pending characters, and according to the plurality of association degrees, a plurality of target pending characters are determined from the plurality of pending characters, and a text composed of the plurality of target pending characters is used as the target text; The translation module is further configured to, for each of the pending characters, use the remaining character with the highest correlation degree among the multiple correlation degrees corresponding to the pending character as the target pending character; The target text is composed of a plurality of the target characters to be determined in sequence.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 6 are implemented.

9. An electronic device, characterized in that: include: a storage device having at least one computer program stored thereon; At least one processing device, configured to execute the at least one computer program in the storage device to implement the steps of the method according to any one of claims 1 to 6.