Translation recommendation method, post-editing model training method, and related devices

CN117688948BActive Publication Date: 2026-08-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211041422.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2026-08-28
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

[0004]在译后编辑过程中,需要将译文中不恰当译文进行校正,然而目前的译后编辑方式准确性较低,效果较差

Benefits of technology

[0038]由上述技术方案可以看出,本申请在进行翻译推荐时可以获取包括多个分段和分段标识的输入序列,多个分段包括源语言片段和带有掩膜标签的目标语言片段,分段标识用于将源语言片段和目标语言片段进行分割,从而可以显示的区分源语言片段和目标语言片段,目标语言片段是源语言片段的第一原始译文,掩膜标签位于目标语言片段的待推荐位置。将输入序列输入至译后编辑模型,通过译后编辑模型对输入序列进行嵌入处理得到输入序列对应的词向量、位置向量,以及基于分段标识进行嵌入处理得到分段向量,进而基于输入序列对应的词向量、位置向量和分段向量,通过译后编辑模型进行向量融合得到输入序列的输入向量。由于输入向量是基于输入序列对应的词向量、位置向量和分段向量得到的,分段向量是基于分段标识确定的,故输入向量可以显示的区分源语言片段和目标语言片段。这样,根据输入向量,通过译后编辑模型进行编码输出编码结果时,能够针对不同的分段进行区分建模,得到体现不同分段的编码结果,从而考虑到跨语言信息,避免在基于编码结果,通过译后编辑模型进行解码输出待推荐位置对应的翻译推荐结果时,将源语言片段和目标语言片段混淆,导致输出的翻译推荐结果不准。可见,本方案可以通过译后编辑模型进行自动翻译推荐供用户选择,从而实现译后编辑。在进行翻译推荐时,可以显示的区分源语言片段和目标语言片段,进而针对不同的分段进行区分建模,从而在输出翻译推荐结果时考虑到跨语言信息,提高译后编辑模型的推荐性能,提高翻译推荐结果的准确性,进而提高译后编辑的准确性和译后编辑效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117688948B_ABST
    Figure CN117688948B_ABST
Patent Text Reader

Abstract

The application discloses a translation recommendation method, a post-editing model training method and related devices. An input sequence including multiple segments and segment identifiers is obtained. The multiple segments include source language segments and target language segments with mask labels. The segment identifiers segment the source language segments and the target language segments. The mask labels are located at to-be-recommended positions of the target language segments. An input sequence corresponding word vector, a position vector, and a segment vector are obtained by embedding processing of the input sequence through a post-editing model. An input vector of the input sequence is obtained through the post-editing model based on the input sequence corresponding word vector, the position vector, and the segment vector. An encoding result is output by encoding of the input vector through the post-editing model. A translation recommendation result of the to-be-recommended position is output by decoding based on the encoding result through the post-editing model. The accuracy of the translation recommendation result is improved to improve the accuracy and effect of post-editing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine translation, and in particular to a translation recommendation method, a training method for a post-editing model, and related apparatus. Background Technology

[0002] With the deepening of international exchanges, the demand for language translation is increasing daily. However, the world has a wide variety of languages, each with its own characteristics and flexible forms, making automatic language processing, including machine translation between languages, a crucial technology.

[0003] Machine translation, also known as automatic translation, is the process of using computers to transform one language (source language) into another language (target language), generally referring to the translation of sentences and entire texts between natural languages. Correspondingly, machine-translated text refers to text in another language obtained by translating text from one language using a computer. Post-editing (PS) refers to the process of refining the machine-generated translation to make it more human-like and achieve better translation results.

[0004] In the post-editing process, it is necessary to correct inappropriate translations in the original text. However, current post-editing methods have low accuracy and poor results. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a translation recommendation method and related apparatus that can explicitly distinguish between source language segments and target language segments, and then perform differentiation modeling for different segments. This allows the output of translation recommendation results to take cross-linguistic information into account, thereby improving the recommendation performance of the post-editing model, increasing the accuracy of the translation recommendation results, and ultimately improving the accuracy and effectiveness of post-editing.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] On the one hand, embodiments of this application provide a translation recommendation method, the method comprising:

[0008] Obtain an input sequence including multiple segments and segment identifiers. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to segment the source language fragments and the target language fragments. The target language fragment is the first original translation of the source language fragment. The mask label is located at the recommended position of the target language fragment.

[0009] The input sequence is embedded using a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and segment vectors are obtained by embedding based on the segment identifier.

[0010] Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained by vector fusion through the post-editing model;

[0011] Based on the input vector, the encoding result is output through the post-editing model;

[0012] Based on the encoding result, the translation recommendation result corresponding to the position to be recommended is output through the post-editing model.

[0013] On the one hand, embodiments of this application provide a training method for a post-editing model, the method comprising:

[0014] Obtain an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0015] The input sample sequence is embedded using an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and segment vectors are obtained by embedding based on the sample segment identifier.

[0016] Based on the word vectors, position vectors, and segment vectors corresponding to the input sample sequence, the input sample vector of the input sample sequence is obtained by vector fusion through the initial network model;

[0017] Based on the input sample vector, the initial network model is used to encode and output the sample encoding result;

[0018] Based on the sample encoding results, the initial network model is used to decode and output the predicted translation recommendation results corresponding to the sample recommendation positions.

[0019] The initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model.

[0020] On one hand, embodiments of this application provide a translation recommendation device, the device comprising an acquisition unit, a processing unit, a determination unit, an encoding unit, and a decoding unit:

[0021] The acquisition unit is used to acquire an input sequence including multiple segments and segment identifiers. The multiple segments include source language segments and target language segments with mask labels. The segment identifiers are used to divide the source language segments and the target language segments. The target language segment is the first original translation of the source language segment. The mask label is located at the recommended position of the target language segment.

[0022] The processing unit is configured to perform embedding processing on the input sequence through a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and to perform embedding processing based on the segmentation identifier to obtain segment vectors;

[0023] The determining unit is used to obtain the input vector of the input sequence by performing vector fusion through the post-editing model based on the word vector, position vector and segment vector corresponding to the input sequence;

[0024] The encoding unit is used to encode and output the encoding result based on the input vector through the post-editing model;

[0025] The decoding unit is used to decode and output the translation recommendation result corresponding to the position to be recommended based on the encoding result and the post-editing model.

[0026] On one hand, embodiments of this application provide a training apparatus for a post-editing model, the apparatus comprising an acquisition unit, a processing unit, a determination unit, an encoding unit, a decoding unit, and a training unit:

[0027] The acquisition unit is used to acquire an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0028] The processing unit is used to perform embedding processing on the input sample sequence through an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and to perform embedding processing based on the sample segmentation identifier to obtain segment vectors;

[0029] The determining unit is used to obtain the input sample vector of the input sample sequence by performing vector fusion through the initial network model based on the word vector, position vector and segment vector corresponding to the input sample sequence;

[0030] The encoding unit is used to encode and output the sample encoding result based on the input sample vector through the initial network model;

[0031] The decoding unit is used to decode and output the predicted translation recommendation result corresponding to the sample recommendation position based on the sample encoding result and the initial network model.

[0032] The training unit is used to train the initial network model based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions, so as to obtain the post-editing model.

[0033] On one hand, embodiments of this application provide a computer device, the computer device including a processor and a memory:

[0034] The memory is used to store program code and transmit the program code to the processor;

[0035] The processor is configured to execute the method described in any of the foregoing aspects according to the instructions in the program code.

[0036] In one aspect, embodiments of this application provide a computer-readable storage medium for storing program code, which, when executed by a processor, causes the processor to perform the method described in any of the foregoing aspects.

[0037] On one hand, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the foregoing aspects.

