Text translation method, device and storage medium

Through the preset translation model, the translations of different text arrangement orders are generated and spliced ​​together, which solves the problem of the difference in the quality of translations of different target languages ​​in neural machine translation technology, and achieves high-quality translation results.

CN113221581BActive Publication Date: 2024-11-05BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202110524501.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-13
Publication Date
2024-11-05
Estimated Expiration
2041-05-13

AI Technical Summary

Technical Problem

Existing neural machine translation technology cannot guarantee high-quality translations for different target languages, and there are large differences in the quality of translations.

Method used

By using the preset first translation model and second translation model, translations in different text arrangement orders are generated, and then spliced ​​and entered into the third translation model to generate the final target translation.

Benefits of technology

It achieves high-quality translations for text to be translated for different language types, effectively ensuring the accuracy of translation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113221581B_ABST
    Figure CN113221581B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device and storage medium for text translation. The method obtains a first translation text corresponding to a text to be translated by a preset first translation model; obtains a second translation text corresponding to the text to be translated by a preset second translation model; the character arrangement order of the first translation text is different from the character arrangement order of the second translation text; the first translation text and the second translation text are spliced ​​to obtain a target spliced ​​text; the target spliced ​​text is used as the input of a preset third translation model, and the target translation corresponding to the text to be translated is obtained as an output, so that higher-quality translations can be obtained for texts to be translated in different language types, and the accuracy of the translation results can be effectively guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] NMT (Neural Machine Translation) is a technology that uses a neural network algorithm to automatically translate a source language into another target language by machine. It is currently the most mainstream machine translation method and has broad technical and industrial value.

[0003] The current NMT translation quality varies greatly for different target languages, and it is impossible to guarantee a high-quality translation for each target language. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present disclosure provides a method, device and storage medium for text translation.

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

[0006] Get the text to be translated;

[0007] Using the text to be translated as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated;

[0008] The text to be translated is used as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated; the character arrangement order of the first translation text is different from the character arrangement order of the second translation text;

[0009] Splicing the first translated text and the second translated text to obtain a target spliced ​​text;

[0010] The target concatenated text is used as the input of a preset third translation model, and a target translation corresponding to the text to be translated is obtained as output.

[0011] Optionally, the order of characters in the second translation text is the reverse order of the order of characters in the first translation text.

[0012] Optionally, the first translation model is trained in the following manner:

[0013] Acquire a first sample text set, wherein the first sample text set includes a plurality of first sample pairs, each of which includes a first sample text to be translated and a first target translation sample text, wherein the first target translation sample text is a translation text of the first sample text to be translated;

[0014] The first initial network model is trained using the first sample text set to obtain the first translation model.

[0015] Optionally, the second translation model is trained in the following manner:

[0016] Acquire a second sample text set, wherein the second sample text set includes a plurality of second sample pairs, each second sample pair includes a second sample text to be translated and a second target translation sample text, wherein the second target translation sample text is a translation text of the second sample text to be translated;

[0017] Arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each of the second sample texts to be translated;

[0018] The second initial network model is trained by using a plurality of second sample texts to be translated and the third target translation sample text corresponding to each of the second sample texts to be translated to obtain the second translation model.

[0019] Optionally, the step of arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each second sample text to be translated includes:

[0020] Reversing the order of the characters in the second target translation sample text to obtain a second target translation sample with the order of the characters reversed;

[0021] The second target translation sample with the word order reversed is used as the third target translation sample text.

[0022] Optionally, the third translation model is trained in the following manner:

[0023] Acquire a third sample text set, the third sample text set comprising a plurality of third sample pairs, each third sample pair comprising a third sample text to be translated and a fourth target translation sample text, wherein the fourth target translation sample text is a translation text of the third sample text to be translated;

[0024] Using each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated, wherein the order of characters in the first translation text is different from the order of characters in the second translation text;

[0025] Generate a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of the third sample texts to be translated;

