Machine translation style consistency repairing method and related device

By using the BERT or RoBERTa model to detect style deviations and utilizing the gradient-guided diffusion model to adjust the style, the shortcomings of the neural machine translation system in style consistency are addressed, and efficient style restoration and semantic preservation are achieved in low-resource environments.

CN120654712APending Publication Date: 2025-09-16XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510800963.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

Existing neural machine translation systems have shortcomings in terms of translation style consistency, especially when translating formal and informal texts, literary works and professional documents. They are unable to accurately retain the stylistic characteristics of the original text and lack effective style repair methods, which is especially difficult in low-resource language environments.

Method used

A style detector based on the BERT or RoBERTa model is used to obtain the style labels and confidence scores of the original and translated texts, calculate the style consistency score, and perform style adjustment through a gradient-guided diffusion model. The style is repaired iteratively until the semantic similarity and style consistency thresholds are reached to achieve style restoration.

Benefits of technology

Without the need for a parallel corpus, it significantly improves the style consistency between the translated text and the original text. It is suitable for low-resource language environments, can complete style repair in a short time, and ensure the semantic integrity of the translated text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120654712A_ABST
    Figure CN120654712A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of natural language processing and machine translation, and discloses a machine translation style consistency repairing method and related device.The machine translation style consistency repairing method comprises the steps that style labels and confidence scores of an original text and a translated text are obtained; according to the style labels and the confidence scores of the original text and the translated text, obtaining a style consistency score of the original text and the translated text, and when the style consistency score is smaller than a preset style consistency threshold value, taking the translated text as a to-be-repaired translated text; otherwise, outputting the translated text; and iterating the repairing step until the semantic similarity score of the current to-be-repaired translated text and the original text is not less than a preset semantic similarity threshold value and the style consistency score of the current to-be-repaired translated text and the original text is not less than a preset style consistency threshold value, and outputting the current to-be-repaired translated text as a repaired translated text. The method can effectively improve the consistency of translation styles, keeps semantic integrity, and is suitable for scenes with high text style requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing and machine translation, and relates to a method for repairing machine translation style consistency and a related device. Background Art

[0002] With the rapid development of deep learning technology, neural machine translation (NMT) systems have been widely used in various fields of cross-language text translation, including social media, e-commerce, academic research, and international communication. However, despite significant progress in semantic fidelity, NMT systems still have significant shortcomings in terms of stylistic consistency. This is especially true when translating formal and informal texts, literary works, and professional documents. NMT systems often fail to accurately preserve the stylistic characteristics of the original text.

[0003] Current mainstream NMT systems, such as Google Translate, Baidu Translate, and Opus-MT, primarily focus on semantic accuracy and fluency in translation, but suffer from the following deficiencies in terms of style consistency: 1. Inadequate detection of style deviations: Existing style detection methods rely on inherent style features in the training data, making it difficult to identify diverse style deviations. 2. Limited repair methods: Existing NMT systems lack effective post-processing methods for style repair, and most rely solely on retraining models or manual corrections, which are inefficient and unsuitable for large-scale text processing. 3. Lack of parallel corpus support: Most style repair methods rely on large-scale parallel corpora, but obtaining sufficient parallel data in real-world scenarios is difficult, especially for low-resource languages.

[0004] The aforementioned shortcomings of NMT systems in terms of style consistency have resulted in them being unable to meet user needs in demanding applications such as literary works, legal documents, and medical records, which require high-quality translation. Therefore, the urgent challenge is to detect and correct style deviations in machine translation output without requiring parallel corpora, while ensuring translation quality and semantic integrity. Summary of the Invention

[0005] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a method and related device for repairing style consistency in machine translation.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a method for repairing style consistency in machine translation, comprising: obtaining style labels and confidence scores of an original text and a translated text; obtaining a style consistency score of the original text and the translated text based on the style labels and confidence scores of the original text and the translated text, and when the style consistency score is less than a preset style consistency threshold, treating the translated text as a translation text to be repaired; otherwise, outputting the translated text; iterating the repair step until the semantic similarity score between the current translation text to be repaired and the original text is not less than a preset semantic similarity threshold and the style consistency score between the current translation text to be repaired and the original text is not less than the preset style consistency threshold, and outputting the current translation text to be repaired as a repaired translation text; wherein the repair step comprises: obtaining and, based on a target style sample, adopting a gradient-guided repair method, performing style adjustment on the current translation text to be repaired through a pre-trained diffusion model, and obtaining and acquiring the style consistency score and semantic similarity score of the adjusted translation text to be repaired and the original text.