[0038] As can be seen from the above technical solution, this application can obtain an input sequence including multiple segments and segment identifiers when performing translation recommendation. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to divide the source language fragments and target language fragments, thereby clearly distinguishing between them. The target language fragment is the first original translation of the source language fragment, and the mask label is located at the recommended position of the target language fragment. The input sequence is input to a post-editing model, which performs embedding processing on the input sequence to obtain the corresponding word vectors and position vectors, as well as segment vectors based on the segment identifiers. Then, based on the corresponding word vectors, position vectors, and segment vectors, the post-editing model performs vector fusion to obtain the input vector of the input sequence. Since the input vector is obtained based on the corresponding word vectors, position vectors, and segment vectors, and the segment vector is determined based on the segment identifiers, the input vector can clearly distinguish between source language fragments and target language fragments. In this way, when encoding and outputting the encoded result through the post-editing model based on the input vector, it can differentiate and model different segments to obtain encoding results that reflect different segments. This takes into account cross-linguistic information and avoids confusion between source and target language segments when decoding and outputting translation recommendations corresponding to the position to be recommended based on the encoded result, which would lead to inaccurate translation recommendations. Therefore, this solution can automatically recommend translations for users to choose from through the post-editing model, thus realizing post-editing. During translation recommendation, it can explicitly distinguish between source and target language segments, and then differentiate and model different segments, thus taking cross-linguistic information into account when outputting translation recommendations, improving the recommendation performance of the post-editing model, improving the accuracy of translation recommendations, and ultimately improving the accuracy and effectiveness of post-editing. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 An application scenario architecture diagram of a translation recommendation method provided in this application embodiment;

[0041] Figure 2 A flowchart illustrating a translation recommendation method provided in this application embodiment;

[0042] Figure 3A structural diagram of a post-editing model provided in an embodiment of this application;

[0043] Figure 4 A flowchart illustrating a training method for a post-editing model provided in this application embodiment;

[0044] Figure 5 The structure of a translation recommendation device provided in this application embodiment;

[0045] Figure 6 A structural diagram of a training device for a post-editing model provided in an embodiment of this application;

[0046] Figure 7 A structural diagram of a terminal provided in an embodiment of this application;

[0047] Figure 8 This is a structural diagram of a server provided in an embodiment of this application. Detailed Implementation

[0048] The embodiments of this application will now be described with reference to the accompanying drawings.

[0049] During post-editing, it is necessary to correct inappropriate translations in the translated text. The translations used for correction can be selected by the user based on recommended translations. In this case, to enable post-editing, it is necessary to recommend translations to the user.

[0050] Current translation suggestion (TS) methods are mainly based on multilingual pre-trained models such as cross-lingual language models (XLM). These methods can optimize the model by utilizing the training objective of the masked language model (MLM), enabling the model to predict words at masked positions.

[0051] However, this method directly concatenates the source and target language segments together before feeding them into the model. This simple concatenation input fails to provide the model with segmentation information for the source and target language segments, preventing the model from differentiating and modeling based on these segments. This results in limited performance and consequently, lower accuracy and poorer post-editing results.

[0052] To address the aforementioned technical problems, this application provides a translation recommendation method. This method inputs an input sequence comprising multiple segments and segment identifiers into a post-editing model. The source language segments and target language segments are divided using the segment identifiers, thus explicitly distinguishing between them. In this way, the post-editing model can differentiate between different segments, taking cross-linguistic information into account when outputting translation recommendations. This improves the recommendation performance of the post-editing model, enhances the accuracy of translation recommendations, and ultimately improves the accuracy and effectiveness of post-editing.

[0053] It should be noted that the method provided in this application embodiment can be applied to any translation scenario that requires post-translation editing, such as machine translation, human translation, and other translation scenarios. This application embodiment mainly uses machine translation scenario as an example for introduction.

[0054] The translation recommendation method provided in this application can be executed by a computer device, such as a server or a terminal. Specifically, it can be executed by the server or the terminal alone, or by the server and the terminal working together. The server can be a standalone server or a server in a cluster. Terminals include, but are not limited to, smartphones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft.

[0055] It should be noted that the method provided in this application embodiment can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0056] like Figure 1 As shown, Figure 1 An application scenario architecture diagram of a translation recommendation method is shown, which is illustrated using a terminal executing the translation recommendation method provided in the embodiments of this application as an example. This application scenario may include a terminal 100. When it is necessary to convert one language (source language) into another language (target language), the terminal 100 can use machine translation to translate the source language fragment into a target language fragment. To improve translation quality, the target language fragment generated by machine translation can be post-edited to refine the translation, making it more consistent with human language style and achieving better translation results.

[0057] During post-editing, users can perform a selection operation on terminal 100 to select the parts of the translation that need to be corrected, thereby triggering the translation recommendation method provided in this application embodiment. The method of triggering this translation recommendation method can include various approaches, such as direct triggering based on a selection operation, or triggering the translation recommendation method by clicking the "Translate" control after the user performs a selection operation.

[0058] Thereafter, the terminal 100 may acquire an input sequence comprising a plurality of segments and segment identifiers, wherein the plurality of segments comprise a source language segment and a target language segment with a mask label, and the segment identifier is used to separate the source language segment from the target language segment, so that the source language segment and the target language segment can be explicitly distinguished. The target language segment is a first original translation of the source language segment. The mask label is located at a position to be recommended in the target language segment, and the translation at the position to be recommended is masked by the mask label.

[0059] Wherein, the source language segment may be a language text that needs to be translated into a target language, the source language may be various known languages, such as Chinese, English, German, French, etc., and the target language may be other languages different from the source language. The target language segment may be a translation obtained by translating the source language segment. For example, the source language segment is "A song that is called divine comedy has become popular online", and the target language segment is "A song called "shenqu" on the internetfire".

[0060] The position to be recommended may be the position of a partial translation to be corrected in the target language segment, and translation candidates need to be recommended for this position. The position to be recommended may be determined based on a user's selection operation. For example, "huo le" in the above source language segment is incorrectly translated as "fire" in the target language segment. During post-editing, the user may perform a selection operation on "fire", so as to select "fire" as the partial translation to be corrected, and the position of "fire" in the target language segment is referred to as the position to be recommended.

[0061] The terminal 100 inputs the input sequence into a post-editing model, obtains word vectors and position vectors corresponding to the input sequence by performing embedding processing on the input sequence through the post-editing model, and obtains segment vectors by performing embedding processing based on the segment identifiers, then performs vector fusion through the post-editing model based on the word vectors, position vectors and segment vectors corresponding to the input sequence to obtain an input vector of the input sequence.

[0062] Since the input vector is derived from the word vector, position vector, and segment vector corresponding to the input sequence, and the segment vector is determined based on the segment identifier, the input vector can explicitly distinguish between source language segments and target language segments. Thus, when the terminal 100 encodes and outputs the encoding result through the post-editing model based on the input vector, it can differentiate and model different segments, obtaining encoding results that reflect different segments. This takes cross-linguistic information into account and avoids confusion between source and target language segments when decoding and outputting the translation recommendation result corresponding to the position to be recommended based on the encoding result, which would lead to inaccurate translation recommendation results. Therefore, it improves the recommendation performance of the post-editing model, increases the accuracy of translation recommendation results, and ultimately improves the accuracy and effectiveness of post-editing.

[0063] It should be noted that the methods provided in this application primarily relate to artificial intelligence (AI). AI is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.

[0064] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning. The methods provided in this application mainly relate to natural language processing and machine learning / deep learning.

[0065] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs. Examples of this application may relate to machine translation technology.

[0066] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning. In the embodiments of this application, a defect detection model can be trained using machine learning.

[0067] Next, taking the terminal-executed translation recommendation method as an example, the translation recommendation method provided in this application embodiment will be described in detail with reference to the accompanying drawings. See also Figure 2 , Figure 2 A flowchart of a translation recommendation method is shown, the method comprising:

[0068] S201. Obtain an input sequence that includes multiple segments and segment identifiers.

[0069] When it is necessary to convert one language (source language) into another language (target language), the terminal can use machine translation to translate the source language segment into the target language segment. To improve the translation quality, the target language segment generated by machine translation can be edited to refine the translation (here referred to as the first original translation), making the translation more in line with human language style and achieving a better translation effect.

[0070] During the post-editing process, users can perform selection operations on the terminal to choose the parts of the translation that need to be corrected, thereby triggering the translation recommendation method provided in this application embodiment. The parts of the translation that need correction may include, for example, translation errors, awkward sentences, or missing content.

[0071] For example, the source language is Chinese, and the target language is English. The source language segment is "A song called 'shenqu' went viral online," and the target language segment is "A song called 'shenqu' on the internet fire." The word "fire" in the target language segment is translated incorrectly. During post-editing, the user can select "fire" as the part of the translation that needs correction. The position of "fire" in the target language segment is called the "recommended position."

[0072] The terminal can then acquire an input sequence that includes multiple segments and segment identifiers. Each segment includes a source language fragment and a target language fragment with a mask label. The segment identifier is used to separate the source and target language fragments. The target language fragment is the first original translation of the source language fragment, and the mask label is located at the desired recommendation position within the target language fragment.

[0073] Segmentation identifiers can be represented by symbols, numbers, etc. Typically, symbols are used. <sep>The "position to be recommended" indicates the location of the translated portion requiring correction within the target language segment, and suggests candidate translations for that position. The recommended position can be determined based on the user's selection.

[0074] When the source language segment is represented by x, and the target language segment with a mask label is represented by m, the input sequence can be represented as:

[0075] [x; <sep>;m]

[0076] Where [a; b] represents the concatenation of a and b, and in this case, it represents the concatenation of x and m. <sep>It is a segmentation identifier, a symbol used to separate source language segments and target language segments.

[0077] S202. The input sequence is embedded using a post-editing model to obtain the word vector and position vector corresponding to the input sequence, and the segment vector is obtained by embedding based on the segment identifier.

[0078] After obtaining the input sequence, the input sequence can be embedded using a post-editing model to obtain the word vectors, position vectors, and segment vectors based on segment identifiers.

[0079] Specifically, the input sequence can be segmented into words. For each word, a word vector is obtained by looking up the word embedding table. Additionally, to model the position of each word, a position vector is introduced. For each segment, the position embedding is calculated separately, yielding the position vectors of the source and target language segments, thus providing the position vector for the entire input sequence. Furthermore, to distinguish between different segments, a segment embedding is introduced. The segment embedding differentiates between source and target language segments. Therefore, words belonging to the same segment may have the same identifier, while words belonging to different segments may have different identifiers. For example, words belonging to the source language segment may have all identifiers of 0, while words belonging to the target language segment may have all identifiers of 1.

[0080] In one possible implementation, the post-editing model can be based on the encoder-decoderTransformer framework. In this case, the post-editing model can include an input layer, an encoder, and a decoder. Both the encoder and decoder are neural networks. The encoder's output serves as an encoding of the input sequence; the encoder's output is used as the decoder's input, and the decoder's output is the desired target structure. In this embodiment, the target result can be a translation recommendation result. Specifically, the encoder's input is a variable-length vector (i.e., the input vector of the input sequence), and its output is a fixed-length vector (i.e., the subsequent encoding result); the decoder's output is a variable-length vector (i.e., the translation recommendation result).

[0081] Correspondingly, S202 can be implemented by obtaining the word vectors, position vectors, and segment vectors corresponding to the input sequence through the input layer.