[0026] The third initial network model is trained using the target model training sample to obtain the third translation model.

[0027] Optionally, generating a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated includes:

[0028] splicing the first translation text and the second translation text corresponding to each of the third sample texts to be translated to obtain a spliced ​​translation text corresponding to the third sample text to be translated;

[0029] The concatenated translation texts corresponding to the plurality of third sample texts to be translated and the fourth target translation sample text are used as training samples for the target model.

[0030] According to a first aspect of an embodiment of the present disclosure, a text translation device is provided, including:

[0031] An acquisition module, configured to acquire text to be translated;

[0032] A first determination module is configured to use the text to be translated as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated;

[0033] A second determination module is configured to use the text to be translated as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated; wherein the character arrangement order of the first translation text is different from the character arrangement order of the second translation text;

[0034] A third determination module is configured to concatenate the first translation text and the second translation text to obtain a target concatenated text;

[0035] The fourth determination module is configured to use the target concatenated text as an input of a preset third translation model, and output a target translation corresponding to the text to be translated.

[0036] Optionally, the order of characters in the second translation text is the reverse order of the order of characters in the first translation text.

[0037] Optionally, the first translation model is trained in the following manner:

[0038] Acquire a first sample text set, wherein the first sample text set includes a plurality of first sample pairs, each of which includes a first sample text to be translated and a first target translation sample text, wherein the first target translation sample text is a translation text of the first sample text to be translated;

[0039] The first initial network model is trained using the first sample text set to obtain the first translation model.

[0040] Optionally, the second translation model is trained in the following manner:

[0041] Acquire a second sample text set, wherein the second sample text set includes a plurality of second sample pairs, each second sample pair includes a second sample text to be translated and a second target translation sample text, wherein the second target translation sample text is a translation text of the second sample text to be translated;

[0042] Arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each of the second sample texts to be translated;

[0043] The second initial network model is trained by using a plurality of second sample texts to be translated and the third target translation sample text corresponding to each of the second sample texts to be translated to obtain the second translation model.

[0044] Optionally, the step of arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each second sample text to be translated includes:

[0045] Reversing the order of the characters in the second target translation sample text to obtain a second target translation sample with the order of the characters reversed;

[0046] The second target translation sample with the word order reversed is used as the third target translation sample text.

[0047] Optionally, the preset third translation model is trained in the following manner:

[0048] Acquire a third sample text set, the third sample text set comprising a plurality of third sample pairs, each third sample pair comprising a third sample text to be translated and a fourth target translation sample text, wherein the fourth target translation sample text is a translation text of the third sample text to be translated;

[0049] Using each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated, wherein the order of characters in the first translation text is different from the order of characters in the second translation text;

[0050] Generate a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of the third sample texts to be translated;

[0051] The third initial network model is trained using the target model training sample to obtain the third translation model.

[0052] Optionally, generating a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated includes:

[0053] splicing the first translation text and the second translation text corresponding to each of the third sample texts to be translated to obtain a spliced ​​translation text corresponding to the third sample text to be translated;

[0054] The concatenated translation texts corresponding to the plurality of third sample texts to be translated and the fourth target translation sample text are used as training samples for the target model.

[0055] According to a third aspect of an embodiment of the present disclosure, a text translation device is provided, including:

[0056] processor;

[0057] a memory for storing processor-executable instructions;

[0058] Wherein, the processor is configured to: implement the steps of the text translation method provided in the first aspect above when executing the executable instructions.

[0059] According to a fourth aspect of an embodiment of the present disclosure, there is provided a computer-readable storage medium having computer program instructions stored thereon, wherein the program instructions, when executed by a processor, implement the steps of the text translation method provided in the first aspect above.

[0060] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: a first translation text corresponding to the text to be translated is obtained through a preset first translation model; a second translation text corresponding to the text to be translated is obtained through a preset second translation model; the text arrangement order of the first translation text is different from the text arrangement order of the second translation text; based on the first translation text and the second translation text, a target translation corresponding to the text to be translated is obtained through a preset third translation model, so that higher quality translations can be obtained for texts to be translated in different language types, and the accuracy of the translation results can be effectively guaranteed.