[0008] Optionally, obtaining the style labels and confidence scores of the original text and the translated text includes: using a pre-trained style detector based on the BERT model or the RoBERTa model to perform style classification on the original text and the translated text respectively, to obtain the style labels and confidence scores of the original text and the translated text.

[0009] Optionally, obtaining the style consistency score of the original text and the translated text based on the style labels and confidence scores of the original text and the translated text includes: determining whether the style label of the original text is consistent with the style label of the translated text; when the style label of the original text is consistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is the weighted average of the confidence scores of the two; when the style label of the original text is inconsistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is the negative value of the weighted difference between the confidence score of the original text and the confidence score of the translated text; normalizing the initial style consistency scores of the original text and the translated text to between 0 and 1 to obtain the style consistency scores of the original text and the translated text.

[0010] Optionally, the method of obtaining and, based on the target style sample, adopting a gradient-guided repair method to adjust the style of the current translation text to be repaired through a pre-trained diffusion model includes: when the current translation text to be repaired is the original translation text, injecting random noise with the goal of style neutralization into the current translation text to be repaired; obtaining and calculating the gradient direction of the target style sample, and generating a style repair guidance signal; and based on the style repair guidance signal, adjusting the style of the current translation text to be repaired through a pre-trained diffusion model based on a back-propagation mechanism to obtain an adjusted translation text to be repaired.

[0011] Optionally, obtaining the semantic similarity score between the adjusted translated text to be repaired and the original text includes: obtaining the encoding vectors of the adjusted translated text to be repaired and the original text; and calculating the cosine similarity between the encoding vectors of the adjusted translated text to be repaired and the original text as the semantic similarity score between the adjusted translated text to be repaired and the original text.

[0012] Optionally, obtaining the adjusted encoding vectors of the translation text to be repaired and the original text includes: using a MiniLM-L6-v2 model or a Sentence-BERT model to obtain the adjusted encoding vectors of the translation text to be repaired and the original text.

[0013] Optionally, it also includes: generating and outputting a style tag comparison report based on the original text, translated text, style consistency scores of the repaired translated text and the original text, the semantic similarity scores of each translated text to be repaired and the original text, and the style tags of the original text and the translated text; generating and outputting a repair log based on the original text, translated text, the translation engine and version information of the translated text, the style tags and confidence scores of the original text and the translated text, the number of repair step iterations and the repair time.

[0014] According to a second aspect of the present invention, a machine translation style consistency repair system is provided, comprising: a text acquisition module for acquiring style labels and confidence scores of an original text and a translated text; a style detection module for obtaining a style consistency score of the original text and the translated text based on the style labels and confidence scores of the original text and the translated text, and when the style consistency score is less than a preset style consistency threshold, using the translated text as a translation text to be repaired; otherwise, outputting the translated text; a style repair module for iterating the repair steps until the semantic similarity score between the current translation text to be repaired and the original text is not less than a preset semantic similarity threshold and the style consistency score between the current translation text to be repaired and the original text is not less than the preset style consistency threshold, and outputting the current translation text to be repaired as a repaired translation text; wherein the repair step comprises: obtaining and, based on a target style sample, adopting a gradient-guided repair method, performing style adjustment on the current translation text to be repaired through a pre-trained diffusion model, and obtaining and acquiring the style consistency score and semantic similarity score of the adjusted translation text to be repaired and the original text.

[0015] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for repairing machine translation style consistency when executing the computer program.

[0016] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for repairing machine translation style consistency are implemented.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] The present invention's method for repairing style consistency in machine translation first calculates a style consistency score to identify text with style deviations, then obtains the translation to be repaired and iterates the repair steps to repair the translation. This repair step employs a gradient-guided repair method, using a pre-trained diffusion model to adjust the style of the current translation to be repaired, enabling a relatively short time to complete style repair. Furthermore, a semantic similarity calculation mechanism ensures semantic consistency between the repaired translation and the original text. This method relies on monolingual corpora for style repair, eliminating the need for constructing additional parallel corpora and making it suitable for low-resource language environments. It is compatible with a variety of mainstream NMT systems and can be directly integrated into existing translation pipelines. Users can customize style detection and repair strategies by providing target style samples, adapting to diverse application needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a flow chart of a method for repairing style consistency in machine translation according to an embodiment of the present invention.