[0082] In this context, the structural diagram of the post-editing model can be found in [reference needed]. Figure 3 As shown, it includes an input layer 301, an encoder 302, and a decoder 303. The input sequence is fed into the input layer 301, where word vectors, position vectors, and segment vectors corresponding to the input sequence are obtained. Let x represent the source language segment, m represent the target language segment with a mask label, and the segment identifier be denoted by _____. <sep>For example, if x contains s words and m contains t words (one of which can be a mask), <sep>If we consider a word, then the word vectors corresponding to the input sequence can be x1, ..., x2 in sequence. s , <sep>m1, ..., m t (see Figure 3 (as shown); the position vectors can be 0, 1, ..., s, 0, 1, ... (see...) Figure 3 (as shown); the piecewise vectors can be 0, 0, ..., 0, 1, 1, ... (see...) Figure 3 (As shown).

[0083] S203. Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained by vector fusion through the post-editing model.

[0084] Having obtained the word vectors, position vectors, and segment vectors corresponding to the input sequence, the terminal can perform vector fusion using a post-editing model to obtain the input vector of the input sequence. The vector fusion method can include various approaches, such as summing the word vectors, position vectors, and segment vectors corresponding to each word to obtain the final input vector.

[0085] If the post-editing model includes an input layer, encoder, and decoder, as described above... Figure 3 As shown, S203 can be implemented by obtaining the input vector of the input sequence through the input layer based on the word vector, position vector and segment vector corresponding to the input sequence.

[0086] Based on the above Figure 3 Taking word vectors, position vectors, and segment vectors as examples, in Figure 3 In the text, the word vector, position vector, and segment vector of each word correspond one-to-one (i.e., in...). Figure 3 If we represent this as a vertical queue, we can sum the word vectors, position vectors, and segment vectors located in the vertical queue to obtain the vector representation of the position of each word. The vector representation of all the vectors is then used to form the input vector of the input sequence.

[0087] S204. Based on the input vector, the encoding result is output through the post-editing model.

[0088] After obtaining the input vector of the input sequence, the terminal can encode and output the encoded result through the post-editing model.

[0089] Since the input vector is derived from the word vector, position vector, and segment vector corresponding to the input sequence, and the segment vector is determined based on the segment identifier, the input vector can explicitly distinguish between source language segments and target language segments. Thus, when the terminal encodes and outputs the encoded result using the post-editing model based on the input vector, it can differentiate and model different segments, achieving segment-awareness. This results in encoded results that reflect different segments, taking cross-linguistic information into account. It also prevents confusion between source and target language segments when decoding and outputting translation recommendations based on the encoded result at the desired position using the post-editing model, thus avoiding inaccurate translation recommendations and improving the accuracy of the translation recommendations.

[0090] If the post-editing model includes an input layer, encoder, and decoder, as described above... Figure 3 As shown, S204 can be implemented by sending the input vector into the encoder 302, and then encoding the result based on the input vector through the encoder 302.

[0091] Understandably, in the translation recommendation process, it is necessary to predict the translation recommendation result corresponding to the position to be recommended in the target language segment based on the input sequence. The specific translation recommendation result for this position may be related to other words in the input sequence. Some words may have a strong relationship, while others may have a weak or no relationship. To improve the accuracy of the subsequent decoding of the translation recommendation result, it is necessary to accurately select the words in the input sequence that are more crucial for predicting the translation recommendation result. For this purpose, an attention mechanism can be introduced. The attention mechanism is essentially similar to the selective visual attention mechanism in humans. Its core objective is also to select the information that is more crucial to the current task objective (decoding the translation recommendation result) from a large amount of information (such as all the words in the input sequence).

[0092] In this case, the way to encode and output the encoding result based on the input vector is to use the encoder to process the input vector and obtain the attention weight of each word in multiple segments through the attention mechanism, and then encode the input vector and output the encoding result based on the attention weight.

[0093] The attention mechanism can be implemented by an attention layer. Since the input vector in this embodiment is calculated based on segmented vectors, segmented perception can be achieved based on these segmented vectors. Therefore, the attention mechanism can be called a segment-aware attention mechanism, and the attention layer can be called a segment-aware attention layer. In this case, the encoder can include a segment-aware attention layer. If the entire encoder consists of N identical stacked modules, each module contains a segment-aware attention layer and a simple feedforward network (FFN). Other layers, such as add and normalize layers, can also be included.

[0094] See Figure 3 As shown, encoder 302 comprises N modules. Each module includes a segmented perceptual attention layer 3021, a feedforward neural network 3022, and two summation and normalization layers, as shown in 3023 and 3024 respectively. The segmented perceptual attention layer 3021 is used to calculate attention weights; the feedforward neural network 3022 performs spatial transformation. Typically, an FFN contains two linear transformation layers with ReLU activation function in between. Each module in the main framework is followed by a summation and normalization layer, a general technique that effectively improves the gradient vanishing problem in deep models, breaks network symmetry, mitigates network degradation, accelerates convergence, and normalizes the optimization space. For example, a summation and normalization layer 3023 follows the segmented perceptual attention layer 3021, and a summation and normalization layer 3024 follows the feedforward neural network 3022.

[0095] Attention mechanisms in related technologies are used to extract higher-order information from input information (e.g., the input vector of the input sequence), but they do not explicitly distinguish different segments within the input sequence. In this case, the traditional method for calculating attention weights is as follows:

[0096]

[0097] Where Q and K are the query and key in the attention mechanism, specifically the word vectors in the input vector; W Q and W K It is a mapping matrix, specifically the parameters of the attention layer; d x It is the dimension of the input vector.

[0098] For the translation recommendation task, the input sequence contains segments from two different sources: source language segments and target language segments with mask labels. These different segments provide different information to the post-editing model, therefore explicit differentiation in modeling is necessary. However, traditional attention mechanisms cannot distinguish the information from different segments in the input sequence. Based on these analyses, this application proposes a segment-aware attention mechanism. This mechanism incorporates segment vectors during attention weight calculation. Based on the input vectors, the encoder processes the attention weights of each word within multiple segments using the attention mechanism. The calculation method is as follows:

[0099]

[0100] Among them, E seg It is a piecewise vector that can share parameters with the piecewise vector in the input layer, where a·b represents the dot product of a and b.

[0101] This application proposes a segmented awareness attention mechanism, which can visually distinguish different segments in the input sequence during modeling, thereby improving the post-editing model's capabilities.

[0102] It should be noted that attention mechanisms can include various types, such as self-attention, cross-language attention, and multi-head attention. This application mainly introduces the self-attention and cross-attention mechanisms.

[0103] When the attention mechanism is a self-attention mechanism, then Figure 3 The segmented perception attention layer 3021 in the code can be a segmented perception self-attention layer. In this case, based on the input vector, the encoder processes the input vector using an attention mechanism to obtain the attention weight of each word vector. This can be done by performing attention calculations on each word vector and other word vectors belonging to the same segment. Specifically, each word vector in the input vector can be used as the first word vector. Based on the segment vectors in the input vector, attention calculations are performed on the first word vector and each third word vector separately to obtain the attention weight of the first word vector. The third word vectors belong to the same segment as the first word vector.

[0104] If the formula for calculating attention weight is as shown in formula (2) above, then K and Q in formula (2) belong to the same segment. For example, K represents the first word vector and belongs to the source language segment, and Q represents the third word vector and also belongs to the source language segment.

[0105] When the attention mechanism is a cross-lingual attention mechanism, then Figure 3 The segmented perception attention layer 3021 in the code can be a segmented perception cross-attention layer. In this case, based on the input vector, the encoder processes the data using an attention mechanism to obtain the attention weights for each word vector. This can be done by performing attention calculations on each word vector and other word vectors belonging to different segments. Specifically, each word vector in the input vector can be used as the first word vector. Based on the segment vectors in the input vector, attention calculations are performed on the first word vector and each second word vector separately to obtain the attention weight of the first word vector, where the second word vectors belong to different segments from the first word vector.

[0106] If the formula for calculating attention weight is as shown in formula (2) above, then K and Q in formula (2) belong to different segments. For example, K represents the first word vector and belongs to the source language segment, while Q represents the second word vector and belongs to the target language segment.

[0107] By employing a cross-linguistic attention mechanism that takes into account the correlation between different segments, the word information from the source language segments can be incorporated into the subsequent decoding of translation recommendations, providing richer information for the decoding and improving the accuracy of the translation recommendations.

[0108] S205. Based on the encoding result, the translation recommendation result corresponding to the position to be recommended is output through the post-editing model.

[0109] After obtaining the encoding result, the terminal continues to decode the encoding result through the post-editing model and output the translation recommendation result corresponding to the position to be recommended.

[0110] If the post-editing model includes an input layer, encoder, and decoder, as described above... Figure 3 As shown, S205 can be implemented by the encoder outputting the encoded result and sending it to the decoder, and then, based on the encoded result, decoding the code and outputting the translation recommendation result corresponding to the position to be recommended. In this case, the translation recommendation result includes multiple candidate translations of different text lengths.

[0111] Taking the aforementioned source language segment as "A song called 'shenqu' became popular online" and the target language segment as "Asong called 'shenqu' on the internet fire" as an example, the corresponding translation options for the position to be recommended could be "became popular", "has become popular", or "has been popular".

[0112] The translation recommendations are provided to the user so that the user can select one of the translation candidates as the translation to be recommended for the desired position and complete the post-editing of the target language segment.

[0113] Understandably, the translation recommendation methods using MLM provided in related technologies have a fixed number of mask tags placed during each decoding iteration, and each mask tag can only predict one word. Therefore, these methods can only produce a single-length translation per decoding iteration, significantly reducing the diversity of translation recommendations. Furthermore, the number of mask tags is manually defined, resulting in excessive human intervention and greatly reducing the model's degrees of freedom, thus significantly impacting its predictive performance. Simultaneously, because only a single-length translation can be decoded each time, these methods require multiple decoding iterations to provide users with translation candidates of different lengths, leading to extremely time-consuming and inefficient decoding processes.

[0114] This application introduces the encoder-decoder Transormer framework, formalizing translation recommendation as a text generation task. In this method, only a mask tag needs to be placed at the position to be recommended, and the decoder can generate translations of different lengths. This allows for the generation of candidate translations of varying lengths in a single decoding operation, significantly increasing the diversity of translations in the recommendation results and greatly improving decoding efficiency.

[0115] In this embodiment, the decoder can also be composed of N identical modules stacked together. Each module includes a self-attention layer, a cross-attention layer, and a feedforward neural network. Of course, it can also include other layers, such as summation and normalization (Add&Norm) layers.

[0116] See Figure 3 As shown, the decoder 303 includes a self-attention layer 3031, a cross-lingual attention layer 3032, a feedforward neural network 3033, and three summation and normalization layers, namely 3034, 3035, and 3036. The self-attention layer 3031 is followed by the summation and normalization layer 3034, the cross-lingual attention layer 3032 is followed by the summation and normalization layer 3035, and the feedforward neural network 3033 is followed by the summation and normalization layer 3036.

[0117] The self-attention layer 3031 is used to encode the input information, the cross-language attention layer 3032 is used to focus on the information of the source language segment encoded by the encoder, and the functions of the feedforward neural network 3033 and the three summation and normalization layers can be found in the encoder, which will not be repeated here.

[0118] During the decoding process, the decoder's input is the output obtained from the previous decoding step (shifted inputs), see [link to decoder]. Figure 3 As shown. A beam search is performed on the decoder output to obtain the final translation recommendation. For example, if the original translation corresponding to the position to be recommended is "for the unity of the class", the decoder may first decode to obtain the output "to achieve", and then use this output as the input for the next step to continue decoding to obtain the output "class", and then use "class" as the input for the next step to continue decoding to obtain "unity". The final translation recommendation is "for the realization of class unity".

[0119] The method proposed in this application was tested on the public datasets WMT19EN-Zh and WMT14En-De. The experimental results are shown in Table 1. It can be seen that the method achieved the best translation results in four translation directions: English-Chinese (En→Zh), Chinese-English (Zh→En), English-German (En→De), and German-English (De→En).

[0120] Table 1

[0121]

[0122] Table 1 presents four translation recommendation methods: related technology 1 (e.g., XLM-based translation recommendation), related technology 2 (e.g., Native Transformer-based translation recommendation), related technology 3 (e.g., Dual-source Transformer-based translation recommendation), and our proposed method. BLEU and BLEURT are two evaluation metrics for measuring the effectiveness of translation recommendations. As shown in Table 1, compared to the three related technologies, our proposed method achieves higher BLEU and BLEURT values ​​in all four translation directions, indicating better translation performance. Specifically, in the Chinese-English translation direction, our proposed method improves the BLEU score by 1.3 points. The experimental results fully demonstrate the effectiveness of our proposed method.

[0123] Table 2 shows several examples of translation recommendations based on the methods provided in the embodiments of this application, as follows:

[0124] Table 2

[0125]

[0126] In the first example, it is Chinese to English translation (i.e., Zh→En). The source language segment in the input sequence is "A song known as a divine comedy has gone viral online", and the target language segment is "A song called "shenqu" on the internet fire". "Gone viral" in the source language segment is incorrectly translated as "fire". When the user selects the position of "fire" as the position to be recommended, the method of the present invention can provide correct translation recommendation results, which are "became popular", "has became popular" and "has been popular" respectively.

[0127] In the second example, it is also Zh→En, which demonstrates that the method of the present invention can recommend missing parts in the target language segment. The source language segment in the input sequence is "The weather is very nice today. Do you want to go out shopping together?", and the target language segment is "Today is beautiful day, want to go out shopping together?". There is missing content before "want to" in the target language segment, so the method of the present invention can provide correct translation recommendation results, which are "do you want to", "do you like to" and "you want to" respectively.

[0128] In the third example, it is English to Chinese translation (i.e., En→Zh), which demonstrates that the method of the present invention can recommend more fluent translations. The source language segment in the input sequence is "A new measures have been taken to achieve effective class unity", and the target language segment is "For achieving effective class unity, new measures have been taken". "For achieving effective class unity" in the target language segment is not smooth and fluent enough, so the method of the present invention can provide correct translation recommendation results, which are "To effectively achieve class unity", "For effectively achieving unity" and "Effectively achieving unity" respectively.

[0129] As can be seen from the above technical solution, this application can obtain an input sequence including multiple segments and segment identifiers when performing translation recommendation. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to divide the source language fragments and target language fragments, thereby clearly distinguishing between them. The target language fragment is the first original translation of the source language fragment, and the mask label is located at the recommended position of the target language fragment. The input sequence is input to a post-editing model, which performs embedding processing on the input sequence to obtain the corresponding word vectors and position vectors, as well as segment vectors based on the segment identifiers. Then, based on the corresponding word vectors, position vectors, and segment vectors, the post-editing model performs vector fusion to obtain the input vector of the input sequence. Since the input vector is obtained based on the corresponding word vectors, position vectors, and segment vectors, and the segment vector is determined based on the segment identifiers, the input vector can clearly distinguish between source language fragments and target language fragments. In this way, when encoding and outputting the encoded result through the post-editing model based on the input vector, it can differentiate and model different segments to obtain encoding results that reflect different segments. This takes into account cross-linguistic information and avoids confusion between source and target language segments when decoding and outputting translation recommendations corresponding to the position to be recommended based on the encoded result, which would lead to inaccurate translation recommendations. Therefore, this solution can automatically recommend translations for users to choose from through the post-editing model, thus realizing post-editing. During translation recommendation, it can explicitly distinguish between source and target language segments, and then differentiate and model different segments, thus taking cross-linguistic information into account when outputting translation recommendations, improving the recommendation performance of the post-editing model, improving the accuracy of translation recommendations, and ultimately improving the accuracy and effectiveness of post-editing.

[0130] Understandably, during the translation recommendation process, source and target language segments are segmented into corresponding words, including mask tags and segmentation identifiers. The word alignment information between the source and target language segments provides richer evidence for decoding and obtaining translation recommendations for the desired position, facilitating the search for appropriate words during decoding. Therefore, in this embodiment, the source and target language segments can be aligned based on the input vector to obtain word alignment information. Then, during decoding, the word alignment information and encoding results are used to decode via a post-editing model, outputting the translation recommendation result corresponding to the desired position.

[0131] The embodiments of this application can mine effective word alignment information, and then use the word alignment information for decoding, thereby improving the performance of translation recommendation based on the word alignment information contained in the input sequence.

[0132] Since the position to be recommended is masked by a mask label, when determining word alignment information, we can first predict the original translation corresponding to the mask label (i.e., the second original translation), and then determine the word alignment information. That is, we can align the source language segment and the target language segment according to the input vector to obtain the word alignment information between the source language segment and the target language segment. One way is to predict the second original translation of the position to be recommended by the post-editing model based on the input vector, and then use the second original translation to replace the mask label of the position to be recommended in the target language segment to obtain the replaced target language segment. Then, we can align the source language segment and the replaced target language segment to obtain the word alignment information.

[0133] In the foregoing embodiments, a post-editing model is used to automatically recommend translations, thereby completing the post-editing process. The performance of the post-editing model has a significant impact on the accuracy of the translation recommendation results and is crucial for translation recommendation. Therefore, this application also provides a training method for the post-editing model, see [link to relevant documentation]. Figure 4 The method includes:

[0134] S401. Obtain the input sample sequence.

[0135] The input sample sequence includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0136] S402. The input sample sequence is embedded using the initial network model to obtain the word vector and position vector corresponding to the input sample sequence, and the segment vector is obtained by embedding based on the sample segment identifier.