[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0063] Figure 1 is a flowchart of a text translation method according to an exemplary embodiment;

[0064] Figure 2 is a flow chart of a model training method shown in an exemplary embodiment of the present disclosure;

[0065] Figure 3 is a block diagram of a text translation device according to an exemplary embodiment;

[0066] Figure 4 The invention is a block diagram of another device for text translation according to an exemplary embodiment. DETAILED DESCRIPTION

[0067] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0068] Before introducing the specific embodiments of the present disclosure in detail, the application scenarios of the present disclosure are first described as follows. The present disclosure can be applied to the scenario of machine translation, which refers to translating a source language into another target language using a machine. The current mainstream machine translation method is neural machine translation, that is, a technology that automatically translates a source language into another target language based on a neural network algorithm. The current NMT usually models the target language sequence in an L2R or R2L manner to generate a model training sample, and trains the model according to the model training sample to generate a translation that conforms to reading habits. However, different languages ​​have different linguistic characteristics. For example, Chinese is a "subject-verb-object" structure, while Japanese is a "subject-object-verb". Chinese-English translation generally uses L2R rather than R2L, and Chinese-Japanese direction generally uses R2L rather than L2R. However, in the actual NMT application process, it is often that different target languages ​​are either modeled in an L2R manner or in an R2L (Right-To-Left, from right to left) manner. No matter which method is used for modeling, the quality of the translation for different target languages ​​cannot be guaranteed.

[0069] In the related art, there are also methods for obtaining translations through both R2L and L2R modeling methods. However, in the related art, either the quality of the translation is improved by the interaction between the decoder obtained by the R2L modeling method and the decoder obtained by the L2R modeling method, or a forward decoder and a backward decoder are included. The backward decoder first generates an R2L translation, and then the conventional forward encoder generates the final L2R translation through the interaction between the encoder, the R2L translation, and the hidden decoding state generated by the backward decoder, that is, the R2L translation is used as the intermediate translation to adjust the L2R translation, thereby achieving a method for improving the quality of the translation, wherein , when the translation quality is improved by the interaction between the R2L decoder and the L2R decoder, in actual decoding, they can only see each other's generated translation fragments, but cannot see the global translation, and the translation quality cannot be guaranteed. In addition, the model structure of the interaction between the R2L decoder and the L2R decoder is also relatively complex, which is not conducive to improving the efficiency of model generation. Due to language differences, some languages ​​have better L2R translation quality, and some languages ​​have better R2L translation quality. Therefore, the method of using the R2L translation as the intermediate translation to adjust the L2R translation is still not applicable to all target languages. Therefore, it is also impossible to guarantee that high-quality translations can be obtained for different target languages. In other words, the translation quality obtained by the current NMT for different target languages ​​varies greatly, and it is impossible to guarantee a high-quality translation for each target language.

[0070] In order to overcome the technical problems existing in the related art, the present disclosure provides a method, device and storage medium for text translation. The method obtains a first translation text corresponding to a text to be translated through a preset first translation model; obtains a second translation text corresponding to the text to be translated through a preset second translation model; the text arrangement order of the first translation text is different from the text arrangement order of the second translation text; based on the first translation text and the second translation text, a target translation corresponding to the text to be translated is obtained through a preset third translation model, so that higher quality translations can be obtained for texts to be translated in different language types, and the accuracy of the translation results can be effectively guaranteed.

[0071] The solution of the present disclosure is described in detail below with reference to specific embodiments.

[0072] Figure 1 is a flowchart of a text translation method according to an exemplary embodiment. Figure 1 As shown, the text translation method is used in a terminal and may include the following steps:

[0073] In step 101, a text to be translated is obtained.

[0074] The text to be translated can be a voice text in any language such as English, Japanese, French, Chinese, etc.

