Low-resource neural machine translation method and system based on data enhancement

Through data enhancement technology, parallel corpora and monolingual corpora of low-resource languages ​​are used for negative sampling and edit distance constrained sampling, combined with discriminator sub-model screening, to solve the problem of sparse translation data between low-resource languages ​​and improve translation quality and efficiency.

CN113673259BActive Publication Date: 2024-09-17TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110857215.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-28
Publication Date
2024-09-17
Estimated Expiration
2041-07-28

AI Technical Summary

Technical Problem

Machine translation between low-resource languages ​​faces the problem of data sparseness, which prevents the effective application of neural machine translation models. It is difficult for existing technologies to use translation models for high-resource languages ​​to perform high-quality translation between low-resource languages.

Method used

Through data enhancement-based methods, parallel corpora and monolingual corpora on low-resource language pairs are used for data enhancement, including negative sampling, edit distance constrained sampling and discriminator sub-model screening, to construct high-quality pseudo data for training low-resource language pairs. Source Neural Machine Translation Model.

Benefits of technology

It effectively solves the resource shortage problem in low-resource neural machine translation, improves translation quality and efficiency, and achieves high-quality translation between low-resource languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113673259B
    Figure CN113673259B
Patent Text Reader

Abstract

The present invention provides a method and system for low-resource neural machine translation based on data enhancement, wherein the method comprises: determining real data to be translated; inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; wherein the neural machine translation model is obtained by training a low-resource neural machine translation model after data enhancement based on original real data including parallel corpora and monolingual corpora on low-resource language pairs. The embodiment of the present invention realizes the application of sparse data to a neural machine translation model of low-resource neural machine translation, which can efficiently and accurately solve the problem of resource scarcity in low-resource neural machine translation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine translation, and in particular to a low-resource neural machine translation method and system based on data enhancement. Background Art

[0002] Translation between low-resource languages ​​and Chinese is an urgent and important task at present. In order to achieve automatic machine translation, the commonly used technologies include statistical-based and neural network-based methods, the former is statistical machine translation, and the latter is neural machine translation. In order to obtain a reliable translation model, it is necessary to collect large-scale, high-quality parallel corpora. High-quality parallel corpora often only exist between a few languages ​​and are limited to certain specific fields, such as government documents, news, etc., while corpora in other fields are relatively scarce. In addition to corpora in specific fields, some languages ​​themselves are resource-poor, and it is very difficult to find or obtain available parallel corpora on the Internet. At present, neural machine translation has surpassed traditional statistical machine translation in translation quality, but the main disadvantage is that the training of the translation model is highly dependent on large-scale parallel corpora.

[0003] The large amount of corpora on the Internet makes it possible to obtain parallel corpora covering multiple languages ​​and fields. However, among the corpora obtained from the Internet, there are few corpora belonging to specific fields. For example, news corpora are relatively easy to obtain, but corpora in specific fields such as government, film, trade, education, sports, literature, and medicine are difficult to obtain. If the training set, development set (used to tune the trained model) and test set belong to the same field, then the translation results (on the corpora in the field) are very good, otherwise the translation results (on the corpora outside the field) are very poor. Although the research on neural machine translation for high-resource languages ​​has achieved outstanding results, in the machine translation task of low-resource languages, parallel corpora themselves are difficult to obtain, not to mention parallel corpora in specific fields. The problem caused by this is data sparsity. If the translation model is not fully trained, even the most popular and effective neural machine translation method for high-resource language pairs is difficult to use for low-resource machine translation. Therefore, low-resource machine translation is one of the problems that need to be solved as soon as possible. Summary of the invention

[0004] The embodiments of the present invention provide a low-resource neural machine translation method and system based on data enhancement, so as to solve the problem that the neural machine translation model cannot be applied to low-resource neural machine translation due to data sparsity.

[0005] In a first aspect, an embodiment of the present invention provides a data enhancement method for low-resource neural machine translation based on data enhancement, comprising:

[0006] Determine the real data to be translated;

[0007] Inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model;

[0008] The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0009] Furthermore, the neural machine translation model is obtained by training the low-resource neural machine translation model after data enhancement based on original real data including parallel corpora and monolingual corpora on low-resource language pairs, including:

[0010] Acquire original real data including parallel corpora and monolingual corpora on low-resource language pairs, and perform negative sampling on the original real data to obtain negative sample data;

[0011] Training a discriminator sub-model based on the original real data and the negative sample data to obtain an evaluation model;

[0012] The original real data is constructed into pseudo data based on data enhancement of edit distance, and the pseudo data is screened based on the evaluation model to obtain screened data;

[0013] The filtered data and the original real data are combined to construct enhanced data, and a low-resource neural machine translation model is trained using the enhanced data and an encoder / decoder translation framework based on an attention mechanism to obtain the neural machine translation model.

[0014] Furthermore, the original real data comes from a public data set or manually prepared data;

[0015] The low-resource language pairs are language pairs whose parallel corpus size is smaller than a preset value and are from a public dataset;

[0016] The monolingual corpus is a monolingual corpus of a source language or a target language in a low-resource language, and is derived from manually prepared data;

[0017] The negative sampling of the original real data to obtain negative sample data includes: generating negative sample data by randomly discarding or randomly adding the original real data.

[0018] Furthermore, after obtaining the original real data including the parallel corpus and the monolingual corpus on the low-resource language pair, the method further includes:

[0019] The original real data including the source language or the target language is subjected to a preprocessing of cleaning data and a secondary preprocessing including cleaning data, eliminating blank lines, eliminating illegal characters and non-English characters on the target end.

[0020] Furthermore, the original real data is constructed into pseudo data based on the edit distance data enhancement, including:

[0021] Performing edit distance sampling on the original real data based on the edit distance sub-model;

[0022] Select the position of the replacement word based on the position sub-model and the sampled edit distance;

[0023] A new word is substituted at the position of the replacement word based on the replacement sub-model to obtain pseudo data.

[0024] Furthermore, the edit distance sub-model is expressed as follows:

[0025]

[0026] Where τ represents the temperature hyperparameter, c(d,I) represents the number of sentences with an edit distance of d(d∈{0,1,2,3,…,I}) from a sentence of length I;

[0027] The position sub-model is expressed as follows:

[0028]

[0029] The replacement submodel is expressed as follows:

[0030] P(w j |x,d,p)=P(w i |w i-1 ,p i );

[0031] Among them, w j is the sampled new word in step j, p j is the sampling position.

[0032] Furthermore, the discriminator sub-model is used to distinguish the distribution of original real data from the distribution of pseudo data, including a discriminator loss function, which is expressed as follows:

[0033]

[0034] in, is the loss function, is the discriminator, P r (x) is the distribution of the original real data.

[0035] In a second aspect, an embodiment of the present invention provides a low-resource neural machine translation system based on data enhancement, comprising:

[0036] A data determination unit, used for determining real data to be translated;

[0037] A machine translation unit, used for inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model;

[0038] The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0039] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the low-resource neural machine translation method based on data enhancement are implemented as described in any one of the items provided in the first aspect above.

[0040] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a low-resource neural machine translation method based on data enhancement as described in any one of the items provided in the first aspect above.

[0041] The embodiment of the present invention provides a method and system for low-resource neural machine translation based on data enhancement, which obtains a neural machine translation result output by the neural machine translation model by inputting real data into the neural machine translation model; wherein the neural machine translation model is obtained by training the low-resource neural machine translation model after data enhancement based on the original real data including parallel corpora and monolingual corpora on low-resource language pairs. The present invention realizes the application of sparse data to the neural machine translation model of low-resource neural machine translation, which can efficiently and accurately solve the problem of resource scarcity in low-resource neural machine translation. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0043] Figure 1 It is a flowchart of a low-resource neural machine translation method based on data enhancement provided by the present invention;

[0044] Figure 2 It is a schematic diagram of the training process of the neural machine translation model provided by the present invention;

[0045] Figure 3 It is a data enhancement architecture diagram based on edit distance constraint sampling provided by the present invention;

[0046] Figure 4 is a sample diagram of the process of generating negative samples provided by the present invention;

[0047] Figure 5 It is a schematic diagram of the construction process of pseudo data provided by the present invention;

[0048] Figure 6 Schematic diagram of the word-level data enhancement method provided by the present invention;

[0049] Figure 7 It is a structural schematic diagram of a low-resource neural machine translation system based on data enhancement provided by the present invention;

[0050] Figure 8 It is a structural schematic diagram of a machine translation unit provided by the present invention;

[0051] Fig. 9 It is a structural schematic diagram of a data screening unit provided by the present invention;

[0052] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

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

[0054] Technical concept of the present invention: The translation quality of neural machine translation is closely related to the quantity and quality of training corpus. In order to train a high-quality neural machine translation model, commercial-level translation systems often finely process (filter) bidirectional parallel corpora of tens of millions or even hundreds of millions of levels and train models. In resource-rich languages ​​such as English, French, German, and Chinese, corpora of this scale are fully accessible. However, for resource-poor languages, it is very difficult to obtain large-scale parallel corpora. Relevant research work has proved that under the premise of limited parallel corpus scale, the translation quality of neural machine translation is not as good as statistical machine translation. Therefore, how to achieve high-quality neural machine translation under the premise of limited parallel corpus scale has become a research hotspot in the machine translation community. In addition, language itself also has historical, cultural and regional characteristics. In many resource-poor languages, these characteristics are very obvious, which also brings some challenges to the research of low-resource neural machine translation.

[0055] The purpose of the present invention is to achieve high-quality data enhancement. Although different scholars have used monolingual corpora to generate bilingual corpora through data enhancement methods, it is difficult to avoid syntactic and semantic errors in the generated pseudo data, whether it is sentence-level enhancement (generating pseudo data by back-translation on monolingual corpora) or word-level enhancement (replacing words in low-resource languages ​​with words in high-resource languages, that is, using the word vector method to build a dictionary, and then replacing words in high-resource languages ​​with words in low-resource languages). In other words, whether it is possible to construct high-quality pseudo data through existing monolingual data or bilingual data, make full use of existing data to expand the scale of bilingual data, and further improve the quality of low-resource neural machine translation. For example, the source end (Uzbek, Uz) or the target end (Chinese, Zh) in the existing low-resource language pair Uzbek → Chinese (Uz → Zh) is enhanced by the method proposed in the present invention to achieve better translation effect. Although the data set of low-resource languages ​​is much less, it is necessary to try to avoid the situation where the translation quality decreases due to data sparsity. If a method for training a better translation model between low-resource languages ​​or between high-resource and low-resource languages ​​can be proposed based on efficient and easy-to-use data enhancement technology, this problem will not be troubled again. Therefore, a low-resource neural machine translation method based on data enhancement of edit distance constraint sampling is proposed in the present invention. The constrained sampling method based on edit distance is more effective than other random sampling methods used in the original text. In addition, the present invention also designs a discriminator sub-model to select higher quality data after generation, and uses the sub-model to screen out pseudo-data with fewer syntactic and semantic errors to a certain extent. In summary, a simple and effective data enhancement method is urgently needed in low-resource machine translation to solve the problem that it is difficult to ensure the quality of pseudo-data in the prior art, improve the performance of low-resource neural machine translation, improve translation efficiency, and obtain more accurate and large amounts of data.