[0137] S403. Based on the word vectors, position vectors, and segment vectors corresponding to the input sample sequence, the input sample vector of the input sample sequence is obtained by vector fusion through the initial network model.

[0138] S404. Based on the input sample vector, the initial network model is used to encode and output the sample encoding results.

[0139] S405. Based on the sample encoding results, decode and output the predicted translation recommendation results corresponding to the sample recommendation positions through the initial network model.

[0140] S406. The initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model.

[0141] In this embodiment, an input sample sequence including multiple segments and segment identifiers is fed into an initial network model. The source language sample segments and target language sample segments are segmented using the segment identifiers, thus explicitly distinguishing between them. In this way, the initial network model can differentiate between different segments, taking cross-linguistic information into account when outputting predicted translation recommendations. This improves the accuracy of predicted translation recommendations during training, enhances the recommendation performance of the trained post-editing model, and ultimately improves the accuracy and effectiveness of post-editing.

[0142] It should be noted that the processing of the input sample sequence during the training of the post-editing model is similar to... Figure 2 The processing of the input sequence is similar in the corresponding embodiments, as shown in S201-S205, and will not be repeated here. However, during the training process, after obtaining the predicted translation recommendation results, it is necessary to optimize the model parameters of the initial network model using the predicted translation recommendation results. Specifically, the model parameters of the initial network model can be optimized based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions, thereby training the initial network model to obtain the post-editing model.

[0143] In order to obtain more accurate prediction translation recommendation results during training, in this embodiment of the application, the source language sample fragments and target language sample fragments can be aligned according to the input sample vector to obtain sample word alignment information between the source language sample fragments and target language sample fragments. In this way, when executing S405, the initial network model can be decoded according to the sample word alignment information and sample encoding results to output the prediction translation recommendation result corresponding to the sample recommendation position.

[0144] In one possible implementation, the determination of sample word alignment information can be based on the input sample vector. An initial network model predicts a second original sample translation of the sample recommendation position, which is then used to replace the mask label of the sample recommendation position in the target language sample fragment, resulting in a replaced target language sample fragment. The source language sample fragment and the replaced target language sample fragment are then aligned to obtain the sample word alignment information.