[0075] In step 102, the text to be translated is used as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated.

[0076] The first translation text and the text to be translated belong to different language types.

[0077] In this step, the preset first translation model can be obtained by training in the following training method: obtaining a first sample text set, the first sample text set includes a plurality of first sample pairs, each first sample pair includes a first sample text to be translated and a first target translation sample text, wherein the first target translation sample text is the translation text of the first sample text to be translated; and performing model training on a first initial network model through the first sample text set to obtain the first translation model.

[0078] For example, the first sample text set is formed by n bilingual sentences, and the first sample text set can be represented as follows: where x i represents the first sample text to be translated (i.e., the source language sequence), represents the first target translation sample text, (i.e., the target language sequence, which is the language type sequence to be translated, which can be the L2R translation sequence of the target language or the R2L translation sequence of the target language), wherein n≥i≥1, n is an integer, and the first sample text set The first initial network model is trained as a training sample to obtain the preset first translation model, and the preset first translation model is an NMT (neural machine translation) model.

[0079] It should be noted that the first initial network model can be a neural network model, and the neural network model can refer to any one of the encoder-decoder model, CNN (convolution neural network), RNN (recurrent neural network) and self-attention network (self-attention network) in the prior art. Since there is no need to adjust the neural network model framework in the prior art when training the first translation model, the generation efficiency of the first translation model can be effectively improved.

[0080] In step 103, the text to be translated is used as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated.

[0081] The first translation text has a different text arrangement order than the second translation text; the second translation text and the text to be translated belong to different language types, and the second translation text and the first translation text belong to the same language type. The text may be a character or a string, for example, when the language type is English, the text is a string corresponding to a word, and when the language type is Chinese, the text is a Chinese character.

[0082] For example, in the Chinese-English translation scenario, when the text to be translated is "I love you", the text sequence corresponding to the first translation text is "I love you", and the text sequence corresponding to the second translation text may be "you love I".

[0083] In this step, the second translation model can be obtained by training in the following training method: obtaining a second sample text set, the second sample text set includes a plurality of second sample pairs, each second sample pair includes a second sample text to be translated and a second target translation sample text, wherein the second target translation sample text is the translation text of the second sample text to be translated; arranging the text order of the second target translation sample text according to a preset order to obtain a third target translation sample text corresponding to each of the second sample texts to be translated; and training the second initial network model through the plurality of second sample texts to be translated and the third target translation sample text corresponding to each of the second sample texts to be translated to obtain the second translation model.

[0084] It should be noted that the second sample text set may be the same as or different from the first sample text set. When the second sample text set is the same as the first sample text set, the multiple second sample texts to be translated are the same as the multiple first sample texts to be translated, and the multiple second target translation sample texts corresponding to the multiple second sample texts to be translated are the same as the multiple first target translation sample texts corresponding to the multiple first sample texts to be translated; each second target translation sample text is flipped to obtain a corresponding third target translation.

[0085] For example, if the second sample text set is the same as the first sample text set, the second sample text to be translated can be represented by x i , the x i represents the source language sequence, the second target translation sample text can be expressed as Should represents the L2R sequence of the target language, or the R2L sequence of the target language. Here, it is assumed that is the L2R sequence of the target language, is a sequence of t words, which can be expressed as where y t Represents the tth word, Flip, that is, recognize the second target translation sample text of the L2R sequence from right to left, so as to obtain the R2L sequence corresponding to the L2R sequence as the third target translation sample text. The third target translation sample text can be expressed as Should The second sample text to be translated x i With multiple second sample texts to be translated x i The corresponding third target translation sample text As training data, the training data can be expressed as The NMT model is trained by the training data to obtain the second translation model. It should be noted that the second initial network model can be a neural network model, and the neural network model can refer to any one of the encoder-decoder model, convolution neural network (CNN), recurrent neural network (RNN) and self-attention network (self-attention network) in the prior art. Since there is no need to adjust the existing neural network model framework when training the second translation model, the generation efficiency of the second translation model can be effectively improved. In addition, since the first translation model and the second translation model are both independent NMT models, the generated L2R and R2L translations are independent of each other and will not interfere with each other, which is conducive to ensuring the accuracy of the first translation text and the second translation text.