[0056] Combine the following Figure 1-Figure 10 The present invention describes a low-resource neural machine translation method and system based on data enhancement.

[0057] An embodiment of the present invention provides a low-resource neural machine translation method based on data enhancement. Figure 1 A flowchart of a low-resource neural machine translation method based on data enhancement provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0058] Step 110, determining the real data to be translated;

[0059] Step 120, inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model;

[0060] The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0061] The method provided by the embodiment of the present invention can efficiently and accurately solve the resource scarcity problem in low-resource neural machine translation by inputting real data into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model.

[0062] Based on any of the above embodiments, Figure 2 As shown, the neural machine translation model is obtained by training the low-resource neural machine translation model based on original real data including parallel corpora and monolingual corpora on low-resource language pairs after data enhancement, including:

[0063] Step 210, obtaining original real data including parallel corpora and monolingual corpora on low-resource language pairs, and performing negative sampling on the original real data to obtain negative sample data;

[0064] Specifically, parallel corpus and monolingual corpus on low-resource language pairs are prepared as original real data.

[0065] Several elements for preparing parallel corpora and monolingual corpora for low-resource language pairs:

[0066] A. Factors to consider when choosing low-resource language pairs are the size of the parallel corpus, the number of non-repeated words in the monolingual corpus, and the degree of recognition of the dataset.

[0067] B. Generally speaking, the low-resource language pairs mentioned here refer to language pairs with very few parallel corpora, such as language pairs with a parallel corpus size of less than 1 million, less than 500,000, less than 200,000, or even less than 10,000.

[0068] C. The monolingual corpus used in the present invention is the monolingual corpus of the source language or the target language in the low-resource language, rather than the monolingual corpus of the language in other high-resource language pairs.

[0069] D. At the same time, the quality of the monolingual corpus also needs to be carefully considered, because in the present invention, the monolingual corpus is always considered to be the original real data. If the quality of the prepared monolingual corpus is problematic, poor quality samples may appear when constructing pseudo data through the method proposed in the present invention.

[0070] E. Monolingual corpus must be manually prepared, not machine-generated data. If the monolingual corpus is not manually prepared, then the monolingual corpus cannot be called real data. The monolingual corpus required in the present invention is not only original data, but also real data.

[0071] Step 220, training a discriminator sub-model based on the original real data and the negative sample data to obtain an evaluation model;

[0072] Specifically, when using the negative sampling method to generate negative samples on the original real data, the more noise the generated samples contain, the better. If the negative samples contain more noise, the performance of the trained discriminator sub-model will be better. When training the discriminator sub-model, positive samples and negative samples are required, and D r (X) and D n (X) indicates that the negative sampling method (Negative Sampling) used in the present invention is a random omission method. In fact, as long as D n There is enough noise in (X) to r (X) Generate D n (X) Other methods can also be used. If D n If there is not enough noise in (X), it may affect the performance of the discriminator sub-model.

[0073] That is to say, on the original real data, the negative sampling method is used to construct new negative sample data, that is, noisy data that is different from the original real data.

[0074] A discriminator sub-model is trained as an evaluation model (Evaluator Model) using the original real data and the negative samples obtained by negative sampling. Data enhancement methods (whether word-level or sentence-level methods) are difficult to guarantee the quality of pseudo data, and even cannot guarantee the semantic and syntactic integrity of pseudo data at all. Therefore, the present invention designs a discriminator sub-model, which can also be said to be a screening model or a filter model. This model is an independent part in the present invention, that is, the discriminator sub-model will not be trained together with the data enhancement module based on edit distance constraint sampling, but will be trained independently. Using the pseudo data generated by the data enhancement module as the input of the discriminator sub-model helps to build higher quality pseudo data.

[0075] Step 230, constructing the original real data into pseudo data based on the data enhancement of the edit distance, and filtering the pseudo data based on the evaluation model to obtain filtered data;

[0076] Specifically, in the positive sample P r (X), the original real data D is enhanced by the constrained sampling data enhancement method based on edit distance proposed in the present invention. r (X), the constructed data distribution is Through real data D r (X), a data enhancement method based on edit distance constraint sampling is used to generate pseudo data, and the discriminator sub-model proposed in the present invention is used to screen the data, which can reduce syntactic and semantic errors to a certain extent. Therefore, the data enhancement method proposed in the present invention is superior to the previous methods in terms of overall architecture.

[0077] Augmenting the original parallel corpus on the low-resource language pair from the original real data through edit distance constrained sampling, that is, constructing pseudo data through the data augmentation method proposed in the present invention, thereby improving the performance of the low-resource neural machine translation model. This plays a core role in the present invention, because a large amount of pseudo data is constructed through the edit distance constrained sampling method, thereby achieving the improvement of the performance of the low-resource neural machine translation model.