[0145] If the post-editing model is as described above... Figure 3 As shown, the encoder 302 can predict the translation of the second original sample corresponding to the mask label, thereby obtaining the sample word alignment information. Then, the sample word alignment information and the sample encoding result are input into the decoder 303 for decoding.

[0146] In other words, during the training process, in order to improve the performance of the post-editing model obtained from the training, in addition to obtaining the sample translation recommendation results, it is also necessary to predict the translation of the second original sample. Both of these are tasks that need to be learned during the training process. That is, the embodiments of this application introduce a multi-task training method to improve the performance of the post-editing model and thus improve the translation recommendation effect.

[0147] In this scenario, training is required for both tasks. One possible implementation is to train the two tasks alternately, allowing them to improve each other and increase training efficiency. In this case, the initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions. The post-editing model can be obtained by first training the initial network model based on the second set of original sample translations and the annotated original sample translations at the sample recommendation positions, and then second training based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions. This process is repeated alternately until the training stopping condition is met, resulting in the post-editing model.

[0148] This application's embodiments introduce a multi-task training approach, performing iterative training on two tasks: word alignment and translation recommendation. Specifically, it alternately trains a batch of translation recommendation tasks and a batch of word alignment tasks, effectively utilizing the information contained in the input sample sequences to improve recommendation performance.

[0149] It should be noted that, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods.

[0150] based on Figure 2 Corresponding to the translation recommendation method provided in the embodiments, this application also provides a translation recommendation device 500. See also Figure 5 The translation recommendation device 500 includes an acquisition unit 501, a processing unit 502, a determination unit 503, an encoding unit 504, and a decoding unit 505.

[0151] The acquisition unit 501 is used to acquire an input sequence including multiple segments and segment identifiers. The multiple segments include source language segments and target language segments with mask labels. The segment identifiers are used to divide the source language segments and the target language segments. The target language segment is the first original translation of the source language segment. The mask label is located at the recommended position of the target language segment.

[0152] The processing unit 502 is used to perform embedding processing on the input sequence through a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and to perform embedding processing based on the segmentation identifier to obtain segment vectors;

[0153] The determining unit 503 is used to obtain the input vector of the input sequence by performing vector fusion through the post-editing model based on the word vector, position vector and segment vector corresponding to the input sequence;

[0154] The encoding unit 504 is used to encode and output the encoding result based on the input vector through the post-editing model;

[0155] The decoding unit 505 is used to decode and output the translation recommendation result corresponding to the position to be recommended based on the encoding result and the post-editing model.

[0156] In one possible implementation, the post-editing model includes an input layer, an encoder, and a decoder, and the processing unit 502 is used for:

[0157] The input layer obtains the word vector, position vector, and segment vector corresponding to the input sequence.

[0158] The determining unit 503 is used for:

[0159] Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained through the input layer;

[0160] The encoding unit 504 is used for:

[0161] Based on the input vector, the encoder performs encoding and outputs the encoding result;

[0162] The decoding unit 505 is used for:

[0163] Based on the encoding result, the decoder decodes and outputs the translation recommendation result corresponding to the position to be recommended.

[0164] In one possible implementation, the translation recommendation results include multiple candidate translations of different text lengths.

[0165] In one possible implementation, the encoding unit 504 is used for:

[0166] Based on the input vector, the encoder uses an attention mechanism to process the data to obtain the attention weight of each word in the multiple segments;

[0167] Based on the attention weights, the encoder encodes the input vector and outputs the encoding result.

[0168] In one possible implementation, the attention mechanism is a cross-language attention mechanism, and the encoding unit 504 is used for:

[0169] Each word vector in the input vector is taken as the first word vector. Based on the segmented vectors in the input vector, attention is calculated on the first word vector and each second word vector to obtain the attention weight of the first word vector. The second word vector and the first word vector belong to different segments.

[0170] In one possible implementation, the attention mechanism is a self-attention mechanism, and the encoding unit 504 is used for:

[0171] Each word vector in the input vector is taken as the first word vector. Based on the segmented vectors in the input vector, attention is calculated on the first word vector and each third word vector to obtain the attention weight of the first word vector. The third word vector and the first word vector belong to the same segment.

[0172] In one possible implementation, the determining unit 503 is further configured to:

[0173] The source language segment and the target language segment are aligned based on the input vector to obtain word alignment information between the source language segment and the target language segment;

[0174] The decoding unit 505 is used for:

[0175] Based on the word alignment information and the encoding result, the post-editing model is used for decoding to output the translation recommendation result corresponding to the position to be recommended.

[0176] In one possible implementation, the determining unit 503 is configured to:

[0177] Based on the input vector, the post-editing model predicts the second original translation for the position to be recommended.

[0178] The mask label of the position to be recommended in the target language segment is replaced with the second original translation to obtain the replaced target language segment;

[0179] The source language segment and the replaced target language segment are aligned to obtain the word alignment information.

[0180] As can be seen from the above technical solution, this application can obtain an input sequence including multiple segments and segment identifiers when performing translation recommendation. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to divide the source language fragments and target language fragments, thereby clearly distinguishing between them. The target language fragment is the first original translation of the source language fragment, and the mask label is located at the recommended position of the target language fragment. The input sequence is input to a post-editing model, which performs embedding processing on the input sequence to obtain the corresponding word vectors and position vectors, as well as segment vectors based on the segment identifiers. Then, based on the corresponding word vectors, position vectors, and segment vectors, the post-editing model performs vector fusion to obtain the input vector of the input sequence. Since the input vector is obtained based on the corresponding word vectors, position vectors, and segment vectors, and the segment vector is determined based on the segment identifiers, the input vector can clearly distinguish between source language fragments and target language fragments. In this way, when encoding and outputting the encoded result through the post-editing model based on the input vector, it can differentiate and model different segments to obtain encoding results that reflect different segments. This takes into account cross-linguistic information and avoids confusion between source and target language segments when decoding and outputting translation recommendations corresponding to the position to be recommended based on the encoded result, which would lead to inaccurate translation recommendations. Therefore, this solution can automatically recommend translations for users to choose from through the post-editing model, thus realizing post-editing. During translation recommendation, it can explicitly distinguish between source and target language segments, and then differentiate and model different segments, thus taking cross-linguistic information into account when outputting translation recommendations, improving the recommendation performance of the post-editing model, improving the accuracy of translation recommendations, and ultimately improving the accuracy and effectiveness of post-editing.

[0181] based on Figure 4 Corresponding to the training method of the post-editing model provided in the embodiments, this application also provides a training device 600 for the post-editing model. See also Figure 6 The training device 600 for the post-editing model includes an acquisition unit 601, a processing unit 602, a determination unit 603, an encoding unit 604, a decoding unit 605, and a training unit 606.

[0182] The acquisition unit 601 is used to acquire an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0183] The processing unit 602 is used to perform embedding processing on the input sample sequence through an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and to perform embedding processing based on the sample segmentation identifier to obtain segment vectors.

[0184] The determining unit 603 is used to obtain the input sample vector of the input sample sequence by performing vector fusion through the initial network model based on the word vector, position vector and segment vector corresponding to the input sample sequence;

[0185] The encoding unit 604 is used to encode and output the sample encoding result based on the input sample vector through the initial network model;

[0186] The decoding unit 605 is used to decode and output the predicted translation recommendation result corresponding to the sample recommendation position based on the sample encoding result and the initial network model.

[0187] The training unit 606 is used to train the initial network model based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions, so as to obtain the post-editing model.

[0188] In one possible implementation, the determining unit 603 is further configured to:

[0189] Alignment processing is performed on the source language sample fragment and the target language sample fragment based on the input sample vector to obtain sample word alignment information between the source language sample fragment and the target language sample fragment;