[0086] In step 104, the first translated text and the second translated text are concatenated to obtain a target concatenated text.

[0087] The implementation method of splicing the first translation text and the second translation text may be to splice the second translation text after the first translation text, or to splice the first translation text after the second translation text.

[0088] In step 105, the target concatenated text is used as the input of a preset third translation model, and a target translation corresponding to the text to be translated is obtained as output.

[0089] For example, in a Chinese-English translation scenario, if the first translated text is "I love you" and the second translated text is "you love I", the target concatenated text "I love you you love I" is first generated and the target concatenated text is input into the preset third translation model, so that the preset third translation model outputs the target translation "I love you".

[0090] It should be noted that since the preset first translation model, the preset second translation model and the preset third translation model do not need to adjust the existing neural network model framework during the training process, the generation efficiency of the model can be effectively guaranteed, and since the preset third translation model generates the final target translation based on the target concatenated text of the first translation text and the second translation text, it can obtain a target translation that is more in line with reading habits based on translations of different text orders. For example, the final translation can be obtained based on the concatenated translation of the L2R translation and the R2L translation. Therefore, it can meet the language translation requirements of the language sequence that conforms to the L2R modeling method, and can also meet the language translation requirements of the R2L modeling method. It can obtain higher quality translations for texts to be translated in different language types, and can effectively guarantee the accuracy of the translation results.

[0091] The above technical scheme obtains a first translation text corresponding to the text to be translated through a preset first translation model; obtains a second translation text corresponding to the text to be translated through a preset second translation model; the character arrangement order of the first translation text is different from the character arrangement order of the second translation text; based on the first translation text and the second translation text, a target translation corresponding to the text to be translated is obtained through a preset third translation model, which can obtain higher quality translations for texts to be translated in different language types and can effectively ensure the accuracy of the translation results.

[0092] Figure 2 is a flowchart of a model training method shown in an exemplary embodiment of the present disclosure; see Figure 2 , the above Figure 1 The third translation model shown in can be obtained by Figure 2 The model training method can include:

[0093] S1, obtaining a third sample text set.

[0094] The third sample text set includes a plurality of third sample pairs, each of which includes a third sample text to be translated and a fourth target translation sample text, and the fourth target translation sample text is a translation text of the third sample text to be translated.

[0095] It should be noted that the third sample text set may be the same as or different from the first sample text set or the second sample text set. For example, the third sample text set may also be represented as: where x i represents the third sample text to be translated (i.e., the source language sequence), represents a fourth target translation sample text (ie, a target language sequence, which may be an L2R translation sequence of the target language or an R2L translation sequence of the target language), wherein n≥i≥1, and n is an integer.

[0096] S2, taking each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated.

[0097] The text arrangement order of the first translation text is different from the text arrangement order of the second translation text. For example, the first translation text is an L2R sequence of the target language corresponding to the third sample text to be translated, and the second translation text is an R2L sequence of the target language corresponding to the third sample text to be translated. The text can be a character or a string. For example, when the language type is English, the text is a string corresponding to a word, and when the language type is Chinese, the text is a Chinese character.

[0098] For example, if the third sample text to be translated is the Chinese text "I work in company A", the fourth target translation sample text corresponding to the third sample text to be translated is "I work in A company", the third sample text to be translated "I work in company A" is used as the input of the preset first translation model, and the preset first translation model outputs the first translation text "I work in company A", and the third sample text to be translated "I work in company A" is used as the input of the preset second translation model, and the preset second translation model outputs the second translation text "company A in work I".

[0099] S3, generating a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated.

[0100] In this step, a possible implementation may include:

[0101] The first translation text and the second translation text corresponding to each of the third sample texts to be translated are spliced ​​to obtain a spliced ​​translation text corresponding to the third sample text to be translated; and the spliced ​​translation texts corresponding to the plurality of third sample texts to be translated and the fourth target translation sample text are used as training samples for the target model.

[0102] By way of example, still taking the embodiment shown in the above step S2 as an example, the first translated text "I work in A company" and the second translated text "company A in work I" are spliced ​​to obtain a spliced ​​translated text "I work in A companycompany A in work I" corresponding to the third sample text to be translated in Chinese "I work in A company", and the spliced ​​translated text "I work in A company company A in workI" and the fourth target translated sample text "I work in A company" are used as a set of data in the target model training samples, that is, the spliced ​​translated text corresponding to multiple third sample texts to be translated and the fourth target translated sample text are used as the target model training samples.

[0103] Optionally, in this step, another possible implementation may include:

[0104] The first translated text, the second translated text and the fourth target translated sample text corresponding to the plurality of third sample texts to be translated are used as training samples for the target model.

[0105] By way of example, still taking the embodiment shown in the above step S2 as an example, the first translated text "I work in A company", the second translated text "company A in work I" and the fourth target translated sample text "I work in A company" are used as a group of data in the target model training sample, so that the first translated text, the second translated text and the fourth target translated sample text corresponding to the plurality of third sample texts to be translated are used as the target model training samples.

[0106] S4, performing model training on the third initial network model using the target model training sample to obtain the third translation model.

[0107] Among them, the third initial network model can be a neural network model. The third initial network model does not need to change the architecture of the existing neural network model, and can directly train the neural network model according to the target model training sample, thereby effectively improving the model training efficiency.

[0108] It should be noted that, since the first translation model, the second translation model and the third translation model do not need to adjust the existing neural network model framework, the generation efficiency of the model can be effectively guaranteed; and, since the first translation model and the second translation model are both independent NMT models, it can ensure that the first translation text and the second translation text are independent of each other and will not interfere with each other, which is conducive to ensuring the accuracy of each. Furthermore, since the third translation model generates the final target translation based on the target concatenated text of the first translation text and the second translation text, it can obtain a target translation that is more in line with reading habits based on translations of different word orders, which is conducive to improving the quality of the translation; and, since the third translation model can obtain the final translation based on the concatenated translation of the L2R translation and the R2L translation, it can meet the language translation requirements of the L2R modeling method and the R2L modeling method, and can obtain a higher quality translation for the text to be translated of different language types, which can effectively ensure the accuracy of the translation result.

[0109] The above technical scheme generates a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated, and performs model training on the third initial network model through the target model training sample to obtain the third translation model. Under the condition of ensuring the efficiency of model training, higher quality translations can be obtained for texts to be translated in different language types, and the accuracy of the translation results can be effectively guaranteed.

[0110] Figure 3 is a block diagram of a text translation device according to an exemplary embodiment; see Figure 3 , the text translation device may include:

[0111] An acquisition module 301 is configured to acquire a text to be translated;

[0112] The first determination module 302 is configured to use the text to be translated as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated;

[0113] The second determination module 303 is configured to use the text to be translated as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated; the character arrangement order of the first translation text is different from the character arrangement order of the second translation text;

[0114] A third determination module 304 is configured to concatenate the first translation text and the second translation text to obtain a target concatenated text;

[0115] The fourth determination module 305 is configured to use the target concatenated text as an input of a preset third translation model, and output a target translation corresponding to the text to be translated.

[0116] The above technical scheme obtains a first translation text corresponding to the text to be translated through a preset first translation model; obtains a second translation text corresponding to the text to be translated through a preset second translation model; the character arrangement order of the first translation text is different from the character arrangement order of the second translation text; based on the first translation text and the second translation text, a target translation corresponding to the text to be translated is obtained through a preset third translation model, which can obtain higher quality translations for texts to be translated in different language types and can effectively ensure the accuracy of the translation results.

[0117] Optionally, the order of characters in the second translation text is the reverse order of the order of characters in the first translation text.