[0078] In order to further ensure the fluency and fidelity of the pseudo data, the discriminator sub-model is used for screening, thereby retaining the best quality data. In other words, the discriminator sub-model is used to remove sentences containing syntactic or semantic errors, mainly to screen the pseudo data generated by the core algorithm proposed in the present invention, so as to further improve the quality of the pseudo data.

[0079] Figure 3 The structure of the core data enhancement module and the discriminator sub-model proposed in this invention is given. Let x = x1, x2, x3…, x i ,…,x I is a source sentence containing I words, and y = y1, y2, y3…, y j ,…,y J is the target sentence containing J words, Represents the original training data containing M sentences. Figure 3 As shown, the data augmentation task is formalized as follows: given the distribution P of real data r (x), the enhancement task is to r(x) is used to train the enhanced model and generate pseudo data. The pseudo data distribution generated by the model proposed in the present invention is Close to P r (x).

[0080] like Figure 4 The negative sampling method shown is based on the original real data P r (x) Sample some negative samples P n (x), used to train the discriminator sub-model; then on the original real data P r (x) The process of step D explained in the description of the present invention (the highlight and the core point of the present invention), that is, the method of editing distance constraint sampling to generate pseudo data Next, the negative sample P constructed by the negative sampling method n (x) and the original real data P r (x) Train the discriminator sub-model Then the dummy data Using the discriminator sub-model The best quality data is further screened out, that is, data with few syntactic and semantic errors, or even data with no grammatical errors at all. Finally, the screened high-quality data is combined with the original real data to generate large-scale data, thereby achieving data enhancement and effectively solving the problem of performance inability to improve low-resource neural machine translation tasks due to insufficient data resources.

[0081] Step 240: Combine the screened data and the original real data to construct enhanced data, and use the enhanced data and an encoder / decoder translation framework based on an attention mechanism to train a low-resource neural machine translation model to obtain the neural machine translation model.

[0082] Specifically, a large amount of pseudo data and the most original small amount of real data are screened out and merged to construct larger-scale data, thereby realizing data enhancement. Through this process, the characteristics of neural machine translation for data hunger (Data Hungry) can be met, and the problem that the low-resource neural machine translation model cannot be improved in performance due to insufficient data can be solved to a certain extent, so that the performance of the neural network machine translation model between resource-poor languages ​​or between these languages ​​and resource-rich languages ​​can be improved. After realizing data enhancement by the method proposed in the present invention, the low-resource neural machine translation model is trained. The neural machine translation model used in the present invention adopts an encoder-decoder architecture based on an attention mechanism, and an RNN network (Recurrent Neural Network) based on LSTM (Long-Short Term Memory) is used in both the encoder and decoder ends.

[0083] The filtered data and the original real data are combined to construct high-quality enhanced data, on which the low-resource neural machine translation model is trained using the encoder-decoder neural machine translation framework based on the attention mechanism. The neural machine translation model based on the encoder-decoder architecture of the attention mechanism is trained on the training corpus in the training set to obtain the neural machine translation model parameters for low-resource languages; specifically, the model parameters include word vectors on the source language side and the target language side, as well as model weight matrix parameters.

[0084] The training process of the translation model is as follows:

[0085] First, we obtain the word vector of each word in the input sentence, which is implemented through the preprocessing step of the RNN language model:

[0086] F1. The RNN language model consists of three parts: the look-up layer, the hidden layer, and the output layer. Each word contained in the input sentence is converted into the corresponding word vector representation through the look-up layer:

[0087] x t =look-up(s) (1)

[0088] Among them, x t is the word vector representation of s, s is the input of each time period t, and look-up represents the look-up layer.

[0089] F2. For the parallel sentence pair obtained in step A, let its source be x=x1,…,x i ,…,x I , the target end is y=y1,…,y j ,…,y J Neural machine translation often factors sentence-level translation probabilities into word-level probabilities:

[0090]

[0091] where θ is a series of model parameters, y <j is a partial translation. If the training set is

[0092]

[0093] The training goal is to maximize the log-likelihood on the training set:

[0094]

[0095] The decision rule for translation is to use the learned model parameters for a source sentence x that has not been encountered (i.e., not trained) Get the target sentence with the highest translation probability

[0096]

[0097] Specifically, in maximizing The translation probability is obtained by maximizing the word This is achieved by using the word-level translation probability:

[0098]

[0099] After steps F1 and F2, the following steps are required:

[0100] F3. After the input obtained through step F2, further processing is required. A bidirectional LSTM is used on the encoder side to obtain the representation of the entire source sentence. Because GRU is also a unit of the RNN network, and it has been explained in step F1, the RNN language model consists of a look-up layer, a hidden layer, and an output layer. In step F1, the word vector representation of each word is obtained through RNN, and then the result is used as the input of the encoder, that is, the information prepared for the hidden layer in the encoder stage. When the hidden layer calculates the current hidden state, the output of the look-up layer is used as the input, that is, according to the word vector of each word and the previous hidden state information, the word is mapped to a context vector:

[0101] h t =f(x t ,h t-1 ), (7)

[0102] Where f is an abstract function that is used to generate a t and the historical state h t-1 Under the premise of , calculate the current new hidden state. The initial state h0 is often set to 0, and the form of the f function is generally h t =σ(W xh x t +W xh h t-1 ), where σ is a nonlinear function (such as sigmoid or tanh, etc.).

[0103] Therefore, the forward state of the bidirectional BiRNN is calculated according to the following formula:

[0104]

[0105] in,

