Translation model training method, device, equipment and storage medium

By generating and replacing the target language text units and training the translation model with weak supervision technology, the problem of sparse parallel corpus in the training of small language translation models is solved, and efficient zero-resource or low-resource machine translation system training is achieved, which improves translation accuracy.

CN114626389BActive Publication Date: 2025-08-19ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210071284.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2025-08-19
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

In the prior art, the training of translation model for small languages requires a large number of parallel corpus, resulting in high cost and poor results in machine translation systems in zero-resource or low-resource scenarios.

Method used

By using source language text and translation dictionary, the target language text is generated and the text unit that does not appear in the dictionary is replaced as the target text unit. The translation model is trained in combination with weak supervision technology and self-training technology.

Benefits of technology

It realizes effective training of machine translation models under zero resource or low resource conditions, improves translation accuracy and avoids error accumulation problems caused by relying on pivot language.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114626389B_ABST
    Figure CN114626389B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a translation model training method, apparatus, device and storage medium. The present disclosure generates a target language text through a source language text and a translation dictionary. When there are preset text units in the target language text that do not appear in the translation dictionary, the preset text units in the target language text that do not appear in the translation dictionary can be replaced with target text units to obtain an updated target language text. The translation model is trained based on the source language text and the updated target language text. Therefore, when parallel corpus from source language sentences to target language sentences is very scarce, the target language text can be constructed and updated through the source language text and the translation dictionary. The translation model can be trained through the source language sentences and the updated target language text. This realizes a training method for a machine translation model or machine translation system based on zero resources or low resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular to a translation model training method, apparatus, device, and storage medium. Background Art

[0002] Currently, the training process for translation models requires a large amount of parallel corpus, such as the correspondence between source language sentences and target language sentences.

[0003] However, the inventors of the present application have discovered that if the source language and / or the target language is a minority language, the parallel corpus from the source language sentences to the target language sentences will be very scarce, making it impossible to train the translation model. Summary of the Invention

[0004] To address the aforementioned technical issues, or at least partially address them, the present disclosure provides a translation model training method, apparatus, device, and storage medium. These methods train the translation model using source language sentences and updated target language text. This enables training of zero- or low-resource machine translation models or systems.

[0005] In a first aspect, an embodiment of the present disclosure provides a translation model training method, comprising:

[0006] generating a target language text based on the source language text and a translation dictionary, wherein the translation dictionary includes correspondences between source language text units and target language text units;

[0007] Replacing a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text;

[0008] A translation model is trained based on the source language text and the updated target language text.

[0009] In a second aspect, an embodiment of the present disclosure provides a translation model training device, comprising:

[0010] a generating module for generating a target language text based on a source language text and a translation dictionary, wherein the translation dictionary includes a correspondence between source language text units and target language text units;

[0011] a replacement module, configured to replace a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text;

[0012] A training module is used to train a translation model based on the source language text and the updated target language text.

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

[0014] Memory;

[0015] processor; and

[0016] computer programs;

[0017] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.

[0018] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described in the first aspect.

[0019] The translation model training method, apparatus, device and storage medium provided by the embodiments of the present disclosure generate a target language text through a source language text and a translation dictionary. When there is a preset text unit in the target language text that does not appear in the translation dictionary, the preset text unit in the target language text that does not appear in the translation dictionary can be replaced with a target text unit to obtain an updated target language text. Further, the translation model is trained based on the source language text and the updated target language text. Therefore, when the parallel corpus from the source language sentence to the target language sentence is very scarce, the target language text can be constructed and updated through the source language text and the translation dictionary, so that the updated target language text can be close to the real target language sentence. The translation model can be trained through the source language sentence and the updated target language text. Thus, a training method for a machine translation model or machine translation system based on zero resources or low resources is realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] 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.

[0021] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0022] Figure 1 A flowchart of the translation model training method provided in an embodiment of the present disclosure;

[0023] Figure 2 A flowchart of the translation model training method provided in an embodiment of the present disclosure;

[0024] Figure 3 A flowchart of a translation model training method provided in another embodiment of the present disclosure;