[0118] Optionally, the first translation model is trained in the following manner:

[0119] Acquire a first sample text set, wherein the first sample text set includes a plurality of first sample pairs, each of which includes a first sample text to be translated and a first target translation sample text, wherein the first target translation sample text is a translation text of the first sample text to be translated;

[0120] The first initial network model is trained using the first sample text set to obtain the first translation model.

[0121] Optionally, the second translation model is trained in the following manner:

[0122] Acquire a second sample text set, wherein the second sample text set includes a plurality of second sample pairs, each second sample pair includes a second sample text to be translated and a second target translation sample text, wherein the second target translation sample text is a translation text of the second sample text to be translated;

[0123] Arranging the text order of the second target translation sample text according to a preset order to obtain a third target translation sample text corresponding to each second sample text to be translated;

[0124] The second initial network model is trained by using a plurality of second sample texts to be translated and the third target translation sample text corresponding to each of the second sample texts to be translated to obtain the second translation model.

[0125] Optionally, the step of arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each second sample text to be translated includes:

[0126] Reversing the order of the characters in the second target translation sample text to obtain a second target translation sample with the order of the characters reversed;

[0127] The second target translation sample with the word order reversed is used as the third target translation sample text.

[0128] Optionally, the third translation model is trained in the following manner:

[0129] Acquire a third sample text set, the third sample text set comprising a plurality of third sample pairs, each third sample pair comprising a third sample text to be translated and a fourth target translation sample text, wherein the fourth target translation sample text is a translation text of the third sample text to be translated;

[0130] Using each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated, wherein the character arrangement order of the first translation text is different from the character arrangement order of the second translation text;

[0131] Generate a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated;

[0132] The third initial network model is trained using the target model training sample to obtain the third translation model.

[0133] Optionally, generating a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated includes:

[0134] splicing the first translation text and the second translation text corresponding to each of the third sample texts to be translated to obtain a spliced ​​translation text corresponding to the third sample texts to be translated;

[0135] The concatenated translation texts corresponding to the plurality of third sample texts to be translated and the fourth target translation sample text are used as training samples for the target model.

[0136] The above technical scheme generates a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated, and performs model training on the third initial network model through the target model training sample to obtain the third translation model. Under the condition of ensuring the efficiency of model training, higher quality translations can be obtained for texts to be translated in different language types, and the accuracy of the translation results can be effectively guaranteed.

[0137] Figure 4 4 is a block diagram of another text translation device according to an exemplary embodiment. For example, the device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0138] Reference Figure 4 , the device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .

[0139] The processing component 402 generally controls the overall operation of the device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned method of text translation. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

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

[0141] The power component 406 provides power to the various components of the device 400. The power component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 400.

[0142] The multimedia component 408 includes a screen that provides an output interface between the device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0143] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the device 400 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.

[0144] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0145] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the device 400. For example, the sensor assembly 414 can detect the open / closed state of the device 400, the relative positioning of components, such as the display and keypad of the device 400, and the sensor assembly 414 can also detect the position change of the device 400 or a component of the device 400, the presence or absence of user contact with the device 400, the orientation or acceleration / deceleration of the device 400, and the temperature change of the device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0146] The communication component 416 is configured to facilitate wired or wireless communication between the device 400 and other devices. The device 400 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0147] In an exemplary embodiment, the apparatus 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned text translation method.

[0148] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the instructions can be executed by the processor 420 of the device 400 to complete the above-mentioned text translation method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0149] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0150] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for text translation, characterized in that: include: Get the text to be translated; Using the text to be translated as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated; Using the text to be translated as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated; wherein the character arrangement order of the first translation text is different from the character arrangement order of the second translation text; splicing the first translated text and the second translated text to obtain a target spliced ​​text; Using the target concatenated text as input of a preset third translation model, and outputting a target translation corresponding to the text to be translated; The third translation model is trained in the following way: Acquire a third sample text set, the third sample text set comprising a plurality of third sample pairs, each third sample pair comprising a third sample text to be translated and a fourth target translation sample text, wherein the fourth target translation sample text is a translation text of the third sample text to be translated; Using each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated, wherein the order of characters in the first translation text is different from the order of characters in the second translation text; Generate a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of the third sample texts to be translated; The third initial network model is trained using the target model training sample to obtain the third translation model.