[0020] Figure 2 This is a structural block diagram of a machine translation style consistency repair system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0022] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] The present invention is described in further detail below with reference to the accompanying drawings:

[0024] See also Figure 1 In one embodiment of the present invention, a method for repairing style consistency in machine translation is provided to address the limitations of existing NMT systems in style consistency detection and repair. It can significantly improve the style consistency between the translated text and the original text while maintaining semantic integrity.

[0025] Specifically, the method for repairing machine translation style consistency of the present invention includes the following steps:

[0026] S1: Obtain the style labels and confidence scores of the original text and the translated text.

[0027] S2: Based on the style labels and confidence scores of the original text and the translated text, a style consistency score of the original text and the translated text is obtained. When the style consistency score is less than a preset style consistency threshold, the translated text is used as the translation text to be repaired; otherwise, the translated text is output.

[0028] S3: Iterate the repair steps until the semantic similarity score between the current translation text to be repaired and the original text is not less than a preset semantic similarity threshold and the style consistency score between the current translation text to be repaired and the original text is not less than a preset style consistency threshold, and output the current translation text to be repaired as the repaired translation text.

[0029] Among them, the repair step includes: obtaining and using a gradient-guided repair method based on the target style sample, adjusting the style of the current translation text to be repaired through a pre-trained diffusion model, and obtaining and obtaining the style consistency score and semantic similarity score of the adjusted translation text to be repaired and the original text.

[0030] The present invention's method for repairing style consistency in machine translation first calculates a style consistency score to identify text with style deviations, then obtains the translation to be repaired and iterates the repair steps to repair the translation. This repair step employs a gradient-guided repair method, using a pre-trained diffusion model to adjust the style of the current translation to be repaired, enabling a relatively short time to complete style repair. Furthermore, a semantic similarity calculation mechanism ensures semantic consistency between the repaired translation and the original text. This method relies on monolingual corpora for style repair, eliminating the need for constructing additional parallel corpora and making it suitable for low-resource language environments. It is compatible with a variety of mainstream NMT systems and can be directly integrated into existing translation pipelines. Users can customize style detection and repair strategies by providing target style samples, adapting to diverse application needs.

[0031] In one possible implementation, obtaining the style labels and confidence scores of the original text and the translated text includes: using a pre-trained style detector based on the BERT model or the RoBERTa model to perform style classification on the original text and the translated text respectively, to obtain the style labels and confidence scores of the original text and the translated text.

[0032] Explanatory, a style detector based on the BERT model or the RoBERTa model is used. By pre-training on large-scale monolingual corpora, a pre-trained style detector based on the BERT model or the RoBERTa model is obtained, which can effectively extract the style features of the text, such as formality and literary quality.

[0033] BERT (Bidirectional Encoder Representations from Transformers) and RoBERTa (A Robustly Optimized BERT Pretraining Approach) are both pre-trained language models based on the Transformer architecture.

[0034] Explanatory, style deviations can manifest as differences in formality, tone, and literary quality between the original and translated texts. For example, in the translation of legal documents, the original text has a highly formal style, but the translated text output by the machine translation may be more casual or colloquial. In addition, poetic expressions in literary works and professional terminology in academic papers may also cause deviations in the results of the NMT system. The style features of the original text are usually related to sentence structure, word usage habits, and grammatical complexity, and these features cannot be fully captured by simple semantic matching, resulting in the inability of existing semantic-based machine translation outputs of translated texts to meet the requirements of style consistency.

[0035] Specifically, for the original text and translated text, the pre-trained style detector based on the BERT model or the RoBERTa model can output the style labels and confidence scores of the original text and translated text. The confidence score indicates the degree to which the text conforms to the style label, and the value range is [0, 1].

[0036] Optionally, after completing style detection, the source text, translated text, generated style tags, and confidence scores can be saved to a log file or database for subsequent analysis. The name of the translation engine used to translate the text and the sample source can also be recorded to support traceability of results and comparative experiments across multiple translation engines. Furthermore, to facilitate subsequent tracking of the repair status of each source text, a unique identifier can be assigned to each source text, ensuring the integrity and auditability of the entire repair process.

[0037] In a possible implementation, obtaining the style consistency score of the original text and the translated text based on the style labels and confidence scores of the original text and the translated text includes: determining whether the style label of the original text is consistent with the style label of the translated text; when the style label of the original text is consistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is a weighted average of the confidence scores of the two; when the style label of the original text is inconsistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is the negative value of the weighted difference between the confidence score of the original text and the confidence score of the translated text; and normalizing the initial style consistency scores of the original text and the translated text to between 0 and 1 to obtain the style consistency scores of the original text and the translated text.