[0025] Figure 4 A flowchart of a translation model training method provided in another embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of a supervised model training process provided by another embodiment of the present disclosure;

[0027] Figure 6 A flowchart of a translation model training method provided in another embodiment of the present disclosure;

[0028] Figure 7 A schematic diagram of the structure of a translation model training device provided in an embodiment of the present disclosure;

[0029] Figure 8 A schematic diagram of the structure of an electronic device embodiment provided by the present disclosure. DETAILED DESCRIPTION

[0030] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0032] Generally, for the training process of the translation model, a large amount of parallel corpora are needed, for example, the correspondence between the source language sentences and the target language sentences. However, if the source language and / or the target language is a minority language, the parallel corpora from the source language sentences to the target language sentences will be very scarce, thus making it impossible to train the translation model. For example, the traditional translation model needs to rely on a large amount of parallel corpora (such as paired source language sentences and target language sentences) during the training phase, making it extremely expensive for the machine translation system to train some zero-resource or low-resource scenarios (such as minority languages). In response to this problem, the present disclosure provides a translation model training method, which will be described below in conjunction with specific embodiments.

[0033] Figure 1A flow chart of the translation model training method provided in the embodiment of the present disclosure. The method can be executed by a translation model training device, which can be implemented in software and / or hardware. The device can be configured in an electronic device, such as a server or a terminal, wherein the terminal specifically includes a mobile phone, a computer or a tablet computer, etc. The following describes the translation model training method using a server as an example. Specifically, the translation model can be a translation system from a source language to a target language. The embodiment of the present disclosure does not limit the language of the source language and the target language. Specifically, the source language and / or the target language can be a language with a higher degree of popularity, or can also be a minority language. For example, the source language can be German, and the target language can be Russian. As Figure 1 As shown, the specific steps of this method are as follows:

[0034] S101 : Generate a target language text according to a source language text and a translation dictionary, wherein the translation dictionary includes correspondences between source language text units and target language text units.

[0035] like Figure 2 As shown, the server can first train a weakly supervised model using the source language text and a translation dictionary. The specific training process can be referred to in the subsequent embodiments. The source language text can be recorded as source language data. The source language text can be source language paragraph-level text or sentence-level text. Sentence-level text is used as an example for schematic illustration below. Specifically, after the weakly supervised model is trained, the source language text can be re-input into the trained weakly supervised model so that the trained weakly supervised model can output a target language text corresponding to the source language text. It is understood that there can be multiple source language texts. After each source language text is input into the trained weakly supervised model, a target language text corresponding to each source language text can be obtained. The target language text can be recorded as target language data. The target language text can be target language paragraph-level text or sentence-level text. Sentence-level text is used as an example for schematic illustration below. In addition, the translation dictionary includes correspondences between source language text units and target language text units. The source language text units can be units that constitute the source language text, such as source language words. Similarly, the target language text units can be units that constitute the target language text, such as target language words. Among them, words in a certain source language text input to the weakly supervised model can partially appear in the translation dictionary.

[0036] S102: Replace the preset text units in the target language text that do not appear in the translation dictionary with target text units to obtain an updated target language text.

[0037] like Figure 2As shown in the figure, after the trained weakly supervised model outputs the target language text, greedy decoding can be used to decode the target language text to obtain pseudo-label data in the target language. The pseudo-label data is essentially the target language text, but the form and name are slightly different, so as to distinguish the content before decoding from the content after decoding. Among them, the pseudo-label data may include <unk> , <unk>Refers to unknown words, for example, preset text units that do not appear in the translation dictionary, that is, words outside the translation dictionary. For example, a source language text input into a trained weakly supervised model includes source language word A1, source language word A2, source language word A3, and source language word A4. The weakly supervised model can query the target language word corresponding to each source language word from the translation dictionary. Assume that there are target language words corresponding to source language word A1 and source language word A3 respectively in the translation dictionary, and the target language words corresponding to source language word A1 and source language word A3 are respectively recorded as target language word B1 and target language word B3. Source language word A2 and source language word A4 do not appear in the translation dictionary, then the target language words corresponding to source language word A2 and source language word A4 are respectively recorded as <unk>, so that the pseudo-label data includes the target language word B1, <unk>、Target language words B3、 <unk>.