[0106]

[0107]

[0108]

[0109] is the word vector matrix, and is the weight matrix, n×m are the word vector dimension and hidden state dimension respectively, and σ is the sigmoid function.

[0110] Reverse state The calculation method is similar to the forward state. The word embedding matrix is ​​shared between the forward and reverse states. But the weight matrix is ​​not shared. After merging the forward and reverse states, we get in,

[0111]

[0112] The decoder of the translation model uses a unidirectional RNN, which is different from the encoder which uses a bidirectional RNN.

[0113] The decoder also has corresponding hidden states, but they are different from the encoder’s hidden states. The detailed calculation process is as follows:

[0114]

[0115] in,

[0116]

[0117] z i =σ(W z Ey i +U z s i-1 +C z c i ), (15)

[0118] r i =σ(W r Ey i +U r s i-1 +C r c i ), (16)

[0119] E is the word vector matrix of each word contained in the target language sentence, and is the weight matrix, m, n are the word vector dimension and hidden state dimension respectively, and σ is the sigmoid function. The initial hidden state s0 is calculated as follows:

[0120]

[0121] in,

[0122] The context word vector is recalculated at each time step:

[0123]

[0124] in,

[0125]

[0126]

[0127] h j is the hidden state corresponding to the jth word in the source sentence, and are all weight matrices.

[0128] Based on any of the above embodiments, the original real data comes from a public data set or manually prepared data;

[0129] Specifically, the constructed datasets come from five public datasets: NIST, Tanzil, WMT14, IWSLT14, and IWSLT15. The NIST dataset contains Chinese → English (Zh→En); the Tanzil dataset contains Azerbaijani → English (Az→En), Hindi → English (Hi→En), Uzbek → English (Uz→En), Uyghur → English (Ug→En), and Turkish → English (Tr→En); WMT14 contains English → German (En→De); IWSLT14 contains German → English (De→En); and IWSLT15 contains Vietnamese → English (Vi→En). The corresponding training set, development set, and test set are selected according to each language pair; it should be emphasized that the parallel corpus mentioned here does not have special annotation information such as language direction (for example, <2ch> indicates the language direction from the source language to Chinese, etc.).

[0130] The low-resource language pairs are language pairs whose parallel corpus size is smaller than a preset value and are from a public dataset;

[0131] The monolingual corpus is a monolingual corpus of a source language or a target language in a low-resource language, and is derived from manually prepared data;

[0132] The negative sampling of the original real data to obtain negative sample data includes: generating negative sample data by randomly discarding or randomly adding the original real data.

[0133] Specifically, the negative sampling method used when generating negative samples is to randomly discard a word so that the original real sentence produces grammatical errors (semantic errors or syntactic errors). Furthermore, because there are many negative sampling methods, in order to make the negative sample contain enough noise to train a better discriminator, the method of randomly discarding words is selected from many negative sampling methods. In fact, it is also possible to randomly select a position to insert a new word to break the integrity of the entire sentence, or randomly select different words from the original sentence and exchange positions. However, other methods cannot generate enough noise in most cases, so the present invention selects a method of randomly discarding words.

[0134] Some negative samples are generated by negative sampling. Let's assume that the source end is enhanced, so temporarily only negative sampling is performed on the source end to generate some negative samples. In fact, the enhancement of the target end is similar, that is, when the target end needs to be enhanced, negative sampling is performed on the target end monolingual material. Suppose the original real data is The generated negative sample data is Generate new negative samples by randomly discarding or randomly adding, such as the original real sentence S r =w1,w2,w3…,w i ,…,w I , after random deletion (assuming w2 is deleted), the negative sample is Its length changes from I to I-1; after random increase (assuming that w i Add the word w at the end l ) The negative sample after is Its length changes from I to I+1.

[0135] Figure 4 A process for generating negative samples is given. The discriminator submodel mentioned in the present invention is the core part of the present invention and one of the highlights. Since negative samples need to be prepared for training the discriminator submodel, the generation of negative samples is also an important part of the present invention. The negative samples used are based on the original real data D r (x) by attaching Figure 4 The negative sampling method shown is used to construct the noisy negative sample data D n (x).

[0136] Negative sampling is also widely used in many tasks in the field of machine learning and natural language processing. Negative sampling refers to randomly generating some negative examples related to the positive examples in the training data. Negative sampling plays different roles in different machine learning tasks. For example, in contrastive learning, negative sampling is used to achieve the training goal of contrastive learning, so that the distance between the representation of positive examples and negative examples increases. In word2vec, negative sampling is used to reduce the number of parameters updated each time the model is updated, which can effectively improve training efficiency. In machine translation tasks, the use of negative sampling also follows its usage in machine learning, that is, in machine translation, the original real sentence S is replaced by the original real sentence S. r =w1,w2,w3…,w i ,…,w I Generate new sequences by adopting the "negative sampling" strategy But the newly generated sentence and the original sentence S r There are some differences. In most cases, With S r There is a gap at the syntactic or semantic level, which is what negative sampling hopes to achieve.

[0137] like Figure 4 As shown, the commonly used negative sampling method is to extract the original real sentence S r Randomly delete some sentence components (core components) or randomly add some components (irrelevant components) to generate Try to include some syntactic or semantic errors. r generate Sometimes, some samples without syntactic and semantic errors are generated, which are more like positive samples than negative samples. r Generated by random deletion There is a syntax error in (deleted "is"), but There is no grammatical error in (deleting "carefully"). Similarly, Generated by random addition There is a syntax error in (added "math") while There is no syntax error in (adding "now"). In the process of negative sampling, we hope to generate as much as possible similar Such grammatically incorrect sentences, rather than sentences like Such sentences without grammatical errors, therefore, will use a more extreme method in negative sampling to ensure that the sampled samples are negative samples as much as possible and avoid positive samples.