[0038] For explanatory purposes, the style consistency score ranges from [0 to 1], where scores closer to 1 indicate greater style consistency, and lower scores indicate greater style deviation. If the style consistency score is lower than a preset style consistency threshold (e.g., 0.8), it is considered a style deviation sample and requires further repair. If the style consistency score is not lower than the preset style consistency threshold, the style of the translated text is considered to meet the consistency requirements and no repair is required. The translated text is directly output.

[0039] For example, if style detection is performed on a batch of original texts, the style detection can be performed one by one. In addition, to improve processing efficiency, a batch processing mode can also be used to perform style detection in parallel when the amount of original text data is large.

[0040] In one possible implementation, obtaining and, based on the target style sample, using a gradient-guided restoration method to perform style adjustment on the current translation text to be repaired using a pre-trained diffusion model includes: when the current translation text to be repaired is the original translation text, injecting random noise into the current translation text to be repaired with the goal of style neutralization; obtaining and calculating the gradient direction of the target style sample and generating a style restoration guidance signal; and, based on the style restoration guidance signal, performing style adjustment on the current translation text to be repaired using a pre-trained diffusion model based on a back-propagation mechanism to obtain an adjusted translation text to be repaired.

[0041] Explanatory, it can include the following specific steps. Step 1, style embedding extraction stage: First, use the pre-trained style embedding model Es(·) to process the target style sample set [y1,y2,...,yn] to obtain the style embedding representation Es(yi) of each sample; by averaging the style embeddings of all target style samples, a comprehensive representation vector of the target style is obtained as the guiding target for style restoration. Step 2, noise injection stage: When the current translation text to be restored is the original translation text r, a specific noise addition strategy is used to convert it into a representation in the embedding space; according to the formula (where ∈ t ~N(0,I)) is used to inject noise into text embedding, E(·) represents the embedding model, β t represents the noise scheduling parameter at time t; the noise scheduling parameter β t According to the formula Setting it so that it decreases to zero at a slower rate during the diffusion process, effectively retaining the semantic information of the text. Step 3: Gradient direction calculation and style guidance signal generation: Constructing the style guidance function Where d(·,·) represents the cosine similarity, Represents the estimated text at time t, E s (·) is the style embedding model; calculate the gradient of the style guidance function J with respect to the current text representation The gradient points to the direction that makes the current text style closer to the target style sample; the calculated gradient Multiply it with the preset guidance strength parameter λ to get the final style restoration guidance signal. Step 4: Diffusion model guidance adjustment: Use the pre-trained diffusion model For the current noise representation x t Processing to obtain preliminary estimated text Combined with the style restoration guidance signal, we can get the style-adjusted representation The optimized text representation is obtained by performing softmax processing on the adjusted representation and applying top-p sampling controlled by the temperature parameter τ Step 5, iterative optimization and denoising process: the optimized text is represented as Re-embed and pass the formula Generate the noise representation of the next time step t-1; repeat steps 3 and 4, gradually reducing the time step t until t=0, and obtain the final style-adjusted text In each iterative step, the diversity of the generated text is controlled by adjusting the temperature parameter τ. A lower τ value (such as 0.3) can achieve effective style transfer while maintaining semantics.

[0042] For example, during the restoration process, the hyperparameters of the diffusion model (such as learning rate and style adjustment strength) can be adjusted according to specific task requirements.

[0043] In a possible implementation, obtaining the semantic similarity score between the adjusted translation text to be repaired and the original text includes: obtaining encoding vectors of the adjusted translation text to be repaired and the original text; and calculating the cosine similarity between the encoding vectors of the adjusted translation text to be repaired and the original text as the semantic similarity score between the adjusted translation text to be repaired and the original text.

[0044] Explanatory, after completing the style repair, in order to ensure that the adjusted translation text to be repaired still retains the original semantic integrity, the semantic consistency is ensured by calculating the semantic similarity score between the adjusted translation text to be repaired and the original text. Exemplarily, the semantic similarity score ranges from [0, 1], and a higher semantic similarity score indicates a higher degree of semantic preservation. When the semantic similarity score is lower than a preset semantic similarity threshold (e.g., 0.9), the repair step needs to be performed again until the semantic similarity score between the adjusted translation text to be repaired and the original text is not less than the preset semantic similarity threshold.