[0038] Furthermore, the pseudo-label data is decoded by beam search through the N-gram model, so that each <unk>Replace with a specific word, each <unk>The corresponding specific word can be the most appropriate <unk>The specific word required by the context can be recorded as a target text unit, thereby obtaining replaced pseudo-label data, which can be called updated target language text.

[0039] S103: Training a translation model based on the source language text and the updated target language text.

[0040] For example, there may be multiple source language texts, each of which corresponds to replaced pseudo-label data. Furthermore, a translation model is trained based on each source language text and the replaced pseudo-label data corresponding to each source language text. The translation model may employ an autoregressive model or a non-autoregressive model.

[0041] For example, in a training process, the source language text can be segmented into multiple words, and the pseudo-label data corresponding to the source language text after replacement can be segmented into multiple words. Then, the multiple words included in the source language text are input into the translation model so that the translation model outputs multiple words in the target language. Further, a loss function is calculated based on the multiple words in the target language output by the translation model and the multiple words included in the pseudo-label data, so as to update the parameters of the translation model. Specifically, a training process can be regarded as an iteration, and through multiple iterations, the parameters of the translation model can be continuously updated until the target conditions are met. In some other embodiments, the source language text and the pseudo-label data corresponding to the source language text after replacement can also be segmented into tokens at the subword or character (e.g., letter) level.

[0042] The disclosed embodiment generates a target language text through a source language text and a translation dictionary. When there is a preset text unit in the target language text that does not appear in the translation dictionary, the preset text unit in the target language text that does not appear in the translation dictionary can be replaced with a target text unit to obtain an updated target language text. Further, a translation model is trained based on the source language text and the updated target language text. Therefore, when parallel corpus from source language sentences to target language sentences is very scarce, the target language text can be constructed and updated through the source language text and the translation dictionary, so that the updated target language text can be similar to the real target language sentence. The translation model can be trained through the source language sentence and the updated target language text. Thus, a training method for a machine translation model or machine translation system based on zero resources or low resources is realized.

[0043] Figure 3 This is a flow chart of a translation model training method provided by another embodiment of the present disclosure. The specific steps of the method are as follows:

[0044] S301 : Train a supervision model according to the source language text and the translation dictionary to obtain a trained supervision model.

[0045] The supervision model can specifically be the weak supervision model described above. Figure 2 As shown, the server can first train the weak supervision model using the source language text and the translation dictionary to obtain the trained weak supervision model.

[0046] S302: Generate a target language text corresponding to the source language text according to the trained supervision model.

[0047] For example, there may be multiple source language texts. After inputting each source language text into the trained weakly supervised model, the target language text corresponding to each source language text can be obtained.

[0048] S303: Determine a target text unit corresponding to a preset text unit in the target language text according to a context of the preset text unit that does not appear in the translation dictionary.

[0049] For example, each <unk>The corresponding specific word can be the most appropriate <unk>The following describes the specific process of beam-search decoding. For example, the pseudo-label data before replacement includes the target language word B1, <unk>、Target language words B3、 <unk>, among which the first <unk>The context includes the target language word B1, the target language word B3 and the second <unk>First, according to the first <unk>The context predicts the first <unk>The corresponding specific words, for example, get the top 5 specific words with the highest scores. <unk>The context of includes the target language word B1, any one of the five specific words, and the target language word B3. Therefore, the second <unk>The context includes 5 cases, in each case, predicting the second <unk>The corresponding specific words can be counted similarly to get the top 5 specific words. <unk>The corresponding top 5 scoring words and the second <unk>The corresponding top 5 scoring words are combined to determine the first <unk>The corresponding final specific word and the second <unk>The corresponding final specific word makes the sum of the two scores the largest.

[0050] S304: Replace the preset text units in the target language text that do not appear in the translation dictionary with target text units to obtain an updated target language text.

[0051] Specifically, the implementation method and specific principles of S304 and S102 are the same, and will not be repeated here.

[0052] S305: Training a translation model based on the source language text and the updated target language text.

[0053] Specifically, the implementation method and specific principles of S305 and S103 are the same, and will not be repeated here.

