Translation device and program
The translation device enhances neural machine translation by using context information from previous translations to improve accuracy and fluency, addressing issues of inconsistent output styles and terminology.
Patent Information
- Application Number
- JP2020190613
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-11-17
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-11-17
AI Technical Summary
Existing neural machine translation methods fail to account for context information, leading to inconsistent output styles and terminology, which deteriorates translation accuracy and fluency.
A translation device that utilizes context information by encoding both source and target language sentences, incorporating previous translation results as context, and employing a probabilistic selection of correct or machine-generated translations during learning to enhance model training.
Improves translation accuracy and fluency by aligning output style and terminology with the target language context, reducing errors and inconsistencies.
Smart Images

Figure 0007546457000005 
Figure 0007546457000006 
Figure 0007546457000011
Abstract
Description
[Technical field]
[0001] The present invention relates to a translation device and a program. [Background technology]
[0002] Neural machine translation is a machine translation method that uses a neural network. Neural machine translation can be realized by machine learning using a large amount of bilingual data (called "training data") in the source language and the target language. However, the translation model on which neural machine translation is based is designed for learning and translation at the sentence level, so it cannot learn or translate with context in mind. In other words, the translation model used by general neural machine translation does not take context information into account. In addition, existing training data is often bilingual that is matched at the sentence level, and there is also the issue that there is little training data with context. If translation is performed without considering context information, the translation accuracy will decrease due to reasons such as an indefinite translation style, an inability to complete subjects, and an inability to unify terminology.
[0003] In such a situation, the machine translation methods described in Non-Patent Documents 1, 2, and 3 attempt to enable translation that takes context into account by incorporating context information into training data during training. For example, the method described in Non-Patent Document 1 is a method that uses the "previous source language sentence" for training. Also, the methods described in Non-Patent Documents 1 and 3 are methods that use the "previous target language sentence" for training. [Prior art documents] [Non-patent literature]
[0004] [Non-Patent Document 1] Rachel Bawden, Rico Sennrich, Alexandra Birch, Barry Haddow, “Evaluating Discourse Phenomena in Neural Machine Translation”, In Proceedings of NAACL-HLT, pp. 1304-1313, New Orleans, Louisiana, June 1 - 6, 2018, [online], [downloaded October 10, 2020], Internet<URL:https: / / www.aclweb.org / anthology / N18-1118.pdf> . [Non-Patent Document 2] Li Linghan, Nakazawa Toshiaki, Tsuruoka Yoshimasa, Japanese-English Neural Machine Translation Considering Contextual Information, Proceedings of the 25th Annual Conference of the Association for Natural Language Processing, pp.101-104, March 2019, [online], [downloaded on October 10, 2020], Internet<URL:https: / / www.anlp.jp / proceedings / annual_meeting / 2019 / pdf_dir / A2-2.pdf> . [Non-Patent Document 3] Ruchit Agrawal, Marco Turchi, Matteo Negri, “Contextual handling in neural machine translation: Look behind, ahead and on both sides”, In Proceedings of EAMT2018, 21st Annual Conference of the European Association for Machine Translation, 28-30 May 2018, [online], [downloaded on October 10, 2020], Internet<URL:https: / / pdfs.semanticscholar.org / b98a / 268a7f63f9ba0df2dc88b7f002792bf01bc0.pdf> . Summary of the Invention [Problem to be solved by the invention]
[0005] However, while the above-mentioned conventional techniques are translation methods that utilize context information, there are further problems.
[0006] In the methods described in Non-Patent Documents 1 and 2 that use context information of a source language sentence as input, since the appropriate style at the time of output is unknown, output having an appropriate style may not be obtained. Furthermore, in the methods that use context information of a source language sentence as input, errors due to the gap between the source language and the target language may be mixed in, which may hinder improvement of translation accuracy.
[0007] For example, when creating a translation device that translates English news scripts into Japanese news scripts, if the device is trained without understanding the style of the output text in the target language, Japanese, the output style of the translation results may be inconsistent. For example, the output Japanese text may contain a mixture of sentences in the "de aru" style and sentences in the "desu / masu" style, resulting in a decrease in the quality of the translation results.
[0008] Similarly, when realizing a translation device that translates English news sentences into Japanese sentences, if the device is trained without understanding the terminology in the target language, which is the output destination, the terminology in the translated sentences may not be consistent. For example, the terminology may not be consistent in one sentence in a news story, and may be written as "Prime Minister Tanaka Shinzo" in another sentence that follows, resulting in a decrease in the quality of the translation results.
[0009] In addition, it has been reported that the methods described in Non-Patent Documents 1 and 3, which use information on the target language sentence as input, are unable to properly learn the characteristics of the machine translation results that should be used during translation, resulting in reduced translation accuracy.
[0010] The present invention has been made based on the recognition of the above problem, and aims to provide a translation device and program that can improve the translation accuracy and fluency of the output target language sentence (translation result) while utilizing contextual information. [Means for solving the problem]
[0011] [1] In order to solve the above problems, a translation device according to one embodiment of the present invention includes an encoder that encodes a source language sentence and target language context information corresponding to the source language sentence, and a decoder that performs decoding based on the information resulting from the encoding process by the encoder, and outputs a target language sentence that is a translation result of the source language sentence. In a translation mode that performs translation processing of an unknown source language sentence obtained from outside, the context information is a target language sentence that is a translation result output by the decoder based on a source language sentence that precedes the source language sentence, and in a learning mode that trains the encoder and the decoder, the context information is at least a target language sentence that is a translation result output by the decoder based on a source language sentence that precedes the current source language sentence.
[0012] [2] Also, one aspect of the present invention is that in the above-mentioned translation device, the encoder includes a source language sentence encoder that encodes the source language sentence and a context encoder that encodes target language context information corresponding to the source language sentence, and the decoder performs the decoding process based on both the information resulting from the encoding process by the source language sentence encoder and the information resulting from the encoding process by the context encoder.
[0013] [3] Furthermore, one aspect of the present invention is that the above-mentioned translation device further includes a concatenation unit that concatenates information of the source language sentence and the context information to generate concatenated information and passes the concatenated information to the encoder, and the encoder performs the encoding process based on the concatenated information output by the concatenation unit.
[0014] [4] In another aspect of the present invention, in the translation device described above, the concatenation unit inserts a separator token between the information of the source language sentence and the context information to generate the concatenated information.
[0015] [5] Further, in one aspect of the present invention, in the above-described translation device, in the learning mode, the decoder outputs a target language sentence that is a translation result based on a source language sentence before the current source language sentence, and a target language sentence of the correct translation corresponding to the source language sentence before the current source language sentence. A selection unit that selects either one as the context information on the target language side and outputs the selected context information is further provided, and the encoder encodes the context information output by the selection unit.
[0016] [6] Further, in one aspect of the present invention, in the above-described translation device, the selection unit selects the target language sentence of the correct translation as the context information with a probability p based on a predetermined probability value p (where 0 < p < 1), and with a probability (1 - p), selects the target language sentence that is the translation result output by the decoder as the context information.
[0017] [7] Further, in one aspect of the present invention, in the above-described translation device, when the learning of the encoder and the decoder is the e-th (e is a positive integer) epoch, the selection unit determines the value of p so that p monotonically decreases in correspondence with an increase in the value of e.
[0018] [8] Further, in one aspect of the present invention, a program causes a computer to function as a translation device including an encoder that encodes a source language sentence and context information on the target language side corresponding to the source language sentence, and a decoder that performs decoding processing based on the information obtained by encoding the encoder and outputs a target language sentence that is a translation result of the source language sentence. In the translation mode for performing translation processing of an unknown source language sentence acquired from the outside, the context information is a target language sentence that is a translation result output by the decoder based on a source language sentence before the current source language sentence. In the learning mode for learning the encoder and the decoder, the program is a program that at least includes a case where the context information is a target language sentence that is a translation result output by the decoder based on a source language sentence before the current source language sentence. [Advantages of the Invention]
[0019] According to the present invention, the translation device uses context information when learning a model. The context information includes at least the case where the context information is a translation result output by a decoder based on a source language sentence prior to the current source language sentence. This allows the model to perform translation processing using the translation result sentence output by the device itself as context. This improves the quality of the translation result output by the translation device. [Brief description of the drawings]
[0020] [Figure 1] 1 is a block diagram showing a schematic functional configuration of a translation device according to a first embodiment of the present invention. [Diagram 2] FIG. 2 is a block diagram showing an example of a more detailed configuration of a first encoder, a second encoder, and a decoder according to the first embodiment. [Diagram 3] FIG. 11 is a block diagram showing a schematic functional configuration of a translation device according to a second embodiment. [Figure 4] 13 is a schematic diagram showing the action of a selection unit according to the second embodiment. FIG. [Diagram 5] FIG. 11 is a block diagram showing a schematic functional configuration of a translation device according to a third embodiment. [Figure 6] 13 is a schematic diagram showing an example of a connection process executed by a connection unit according to the third embodiment. FIG. [Figure 7] FIG. 13 is a block diagram showing a schematic functional configuration of a translation device according to a fourth embodiment. [Figure 8] FIG. 13 is a schematic diagram showing a process of stochastically selecting data to be input to an encoder when the translation device operates in a learning mode in the fourth embodiment. [Figure 9] FIG. 1 is a block diagram showing an example of the internal configuration of a translation device according to a first embodiment to a fourth embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0021] Next, a number of embodiments of the present invention will be described with reference to the drawings. In the translation device of each of the following embodiments, in addition to a pair of a source language sentence and a target language sentence, the context of the target language sentence is used to learn a model. The context information is a correctly translated sentence or a sentence resulting from machine translation. As for the model form, an embodiment using a single encoder model and an embodiment using a multi-encoder model are possible. By using the context information of the target language sentence as described above, it is possible to faithfully learn the style of the target language.
[0022] In particular, in the second and fourth embodiments, both data, the previous correct sentence in the target language and the previous sentence resulting from machine translation in the target language, are used for learning while controlling the ratio to be appropriate. This makes it possible to learn the subject and output style of the previous sentence, and is expected to improve translation accuracy.
[0023] [First embodiment] FIG. 1 is a block diagram showing a schematic functional configuration of a translation device according to a first embodiment. As shown in the figure, the translation device 1 includes a first encoder 11, a second encoder 12, a decoder 15, an input unit 21, an output unit 22, a learning data supply unit 23, and a context supply unit 31. Each of these functional units can be realized, for example, by a computer and a program. Each functional unit has a storage means as necessary. The storage means is, for example, a variable in a program or a memory allocated by the execution of a program. Non-volatile storage means such as a magnetic hard disk drive or a solid state drive (SSD) may be used as necessary. At least a part of the functions of each functional unit may be realized as a dedicated electronic circuit rather than a program.
[0024] The translation device 1 is realized using a model capable of machine learning. At a certain point in time, the translation device 1 performs processing in either a learning mode or a translation mode. In the learning mode, the translation device 1 performs a learning process for an internal model using learning data. The learning data includes data pairs of a sentence in a source language, which is a language from which the translation is to be performed, and a correct sentence in a target language corresponding to the source language sentence. In the translation mode, the translation device 1 performs a translation process for an input source language sentence based on a learned model, and outputs a target language sentence. The source language and the target language may each be any natural language. The source language and the target language may each be Japanese, English, German, French, Russian, Spanish, Italian, Chinese, Korean, or other languages.
[0025] The translation device 1 targets a sequence of sentences, not a single sentence, for translation. In this embodiment, the context refers to a situation based on sentences before and after the single sentence to be translated. In this embodiment, the term "context" may particularly refer to one or more sentences that appear before the sentence to be translated. In this embodiment, the term "context" may also particularly refer to a sentence that appears immediately before the sentence to be translated. Some of the features of the translation device 1 are that it performs translation processing using context, and that it performs machine learning of a model for performing translation processing using context.
[0026] The first encoder 11 encodes the source language sentence to be translated. The first encoder 11 passes the information resulting from the encoding to the decoder 15. The first encoder 11 may obtain a string of word vectors as information equivalent to the source language sentence and use it as the processing target. In the learning mode, the first encoder 11 encodes the source language sentence (learning data) supplied by the learning data supply unit 23. In the translation mode, the first encoder 11 encodes the unknown source language sentence to be translated, which is passed from the input unit 21. The first encoder 11 is also called a "source language sentence encoder."
[0027] The second encoder 12 encodes the target language context information corresponding to the source language sentence. The second encoder 12 passes the information resulting from the encoding process to the decoder 15. The second encoder 12 may obtain a string of word vectors as the context information and use it as the processing target. The second encoder 12 is also called a "context encoder."
[0028] The context information to be processed by the second encoder 12 is as follows: In other words, in a translation mode in which a translation process of an unknown source language sentence obtained from outside is performed, the context information is a target language sentence which is a translation result output by the decoder 15 based on a source language sentence that precedes the source language sentence. In a learning mode in which the encoder and decoder are trained, the context information includes at least the case where it is a target language sentence which is a translation result output by the decoder 15 based on a source language sentence that precedes the current source language sentence.
[0029] The “encoder” consisting of the first encoder 11 and the second encoder 12 encodes a source language sentence and target language context information corresponding to the source language sentence and passes the result to a decoder 15.
[0030] The decoder 15 performs a decoding process based on the information resulting from the encoding process by the encoders (the first encoder 11 and the second encoder 12) and outputs a target language sentence that is the translation result of the source language sentence. More specifically, the decoder 15 performs a decoding process based on both the information resulting from the encoding process by the first encoder 11 and the information resulting from the encoding process by the second encoder 12.
[0031] In the learning mode, the output from the decoder 15 is compared with the correct translation. Based on the comparison result, the internal parameters of the encoder and decoder models are adjusted. In this case, a method such as backpropagation is used. In the translation mode, the output from the decoder 15 is output from the output unit 22 as the translated sentence.
[0032] In the translation mode, the input unit 21 acquires a sentence to be translated (a source language sentence) and passes it to the first encoder 11.
[0033] In the translation mode, the output unit 22 outputs the translation result sentence (target language sentence) passed from the decoder 15 to the outside.
[0034] The learning data supply unit 23 supplies learning data in the learning mode. The learning data is a collection of pairs (translations) of source language sentences and target language sentences. The target language sentences are correct translations of the source language sentences. The learning data is a sequence of sentences on both the source language sentence side and the target language sentence side. The multiple sentences that make up the sequence of sentences have an order relationship.
[0035] The context provider 31 provides the result of the machine translation of the previous sentence as input to the second encoder 12. In particular, the context provider 31 may provide a sentence that is the result of the machine translation of the previous sentence.
[0036] FIG. 2 is a block diagram showing an example of a more detailed configuration of the first encoder 11, the second encoder 12, and the decoder 15. As shown in the figure, the first encoder 11, the second encoder 12, and the decoder 15 can be configured using a Transformer model. The Transformer is one of the models based on existing technology using a neural network. The Transformer is also described in the literature "Attention Is All You Need" by Ashish Vaswani et al. (31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, https: / / arxiv.org / pdf / 1706.03762.pdf).
[0037] In the translation device 1, the output from the first encoder 11 and the output from the second encoder 12 are each input to a decoder 15.
[0038] Input embedding is performed at the input of each of the first encoder 11 and the second encoder 12. That is, the string of word vectors input to each of the first encoder 11 and the second encoder 12 is converted into a vector with the dimensionality of the internal model of the first encoder 11 and the second encoder 12. In addition, positional encoding is performed at the input of each of the first encoder 11 and the second encoder 12 to incorporate information on the position of the word in each sentence into the input value. Each of the first encoder 11 and the second encoder 12 has a configuration in which n layers are stacked. Each of these layers has a sublayer of a multi-head self-attention mechanism and a sublayer of a fully connected feedforward network.
[0039] Input embedding is performed at the input to the decoder 15. That is, the string of word vectors input to the decoder 15 is converted into a vector with the dimensionality of the model inside the decoder 15. Also, positional encoding is performed at the input to the decoder 15 to incorporate information on the position of the word in the sentence into the input value. The decoder 15 has a configuration in which n layers are stacked, similar to the first encoder 11 and the second encoder 12. Each of these layers has a sublayer of a masked multi-head self-attention mechanism, a sublayer of multi-head attention using the output values from the first encoder 11 and the second encoder 12, and a sublayer of a feed-forward network for each position in the sentence (position-wise feed-forward).
[0040] According to this embodiment, in the learning mode, the translation device 1 inputs the translation result (target language sentence) of the previous sentence output by the device itself to the second encoder 12 as context information. As a result, each model of the first encoder 11, the second encoder 12, and the decoder 15 performs learning based on the above-mentioned context information in addition to the pair of the source language sentence and the target language sentence (correct answer) included in the learning data. By such learning, the translation device 1 can output a translation result that matches the context output by the device itself. In other words, the translation device 1 of this embodiment eliminates the gap caused by the difference in context information used during learning and translation.
[0041] [Second embodiment] Next, a second embodiment of the present invention will be described. Note that the matters already described in the previous embodiment may not be described below. Here, the matters unique to this embodiment will be mainly described.
[0042] FIG. 3 is a block diagram showing a schematic functional configuration of a translation device according to the second embodiment. As shown in the figure, the translation device 2 includes a first encoder 11, a second encoder 12, a decoder 15, an input unit 21, an output unit 22, a learning data supply unit 23, a context supply unit 31, and a selection unit 32. The translation device 2 can also be realized, for example, by using a computer. Among the above configuration, the first encoder 11, the second encoder 12, the decoder 15, the input unit 21, the output unit 22, the learning data supply unit 23, and the context supply unit 31 each have the same functions as in the first embodiment. However, in this embodiment, the second encoder 12 inputs context information (target language sentence) passed from the selection unit 32 and performs encoding processing.
[0043] The feature of this embodiment is that, in the process of the learning mode, the selection unit 32 selects and outputs either the target language sentence supplied from the context supply unit 31 or the target language sentence supplied from the learning data supply unit 23. The second encoder 12 processes the context information output by this selection unit 32. That is, the selection unit 32 outputs either the target language sentence that is the machine translation result of the sentence immediately preceding the sentence to be translated at that time (supplied by the context supply unit 31) or the target language sentence that is the correct translation of the same immediately preceding sentence (supplied by the learning data supply unit 23). In the process of the translation mode, the selection unit 32 always outputs the target language sentence supplied from the context supply unit 31. In the process of the translation mode, the learning data supply unit 23 does not supply learning data (target language sentences).
[0044] More specifically, in the process of the learning mode, the selection unit 32 selects either the target language sentence that is the correct translation of the previous sentence or the target language sentence that is the machine translation result of the previous sentence based on a predetermined probability p (0 < p < 1), and passes it to the second encoder 12. That is, when the value of p is given, the selection unit 32 passes the target language sentence that is the correct translation of the previous sentence passed from the learning data supply unit 23 to the second encoder 12 with a probability of p. Also, based on the above value of p, the selection unit 32 passes the target language sentence that is the machine translation result of the previous sentence passed from the context supply unit 31 to the second encoder 12 with a probability of (1 - p). In order to probabilistically select either target language sentence based on the value of p as described above, the selection unit 32 may appropriately perform a process of generating, for example, pseudo-random numbers, and perform a process based on the pseudo-random number value. However, without using pseudo-random numbers or the like, for example, according to a pattern based on the value of p, the selection unit 32 may sequentially select either the target language sentence that is the correct translation of the previous sentence or the target language sentence that is the machine translation result of the previous sentence. The value of p may be determined as appropriate.
[0045] The value of p may be determined, for example, as follows. That is, when the machine learning process of the model in the translation device 2 is the e-th epoch (e=1, 2, 3, . . .), the probability value p is set to be as shown in the following formula (1). In other words, the value of e is the number of times the translation device 2 has learned at that time (the number of batches, the number of epochs). However, the value of e may start from 2. In addition, in formula (1), exp() is an exponential function with Napier's number as the base. Furthermore, k is a hyperparameter, and the value of k is appropriately determined. However, k≧1. The smaller the value of k (the closer to 1), the faster the rate of change in the value of p in response to a change in the value of e. The larger the value of k, the slower the rate of change in the value of p in response to a change in the value of e.
[0046]
number
[0047] When p shown in formula (1) is used, as the value of the number of learning times e increases, the value of p decreases monotonically and approaches 0. That is, as the value of e decreases, the selection unit 32 selects the target language sentence of the correct translation (probability p) with a higher probability than the target language sentence of the machine translation result (probability 1-p). And, as the value of e increases, the value of p gradually approaches 0. That is, as the value of e increases, the selection unit 32 selects the target language sentence of the machine translation result (probability p) with a higher probability than the target language sentence of the correct translation (probability p). That is, while the learning of the model for translation is not progressing very much, the translation device 2 proceeds with the learning of the model for translation by relying relatively heavily on the context (previous sentence) based on the correct translation. Also, as the learning of the model for translation progresses, the translation device 2 proceeds with the learning of the model for translation while gradually becoming more dependent on the context (previous sentence) of the machine translation result, which is the output of the device itself.
[0048] That is, in the early stages of model learning, translation device 2 promotes learning with less noise by using correct translations more heavily. Furthermore, as model learning progresses, translation device 2 proceeds with learning by gradually using machine translation results more heavily. By gradually using machine translation results more heavily, it becomes possible to perform learning without gaps that corresponds to noise contained in machine translation results that have the same characteristics as those at the time of translation. In other words, learning of a translation model by translation device 2 has the same effect as curriculum learning. Curriculum learning is also described in the following references. [References] Yoshua Bengio, Jerome Louradour, Ronan Collobert, Jason Weston, “Curriculum Learning”, Proceedings of the 26th International Conference on Machine Learning (ICML'09), Montreal, Canada, 2009, p.41-49, https: / / mila.quebec / wp-content / uploads / 2019 / 08 / 2009_curriculum_icml.pdf
[0049] As described above, in the learning mode, the selection unit 32 selects, as the context information on the target language side, either the target language sentence that is the translation result output by the decoder 15 based on the source language sentence that precedes the current source language sentence, or the target language sentence that is the correct translation corresponding to the source language sentence that precedes the current source language sentence, and outputs the selected context information. The sentence that is the translation result output by the decoder 15 is passed from the context supply unit 31 to the selection unit 32. The selection unit 32 passes the selected context information to the second encoder 12. The second encoder 12 encodes the context information output by the selection unit 32.
[0050] As described above, the selection unit 32 may select, based on a predetermined probability value p (where 0 < p < 1), the target language sentence of the correct translation as the context information with probability p, and select, with probability (1 - p), the target language sentence that is the translation result output by the decoder 15 as the context information. Further, when the learning of the encoder and the decoder is at the e-th (e is a positive integer) epoch, the selection unit 32 may determine the value of p such that p monotonically decreases in correspondence with an increase in the value of e. As an example thereof, the selection unit 32 may determine the value of p based on the above formula (1).
[0051] FIG. 4 is a schematic diagram showing the operation of the above-described selection unit 32. As shown in the figure, either the correct translation supplied by the learning data supply unit or the machine translation sentence supplied by the context supply unit 31 is input to the second encoder 12. The above input to the second encoder 12 is probabilistically selected by the selection unit 32. That is, with probability p (0 < p < 1), the correct translation sentence is input to the second encoder. Also, with probability (1 - p), the machine translation sentence is input to the second encoder.
[0052] [Third Embodiment] Next, a third embodiment of the present invention will be described. Note that descriptions of matters already described in the previous embodiments may be omitted below. Here, the description will focus on matters specific to this embodiment.
[0053] FIG. 5 is a block diagram showing a schematic functional configuration of a translation device according to the third embodiment. As shown in the figure, the translation device 3 includes an encoder 13, a decoder 15, an input unit 21, an output unit 22, a learning data supply unit 23, a context supply unit 31, and a connection unit 33. The translation device 3 can also be realized using, for example, a computer. Among the above configurations, the functions of each of the decoder 15, the input unit 21, the output unit 22, the learning data supply unit 23, and the context supply unit 31 are the same as those described in the first embodiment.
[0054] Compared with the configuration of the translation device 1 of the first embodiment, the translation device 3 of the third embodiment has the following features. That is, while the translation device 1 of the first embodiment includes a first encoder 11 and a second encoder 12, the translation device 3 of the third embodiment includes an encoder 13. The encoder 13 is a single encoder and receives as input both a source language sentence, which is a sentence to be translated, and context information on the target language side. Specifically, the encoder 13 receives as input, as context information, a target language sentence, which is a machine translation result of the sentence immediately preceding the sentence to be translated. Specifically, the encoder 13 receives as input data passed from a linking unit 33. That is, the encoder 13 performs encoding processing based on the linking information output by the linking unit 33.
[0055] The concatenation unit 33 concatenates the source language sentence and the context information, and passes the concatenated result to the encoder 13. Specifically, in the learning mode, the concatenation unit 33 concatenates a source language sentence included in the learning data supplied by the learning data supply unit 23 and a machine-translated sentence (target language sentence) that is the translation result of the sentence immediately preceding the source language sentence, supplied by the context supply unit 31. In the translation mode, the concatenation unit 33 concatenates one of the source language sentences acquired by the input unit 21 and a machine-translated sentence (target language sentence) that is the translation result of the sentence immediately preceding the source language sentence, supplied by the context supply unit 31. In both the learning mode and the translation mode, the concatenation unit 33 concatenates a word string corresponding to the source language sentence and a word string corresponding to the target language sentence (context), and inserts a separator token between the two word strings.
[0056] That is, the concatenation unit 33 concatenates the information of the source language sentence and the context information to generate concatenated information, and passes the concatenated information to the encoder 13. Furthermore, the concatenation unit 33 may insert a separator token between the information of the source language sentence and the context information to generate concatenated information.
[0057] FIG. 6 is a schematic diagram showing an example of concatenation processing by the concatenation unit 33. The illustrated example is an example in which the source language is Japanese and the target language is English. The target language sentence shown is the English sentence, "A male student in the first year of junior high school in Kanagawa Prefecture...". This target language sentence is the sentence immediately before the sentence to be translated below (machine translated sentence). Meanwhile, the current sentence to be translated (source language sentence) is the Japanese sentence, "The school has been closed since the 3rd of this month." The concatenation unit 33 concatenates these two sentences and inserts a separator token, <sep>The result of the concatenation by the concatenation unit 33 is "A male student in the first year of junior high school in Kanagawa Prefecture..." <sep>The token sequence is "Schools have been closed since the 3rd of this month." Encoder 13 takes this token sequence, separated by separator tokens, as input and processes it.
[0058] [Fourth embodiment] Next, a fourth embodiment of the present invention will be described. Note that the description of the matters already described in the previous embodiments may be omitted below. Here, the description will focus on matters unique to this embodiment.
[0059] Fig. 7 is a block diagram showing a schematic functional configuration of a translation device according to the fourth embodiment. As shown in the figure, the translation device 4 includes an encoder 13, a decoder 15, an input unit 21, an output unit 22, a learning data supply unit 23, a context supply unit 31, a selection unit 32, and a linking unit 33. The translation device 4 can also be realized, for example, by using a computer. Among these functions, the respective functions of the encoder 13, the decoder 15, the input unit 21, the output unit 22, the learning data supply unit 23, and the context supply unit 31 are similar to those described in the third embodiment.
[0060] The features of this embodiment are as follows. That is, translation device 4 of the fourth embodiment has a linking unit 33, similar to translation device 3 of the third embodiment. That is, in translation device 4, linking unit 33 links information of a source language sentence to be translated and context information of the source language sentence (information of a target language sentence corresponding to the previous source language sentence). Furthermore, translation device 4 has a selection unit 32, similar to translation device 2 of the second embodiment. That is, when operating in the learning mode, selection unit 32 of translation device 4 probabilistically selects, as context information, a target language sentence of a correct translation and a target language sentence that is a machine-translated result.
[0061] The method by which the selection unit 32 selects either the context information of the target language sentence that is the correct translation (also called "context reference information") or the context information of the target language sentence that is the result of machine translation (also called "context inference information") is the same as that described in the second embodiment. That is, the selection unit 32 selects the context reference information with a probability p, and selects the context inference information with a probability (1-p). The method of determining the value of p is also as described in the second embodiment. One example of the method of determining p is as described in the second embodiment with reference to formula (1).
[0062] That is, in the learning mode, the selection unit 32 of this embodiment selects, as the context information on the target language side, either the target language sentence that is the translation result output by the decoder 15 based on the source language sentence that precedes the current source language sentence, or the target language sentence that is the correct translation corresponding to the source language sentence that precedes the current source language sentence, and outputs the selected context information. The selection unit 32 passes the selected context information to the linking unit 33. The linking unit 33 links the context information output by the selection unit 32 to the source language sentence.
[0063] FIG. 8 is a schematic diagram showing a process of stochastically selecting data to be input to the encoder 13 when the translation device 4 operates in the learning mode in the fourth embodiment. As shown in the figure, data in which the context reference information (target language sentence) and the source language sentence (sentence to be translated) are linked with a probability p is input to the encoder 13. Also, data in which the context inference information (target language sentence) and the source language sentence (sentence to be translated) are linked with a probability (1-p) is input to the encoder 13. The source language sentence (sentence to be translated) is a sentence to be translated currently, which is supplied by the learning data supply unit 23. The context reference information (target language sentence) is a sentence of a correct translation corresponding to the sentence to be translated immediately before, which is supplied by the learning data supply unit 23. The context inference information (target language sentence) is a sentence resulting from machine translation corresponding to the sentence to be translated immediately before, which is supplied by the context supply unit 31. The process of selecting either the context reference information or the context inference information is a process performed by the selection unit 32. The process of linking the context information (target language sentence) and the source language sentence to be translated is performed by the linking unit 33. As in the third embodiment, the linking unit 33 links the separator token <sep>7 shows an order in which the selection unit 32 makes a selection and then the concatenation unit 33 makes a concatenation, the translation device 4 may be realized in an order in which the concatenation unit 33 makes a concatenation and then the selection unit 32 makes a selection.
[0064] FIG. 9 is a block diagram showing an example of the internal configuration of the translation device according to the first to fourth embodiments. The translation device 1, 2, 3, or 4 can be realized using a computer. As shown in the figure, the computer includes a central processing unit 901, a RAM 902, an input / output port 903, input / output devices 904 and 905, and a bus 906. The computer itself can be realized using existing technology. The central processing unit 901 executes instructions included in a program read from the RAM 902 or the like. The central processing unit 901 writes data to the RAM 902, reads data from the RAM 902, and performs arithmetic and logical operations according to each instruction. The RAM 902 stores data and programs. Each element included in the RAM 902 has an address and can be accessed using the address. The RAM is an abbreviation for "random access memory." The input / output port 903 is a port through which the central processing unit 901 exchanges data with an external input / output device or the like. The input / output devices 904 and 905 are input / output devices. Input / output devices 904 and 905 exchange data with the central processing unit 901 via an input / output port 903. A bus 906 is a common communication path used inside the computer. For example, the central processing unit 901 reads and writes data from and to a RAM 902 via the bus 906. Also, for example, the central processing unit 901 accesses the input / output port via the bus 906.
[0065] At least some of the functions of the translation device in the above-mentioned embodiment can be realized by a computer. In that case, a program for realizing the functions may be recorded in a computer-readable recording medium, and the program recorded in the recording medium may be read into a computer system and executed to realize the functions. The term "computer system" here includes hardware such as an OS and peripheral devices. The term "computer-readable recording medium" refers to portable media such as flexible disks, optical magnetic disks, ROMs, CD-ROMs, DVD-ROMs, and USB memories, and storage devices such as hard disks built into a computer system. In other words, the term "computer-readable recording medium" may be a non-transitory computer-readable recording medium. The term "computer-readable recording medium" may also include a medium that temporarily and dynamically holds a program, such as a communication line when a program is transmitted via a network such as the Internet or a communication line such as a telephone line, and a medium that holds a program for a certain period of time, such as a volatile memory inside a computer system that is a server or client in such a case. The above-mentioned program may be a program for realizing some of the functions described above, or may be a program that can be realized in combination with a program already recorded in the computer system.
[0066] Although a number of embodiments have been described above, the present invention can also be embodied in the following modified examples.
[0067] For example, in the first to fourth embodiments, the context supplying unit 31 supplies only the immediately preceding sentence as context information. As a modified example, the context supplying unit 31 may supply multiple sentences preceding the current sentence as context information. In this case, in each of the second and fourth embodiments, the learning data supplying unit 23 also supplies the same number of correctly translated sentences as context information.
[0068] As described above, in any of the above-described embodiments (including the modified examples), a translation model is trained using context information on the target language sentence side. This makes it possible to learn information such as the style of the translation result to be output and omitted subjects, thereby improving translation accuracy.
[0069] Although an embodiment of the present invention has been described in detail above with reference to the drawings, the specific configuration is not limited to this embodiment, and designs that do not deviate from the gist of the present invention are also included.
[0070] [About the evaluation experiment] Each embodiment was implemented, and translation processing was actually performed using real data examples, and the translation results were evaluated. The results are described below. In this experiment, the source language was Japanese and the target language was English. The data used in the experiment was a corpus of current affairs news (national production) and a corpus of TED talks. In the current affairs news (national production) data, the number of data sentences for learning was 220,180 sentences, and the number of sentences in the evaluation test set was 2,000 sentences. In the TED talk data, the number of data sentences for learning was 194,170 sentences, and the number of sentences in the evaluation test set was 1,285 sentences.
[0071] [Results of Experiment 1] In experiment 1, the first and second embodiments were evaluated and compared with the systems of the prior art. The baseline systems were (A) a sentence-level machine translation system, (B) a Japanese-side context-aware machine translation system, and (C) an English-side context-aware machine translation system (p=1). (A) The sentence-level machine translation system performs translation without using context information. (B) The Japanese-side context-aware machine translation system performs translation by inputting the previous sentence on the source language (Japanese) side as context information. (C) The English-side context-aware machine translation system (p=1) performs learning using only the correct translation of the previous sentence on the target language (English) side as context information. Note that BLEU, which is often used to evaluate machine translation processing, is used as the evaluation measure.
[0072] The evaluation results based on the BLEU values of the first and second embodiments and a comparison with the baseline are shown in Table 1.
[0073] [Table 1]
[0074] As described above, the evaluation value of the first embodiment exceeded the evaluation values of (A) the sentence-level machine translation system and (C) the English-side context-aware machine translation system (p=1), depending on the type of data. The evaluation value of the second embodiment exceeded the evaluation values of (A) the sentence-level machine translation system, (B) the Japanese-side context-aware machine translation system, and (C) the English-side context-aware machine translation system (p=1), regardless of the type of data. The evaluation value of the second embodiment exceeded the evaluation value of the first embodiment.
[0075] An example of the translation result in this experiment 1 is as follows. As the context information for the sentence to be translated, the first sentence in the target language (English) was "I'm going to talk about a boy in a village." Here, the sentence in the source language (Japanese) to be translated was "I don't know his name, but I can talk about him." The target language sentence of the correct translation corresponding to this source language sentence is "I don't know his name, but I do know his story." That is, the "name" in the source language sentence is the name of "a boy" that appears as the context, and therefore the correct translation corresponding to "name" is "his name." The translation result of the sentence-level machine translation system (A) for such a test sentence was "I don't know the name, but I can tell you his story." In other words, since the system (A) of the prior art performs translation without using the context, it can be interpreted as learning in a way that avoids distinguishing whether the "name" is "his name" or not by outputting the translation result "the name." On the other hand, the translation result by the system of the second embodiment was "I don't know his name, but I can tell you his story." In other words, the system of the second embodiment outputted "his name" as the translation of "name." In this way, the system of the second embodiment can be evaluated as performing a higher quality translation that also depends on the context.
[0076] [Results of Experiment 2] In experiment 2, the third and fourth embodiments were evaluated and compared with the prior art systems. The baseline systems were (A) a sentence-level machine translation system and (C) an English-side context-aware machine translation system (p=1).
[0077] The evaluation results based on the BLEU values of the third and fourth embodiments and a comparison with the baseline are shown in Table 2.
[0078] [Table 2]
[0079] As described above, the evaluation value of the fourth embodiment exceeded the evaluation value of the (A) sentence-level machine translation system depending on the type of data. Also, the evaluation value of the fourth embodiment exceeded the evaluation value of the (C) English-side context-aware machine translation system (p=1) regardless of the type of data. The evaluation value of the fourth embodiment exceeded the evaluation value of the third embodiment.
[0080] An example of the translation result in experiment 2 is explained below. The context information for the sentence to be translated was the following sentence in the target language (English): "On September 11, 2001, I heard a young man flying in a city, and he went down, and a man came down the stairs, he was going down the stairs, he was going down a piece of paper, and he was doing it every Wednesday." The sentence to be translated in the source language (Japanese) was "I tried to thank him for doing his work on that day of all days, but tears started to come out." The target language sentence that corresponds to this source language sentence is "And I tried to thank him for doing his work on that day of all days, but I started to cry." In other words, the person to whom the subject of the sentence, "I," was trying to thank is expressed as "him" (referring to the man mentioned above). The translation result of the sentence-level machine translation system (A) for this test sentence was "And I was trying to appreciate the fact that I was doing my work every day, but tears were coming out." In other words, the conventional system (A) does not specify that the person to whom the sentence is to be "appreciated" is "him," and outputs the incorrect translation, "that I was doing my work every day." The English-side context-aware machine translation system (C) (p=1) outputs the translation, "And I was going to thank you for that day, and I was going to thank you for doing my work every day, but I got to tears."That is, the system of the conventional technology (C) outputs a translation result of "thank you for doing my work," which uses a different person from the correct translation. Since the translation is performed without using context, it can be interpreted that the system learns in a way that avoids distinguishing whether the "name" is "his name" or not by outputting the translation result of "the name." On the other hand, the translation result by the system of the second embodiment was "I don't know his name, but I can tell you his story." In other words, the system of the second embodiment outputs "his name" as the translation of "name." In this way, the system of the second embodiment can be evaluated as performing a higher quality translation that also depends on the context. On the other hand, the translation system of the fourth embodiment outputs a translation result of "And I was grateful for that day, and I tried to thank him for doing work all the day, but I had tears in my tears." in response to the above source language sentence. In other words, the system of the fourth embodiment explicitly indicates that the person to whom the system tried to thank is "him" by saying "tried to thank him" based on the above context information. In this way, the system of the fourth embodiment can be evaluated as providing higher quality translation that also depends on the context. [Industrial Applicability]
[0081] The present invention can be used in, for example, any industrial field that requires translation of natural languages, but the scope of use of the present invention is not limited to the examples given here. [Explanation of symbols]
[0082] 1,2,3,4 Translation Device 11 First Encoder (Source Sentence Encoder) 12 Second Encoder (Context Encoder) 13 Encoder 15 Decoder 21 Input section 22 Output section 23 Learning Data Supply Department 31 Context supply part 32 Selection section 33 Connecting part 901 Central Processing Unit 902 RAM 903 Input / Output Ports 904,905 Input / Output Devices 906 Bus< / sep> < / sep> < / sep>
Claims
1. an encoder for encoding a source language sentence and target language context information corresponding to the source language sentence; a decoder that performs a decoding process based on information resulting from the encoding process performed by the encoder, and outputs a target language sentence that is a translation result of the source language sentence; Equipped with In a translation mode for translating an unknown source sentence obtained from outside, the context information is a target sentence which is a translation result output by the decoder based on a source sentence preceding the source sentence, In a learning mode in which the encoder and the decoder are trained, the context information includes at least a case in which the context information is a target sentence that is a translation result output by the decoder based on a source sentence prior to the current source sentence. Translation device.
2. The encoder includes a source sentence encoder for encoding the source sentence, and a context encoder for encoding target language context information corresponding to the source sentence, The decoder performs the decoding process based on both information resulting from the encoding process performed by the source language sentence encoder and information resulting from the encoding process performed by the context encoder. The translation device according to claim 1.
3. a concatenation unit that concatenates the source language sentence information and the context information to generate concatenated information and passes the concatenated information to the encoder; Further equipped with The encoder performs the encoding process based on the connection information output by the connection unit. The translation device according to claim 1.
4. the concatenation unit inserts a separator token between the information of the source language sentence and the context information to generate the concatenated information. The translation device according to claim 3.
5. a selection unit that selects, in the learning mode, either a target language sentence which is a translation result output by the decoder based on a source language sentence preceding the current source language sentence, or a target language sentence which is a correct translation corresponding to a source language sentence preceding the current source language sentence, as the context information on the target language side, and outputs the selected context information; Further equipped with The encoder encodes the context information output by the selection unit. A translation device according to any one of claims 1 to 4.
6. the selection unit selects, based on a predetermined probability value p (where 0<p<1), the target language sentence of the correct translation with a probability p as the context information, and selects, with a probability (1-p), the target language sentence that is the translation result output by the decoder as the context information; 6. The translation device according to claim 5.
7. The selection unit determines the value of p such that p monotonically decreases in response to an increase in the value of e when the learning of the encoder and the decoder is in an e-th epoch (e is a positive integer). The translation device according to claim 6.
8. Computer, an encoder for encoding a source language sentence and target language context information corresponding to the source language sentence; a decoder that performs a decoding process based on information resulting from the encoding process performed by the encoder, and outputs a target language sentence that is a translation result of the source language sentence; A program for causing a translation device to function as a translation device comprising: In a translation mode for translating an unknown source sentence obtained from outside, the context information is a target sentence which is a translation result output by the decoder based on a source sentence preceding the source sentence, In a learning mode in which the encoder and the decoder are trained, the context information includes at least a case in which the context information is a target sentence that is a translation result output by the decoder based on a source sentence prior to the current source sentence. program.
Citation Information
Patent Citations
Text translation method and device, storage medium and computer equipment
CN109948166A