[0190] The decoding unit 605 is used for:

[0191] Based on the sample word alignment information and the sample encoding result, the initial network model is used for decoding to output the predicted translation recommendation result corresponding to the sample recommendation position.

[0192] In one possible implementation, the determining unit 603 is configured to:

[0193] Based on the input sample vector, the second original sample translation of the sample recommendation position is predicted through the initial network model;

[0194] The mask label at the recommended position of the target language sample fragment is replaced with the translation of the second original sample to obtain the replaced target language sample fragment;

[0195] Alignment processing is performed on the source language sample fragment and the replaced target language sample fragment to obtain the sample word alignment information.

[0196] In one possible implementation, the training unit 606 is used for:

[0197] The initial network model is trained for the first time based on the second original sample translation and the annotated original sample translation of the sample recommendation position;

[0198] The initial network model is trained a second time based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions.

[0199] The first training and the second training are performed alternately until the training stopping condition is met, thus obtaining the post-editing model.

[0200] In this embodiment, an input sample sequence including multiple segments and segment identifiers is fed into an initial network model. The source language sample segments and target language sample segments are segmented using the segment identifiers, thus explicitly distinguishing between them. In this way, the initial network model can differentiate between different segments, taking cross-linguistic information into account when outputting predicted translation recommendations. This improves the accuracy of predicted translation recommendations during training, enhances the recommendation performance of the trained post-editing model, and ultimately improves the accuracy and effectiveness of post-editing.

[0201] This application also provides a computer device capable of executing translation recommendation methods or post-editing model training methods. This computer device can be, for example, a terminal, such as a smartphone.

[0202] Figure 7 The diagram shown is a block diagram of a portion of the structure of a smartphone provided in an embodiment of this application. (Reference) Figure 7 The smartphone includes components such as: a radio frequency (RF) circuit 710, a memory 720, an input unit 730, a display unit 740, a sensor 750, an audio circuit 760, a Wi-Fi module 770, a processor 780, and a power supply 790. The input unit 730 may include a touch panel 731 and other input devices 732, the display unit 740 may include a display panel 741, and the audio circuit 760 may include a speaker 761 and a microphone 762. It is understood that... Figure 7 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0203] The memory 720 can be used to store software programs and modules. The processor 780 executes various functions and data processing of the smartphone by running the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the smartphone (such as audio data, phonebook, etc.). In addition, the memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0204] The processor 780 is the control center of the smartphone, connecting various parts of the smartphone via various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 720, and by accessing data stored in the memory 720. Optionally, the processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 780.

[0205] In this embodiment, the processor 780 in the smartphone can perform the following steps:

[0206] Obtain an input sequence including multiple segments and segment identifiers. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to segment the source language fragments and the target language fragments. The target language fragment is the first original translation of the source language fragment. The mask label is located at the recommended position of the target language fragment.

[0207] The input sequence is embedded using a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and segment vectors are obtained by embedding based on the segment identifier.

[0208] Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained by vector fusion through the post-editing model;

[0209] Based on the input vector, the encoding result is output through the post-editing model;

[0210] Based on the encoding result, the translation recommendation result corresponding to the position to be recommended is output through the post-editing model.

[0211] or,

[0212] Obtain an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0213] The input sample sequence is embedded using an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and segment vectors are obtained by embedding based on the sample segment identifier.

[0214] Based on the word vectors, position vectors, and segment vectors corresponding to the input sample sequence, the input sample vector of the input sample sequence is obtained by vector fusion through the initial network model;

[0215] Based on the input sample vector, the initial network model is used to encode and output the sample encoding result;

[0216] Based on the sample encoding results, the initial network model is used to decode and output the predicted translation recommendation results corresponding to the sample recommendation positions.

[0217] The initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model.

[0218] The computer device provided in this application embodiment can also be a server. Please refer to [link / reference]. Figure 8 As shown, Figure 8 This is a structural diagram of a server 800 provided in an embodiment of this application. The server 800 can vary significantly due to different configurations or performance. It may include one or more processors, such as a Central Processing Unit (CPU) 822, and a memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) for storing application programs 842 or data 844. The memory 832 and storage media 830 can be temporary or persistent storage. The program stored in the storage media 830 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 822 may be configured to communicate with the storage media 830 and execute the series of instruction operations stored in the storage media 830 on the server 800.

[0219] Server 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input / output interfaces 858, and / or one or more operating systems 841, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.

[0220] In this embodiment, the central processing unit 822 in the server 800 can perform the following steps:

[0221] Obtain an input sequence including multiple segments and segment identifiers. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to segment the source language fragments and the target language fragments. The target language fragment is the first original translation of the source language fragment. The mask label is located at the recommended position of the target language fragment.

[0222] The input sequence is embedded using a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and segment vectors are obtained by embedding based on the segment identifier.

[0223] Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained by vector fusion through the post-editing model;

[0224] Based on the input vector, the encoding result is output through the post-editing model;

[0225] Based on the encoding result, the translation recommendation result corresponding to the position to be recommended is output through the post-editing model.

[0226] or,

[0227] Obtain an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment.

[0228] The input sample sequence is embedded using an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and segment vectors are obtained by embedding based on the sample segment identifier.

[0229] Based on the word vectors, position vectors, and segment vectors corresponding to the input sample sequence, the input sample vector of the input sample sequence is obtained by vector fusion through the initial network model;

[0230] Based on the input sample vector, the initial network model is used to encode and output the sample encoding result;

[0231] Based on the sample encoding results, the initial network model is used to decode and output the predicted translation recommendation results corresponding to the sample recommendation positions.

[0232] The initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model.

[0233] According to one aspect of this application, a computer-readable storage medium is provided for storing program code for performing the methods described in the foregoing embodiments.

[0234] According to one aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.

[0235] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.

[0236] The terms "first," "second," "third," "fourth," etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0237] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0238] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0239] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0240] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0241] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.< / sep> < / sep> < / sep> < / sep> < / sep> < / sep>

Claims

1. A translation recommendation method, characterized in that, The method includes: Obtain an input sequence including multiple segments and segment identifiers. The multiple segments include source language fragments and target language fragments with mask labels. The segment identifiers are used to segment the source language fragments and the target language fragments. The target language fragment is the first original translation of the source language fragment. The mask label is located at the recommended position of the target language fragment. The post-editing model performs embedding processing on the input sequence to obtain word vectors and position vectors corresponding to the input sequence, and performs embedding processing based on the segmentation identifier to obtain segment vectors. The post-editing model is implemented based on the encoder-decoder Transformer framework and includes an input layer, an encoder, and a decoder. Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained by vector fusion through the post-editing model; Based on the input vector, the encoding result is output through the post-editing model; Based on the encoding result, the translation recommendation result corresponding to the position to be recommended is output through the post-editing model; Based on the input vector, the post-editing model predicts the second original translation for the position to be recommended. The mask label of the position to be recommended in the target language segment is replaced with the second original translation to obtain the replaced target language segment; The source language segment and the replaced target language segment are aligned to obtain word alignment information; The step of decoding and outputting the translation recommendation result corresponding to the position to be recommended based on the encoding result through the post-editing model includes: Based on the word alignment information and the encoding result, the post-editing model is used for decoding to output the translation recommendation result corresponding to the position to be recommended.

2. The method according to claim 1, characterized in that, The post-editing model includes an input layer, an encoder, and a decoder. The step of embedding the input sequence using the post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and embedding the segment vectors based on the segment identifiers, includes: The input layer obtains the word vector, position vector, and segment vector corresponding to the input sequence. The step of obtaining the input vector of the input sequence by performing vector fusion through the post-editing model based on the word vectors, position vectors, and segment vectors corresponding to the input sequence includes: Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained through the input layer; The process of encoding and outputting the encoding result based on the input vector through the post-editing model includes: Based on the input vector, the encoder performs encoding and outputs the encoding result; The step of decoding and outputting the translation recommendation result corresponding to the position to be recommended based on the encoding result through the post-editing model includes: Based on the encoding result, the decoder decodes and outputs the translation recommendation result corresponding to the position to be recommended.