[0054] In this embodiment, the supervision model is trained by the source language text and the translation dictionary to obtain a trained supervision model, and a target language text corresponding to the source language text is generated according to the trained supervision model. Furthermore, according to the context of the preset text unit in the target language text that does not appear in the translation dictionary, the target text unit corresponding to the preset text unit is determined, and the preset text unit in the target language text that does not appear in the translation dictionary is replaced with the target text unit to obtain an updated target language text. Thus, the translation model is trained according to the source language text and the updated target language text. In other words, a usable machine translation system can be trained by only using a translation dictionary, combined with weak supervision technology and self-training technology. This method is applicable to zero-resource or low-resource scenarios, and can greatly improve the accuracy of machine translation systems based on zero or low resources.

[0055] In addition, the prior art usually uses a pivot language as a bridge to obtain parallel corpora from source language sentences to target language sentences. For example, when training a translation model from German to Russian, since there is no parallel corpus from German to Russian, the prior art can use English as the pivot language, first using the existing English to German model to generate parallel corpora from English to German, and using the existing English to Russian model to generate parallel corpora from English to Russian. Furthermore, based on the parallel corpora from English to German and from English to Russian, a parallel corpus from German to Russian is constructed, and then the parallel corpus from German to Russian is used to train the translation model from German to Russian. However, since this method relies on the model from the pivot language to the source language and the model from the pivot language to the target language, it is easily affected by error accumulation, resulting in the generated parallel corpus from German to Russian being of low quality. The translation model training method disclosed in this application, however, only requires a translation dictionary to construct a parallel corpus from source language sentences to target language sentences, eliminating the need for a pivot language. Therefore, error accumulation is eliminated, thereby improving the quality of the parallel corpus from source language sentences to target language sentences.

[0056] Based on the above embodiment, the supervision model is trained according to the source language text and the translation dictionary, including the following steps: Figure 4 The following steps are shown:

[0057] S401 : For each source language text unit in the source language text, search the translation dictionary for a target language text unit corresponding to the source language text unit to obtain an unordered sample in the target language.

[0058] For example, the source language text includes multiple source language text units, the source language text can be a source language sentence, and the source language text unit can specifically be a source language word. For example, the multiple source language words included in the source language sentence are respectively recorded as x_0, x_1, x_2, and x_3. By querying the translation dictionary, the target language text units such as target language words corresponding to x_0, x_1, x_2, and x_3 can be obtained. For example, the target language words corresponding to x_0, x_1, x_2, and x_3 are w_0, w_1, w_2, and w_1 respectively. Further, w_0, w_1, w_2, and w_1 constitute an unordered sample of the target language. Assume that w_0 and w_1 are words in the translation dictionary, and w_2 is not a word in the translation dictionary. At this time, w_2 can be as described above. <unk>, that is, w_2 is an out-of-vocabulary (OOV) word in the translation dictionary. In other words, the target language word corresponding to x_2 is not found in the translation dictionary. In addition, x_1 and x_3 correspond to w_1 respectively.

[0059] Optionally, the unordered samples include target language text units obtained by querying the translation dictionary, and preset text units that do not appear in the translation dictionary.

[0060] For example, the unordered sample of the target language includes target language text units such as w_0 and w_1 obtained by querying the translation dictionary, and preset text units such as w_2 that do not appear in the translation dictionary.

[0061] S402 : Obtain a first probability distribution of each text unit in the disordered sample according to the number of times each text unit in the disordered sample appears in the disordered sample.

[0062] For example, in the unordered sample of the target language, w_0 appears once, w_1 appears twice, and w_2 appears once. Therefore, according to the number of times w_0, w_1, and w_2 appear respectively, the unordered sample of the target language can be converted into the first probability distribution of each text unit in the unordered sample. The source language text composed of x_0, x_1, x_2, and x_3 as described above can also be recorded as the source language sample, and the first probability distribution can be recorded as the target language probability distribution of the source language sample. Specifically, the first probability distribution is p = {w_0: 0.25, w_1: 0.5, <unk>:0.25}.