2. The method according to claim 1, characterized in that The character arrangement order of the second translation text is the reverse order of the character arrangement order of the first translation text.

3. The method according to claim 1, characterized in that: The first translation model is trained in the following way: Acquire a first sample text set, wherein the first sample text set includes a plurality of first sample pairs, each of which includes a first sample text to be translated and a first target translation sample text, wherein the first target translation sample text is a translation text of the first sample text to be translated; The first initial network model is trained using the first sample text set to obtain the first translation model.

4. The method according to claim 1, characterized in that: The second translation model is trained in the following way: Acquire a second sample text set, wherein the second sample text set includes a plurality of second sample pairs, each second sample pair includes a second sample text to be translated and a second target translation sample text, wherein the second target translation sample text is a translation text of the second sample text to be translated; Arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each of the second sample texts to be translated; The second initial network model is trained by using a plurality of second sample texts to be translated and the third target translation sample text corresponding to each of the second sample texts to be translated to obtain the second translation model.

5. The method according to claim 4, characterized in that The step of arranging the text order of the second target translation sample texts according to a preset order to obtain a third target translation sample text corresponding to each of the second sample texts to be translated includes: Reversing the order of the characters in the second target translation sample text to obtain a second target translation sample with the order of the characters reversed; The second target translation sample with the word order reversed is used as the third target translation sample text.

6. The method according to claim 1, characterized in that The generating a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of third sample texts to be translated comprises: splicing the first translation text and the second translation text corresponding to each of the third sample texts to be translated to obtain a spliced ​​translation text corresponding to the third sample text to be translated; The concatenated translation texts corresponding to the plurality of third sample texts to be translated and the fourth target translation sample text are used as training samples for the target model.

7. A text translation device, characterized in that: include: An acquisition module, configured to acquire text to be translated; A first determination module is configured to use the text to be translated as an input of a preset first translation model to obtain a first translation text corresponding to the text to be translated; A second determination module is configured to use the text to be translated as an input of a preset second translation model to obtain a second translation text corresponding to the text to be translated; wherein the character arrangement order of the first translation text is different from the character arrangement order of the second translation text; A third determination module is configured to concatenate the first translation text and the second translation text to obtain a target concatenated text; A fourth determination module is configured to use the target concatenated text as an input of a preset third translation model, and output a target translation corresponding to the text to be translated; The third translation model is trained in the following way: Acquire a third sample text set, the third sample text set comprising a plurality of third sample pairs, each third sample pair comprising a third sample text to be translated and a fourth target translation sample text, wherein the fourth target translation sample text is a translation text of the third sample text to be translated; Using each of the third sample texts to be translated as inputs of the first translation model and the second translation model, respectively, so that the first translation model outputs a first translation text corresponding to the third sample text to be translated, and the second translation model outputs a second translation text corresponding to the third sample text to be translated, wherein the order of characters in the first translation text is different from the order of characters in the second translation text; Generate a target model training sample according to the first translation text, the second translation text and the fourth target translation sample text corresponding to the plurality of the third sample texts to be translated; The third initial network model is trained using the target model training sample to obtain the third translation model.

8. A text translation device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to: implement the steps of the method described in any one of claims 1 to 6 when executing the executable instructions.

9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Translation model training method and device

    CN110175335A

  • Text translation method and device

    CN110532575A

  • Text translation method and device, electronic equipment and storage medium

    CN111368560A

  • Bidirectional coding target encoder construction method and device

    CN112329392A

  • Synchronous interactive translation method and device, storage medium and computer equipment

    CN112733556A