[0045] Specifically, the cosine similarity S between the encoding vectors of the adjusted translation text to be repaired and the original text can be calculated using the following calculation formula:

[0046]

[0047] Among them, A is the encoding vector of the translation text to be repaired, and B is the encoding vector of the original text.

[0048] In a possible implementation, obtaining the adjusted encoding vectors of the translation text to be repaired and the original text includes: using a MiniLM-L6-v2 model or a Sentence-BERT model to obtain the adjusted encoding vectors of the translation text to be repaired and the original text.

[0049] Explanatory, MiniLM-L6-v2 model, a sentence embedding model based on the sentence-transformers library, belongs to the MiniLM series. It is a lightweight model compressed from a larger model through knowledge distillation technology, with approximately 22M parameters, suitable for running in resource-constrained environments. The model can map sentences and paragraphs into a 384-dimensional dense vector space. The Sentence-BERT model (Sentence BERT model) is a variant of the BERT model that obtains fixed-length sentence features by extending the pre-trained BERT model. It is mainly used for tasks such as sentence pair classification and calculating the similarity between two sentences. The Sentence-BERT model feeds sentence tokens into the pre-trained BERT model to obtain sentence features.

[0050] For explanatory purposes, after completing style restoration and semantic evaluation, a pre-trained style detector based on the BERT or RoBERTa model can be used again to calculate the style consistency score between the adjusted translation to be restored and the original text to evaluate the restoration effect. The restoration is successful when the style consistency score between the adjusted translation to be restored and the original text is no less than the preset style consistency threshold, and the semantic similarity score between the adjusted translation to be restored and the original text is no less than the preset semantic similarity threshold.

[0051] In a possible implementation, the machine translation style consistency repair method further includes: generating and outputting a style label comparison report based on the original text, the translated text, the style consistency score between the repaired translated text and the original text, the semantic similarity score between each translated text to be repaired and the original text, and the style labels of the original text and the translated text.

[0052] In one possible implementation, the machine translation style consistency repair method further includes: generating and outputting a repair log based on the original text, the translated text, the translation engine and version information of the translated text, the style tags and confidence scores of the original text and the translated text, the number of repair step iterations, and the repair time.

[0053] Interpretative, by generating style tag comparison reports and repair logs for subsequent review and analysis.

[0054] The following are device embodiments of the present invention, which can be used to perform the method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.

[0055] See also Figure 2In another embodiment of the present invention, a machine translation style consistency repair system is provided, which can be used to implement the above-mentioned machine translation style consistency repair method. Specifically, the machine translation style consistency repair system includes a text acquisition module, a style detection module and a style repair module.

[0056] Among them, the text acquisition module is used to obtain the style labels and confidence scores of the original text and the translated text; the style detection module is used to obtain the style consistency score of the original text and the translated text based on the style labels and confidence scores of the original text and the translated text, and when the style consistency score is less than a preset style consistency threshold, the translated text is used as the translated text to be repaired; otherwise, the translated text is output; the style repair module is used to iterate the repair steps until the semantic similarity score between the current translated text to be repaired and the original text is not less than the preset semantic similarity threshold and the style consistency score between the current translated text to be repaired and the original text is not less than the preset style consistency threshold, and the current translated text to be repaired is output as the repaired translated text; wherein the repair step includes: obtaining and using a gradient-guided repair method based on a target style sample, adjusting the style of the current translated text to be repaired through a pre-trained diffusion model, and obtaining and obtaining the style consistency score and semantic similarity score of the adjusted translated text to be repaired and the original text.

[0057] All relevant contents of each step involved in the embodiment of the aforementioned machine translation style consistency repair method can be referred to the functional description of the corresponding functional modules of the machine translation style consistency repair system in the embodiment of the present invention, and will not be repeated here.

[0058] The module division in the embodiments of the present invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in various embodiments of the present invention may be integrated into a single processor, exist physically as separate modules, or two or more modules may be integrated into a single module. The integrated modules may be implemented in either hardware or software functional modules.

[0059] In another embodiment of the present invention, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the machine translation style consistency repair method.

[0060] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the method for repairing machine translation style consistency in the above embodiment.