[0063] S403: For each source language text unit in the source language text, generate a second probability distribution corresponding to the source language text unit, the second probability distribution including probability values of the source language text unit being translated into each target language text unit in the translation dictionary.

[0064] For example, for each source language text unit in the source language text, i.e., x_0, x_1, x_2, x_3, a second probability distribution corresponding to each word in x_0, x_1, x_2, and x_3 is generated. Taking x_0 as an example, assuming that the translation dictionary includes a total of 60 target language words, the probability value of x_0 being translated into each of the 60 target language words can be further predicted, thereby obtaining 60 probability values, which constitute the second probability distribution corresponding to x_0. Similarly, the second probability distributions corresponding to x_1, x_2, and x_3 can be calculated, which will not be repeated here.

[0065] Optionally, for each source language text unit in the source language text, generating a second probability distribution corresponding to the source language text unit includes: for each source language text unit in the source language text, generating a representation vector corresponding to the source language text unit; and passing the representation vector corresponding to the source language text unit through a non-autoregressive model to obtain the second probability distribution corresponding to the source language text unit.

[0066] like Figure 5 As shown, the source language text includes x_0, x_1, x_2, and x_3. x_0, x_1, x_2, and x_3 can each correspond to a representation vector, such as a word vector. The word vectors corresponding to x_0, x_1, x_2, and x_3 are input into the non-autoregressive model, so that the non-autoregressive model can output a second probability distribution for each word vector.

[0067] S404: Integrate the second probability distributions corresponding to each source language text unit to obtain a third probability distribution.

[0068] For example Figure 5 As shown in Figure 2, assuming that four word vectors are input to the non-autoregressive model, the non-autoregressive model can output four second probability distributions. Furthermore, LogSumExp is used to integrate these four second probability distributions to obtain a third probability distribution.

[0069] S405: Train a supervision model according to the first probability distribution and the third probability distribution.

[0070] For example Figure 5 As shown, a loss function is calculated based on the first probability distribution and the third probability distribution obtained in the above steps, thereby training the weakly supervised model. The loss function can specifically be a cross-entropy loss function.

[0071] In other embodiments, the supervised model is trained based on the source language text and the translation dictionary, including: Figure 6 The following steps are shown:

[0072] S601: For each source language text unit in the source language text, search the translation dictionary for a target language text unit corresponding to the source language text unit to obtain an unordered sample of the target language.

[0073] Specifically, the implementation method and specific principles of S601 and S401 are the same, and will not be repeated here.

[0074] Optionally, the unordered samples include target language text units obtained by querying the translation dictionary, and preset text units that do not appear in the translation dictionary.

[0075] For example, the unordered sample of the target language includes target language text units such as w_0 and w_1 obtained by querying the translation dictionary, and preset text units such as w_2 that do not appear in the translation dictionary.

[0076] S602: Obtain a first probability distribution of each text unit in the disordered sample according to the number of times each text unit in the disordered sample appears in the disordered sample.

[0077] Specifically, the implementation methods and specific principles of S602 and S402 are the same and will not be repeated here. For example, the first probability distribution is p={w_0: 0.25, w_1: 0.5, <unk>:0.25}.

[0078] S603. Normalize the first probability distribution according to a preset value to obtain a normalized first probability distribution, where the preset value represents the proportion of text units in the source language text that do not need to be translated during the translation process from the source language text to the target language text, and the normalized first probability distribution includes the preset value.

[0079] For example, this embodiment may also add a new hyperparameter alpha, which may be a preset value. Specifically, the preset value indicates the proportion of text units in the source language text that do not need to be translated during the translation process from the source language text to the target language text. Specifically, when the source language and the target language are fixed, the initial value of the hyperparameter is also fixed, but the hyperparameter can be further adjusted. For example, the initial value of the hyperparameter may be 0.5, and further, the hyperparameter may be adjusted to values such as 0.4 or 0.3. Specifically, according to each hyperparameter, a weak supervision model may be trained respectively, and further, according to the quality of each weak supervision model, a weak supervision model with the best quality may be selected as the final weak supervision model. Specifically, the initial value of the hyperparameter may be an empirical value or a statistical value, and the hyperparameter can reflect the proportion of words in the source language text that do not need to be translated during the translation process from the source language text to the target language text. Specifically, words that do not need to be translated can be recorded as special words <blank>, that is, the hyperparameter is a special word <blank>The prior probability distribution of . Further, according to the hyperparameters, the first probability distribution p = {w_0: 0.25, w_1: 0.5, <unk>:0.25} for normalization. For example, when alpha=0.5, the first probability distribution after normalization is p={w_0:0.125,w_1:0.25, <unk> :0.125, <blank>:0.5}.