3. The method according to claim 2, characterized in that, The translation recommendation results include multiple candidate translations of different text lengths.

4. The method according to claim 2, characterized in that, The step of encoding and outputting the encoded result based on the input vector through the encoder includes: Based on the input vector, the encoder uses an attention mechanism to process the data to obtain the attention weight of each word in the multiple segments; Based on the attention weights, the encoder encodes the input vector and outputs the encoding result.

5. The method according to claim 4, characterized in that, The attention mechanism is a cross-lingual attention mechanism. Based on the input vector, the encoder processes the input vector using the attention mechanism to obtain the attention weights for each word vector, including: Each word vector in the input vector is taken as the first word vector. Based on the segmented vectors in the input vector, attention is calculated on the first word vector and each second word vector to obtain the attention weight of the first word vector. The second word vector and the first word vector belong to different segments.

6. The method according to claim 4, characterized in that, The attention mechanism is a self-attention mechanism. Based on the input vector, the encoder processes the input vector using the attention mechanism to obtain the attention weights for each word vector, including: Each word vector in the input vector is taken as the first word vector. Based on the segmented vectors in the input vector, attention is calculated on the first word vector and each third word vector to obtain the attention weight of the first word vector. The third word vector and the first word vector belong to the same segment.

7. A training method for a post-editing model, characterized in that, The method includes: Obtain an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment. The input sample sequence is embedded using an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and segment vectors are obtained by embedding based on the sample segment identifier. Based on the word vectors, position vectors, and segment vectors corresponding to the input sample sequence, the input sample vector of the input sample sequence is obtained by vector fusion through the initial network model; Based on the input sample vector, the initial network model is used to encode and output the sample encoding result; Based on the sample encoding results, the initial network model is used to decode and output the predicted translation recommendation results corresponding to the sample recommendation positions. The initial network model is trained based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model; Based on the input sample vector, the second original sample translation of the sample recommendation position is predicted through the initial network model; The mask label at the recommended position of the target language sample fragment is replaced with the translation of the second original sample to obtain the replaced target language sample fragment; Alignment processing is performed on the source language sample fragment and the replaced target language sample fragment to obtain sample word alignment information; The step of decoding and outputting the predicted translation recommendation result corresponding to the sample recommendation position based on the sample encoding result through the initial network model includes: Based on the sample word alignment information and the sample encoding result, the initial network model is used for decoding to output the predicted translation recommendation result corresponding to the sample recommendation position.

8. The method according to claim 7, characterized in that, The process of training the initial network model based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions to obtain the post-editing model includes: The initial network model is trained based on the second original sample translation and the annotated original sample translation of the sample recommendation position. The initial network model is trained a second time based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions. The first training and the second training are performed alternately until the training stopping condition is met, thus obtaining the post-editing model.

9. A translation recommendation device, characterized in that, The device includes an acquisition unit, a processing unit, a determination unit, an encoding unit, and a decoding unit: The acquisition unit is used to acquire an input sequence including multiple segments and segment identifiers. The multiple segments include source language segments and target language segments with mask labels. The segment identifiers are used to divide the source language segments and the target language segments. The target language segment is the first original translation of the source language segment. The mask label is located at the recommended position of the target language segment. The processing unit is used to perform embedding processing on the input sequence through a post-editing model to obtain word vectors and position vectors corresponding to the input sequence, and to perform embedding processing based on the segmentation identifier to obtain segment vectors. The post-editing model is implemented based on the encoder-decoder Transformer framework, and the post-editing model includes an input layer, an encoder, and a decoder. The determining unit is used to obtain the input vector of the input sequence by performing vector fusion through the post-editing model based on the word vector, position vector and segment vector corresponding to the input sequence; The encoding unit is used to encode and output the encoding result based on the input vector through the post-editing model; The decoding unit is used to decode and output the translation recommendation result corresponding to the position to be recommended based on the encoding result and the post-editing model; The determining unit is further configured to: The source language segment and the target language segment are aligned based on the input vector to obtain word alignment information between the source language segment and the target language segment; The decoding unit is used for: Based on the word alignment information and the encoding result, the post-editing model is used to decode and output the translation recommendation result corresponding to the position to be recommended. The determining unit is used for: Based on the input vector, the post-editing model predicts the second original translation for the position to be recommended. The mask label of the position to be recommended in the target language segment is replaced with the second original translation to obtain the replaced target language segment; The source language segment and the replaced target language segment are aligned to obtain the word alignment information.

10. The apparatus according to claim 9, characterized in that, The post-editing model includes an input layer, an encoder, and a decoder. The processing unit is used for: The input layer obtains the word vector, position vector, and segment vector corresponding to the input sequence. The determining unit is used for: Based on the word vectors, position vectors, and segment vectors corresponding to the input sequence, the input vector of the input sequence is obtained through the input layer; The encoding unit is used for: Based on the input vector, the encoder performs encoding and outputs the encoding result; The decoding unit is used for: Based on the encoding result, the decoder decodes and outputs the translation recommendation result corresponding to the position to be recommended.

11. The apparatus according to claim 10, characterized in that, The translation recommendation results include multiple candidate translations of different text lengths.

12. A training device for a post-editing model, characterized in that, The device includes an acquisition unit, a processing unit, a determination unit, an encoding unit, a decoding unit, and a training unit. The acquisition unit is used to acquire an input sample sequence, which includes multiple sample segments and sample segment identifiers. The multiple sample segments include source language sample fragments and target language sample fragments with mask labels. The sample segment identifiers are used to segment the source language sample fragments and the target language sample fragments. The target language sample fragment is the first original sample translation of the source language sample fragment. The mask label is located at the sample recommendation position of the target language sample fragment. The processing unit is used to perform embedding processing on the input sample sequence through an initial network model to obtain word vectors and position vectors corresponding to the input sample sequence, and to perform embedding processing based on the sample segmentation identifier to obtain segment vectors; The determining unit is used to obtain the input sample vector of the input sample sequence by performing vector fusion through the initial network model based on the word vector, position vector and segment vector corresponding to the input sample sequence; The encoding unit is used to encode and output the sample encoding result based on the input sample vector through the initial network model; The decoding unit is used to decode and output the predicted translation recommendation result corresponding to the sample recommendation position based on the sample encoding result and the initial network model. The training unit is used to train the initial network model based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions, so as to obtain the post-editing model. The determining unit is further configured to: Alignment processing is performed on the source language sample fragment and the target language sample fragment based on the input sample vector to obtain sample word alignment information between the source language sample fragment and the target language sample fragment; The decoding unit is used for: Based on the sample word alignment information and the sample encoding result, the initial network model is used for decoding to output the predicted translation recommendation result corresponding to the sample recommendation position; The determining unit is used for: Based on the input sample vector, the second original sample translation of the sample recommendation position is predicted through the initial network model; The mask label at the recommended position of the target language sample fragment is replaced with the translation of the second original sample to obtain the replaced target language sample fragment; Alignment processing is performed on the source language sample fragment and the replaced target language sample fragment to obtain the sample word alignment information.

13. The apparatus according to claim 12, characterized in that, The training unit is used for: The initial network model is trained based on the second original sample translation and the annotated original sample translation of the sample recommendation position. The initial network model is trained a second time based on the predicted translation recommendation results and the standard translations corresponding to the sample recommendation positions. The first training and the second training are performed alternately until the training stopping condition is met, thus obtaining the post-editing model.

14. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1-8 according to the instructions in the program code.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program code that, when executed by a processor, causes the processor to perform the method according to any one of claims 1-8.

16. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-8.