[0061] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0062] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0063] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0064] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A method for repairing style consistency in machine translation, characterized in that: include: Get style labels and confidence scores for the original and translated texts; Obtaining a style consistency score between the original text and the translated text based on the style labels and confidence scores of the original text and the translated text, and treating the translated text as a translation text to be repaired when the style consistency score is less than a preset style consistency threshold; Otherwise, output the translated text; Iterate the repairing step until the semantic similarity score between the current translation text to be repaired and the original text is not less than a preset semantic similarity threshold and the style consistency score between the current translation text to be repaired and the original text is not less than a preset style consistency threshold, and output the current translation text to be repaired as the repaired translation text; Among them, the repair step includes: obtaining and using a gradient-guided repair method based on the target style sample, adjusting the style of the current translation text to be repaired through a pre-trained diffusion model, and obtaining and obtaining the style consistency score and semantic similarity score of the adjusted translation text to be repaired and the original text.

2. The method for repairing machine translation style consistency according to claim 1, characterized in that: The step of obtaining the style labels and confidence scores of the original text and the translated text includes: A pre-trained style detector based on the BERT model or the RoBERTa model is used to perform style classification on the original text and the translated text, respectively, to obtain the style labels and confidence scores of the original text and the translated text.

3. The method for repairing machine translation style consistency according to claim 1, characterized in that: The style consistency score of the original text and the translated text is obtained based on the style labels and confidence scores of the original text and the translated text, including: Determine whether the style tags of the original text are consistent with the style tags of the translated text; When the style label of the original text is consistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is the weighted average of their confidence scores; when the style label of the original text is inconsistent with the style label of the translated text, the initial style consistency score of the original text and the translated text is the negative value of the weighted difference between the confidence score of the original text and the confidence score of the translated text; The initial style consistency scores of the original text and the translated text are normalized to between 0 and 1 to obtain the style consistency scores of the original text and the translated text.

4. The method for repairing machine translation style consistency according to claim 1, characterized in that: The step of obtaining and, based on the target style sample, using a gradient-guided restoration method to perform style adjustment on the current translation text to be restored using a pre-trained diffusion model includes: When the current translation text to be repaired is the original translation text, random noise is injected into the current translation text to be repaired with the goal of making it style neutral; Obtain and calculate the gradient direction of the target style sample and generate a style restoration guidance signal; According to the style repair guidance signal, based on the back-propagation mechanism, the style of the current translation text to be repaired is adjusted through the pre-trained diffusion model to obtain the adjusted translation text to be repaired.

5. The method for repairing machine translation style consistency according to claim 1, characterized in that: The step of obtaining the semantic similarity score between the adjusted translation text to be repaired and the original text includes: Obtain the adjusted encoding vectors of the translation text to be repaired and the original text; The cosine similarity between the encoding vectors of the adjusted translation text to be repaired and the original text is calculated as the semantic similarity score between the adjusted translation text to be repaired and the original text.

6. The method for repairing machine translation style consistency according to claim 5, characterized in that: The step of obtaining the adjusted encoding vectors of the translation text to be repaired and the original text includes: Use the MiniLM-L6-v2 model or the Sentence-BERT model to obtain the encoding vectors of the adjusted translation text to be repaired and the original text.

7. The method for repairing machine translation style consistency according to claim 1, characterized in that: Also includes: Generate and output a style tag comparison report based on the style consistency scores of the original text, the translated text, the repaired translated text and the original text, the semantic similarity scores of each translation text to be repaired and the original text, and the style tags of the original text and the translated text; Generate and output a repair log based on the original text, translated text, translation engine and version information of the translated text, style tags and confidence scores of the original text and translated text, number of repair step iterations, and repair time.

8. A machine translation style consistency repair system, characterized by: include: The text acquisition module is used to obtain the style labels and confidence scores of the original text and the translated text; A style detection module is used to obtain a style consistency score between the original text and the translated text based on their style labels and confidence scores, and to identify the translated text as a text to be repaired when the style consistency score is less than a preset style consistency threshold; Otherwise, output the translated text; The style repair module is used to iterate the repair steps until the semantic similarity score between the current translation text to be repaired and the original text is not less than a preset semantic similarity threshold and the style consistency score between the current translation text to be repaired and the original text is not less than a preset style consistency threshold, and output the current translation text to be repaired as the repaired translation text; wherein the repair step includes: obtaining and using a gradient-guided repair method based on a target style sample, adjusting the style of the current translation text to be repaired through a pre-trained diffusion model, and obtaining and acquiring the style consistency score and semantic similarity score of the adjusted translation text to be repaired and the original text.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for repairing style consistency in machine translation according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for repairing style consistency in machine translation according to any one of claims 1 to 7 are implemented.