[0080] S604: For each source language text unit in the source language text, generate a second probability distribution corresponding to the source language text unit, the second probability distribution including probability values of the source language text unit being translated into each target language text unit in the translation dictionary.

[0081] Specifically, the implementation method and specific principles of S604 and S403 are the same, and will not be repeated here. Figure 5 Each second probability distribution output by the illustrated non-autoregressive model may be a token-level probability distribution.

[0082] Optionally, the second probability distribution corresponding to each source language text unit further includes a probability value that the source language text unit does not need to be translated.

[0083] For example, taking x_0 as an example, when the word vector corresponding to x_0 is input into the non-autoregressive model, the second probability distribution output by the non-autoregressive model not only includes the probability value of x_0 being translated into each of the 60 target language words, but also includes the probability value of x_0 not being translated. In other words, each second probability distribution can be a 61-dimensional array.

[0084] S605: Integrate the second probability distribution corresponding to each source language text unit to obtain a third probability distribution.

[0085] Specifically, the implementation method and specific principle of S605 and S404 are consistent and will not be repeated here. Specifically, the third probability distribution can also be a 61-dimensional array.

[0086] S606: Train a supervision model according to the normalized first probability distribution and the third probability distribution.

[0087] It can be understood that the first probability distribution after the normalization process is p={w_0: 0.125, w_1: 0.25, <unk> :0.125, <blank>:0.5}, it can be seen that the current normalized first probability distribution is 4-dimensional. Further, on the basis of the 4-dimensionality, 0 can be filled so that the normalized first probability distribution can be expanded to 61 dimensions. The specific filling method is not limited here, but it is necessary to ensure that the position of each probability value in the normalized first probability distribution corresponds to the position of each probability value in the third probability distribution. For example, the position of the probability value corresponding to w_0 in the normalized first probability distribution is consistent with the position of the probability value corresponding to w_0 in the third probability distribution.

[0088] This embodiment provides a zero-resource machine translation model training method. Using only a translation dictionary, combined with weak supervision and self-training techniques, a usable machine translation system can be trained. This method overcomes the traditional method's reliance on a pivot language. This method is applicable to zero-resource or low-resource scenarios and can significantly improve the accuracy of zero-resource or low-resource machine translation systems.

[0089] Figure 7 The diagram of the structure of the translation model training device provided by the embodiment of the present disclosure. The translation model training device provided by the embodiment of the present disclosure can execute the processing flow provided by the translation model training method embodiment, such as Figure 7 As shown, the translation model training device 70 includes:

[0090] A generating module 71 is configured to generate a target language text based on a source language text and a translation dictionary, wherein the translation dictionary includes correspondences between source language text units and target language text units;

[0091] a replacement module 72 for replacing a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text;

[0092] The training module 73 is configured to train the translation model based on the source language text and the updated target language text.

[0093] Optionally, the translation model training device 70 also includes: a determination module 74, which is used to determine the target text unit corresponding to the preset text unit according to the context of the preset text unit in the target language text that does not appear in the translation dictionary before the replacement module 72 replaces the preset text unit in the target language text that does not appear in the translation dictionary with the target text unit.

[0094] Optionally, the generation module 71 includes a training unit 711 and a generation unit 712, the training unit 711 is used to train the supervision model according to the source language text and the translation dictionary to obtain a trained supervision model; the generation unit 712 is used to generate a target language text corresponding to the source language text according to the trained supervision model.

[0095] Optionally, the training unit 711 includes: a query subunit 7111, a statistics subunit 7112, a generation subunit 7113, an integration subunit 7114, and a training subunit 7115.