[0138] In order to solve the data scarcity problem faced by neural machine translation in low-resource scenarios, this paper proposes a constrained sampling strategy method. In this method, in order to train a discriminator sub-model, some negative samples need to be prepared. r Generate negative samples D by randomly deleting some words on (x) n (x).

[0139] Based on any of the above embodiments, after obtaining the original real data including the parallel corpus and the monolingual corpus on the low-resource language pair, the method further includes:

[0140] The original real data including the source language or the target language is subjected to a preprocessing of cleaning data and a secondary preprocessing including cleaning data, eliminating blank lines, eliminating illegal characters and non-English characters on the target end.

[0141] Specifically, the step of preprocessing the data includes data processing of the source language text and the target language text in the data set, such as using the preprocessing tool provided by NiuTrans to clean the data and eliminate illegal characters (the target end of the parallel sentence pairs used in the experiment of the present invention is English). In addition, a series of preprocessing tools are developed using the Python language to perform some operations, including secondary preprocessing (cleaning the data again, eliminating blank lines, eliminating illegal characters and non-English characters on the target end, etc.). In the preprocessing stage, the data in languages ​​other than Chinese are segmented using the tokenizer.perl provided by the statistical machine translation open source system MOSES, and the Chinese data are segmented using the THULAC toolkit (a Chinese word segmentation tool proposed by the natural language processing of University A and the key laboratory of B). Then for all corpora, the BPE method is used for subword segmentation.

[0142] Based on any of the above embodiments, Figure 5 As shown, the data enhancement based on the edit distance constructs the original real data into pseudo data, including:

[0143] Step 510, performing edit distance sampling on the original real data based on the edit distance sub-model;

[0144] Step 520, selecting a replacement word position based on the position sub-model and the sampled edit distance;

[0145] Step 530: Replace the new word at the position of the replacement word based on the replacement sub-model to obtain pseudo data.

[0146] Specifically, data augmentation based on edit distance constraint sampling is also a word-level data augmentation method, that is, the process of word replacement. This step can be regarded as a restricted constraint sampling process, which can be divided into three sub-steps: the first step is edit distance sampling, the second step is to calculate the position according to the edit distance, and the third step is to calculate the replaced word according to the first two steps.

[0147] Figure 6 This gives one of the most commonly used methods in the field of data augmentation, which is often used in both neural machine translation and other tasks in natural language processing.

[0148] Data augmentation methods refer to methods that expand the scale of training data. Not only in machine translation, but also in natural language processing tasks such as dialogue generation, question answering, machine writing, and natural language inference, data augmentation has been widely used.

[0149] In machine translation, the commonly used data augmentation methods are mainly carried out from two perspectives: "word level" and "sentence level".

[0150] Word-level data augmentation includes methods such as randomly replacing words, randomly inserting some words, randomly deleting words, and randomly swapping the positions of different words to achieve data augmentation. For example, randomly select a word from the original sentence and then replace it with a word in the dictionary (in Figure 6 replace "于" with "着", "故事" with "材料"), or randomly select a word from the original sentence and swap its position with other words in the sentence ( Figure 6 in the original sentence, "现在" was the second word, but in the generated first sentence it swapped positions with the first word) to generate a new sentence. A typical work of word-level data augmentation methods is the random replacement method proposed by Fadaee et al.

[0151] Sentence-level data augmentation mainly uses methods such as back translation (BT), forward translation (FT), and some modified versions of back translation, such as tagged back translation (Tagged BT), etc. to perform data augmentation. Among various sentence-level data augmentation methods, the commonly used method is back translation. Its core idea is to first make full use of the existing bilingual data and train a reverse neural machine translation model, and then construct pseudo source-side sentences through the monolingual data on the target side, so as to form pseudo parallel data, which is merged with the original bilingual corpus for data augmentation.

[0152] However, whether it is the sentence-level BT method or the word-level replacement, exchange and other methods, some sentences containing grammatical errors are often generated, which are actually undesirable sentences. Therefore, in order to alleviate the grammatical problem after data enhancement to a certain extent, a method for generating high-quality data based on edit distance constrained sampling is proposed.

[0153] Based on any of the above embodiments, the edit distance sub-model is expressed as follows:

[0154]

[0155] Where τ represents the temperature hyperparameter, c(d,I) represents the number of sentences with an edit distance of d(d∈{0,1,2,3,…,I}) from a sentence of length I;

[0156] The position sub-model is expressed as follows:

[0157]

[0158] The replacement submodel is expressed as follows:

[0159] P(w j |x,d,p)=P(w i |w i-1 ,p i ); (twenty three)

[0160] Among them, w j is the sampled new word in step j, p j is the sampling position.

[0161] Specifically, the present invention develops a constrained sampling method for low-resource neural machine translation. The enhancement steps of the present invention are roughly the same as the pure word replacement method, but a different sampling method is used instead of random sampling to replace words. Let P r (x) is the actual data distribution, represents a fake sentence generated based on the original sentence x. Given x, use Represents pseudo data The distribution of enhanced data can be expressed as:

[0162]

[0163] Generate from x by replacing words based on edit distance For example, suppose x is "I like the book", For "I like a movie", the edit distance is 2, the positions of the replaced words are 3 and 4, and the replaced words are "a" and "movie". More formally, let d represent x and The edit distance between them, P = {p1,…,p d} represents the position of the replaced word, P = {w1,…,w d} represents a list of replacement words. In the above example, d = 2, p1 = 3, p2 = 4, w1 = "a", w2 = "movie". According to the distribution of the original real data P r (x), the enhancement distribution is defined as:

[0164]

[0165]

[0166] More precisely, the constrained sampling method in this paper consists of the following three parts:

[0167] D1. Sample the edit distance d according to the real data samples. Mainly based on the idea of ​​edit distance, the edit distance sub-model is defined as follows:

[0168]

[0169] Where τ represents the temperature hyperparameter, which restricts the search space around the original sentence. It can be inferred that a larger τ will obtain more samples with longer edit distances. c(d,I) represents the number of sentences with edit distance d (d∈{0,1,2,3,…,I}) from the sentence of length I, which can be obtained as follows:

[0170]

[0171] in Represents a vocabulary.

[0172] D2. When replacing a word, the position of the word needs to be selected based on the sampled edit distance d. The position sub-model is defined as follows:

[0173]

[0174] According to the above sampling method, we obtain the position set P = {p1, p2, p3, ..., p d}. This approach roughly guarantees that the edit distance between the new sentence and the initial sentence is d.

[0175] D3, the replacement model will be at each sampling position p j This process will be carried out for a total of d steps. In each step (assuming it is the jth step), we can replace the new word with the new word from the distribution P(w|X j-1 ,p=p j ) to sample a new word w j , then in X j-1p j Positionally replace old words to generate X j . Finally, the replacement submodel is defined as:

[0176] P(w j |x,d,p)=P(w i |w i-1 ,p i ), (29)

[0177] Here we use a constrained sampling scheme to j Sampling is performed to maximize the sequence X j The language model score.

[0178] Based on any of the above embodiments, the discriminator sub-model is used to distinguish the distribution of original real data from the distribution of pseudo data, and includes a discriminator loss function, which is expressed as follows:

[0179]

[0180] in, is the loss function, is the discriminator, P r (x) is the distribution of the original real data.

[0181] Specifically, in order to improve the quality of pseudo data, the original real data D r (X) and negative samples D obtained using negative sampling n (X) Train the discriminator sub-model It can also be called a data filter. For the pseudo data obtained after restricted sampling enhancement, the discriminator acts as a filter. The discriminator submodel is similar to GAN and is mainly used to distinguish the distribution P of real data. r (x) and the distribution of pseudo data Similar to the least squares generative adversarial network, the discriminator loss function is set as follows:

[0182]

[0183] Loss Function Make the discriminator The reward for real data is higher than that for fake data. You can choose pseudo data that is closer to the real data distribution and higher quality. The above are all data enhancement methods for the source side, but in fact it is also easy to extend to the target side.

[0184] A low-resource neural machine translation system based on data enhancement provided by the present invention is described below. The low-resource neural machine translation method based on data enhancement described below can be referenced to each other.

[0185] Figure 7 A schematic diagram of the structure of a low-resource neural machine translation system based on data enhancement provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the system includes a data determination unit 710 and a machine translation unit 720;

[0186] The data determination unit 710 is used to determine the real data to be translated;

[0187] The machine translation unit 720 is used to input the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model;

[0188] The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0189] The system provided by the embodiment of the present invention can efficiently and accurately solve the resource scarcity problem in low-resource neural machine translation by inputting real data into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model.

[0190] Based on any of the above embodiments, Figure 8 As shown, the machine translation unit includes a data acquisition unit 810, a model training unit 820, a data screening unit 830 and a data enhancement unit 840;

[0191] The data acquisition unit 810 is used to acquire original real data including parallel corpora and monolingual corpora on low-resource language pairs, and perform negative sampling on the original real data to obtain negative sample data;

[0192] The model training unit 820 is used to train a discriminator sub-model based on the original real data and the negative sample data to obtain an evaluation model;

[0193] The data screening unit 830 is used to construct the original real data into pseudo data based on the data enhancement of the edit distance, and screen the pseudo data based on the evaluation model to obtain screened data;

[0194] The data enhancement unit 840 is used to merge the screened data and the original real data to construct enhanced data, and use the enhanced data and an encoder / decoder translation framework based on the attention mechanism to train a low-resource neural machine translation model to obtain the neural machine translation model.

[0195] Based on any of the above embodiments, the original real data comes from a public data set or manually prepared data;

[0196] The low-resource language pairs are language pairs whose parallel corpus size is smaller than a preset value and are from a public dataset;

[0197] The monolingual corpus is a monolingual corpus of a source language or a target language in a low-resource language, and is derived from manually prepared data;

[0198] The negative sampling of the original real data to obtain negative sample data includes: generating negative sample data by randomly discarding or randomly adding the original real data.

[0199] Based on any of the above embodiments, after the data acquisition unit is used to acquire original real data including parallel corpora and monolingual corpora on low-resource language pairs, it also includes:

[0200] The original real data including the source language or the target language is subjected to a preprocessing of cleaning data and a secondary preprocessing including cleaning data, eliminating blank lines, eliminating illegal characters and non-English characters on the target end.