[0096] The query subunit 7111 is used to query the translation dictionary for a target language text unit corresponding to each source language text unit in the source language text, and obtain an unordered sample of the target language;

[0097] The statistics subunit 7112 is configured to obtain a first probability distribution of each text unit in the disordered sample according to the number of times each text unit in the disordered sample appears in the disordered sample;

[0098] The generating subunit 7113 is configured to generate, for each source language text unit in the source language text, a second probability distribution corresponding to the source language text unit, the second probability distribution including probability values of the source language text unit being translated into each target language text unit in the translation dictionary;

[0099] The integration subunit 7114 is configured to integrate the second probability distributions corresponding to each source language text unit to obtain a third probability distribution;

[0100] The training subunit 7115 is used to train the supervision model according to the first probability distribution and the third probability distribution.

[0101] Optionally, the unordered samples include target language text units obtained by querying the translation dictionary, and preset text units that do not appear in the translation dictionary.

[0102] Optionally, the training unit 711 also includes: a normalization processing sub-unit 7116, which is used for the statistical sub-unit 7112 to obtain the first probability distribution of each text unit in the unordered sample according to the number of times each text unit in the unordered sample appears in the unordered sample, and then normalize the first probability distribution according to a preset value to obtain the normalized first probability distribution, wherein the preset value represents the proportion of text units in the source language text that do not need to be translated in the translation process from the source language text to the target language text, and the normalized first probability distribution includes the preset value; accordingly, the second probability distribution corresponding to each source language text unit also includes the probability value that the source language text unit does not need to be translated; the training sub-unit 7115 is specifically used to: train the supervision model according to the normalized first probability distribution and the third probability distribution.

[0103] Optionally, the generation subunit 7113 is specifically used to: generate a representation vector corresponding to each source language text unit in the source language text; and obtain a second probability distribution corresponding to the source language text unit by passing the representation vector corresponding to the source language text unit through a non-autoregressive model.

[0104] Figure 7 The translation model training device of the illustrated embodiment can be used to implement the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0105] The above describes the internal functions and structure of the translation model training device, which can be implemented as an electronic device. Figure 8 This is a schematic diagram of the structure of an electronic device embodiment provided by the present disclosure. Figure 8 As shown, the electronic device includes a memory 81 and a processor 82 .

[0106] The memory 81 is used to store programs. In addition to the aforementioned programs, the memory 81 may also be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, images, videos, etc.

[0107] The memory 81 can be implemented by any type of volatile or non-volatile memory 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.

[0108] The processor 82 is coupled to the memory 81 and executes the program stored in the memory 81 to:

[0109] generating a target language text based on the source language text and a translation dictionary, wherein the translation dictionary includes correspondences between source language text units and target language text units;

[0110] Replacing a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text;

[0111] A translation model is trained based on the source language text and the updated target language text.

[0112] Further, if Figure 8 As shown, the electronic device may further include: a communication component 83, a power component 84, an audio component 85, a display 86 and other components. Figure 8 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 8 Components shown.

[0113] The communication component 83 is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device 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 83 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 83 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.

[0114] The power supply assembly 84 provides power to various components of the electronic device. The power supply assembly 84 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.

[0115] The audio component 85 is configured to output and / or input audio signals. For example, the audio component 85 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 81 or transmitted via the communication component 83. In some embodiments, the audio component 85 also includes a speaker for outputting audio signals.

[0116] The display 86 includes a screen, which 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 touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0117] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the translation model training method described in the above embodiment.

[0118] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or device that includes the element.

[0119] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.< / blank> < / unk> < / blank> < / unk> < / unk> < / blank> < / blank> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk> < / unk>

Claims

1. A translation model training method, wherein: The method comprises: generating a target language text based on a source language text and a translation dictionary, wherein the translation dictionary includes correspondences between source language text units and target language text units, wherein the source language text is a source language sentence and the source language text units are source language words; Replacing a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text, wherein the target text unit is determined based on the context of the preset text unit, and the updated target language text is the pseudo-label data after the replacement; Training a translation model based on the source language text and the updated target language text; The target language text is generated based on a trained supervised model, the trained supervised model is obtained based on a first probability distribution and a third probability distribution, the third probability distribution is obtained by integrating the second probability distribution corresponding to each source language text unit, the second probability distribution is obtained by each source language text unit in the source language text, the first probability distribution is obtained based on the number of occurrences of each text unit in an unordered sample of the target language in the unordered sample, and the unordered sample is obtained by querying the translation dictionary for a target language text unit corresponding to each source language text unit in the source language text; The unordered samples include target language text units obtained by searching the translation dictionary and preset text units that do not appear in the translation dictionary.

2. The method according to claim 1, wherein Before replacing the preset text units in the target language text that do not appear in the translation dictionary with the target text units, the method further includes: According to the context of the preset text unit in the target language text that does not appear in the translation dictionary, a target text unit corresponding to the preset text unit is determined.

3. The method according to claim 1, wherein Generate target language text based on source language text and translation dictionary, including: Training a supervision model according to the source language text and the translation dictionary to obtain a trained supervision model; A target language text corresponding to the source language text is generated according to the trained supervision model.

4. The method according to claim 3, wherein: Training a supervised model based on the source language text and the translation dictionary includes: For each source language text unit in the source language text, searching the translation dictionary for a target language text unit corresponding to the source language text unit to obtain an unordered sample of the target language; Obtaining a first probability distribution of each text unit in the disordered sample according to the number of times each text unit in the disordered sample appears in the disordered sample; For each source language text unit in the source language text, generating a second probability distribution corresponding to the source language text unit, the second probability distribution including probability values of the source language text unit being translated into each target language text unit in the translation dictionary; Integrating the second probability distributions corresponding to each source language text unit to obtain a third probability distribution; The supervised model is trained according to the first probability distribution and the third probability distribution.

5. The method according to claim 4, wherein After obtaining a first probability distribution of each text unit in the disordered sample according to the number of times each text unit in the disordered sample appears in the disordered sample, the method further includes: Normalizing the first probability distribution according to a preset value to obtain a normalized first probability distribution, wherein the preset value represents a proportion of text units in the source language text that do not need to be translated during the translation process from the source language text to the target language text, and the normalized first probability distribution includes the preset value; Correspondingly, the second probability distribution corresponding to each source language text unit also includes a probability value that the source language text unit does not need to be translated; Training a supervised model according to the first probability distribution and the third probability distribution includes: The supervised model is trained according to the normalized first probability distribution and the third probability distribution.

6. The method according to claim 4, wherein: For each source language text unit in the source language text, generating a second probability distribution corresponding to the source language text unit includes: For each source language text unit in the source language text, generating a representation vector corresponding to the source language text unit; The representation vector corresponding to the source language text unit is passed through a non-autoregressive model to obtain a second probability distribution corresponding to the source language text unit.

7. A translation model training device, wherein: include: a generating module for generating a target language text based on a source language text and a translation dictionary, wherein the translation dictionary includes a correspondence between source language text units and target language text units, wherein the source language text is a source language sentence and the source language text units are source language words; a replacement module, configured to replace a preset text unit in the target language text that does not appear in the translation dictionary with a target text unit to obtain an updated target language text, wherein the target text unit is determined based on the context of the preset text unit, and the updated target language text is the pseudo-label data after the replacement; A training module, configured to train a translation model based on the source language text and the updated target language text; The target language text is generated based on a trained supervised model, the trained supervised model is obtained based on a first probability distribution and a third probability distribution, the third probability distribution is obtained by integrating the second probability distribution corresponding to each source language text unit, the second probability distribution is obtained by each source language text unit in the source language text, the first probability distribution is obtained based on the number of occurrences of each text unit in an unordered sample of the target language in the unordered sample, and the unordered sample is obtained by querying the translation dictionary for a target language text unit corresponding to each source language text unit in the source language text; The unordered samples include target language text units obtained by searching the translation dictionary and preset text units that do not appear in the translation dictionary.

8. An electronic device, wherein: include: Memory; processor; as well as computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data-enhanced machine translation method based on similar word and synonym replacement

    CN108920473A

  • Method for expanding corpus and training method and product for translation model

    CN113268996A