[0201] Based on any of the above embodiments, Fig. 9 As shown, the data screening unit includes an edit distance module 910, a position selection module 920 and a position replacement module 930;

[0202] The edit distance module 910 is used to perform edit distance sampling on the original real data based on the edit distance sub-model;

[0203] The position selection module 920 is used to select the position of the replacement word based on the position sub-model and the sampled edit distance;

[0204] The position replacement module 930 is used to replace the new word at the position of the replacement word based on the replacement sub-model to obtain pseudo data.

[0205] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.10As shown, the electronic device may include: a processor 1010, a communication interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020 and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute a low-resource neural machine translation method based on data enhancement, the method comprising: determining real data to be translated; inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; wherein the neural machine translation model is obtained by training the low-resource neural machine translation model after data enhancement based on the original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0206] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0207] On the other hand, an embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the low-resource neural machine translation method based on data enhancement provided by the above methods, and the method includes: determining real data to be translated; inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; wherein the neural machine translation model is obtained by training a low-resource neural machine translation model after data enhancement is performed on the original real data including parallel corpora and monolingual corpora on low-resource language pairs.

[0208] On the other hand, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned low-resource neural machine translation method based on data enhancement, the method comprising: determining real data to be translated; inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; wherein the neural machine translation model is obtained by training a low-resource neural machine translation model after data enhancement is performed on the original real data including parallel corpora and monolingual corpora on low-resource language pairs.

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

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

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

Claims

1. A low-resource neural machine translation method based on data enhancement, characterized in that: include: Determine the real data to be translated; Inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs; The neural machine translation model is obtained by training the low-resource neural machine translation model based on original real data including parallel corpora and monolingual corpora on low-resource language pairs after data enhancement, including: Acquire original real data including parallel corpora and monolingual corpora on low-resource language pairs, and perform negative sampling on the original real data to obtain negative sample data; Training a discriminator sub-model based on the original real data and the negative sample data to obtain an evaluation model; The original real data is constructed into pseudo data based on data enhancement of edit distance, and the pseudo data is screened based on the evaluation model to obtain screened data; The filtered data and the original real data are combined to construct enhanced data, and a low-resource neural machine translation model is trained using the enhanced data and an encoder / decoder translation framework based on an attention mechanism to obtain the neural machine translation model.

2. The low-resource neural machine translation method based on data enhancement according to claim 1, characterized in that: The original real data comes from a public data set or manually prepared data; The low-resource language pairs are language pairs whose parallel corpus size is less than a threshold, and are from public datasets; The monolingual corpus is a monolingual corpus of a source language or a target language in a low-resource language, and is derived from manually prepared data; The negative sampling of the original real data to obtain negative sample data includes: generating negative sample data by randomly discarding or randomly adding the original real data.

3. The low-resource neural machine translation method based on data enhancement according to claim 1, characterized in that: After obtaining the original real data including the parallel corpus and the monolingual corpus on the low-resource language pair, the method further includes: The original real data including the source language or the target language is subjected to a preprocessing of cleaning data and a secondary preprocessing including cleaning data, eliminating blank lines, eliminating illegal characters and non-English characters on the target end.

4. The low-resource neural machine translation method based on data enhancement according to claim 1, characterized in that: The data enhancement based on edit distance constructs the original real data into pseudo data, including: Performing edit distance sampling on the original real data based on the edit distance sub-model; Select the position of the replacement word based on the position sub-model and the sampled edit distance; A new word is substituted at the position of the replacement word based on the replacement sub-model to obtain pseudo data.

5. The low-resource neural machine translation method based on data enhancement according to claim 4, characterized in that: The edit distance submodel is expressed as follows: ; in, represents the temperature hyperparameter, Represents and length The sentence edit distance is The number of sentences; The position sub-model is expressed as follows: ; The replacement submodel is expressed as follows: ; in, For the Step sampling of new words, is the sampling position.

6. The low-resource neural machine translation method based on data enhancement according to claim 1, characterized in that: The discriminator sub-model is used to distinguish the distribution of original real data from the distribution of pseudo data, including a discriminator loss function, which is expressed as follows: ; in, is the loss function, is the discriminator, is the distribution of the original real data.

7. A low-resource neural machine translation system based on data enhancement, characterized in that: include: A data determination unit, used for determining real data to be translated; A machine translation unit, used for inputting the real data to be translated into a neural machine translation model to obtain a neural machine translation result output by the neural machine translation model; The neural machine translation model is obtained by training the low-resource neural machine translation model based on data enhancement of original real data including parallel corpora and monolingual corpora on low-resource language pairs; The neural machine translation model is obtained by training the low-resource neural machine translation model based on original real data including parallel corpora and monolingual corpora on low-resource language pairs after data enhancement, including: Acquire original real data including parallel corpora and monolingual corpora on low-resource language pairs, and perform negative sampling on the original real data to obtain negative sample data; Training a discriminator sub-model based on the original real data and the negative sample data to obtain an evaluation model; The original real data is constructed into pseudo data based on data enhancement of edit distance, and the pseudo data is screened based on the evaluation model to obtain screened data; The filtered data and the original real data are combined to construct enhanced data, and a low-resource neural machine translation model is trained using the enhanced data and an encoder / decoder translation framework based on an attention mechanism to obtain the neural machine translation model.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the low-resource neural machine translation method based on data enhancement are implemented as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the low-resource neural machine translation method based on data enhancement are implemented as described in any one of claims 1 to 6.