Translation method, translation model training method and equipment

By combining preset word sets and prompt text pairs, the problem of insufficient accuracy and professionalism in the translation of existing translation models in professional fields is solved, and more efficient and accurate translation results are achieved.

CN119692365APending Publication Date: 2025-03-25XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411747713.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

When translating texts in professional fields, the existing translation model lacks translation accuracy and professionalism, making it difficult to meet the high demands of cross-language communication needs.

Method used

The target source vocabulary in the target text is accurately matched and replaced by preset word sets, reducing the time for the translation model to search for each vocabulary individually, and using prompt text pairs to provide semantic information to improve the translation quality.

Benefits of technology

Significantly improve the accuracy and professionalism of translations, especially in the fields of information technology, medicine and law, ensuring that translated texts comply with the field's expression habits and industry standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692365A_ABST
    Figure CN119692365A_ABST
Patent Text Reader

Abstract

The invention provides a translation method and a training method and device of a translation model, and relates to the technical field of servers. The translation method comprises the steps of obtaining a to-be-translated target text of a first language; on the basis of a preset word set, target source vocabularies in the target text are replaced with target translation vocabularies, a reconstructed text corresponding to the target text is obtained, the preset word set comprises a plurality of word pairs, and each word pair comprises a source vocabulary of the first language and a translation vocabulary of the second language; the target source vocabulary and the target translation vocabulary are word pairs in a preset word set; and translating the reconstructed text by using the first translation model to obtain a translated text of the second language output by the first translation model. Through the method, the accuracy of text translation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a translation method, a translation model training method and a device. Background Art

[0002] With the rapid development of computer technology and natural language processing, machine translation technology has emerged and has gradually become an important tool for cross-language communication. Machine translation converts one natural language (also called source language) into another natural language (also called target language) through translation models, such as large language models, which greatly improves translation efficiency and reduces translation costs. However, the translation ability of the translation model is poor and needs to be further improved to meet people's translation needs. Summary of the invention

[0003] The embodiments of the present application provide a translation method, a translation model training method and a device, which can improve translation accuracy.

[0004] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0005] In a first aspect, a translation method is provided, the method comprising: obtaining a target text in a first language to be translated; replacing target source vocabulary in the target text with target translation vocabulary based on a preset word set to obtain a reconstructed text corresponding to the target text, wherein the preset word set comprises a plurality of word pairs, each word pair comprises a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; and translating the reconstructed text using a first translation model to obtain a translation text in the second language output by the first translation model.

[0006] In the embodiment of the present application, the target source vocabulary in the target text is accurately matched and replaced by the preset word set, which can ensure that the vocabulary in the target text can be accurately translated during the translation process. In addition, the target source vocabulary in the target text is directly replaced with the target translation vocabulary by the preset word set, which can reduce the time for the first translation model to translate and search each vocabulary in the target text separately, and can significantly improve the translation efficiency in the scenario of processing a large amount of text or quickly generating translation text.

[0007] In a possible implementation, the words in the preset word set are professional words in a preset field.

[0008] In this implementation, unlike common words, many professional words in the preset fields are rare words. If the professional words in these preset fields appear less frequently in the training data of the translation model, the translation model will learn less translation information about the professional words during the training process, which makes the translation model's translation ability for the professional words in the preset fields poor. Therefore, by directly converting the target source words in the target text into target translation words through the preset word set, it can ensure that these source words as special words are accurately matched during the translation process. This is crucial for translation in fields that require high professionalism and accuracy (such as information technology, medicine, and law), and helps to improve the professionalism and authority of the translation, so that the translated text is accurate and conforms to the expression habits and industry standards of the field.

[0009] In a possible implementation, based on a preset word set, target source words in a target text are replaced with target translation words to obtain a reconstructed text corresponding to the target text, including: matching words in the target text with source words in the preset word set to obtain target source words; the target source words are words in the target text that successfully match the source words in the preset word set; determining the target translation words corresponding to the target source words in the preset word set; and replacing the target source words in the target text with the target translation words to obtain the reconstructed text.

[0010] In a possible implementation, the method further includes: obtaining a prompt text pair from a preset text set according to the target text; wherein the preset text set includes a plurality of text pairs, each text pair including a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; and translating the reconstructed text using a first translation model to obtain a translation text in the second language output by the first translation model, including: inputting the reconstructed text and the prompt text pair into the first translation model to obtain a translation text output by the first translation model.

[0011] In this implementation, a hint text semantically related to the target text is input into the first translation model, which provides the first translation model with semantic information of the target text, thereby helping the translation model to more accurately express the meaning of the target text when processing similar or related texts, thereby improving translation quality.

[0012] In one possible implementation, a prompt text pair is obtained from a preset text set according to a target text, including: obtaining a first text vector of the target text; the first text vector is used to represent the semantic information of the target text; from text vectors corresponding to source texts of multiple text pairs, a second text vector whose similarity with the first text vector meets a preset threshold; the second text vector is used to represent the semantic information of the source text that is semantically related to the target text; and the text pair in which the source text corresponding to the second text vector is located is used as a prompt text pair.

[0013] In this implementation, the text is converted into a vector form, and the similarity of the vectors is used to measure the semantic similarity between the texts. This can more accurately find the prompt text pairs that are semantically related to the target text, and help ensure that the translation model can refer to the translation information most relevant to the target text during the translation process, thereby improving the accuracy of the translation.

[0014] In some examples, using the text pair where the source text corresponding to the second text vector is located as the prompt text pair may also include: determining a preset number of text pairs from the text pairs where the source text corresponding to the second text vector is located as the prompt text pairs.

[0015] In a second aspect, a translation method is provided, the method comprising: obtaining a target text in a first language to be translated; obtaining a prompt text pair from a preset text set according to the target text; the preset text set comprises a plurality of text pairs, each text pair comprising a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; and inputting the target text and the prompt text pair into a first translation model to obtain a translation text corresponding to the target text output by the first translation model.

[0016] In an embodiment of the present application, a prompt text that is semantically related to the target text is input into the first translation model, which provides the first translation model with semantic information related to the target text, thereby helping the first translation model to more accurately express the meaning of the target text and improve the translation quality when processing similar or related texts.

[0017] In a third aspect, a method for training a translation model is provided, the method comprising: obtaining a reconstructed sample and a translation sample in a second language corresponding to an original sample in a first language; the reconstructed sample is a text obtained by replacing a target source vocabulary in the original sample with a target translation vocabulary using a preset word set; the preset word set comprises a plurality of word pairs, each word pair comprises a source vocabulary in a first language and a translation vocabulary in a second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; and the second translation model is trained using the reconstructed sample and the translation sample to obtain a first translation model.

[0018] It can be understood that the translated sample in the second language corresponding to the original sample in the first language is the accurate value.

[0019] In the embodiment of the present application, during the training process of the translation model, the reconstructed samples and the translated samples are directly used as training samples. On the one hand, the process of the translation model learning the mapping of source vocabulary and translation vocabulary in multiple word pairs in the preset word set is omitted, which reduces the training time and the consumption of computing resources, so that the translation model does not need to learn multiple word pairs in the preset word set during the training process. The translation model directly learns translation rules from the reconstructed samples and the translated samples, thereby improving the training efficiency of the translation model. On the other hand, since the translation model does not need to learn multiple word pairs in the preset word set during the training process, the training samples required by the translation model do not need to include samples related to the preset word set, thereby reducing the data volume of the training samples.

[0020] In a possible implementation, the vocabulary in the preset word set is professional vocabulary in a preset field; the method also includes: inputting preset prompt information and a data set into an extraction model to obtain a plurality of word pairs in the preset word set; the preset prompt information is used to prompt the extraction model to extract professional vocabulary in the preset field from the data set; the data set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the source vocabulary in the first language in each word pair is extracted from the corresponding source text in the data set, and the translation vocabulary in the second language in each word pair is extracted from the corresponding translation text in the data set.

[0021] In this implementation, by pre-setting prompt information, the extraction model can focus on professional vocabulary in specific fields (such as information technology, medicine, law, etc.) to ensure the professionalism and accuracy of the vocabulary set, which helps the translation model to generate more accurate and professional translations when processing professional field texts.

[0022] In a possible implementation, a second translation model is trained using reconstructed samples and translated samples to obtain a first translation model, including: obtaining an original sample corresponding to the reconstructed sample; obtaining a prompt text pair from a preset text set based on the original sample; the prompt text pair is a text pair in the preset text set that is semantically related to the original sample; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translated text in a second language; using the prompt text pair and the reconstructed sample as inputs of the second translation model, and training the second translation model based on the output of the second translation model and the translated sample to obtain the first translation model.

[0023] In this implementation, by introducing prompt text pairs that are semantically related to the original samples, the translated text in the prompt text pairs provides a reference for the translation model. The translation model can learn more semantic information related to the original samples during the training process, which helps the translation model better understand the intent and meaning of the source text when processing complex texts, thereby generating more accurate and natural translations.

[0024] In a possible implementation, obtaining a reconstructed sample and a translation sample in a second language corresponding to an original sample in a first language includes: obtaining a plurality of initial sample pairs; each initial sample pair includes an initial source sample in the first language and an initial translation sample in the second language corresponding to the initial source sample; for each initial sample pair, inputting the initial source sample in the initial sample pair into a third translation model to obtain a translation text corresponding to the initial source sample output by the third translation model; screening the plurality of initial sample pairs according to the similarity between the translation text corresponding to the initial source sample in each initial sample pair and the initial translation sample in the initial sample pair to obtain screened initial sample pairs; using the initial source sample in the screened initial sample pair as the original sample and the initial translation sample in the screened initial sample pair as the translation sample; replacing the target source vocabulary in the original sample with the target translation vocabulary to obtain the reconstructed sample.

[0025] In this implementation, the initial source sample is translated by the third translation model and compared with the initial translation sample in the initial sample pair for similarity, so that the initial sample pair with higher translation accuracy can be screened out and the initial sample pair is used as data for training the second translation model, which helps to ensure that the samples used to train the second translation model have higher accuracy and reliability, thereby improving the overall performance of the translation model.

[0026] In a possible implementation, the vocabulary in the preset word set is professional vocabulary in a preset field; the method also includes: obtaining multiple initial sample pairs; each initial sample pair includes an initial source sample in a first language and an initial translation sample in a second language corresponding to the source sample; for each initial sample pair, inputting the initial source sample in the initial sample pair into a third translation model to obtain a translation text corresponding to the initial source sample; screening the multiple initial sample pairs according to the similarity between the translation text corresponding to the initial source sample in each initial sample pair and the initial translation sample in the initial sample pair to obtain screened initial sample pairs; using the initial source sample in the screened initial sample pair as the original sample, and the initial translation sample in the screened initial sample pair as the translation sample; inputting preset prompt information, the original sample and the translation sample into an extraction model to obtain multiple word pairs in the preset word set; the preset prompt information is used to prompt the extraction model to extract professional vocabulary in the preset field from the original sample and the translation sample; the source vocabulary in the first language in each word pair is extracted from the original sample, and the translation vocabulary in the second language in each word pair is extracted from the translation sample.

[0027] In this implementation, in the process of constructing the preset word set, the initial sample pairs are screened to ensure that only sample pairs with higher translation quality are used for vocabulary extraction in the preset word set, which helps to improve the quality of word pairs in the preset word set.

[0028] In a fourth aspect, a translation device is provided. The device is applied to a computing device, and the computing device is deployed with a first translation model. The device includes: a first acquisition unit, a reconstruction unit, and a translation unit. The first acquisition unit is used to acquire a target text in a first language to be translated; the reconstruction unit is used to replace the target source vocabulary in the target text with the target translation vocabulary based on a preset word set to obtain a reconstructed text corresponding to the target text, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; the translation unit is used to translate the reconstructed text using the first translation model to obtain a translation text in the second language output by the first translation model.

[0029] In a fifth aspect, a translation device is provided. The device is applied to a computing device, and the computing device is deployed with a first translation model. The device includes: a third acquisition unit, a fourth acquisition unit and a determination unit. The third acquisition unit is used to acquire a target text in a first language to be translated; the fourth acquisition unit is used to acquire a prompt text pair from a preset text set according to the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; the determination unit is used to input the target text and the prompt text pair into the first translation model to obtain a translation text corresponding to the target text output by the first translation model.

[0030] In a sixth aspect, a training device for a translation model is provided. The device includes: a fifth acquisition unit and a training unit. The fifth acquisition unit is used to acquire a reconstructed sample and a translation sample in a second language corresponding to the original sample in the first language; the reconstructed sample is a text obtained by replacing the target source vocabulary in the original sample of the first language with the target translation vocabulary using a preset word set; the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set. The training unit is used to train the second translation model using the reconstructed sample and the translation sample to obtain the first translation model.

[0031] In a seventh aspect, a computing device is provided, comprising: a processor and a memory, wherein the processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.

[0032] In an eighth aspect, an electronic device is provided, comprising: a receiver, a processor and an output device. The receiver and the output device are both connected to the processor. The receiver is used to obtain a target text in a first language to be translated; the processor is used to receive a translation text sent by a computing device; the translation text is a text in a second language output by the first translation model after translating the reconstructed text using a first translation model; the reconstructed text is a text obtained by replacing the target source vocabulary in the target text with the target translation vocabulary based on a preset word set, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; the output device is used to output the translation text.

[0033] In the ninth aspect, an electronic device is provided, comprising: a receiver, a processor and an output device. The receiver and the output device are both connected to the processor. The receiver is used to obtain a target text in a first language to be translated. The processor is used to receive a translation text sent by a computing device; the translation text is a text corresponding to the target text output by the first translation model after the target text and the prompt text pair are input into the first translation model; the prompt text pair is obtained from a preset text set based on the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text. The output device is used to output the translation text.

[0034] In the tenth aspect, an electronic device is provided, comprising: a receiver, a processor and an output device. The receiver and the output device are both connected to the processor. The receiver is used to obtain a target text in a first language to be translated; the processor is used to replace the target source vocabulary in the target text with the target translation vocabulary based on a preset word set to obtain a reconstructed text corresponding to the target text, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; the reconstructed text is sent to a computing device; the processor is also used to receive a translation text sent by the computing device; the translation text is a text in the second language output by the first translation model after translating the reconstructed text using the first translation model. The output device is used to output the translation text.

[0035] In the eleventh aspect, an electronic device is provided, comprising: a receiver, a processor and an output device. The receiver and the output device are both connected to the processor. The receiver is used to obtain a target text in a first language to be translated; the processor is used to obtain a prompt text pair from a preset text set according to the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; the target text and the prompt text pair are sent to a computing device; the processor is also used to receive a translation text sent by the computing device; the translation text is a text corresponding to the target text output by the first translation model when the target text and the prompt text pair are input into the first translation model. The output device is used to output the translation text.

[0036] In the twelfth aspect, a chip is provided, the chip comprising: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to run the code instructions to execute any one of the methods provided in the first aspect above.

[0037] In a thirteenth aspect, a computer-readable storage medium is provided, which stores computer execution instructions. When the computer execution instructions are executed on a computer, the computer executes any one of the methods provided in the first aspect.

[0038] In a fourteenth aspect, a computer program product is provided, comprising computer execution instructions, which, when executed on a computer, enable the computer to execute any one of the methods provided in the first aspect.

[0039] Among them, the technical effects brought about by any implementation method in the fourth to fourteenth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, the second aspect or the third aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A usage scenario diagram of a translation model provided in an embodiment of the present application;

[0041] Figure 2 A system architecture diagram of a computing device provided in an embodiment of the present application;

[0042] Figure 3 A flowchart of a translation method provided in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of a scenario for translating a reconstructed text provided in an embodiment of the present application;

[0044] Figure 5 A comparison result diagram of the bilingual assessment benchmark indicators provided in the embodiment of the present application;

[0045] Figure 6 A comparison result diagram of the cross-language optimized translation evaluation metrics provided in the embodiments of the present application;

[0046] Figure 7 A flowchart of another translation method provided in an embodiment of the present application;

[0047] Figure 8 A flowchart of a method for training a translation model provided in an embodiment of the present application;

[0048] Fig. 9 A schematic diagram of a scenario of a translation model training method provided in an embodiment of the present application;

[0049] Fig.10 A schematic diagram of a scenario for training a translation model provided in an embodiment of the present application;

[0050] Fig.11 A schematic diagram of a translation device provided in an embodiment of the present application;

[0051] Fig.12 A schematic diagram of another translation device provided in an embodiment of the present application;

[0052] Fig.13 A schematic diagram of a translation model training device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0054] In the description of this application, unless otherwise specified, " / " indicates that the objects associated with each other are in an "or" relationship, for example, A / B can represent A or B; "and / or" in this application is merely a description of the association relationship between associated objects, indicating that three relationships may exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.

[0055] Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0056] In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0057] First, the application scenarios of the embodiments of the present application are exemplarily introduced.

[0058] With the rapid development of computer technology and natural language processing, machine translation technology has emerged and has gradually become an important tool for cross-language communication. Machine translation converts one natural language (also called source language) into another natural language (also called target language) through a translation model (such as a large language model). For example, converting Chinese text into English text. Machine translation has greatly improved translation efficiency and reduced translation costs. However, machine translation technology still faces many challenges.

[0059] Figure 1 This is a usage scenario diagram of a translation model. Figure 1 In the translation model, the user inputs the target text in the first language to be translated into the trained translation model. The translation model translates the input target text and outputs the translated text in the second language.

[0060] The following is an exemplary introduction to the system architecture of the embodiments of the present application.

[0061] The embodiment of the present application provides a computing device, which may be a network device or a terminal device. The network device may include a server, etc. The server may be a physical server, or may be two or more physical servers that share different responsibilities and cooperate with each other to implement various functions of the server.

[0062] For example, the server may be a blade server, a high-density server, an artificial intelligence (AI) server, a graphics processing unit (GPU) server, a rack server or a tower server, etc. The terminal device may include a personal digital assistant (PDA), an ultra-mobile personal computer (UMPC), a laptop computer, a netbook, a desktop computer, an all-in-one computer, etc.

[0063] It should be noted that the embodiments of the present application do not limit the device form of the computing device. The system architecture of the computing device provided in the embodiments of the present application is described below using a server as an example.

[0064] like Figure 2, which is a system architecture diagram of a computing device provided in an embodiment of the present application. The hardware part of the computing device includes a baseboard management controller (BMC), a processor (central processing unit, CPU) and a memory, and the software part mainly includes a BMC module, processor firmware and an operating system (OS) management unit.

[0065] The processor may translate the target text of the first language to be translated according to the translation method provided in the embodiment of the present application, or train the second translation model according to the training method of the translation model provided in the embodiment of the present application. It should be noted that in the following embodiments, the execution subject of the translation method or the training method of the translation model is performed by taking a computing device as an example.

[0066] Exemplarily, the BMC module may be a management unit of a non-business module. For example, the BMC module may remotely maintain and manage a computing device through a dedicated data channel. The BMC module is completely independent of the operating system of the computing device and may communicate with a basic input output system (BIOS) and an OS (or an OS management unit) through an out-of-band management interface of the computing device.

[0067] Exemplarily, the processor firmware (also referred to as a processor firmware program) may be firmware such as a basic input output system (BIOS), a management engine (ME), a microcode, or an intelligent management unit (IMU).

[0068] Among them, the memory, also called internal memory or main memory, is installed in the memory slot on the motherboard of the computing device, and the memory communicates with the memory controller through a memory channel.

[0069] Optionally, the computing device may further include an external display terminal, also referred to as an external display; the external display terminal is used to display the interface content output by the CPU.

[0070] Optionally, the computing device further includes an external input device, such as a keyboard, a microphone, etc. The computing device obtains the user's translation instruction through the external input device. For example, the user inputs information such as "translate the text from Chinese to English, what is the translation of the following text, how to say the following text in English, how to express the text in English" through the keyboard. The computing device obtains the translation instruction based on the information input by the user, so that the processor uses the translation model to perform translation.

[0071] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0072] For ease of understanding, the following is an exemplary introduction to the translation method provided by the present application in conjunction with the accompanying drawings. The method is applicable to Figure 2 The computing device shown.

[0073] The following examples of this application will be divided into three parts to exemplarily introduce the scheme of the translation method.

[0074] Part I: Combination Figures 3 to 7 , introduces the translation method provided in the embodiment of the present application, aiming to introduce the implementation method of translating the target text using the translation model.

[0075] Part II: Combination Figure 8 , Fig. 9 , Fig.10 , introduces the training method of the translation model provided in the embodiment of the present application, aiming to introduce the specific process of training the translation model.

[0076] The third part introduces the training method of the translation model provided in the embodiment of the present application, aiming to introduce the preset word set, preset text set and the method of constructing the samples used in training the translation model involved in the present application.

[0077] There are many implementation methods for translating text using a translation model. Below, methods 1 to 3 are used for exemplary description.

[0078] Method 1: Before using the translation model to translate the target text, first replace the target source vocabulary in the target text with the target translation vocabulary corresponding to the target source vocabulary in the preset word set, and then use the translation model to translate the replaced text (i.e., the reconstructed text), so that the translation result of the target text is more accurate, avoiding the occurrence of inaccuracies when the translation model translates the target source vocabulary in the target text.

[0079] Figure 3 1 is a flowchart of a translation method according to an exemplary embodiment. The execution subject of the method may be a computing device. Exemplarily, the method includes the following S301-S303.

[0080] S301: Acquire a target text in a first language to be translated.

[0081] The first language can also be called the original language of the text, which can be Chinese, English, German, etc.

[0082] Exemplarily, the target text may be text in the first language obtained by the user through voice input conversion, or may be text in the first language provided directly by the user through keyboard, handwriting or other input methods. This application does not impose any specific restrictions on the method of obtaining the target text.

[0083] Taking Chinese as an example, the target text in the first language may be “query the usage of data disks on each metadata server”.

[0084] S302: Based on a preset word set, the target source words in the target text are replaced with the target translation words to obtain a reconstructed text corresponding to the target text.

[0085] Among them, the preset word set includes multiple word pairs, and each word pair includes a source word in a first language and a translation word in a second language. The word pairs in the preset word set can be Chinese-English word pairs, and can also be Chinese-German, Arabic-German and other word pairs, which are not specifically limited here. The vocabulary in the word pair can be a single word, or a phrase composed of several words. For example, the source vocabulary in the word pair is a data disk, and the translation vocabulary in the word pair is data disk. For another example, the source vocabulary in the word pair is a metadata server, and the translation vocabulary in the word pair is metadata server. In this case, the first language is Chinese and the second language is English. The present application does not limit the specific implementation form of the preset word set, which can be a bigram, etc. The target source vocabulary and the target translation vocabulary are word pairs in the preset word set.

[0086] In a possible implementation, the vocabulary in the preset word set is professional vocabulary in a preset field. Exemplarily, the preset field refers to a specific knowledge or professional category, and the preset field can cover specific fields such as the information technology (IT) field, the medical field, and the legal field. Professional vocabulary, also known as terminology or professional terms, refers to specialized vocabulary or phrases used in a specific field to accurately and efficiently convey information. These words usually have specific meanings and usages, and are often closely related to the professional knowledge, technology or practice in the field. Taking the IT field as an example, professional vocabulary can be "artificial intelligence", "data structure", etc. Taking the medical field as an example, professional vocabulary can be "cardiopulmonary resuscitation", "electrocardiogram", etc.

[0087] In different fields, there may be significant differences in the translation of the same text. For example, taking Chinese as the first language and English as the second language, for the same Chinese word "interface", in the IT field, "interface" usually refers to the connection point between software or hardware, which is used to achieve communication and data exchange between different systems or components. Therefore, in the IT field, "interface" is often translated as "interface". In the medical field, if "interface" is used to describe the connection between parts of the human body, such as the connection between bones, "interface" is often translated as "articulation". Therefore, for different preset fields, even if the source vocabulary is the same in the preset word set, the corresponding translation vocabulary will be quite different. The specific implementation method for constructing the preset word set will be introduced in the third part, which will not be repeated here.

[0088] Unlike common words, many professional words in the preset fields are rare words. If these professional words in the preset fields appear less frequently in the training data of the translation model, the translation model will learn less translation information about the professional words during the training process, which will make the translation model's translation ability for the professional words in the preset fields poor. Therefore, by directly converting the target source words in the target text into the target translation words through the preset word set, it can ensure that these source words as terms are accurately matched during the translation process. This is crucial for translations in fields that require high professionalism and accuracy, and helps to improve the professionalism and authority of the translation, so that the translated text is accurate while conforming to the expression habits and industry standards of the field.

[0089] For example, in the IT field, the target text is "the low-speed signal cable from the left ear plate to the left ear connector (J6081) of the mainboard". In the preset word set, the source word in word pair 1 is "mounting ear plate" and the translation word is "mounting earplate". The source word in word pair 2 is "connector" and the translation word is "connector". That is to say, in the target text, the target source words are "mounting ear plate" and "connector", and the corresponding target translation words are "mounting ear plate" and "connector". Therefore, the "mounting ear plate" in the target text is replaced with "mounting ear plate", and the "connector" in the target text is replaced with "connector". In this way, the reconstructed text corresponding to the target text is "the low-speed signal cable from the left mounting earplate to the left ear connector (J6081) of the mainboard".

[0090] For different fields, it is necessary to determine the corresponding preset word set, so that before the translation model translates the target text, the target source vocabulary in the target text is replaced with the target translation vocabulary, avoiding inaccurate translation when the translation model translates professional vocabulary.

[0091] Optionally, in the above S302, the target text is reconstructed into the reconstructed text by the following methods a1-a3:

[0092] a1: Match the words in the target text with the source words in the preset word set to determine the target source words in the target text.

[0093] The target source vocabulary is the vocabulary in the target text that successfully matches the source vocabulary in the preset vocabulary set.

[0094] Exemplarily, successful matching means that the vocabulary of the target text is completely consistent with the source vocabulary in the preset word set, that is, it is determined that the vocabulary of the target text is successfully matched with the vocabulary in the preset word set.

[0095] Exemplarily, a successful match can also be that the words in the target text are semantically identical or similar to the words in the preset word set. For example, in the IT field, "program" and "code" can be determined to be a successful match. Taking the text vector of a word as an example of representing the semantics of a word, whether the two words are successfully matched is determined based on the similarity between the text vector of the word in the target text and the text vector of the word in the preset word set. For example, when the similarity is greater than a preset threshold, it is determined that the two words are successfully matched.

[0096] a2: Determine the target translation vocabulary corresponding to the target source vocabulary in the target text in the preset vocabulary set.

[0097] a3: Replace the target source words in the target text with the target translation words to obtain the reconstructed text.

[0098] S303: Translate the reconstructed text using the first translation model to obtain a translation text in the second language output by the first translation model.

[0099] Exemplarily, the first translation model may be a large language model (LLM), or a diffusion model, etc. The present application does not specifically limit the first translation model.

[0100] Figure 4 A schematic diagram of a scenario for translating a reconstructed text. Figure 4 In the translation model, the first language is Chinese and the second language is English. The target text is "Low-speed signal cable for connecting the left mounting ear plate to the left mounting ear connector (J6081) on the mainboard", and the reconstructed text is "Low-speed signal cable for connecting the left mounting ear plate to the left mounting ear connector (J6081) on the mainboard". The reconstructed text is input into the translation model to obtain the translation text corresponding to the target text, namely "Low-speed signal cable for connecting the left mounting ear plate to the left mounting ear connector (J6081) on the mainboard".

[0101] In the above S302, the reconstructed text is the text obtained after the target source vocabulary in the target text is replaced with the target translation vocabulary. In other related technologies, the reconstructed text includes not only the target text but also the target word pair. The target word pair includes the target source vocabulary in the target text and the target translation vocabulary corresponding to the target source vocabulary. The target word pair is a word pair in a preset word set.

[0102] Figure 5 and Figure 6 Comparative results of translation based on reconstructed text. Figure 5 This is a comparison chart of the bilingual evaluation understudy (BLEU) indicator. Figure 6 Comparison results of the cross-lingual optimization metric for evaluation of translation (COMET) indicators. The higher the BLEU and COMET indicators, the better the translation quality. Figure 5 and Figure 6In the translation method, the translation model is used to directly translate the target text without using the reconstructed text, which is recorded as method m. The translation method using the reconstructed sample, and the reconstructed text is the text obtained by replacing the target source vocabulary in the target text with the target translation vocabulary, is recorded as method n. The translation method using the reconstructed sample, and the reconstructed sample contains not only the target text but also the target word pair, is recorded as method p. Figure 5 and Figure 6 As can be seen in the figure, in the IT, legal, and medical fields, the translation quality is ranked from high to low as method n, method p, and method m. Compared with method p, the target word pairs included in the reconstructed text increase the text length of the prompt information. In the process of reconstructing the sample, method n directly embeds the target translation vocabulary into the sample without increasing the text length of the prompt information, saving the consumption of computing resources (such as memory) of the processor during the training model process and improving the training efficiency.

[0103] Method 2: Based on the target text in the first language and the prompt text pair that is semantically related to the target text, the corresponding translation text in the second language is obtained. The prompt text pair provides the translation model with semantic information related to the target text, which helps the translation model to more accurately express the meaning of the target text when processing similar or related texts, thereby improving the translation quality.

[0104] Figure 7 FIG. 1 is a flowchart of another translation method according to an exemplary embodiment. The execution subject of the method may be a computing device. Figure 7 As shown, the translation method includes the following steps S801-S803:

[0105] S801: Obtain a target text in a first language to be translated.

[0106] S802: Acquire a prompt text pair from a preset text set according to the target text.

[0107] Wherein, the preset text set includes multiple text pairs, and each text pair includes a source text in a first language and a translated text in a second language. The text in the text pair can be a sentence or a paragraph consisting of multiple sentences, and this application does not make specific restrictions on this. The prompt text pair is a text pair in the preset text set that is semantically related to the target text. According to the target text, the source text semantically related to the target text can be obtained from the preset text set, and the text pair where the source text is located is used as the prompt text pair. Here, semantic relevance refers to the existence of a certain connection or similarity between two texts in meaning or significance. Exemplarily, the text vector of the text can be used to represent the semantics of the text. In this way, it is determined whether the two texts are semantically related by calculating the similarity of the text vectors of the two texts. If the similarity of the text vectors of the two texts is greater than or equal to the preset threshold, it indicates that the two texts are semantically related.

[0108] Optionally, obtain the prompt text pair through b1-b3 as follows:

[0109] b1: Get the first text vector of the target text.

[0110] The first text vector is used to represent the semantic information of the target text.

[0111] b2: Determine, from the text vectors corresponding to the source texts of the plurality of text pairs, a second text vector whose similarity with the first text vector meets a preset threshold.

[0112] The second text vector is used to characterize the semantic information of the source text that is semantically related to the target text. Here, satisfying the threshold means being greater than or equal to a preset threshold. The preset threshold can be limited according to actual conditions. For example, the preset threshold is set to 0.7. Among the text vectors corresponding to the source texts of the multiple text pairs, the text vector having a similarity greater than or equal to 0.7 with the first text vector is used as the second text vector.

[0113] b3: The text pair containing the source text corresponding to the second text vector is used as the prompt text pair.

[0114] In some examples, using the text pair where the source text corresponding to the second text vector is located as the prompt text pair may also include: determining a preset number of text pairs from the text pairs where the source text corresponding to the second text vector is located as the prompt text pairs.

[0115] Among them, the preset number can be set according to actual needs. Among the text vectors corresponding to the source texts of multiple text pairs that meet the preset threshold, the prompt text pairs are further screened. Exemplarily, the preset number is set to 2. If among the text vectors corresponding to the source texts of multiple text pairs, the text vectors corresponding to the source texts of 5 text pairs meet the preset threshold, then 2 text pairs can be selected from large to small as prompt text pairs based on the similarity with the first text vector. Of course, a preset number of text pairs can also be randomly selected as prompt text pairs from the text pairs that meet the preset threshold.

[0116] In this way, by converting the text into vector form and using the similarity of the vectors to measure the semantic similarity between texts, it is possible to more accurately find prompt text pairs that are semantically related to the target text, which helps ensure that the translation model can refer to the translation information most relevant to the target text during the translation process, thereby improving the accuracy of the translation.

[0117] S803: Input the target text and the prompt text pair into the first translation model to obtain the translation text corresponding to the target text output by the first translation model.

[0118] Method 3: Based on the reconstructed text corresponding to the target text in the first language and the prompt text pair that is semantically related to the target text, the corresponding translation text in the second language is obtained. In this way, the target source words in the target text are directly converted into target translation words through the preset word set, which can ensure that these source words are accurately matched during the translation process, and the prompt text pair is used to provide the translation model with translation information about the target text, which helps the translation model to express the meaning of the target text more appropriately when processing the target text, thereby improving the translation quality.

[0119] In a possible implementation, firstly, the reconstructed text corresponding to the target text and the prompt text pair corresponding to the target text in the preset text set are obtained; then, the reconstructed text and the prompt text pair are input into the translation model to obtain the translated text output by the translation model.

[0120] For how to obtain the reconstructed text corresponding to the target text, please refer to the above method 1, and for how to obtain the prompt text pair corresponding to the target text, please refer to the above method 2, which will not be elaborated here.

[0121] Table 1 shows the bilingual translation results of multiple preset fields. Among them, for the IT field, translation refers to the translation between Chinese and English. For the legal field and the medical field, translation refers to the translation between English and German. In general, the translation method provided in the embodiment of the present application significantly improves the translation quality. The translation method provided in the embodiment of the present application has achieved significant translation performance improvement in the test sets of the IT field, the legal field and the medical field. The translation method provided in the embodiment of the present application has a significantly higher improvement in the BLEU indicator than the COMET indicator. Since BLEU mainly focuses on the vocabulary and phrase levels when evaluating the translation quality, in the embodiment of the present application, the use of a preset word set can help the translation model better translate professional terms in specific fields, which also verifies the effectiveness of reconstructing the text.

[0122] Among the three translation models GPT-3.5, GPT-4o and NLLB-3.3B, GPT-4o has the best translation performance. Therefore, additional experiments were conducted on GPT-4o, and the translation quality was significantly improved by using the preset word set and the preset text set compared to not using the preset word set and the preset text set. For the three translation models Tigerbot-13B, Baichuan2-13B, and Llama2-13B, the translation performance of the translation method of this application in the three fields is better than the translation performance of the translation method of this application not using it.

[0123] Table 1 Bilingual translation results for multiple preset fields

[0124]

[0125]

[0126] In the first part of the embodiment of the present application, in the process of translating the target text using the translation model, by adding a preset word set and / or a prompt text pair, the accuracy of the translation of the target text is improved. Specifically, by using a preset word set, the target source vocabulary in the target text is accurately matched and replaced, which can ensure that the vocabulary in the target text can be accurately translated during the translation process. In addition, the target source vocabulary in the target text is directly replaced with the target translation vocabulary by a preset word set, which can reduce the time for the translation model to translate and search each vocabulary in the target text separately, and can significantly improve the translation efficiency in the scenario of processing a large amount of text or quickly generating a translation text. The prompt text pair provides the translation model with semantic information related to the target text, which helps the translation model to express the meaning of the target text more appropriately and improve the translation quality when processing similar or related texts.

[0127] The above is the first part of the embodiment of this application. Figure 8 , Fig. 9 , Fig.10 , introduces the training method of the translation model provided in the embodiment of the present application, aiming to introduce the specific process of training the translation model.

[0128] In the second part of the implementation of this application, the translation model is trained, including multiple implementation methods. Below, methods a to c are used for exemplary description.

[0129] Mode a: The training data of the second translation model includes reconstructed samples corresponding to the original samples in the first language and translated samples in the second language.

[0130] Figure 8 The flowchart of a method for training a translation model according to an exemplary embodiment is shown. The execution subject of the method may be a computing device. Exemplarily, the method includes the following S901-S902.

[0131] S901: Obtain a reconstructed sample and a translated sample in a second language corresponding to an original sample in a first language.

[0132] The reconstructed sample is a text obtained by replacing the target source vocabulary in the original sample of the first language with the target translation vocabulary using the preset word set. The preset word set includes multiple word pairs, each word pair includes the source vocabulary of the first language and the translation vocabulary of the second language. The target source vocabulary and the target translation vocabulary in the original sample are word pairs in the preset word set.

[0133] The original sample and the translated sample can be texts screened from open source translation data sets such as IT, medical, and legal fields. Taking the IT field as an example, the original sample and the translated sample can be obtained by manually screening the translation pairs in the IT product documents, or by inputting the original sample of the translation pair in the IT product document into the translation model (such as the Baichuan2-13B model) to obtain the output text as the reference text, and then screening the translated text in the translation pair. The specific method for obtaining the original sample and the translated sample will be introduced in the third part of the subsequent embodiments, and will not be repeated here.

[0134] S902: Using the reconstructed samples and the translated samples, the second translation model is trained to obtain the first translation model.

[0135] Optionally, the reconstructed sample is input into a second translation model to obtain an output of the second translation model, the translation sample is used as a reference value, and the parameters of the second translation model are continuously adjusted based on the output of the second translation model and the translation sample, so as to obtain a translation model.

[0136] Exemplarily, a low-rank adaptation (LoRA) fine-tuning strategy is used to train the second translation model to obtain the final translation model. Specifically, during the training process, the processor freezes the initial parameters of the second translation model, and at the same time trains the two low-rank matrices by introducing two low-rank matrices in the self-attention and feedforward network layers of the translation model, and multiplies the two trained low-rank matrices with the initial parameters in the model to obtain the first translation model. During the entire training process, the original parameters of the second translation model do not change, only the two low-rank matrices are updated, thereby reducing the parameters in the model that need to be trained, reducing processor overhead and memory consumption, and enabling the computing device to efficiently fine-tune the translation model with limited resources.

[0137] When fine-tuning the translation model using the low-rank adaptive fine-tuning strategy, the training process is set as follows: the learning rate is set to 3e-4 to ensure the stability of the model parameter update; the training batch size is 2 to adapt to the processor resource and memory resource limitations in the computing device; the maximum sequence length (vocabulary length) is 512 words to ensure the processing power of the model and the completeness of information; the weight decay coefficient is 0.00001 to prevent the model from overfitting; a warmup ratio of 0.01 is used to stabilize the initial learning rate increase; the deepspeed framework and FlashAttention framework are used to improve training efficiency. At the same time, in the LoRA fine-tuning strategy, the rank is set to 16 to minimize the impact on the overall architecture of the model and improve efficiency. In addition, during the model testing phase, the processor uses the efficient virtual large language model (vLLM) framework to accelerate reasoning and reduce memory usage to optimize system performance. During the model testing phase, the processor uses a beam search algorithm with a beam width of 4 to balance computational complexity and translation quality; the temperature is set to 0 to reduce output diversity and ensure accuracy; and the length penalty is set to 1.0 to prevent text generation from being too long or too short.

[0138] In method a, during the training process of the second translation model, the reconstructed samples and the translated samples are directly used as training samples. On the one hand, the process of the second translation model learning the mapping between the source vocabulary and the translated vocabulary in multiple word pairs in the preset word set is omitted, which reduces the training time and the consumption of computing resources, so that the second translation model does not need to learn multiple word pairs in the preset word set during the training process. The second translation model directly learns the translation rules from the reconstructed samples and the translated samples, thereby improving the training efficiency of the second translation model. On the other hand, since the second translation model does not need to learn multiple word pairs in the preset word set during the training process, the training samples required by the second translation model do not need to include samples related to the preset word set, thereby reducing the data volume of the training samples.

[0139] Mode b: The training data of the second translation model includes original samples in the first language, translated samples in the second language, and prompt sample pairs corresponding to the original samples.

[0140] Fig. 9 FIG. 1 is a schematic diagram of a scenario of a method for training a translation model according to an exemplary embodiment. The execution subject of the method may be a computing device. Fig. 9As shown, in the process of training the second translation model, it is first necessary to obtain the original sample in the first language, the translation sample in the second language corresponding to the original sample, and the prompt sample pair corresponding to the original sample. Among them, the prompt text pair is a text pair in the preset text set that is semantically related to the original sample; the preset text set includes multiple text pairs, each text pair includes a source text in the first language and a translation text in the second language. Then, the processor uses the original sample, the translation sample, and the prompt sample pair to train the second translation model to obtain the first translation model. As shown Fig. 9 As shown, the processor takes the original sample and the prompt text pair as the input of the second translation model, and trains the second translation model based on the translation text and the translation sample output by the second translation model to obtain the first translation model.

[0141] Of course, during the training process of the second translation model, a low-rank adaptive fine-tuning strategy can also be used to train the second translation model to obtain the first translation model. The specific implementation method can refer to the fine-tuning strategy in method a, which will not be repeated here.

[0142] In method b, by introducing prompt text pairs that are semantically related to the original samples, the translated text in the prompt text pairs provides a reference for the translation model. The translation model can learn more semantic information related to the original samples during the training process, which helps the translation model better understand the intent and meaning of the source text when processing complex texts, thereby generating more accurate and natural translations.

[0143] Mode c: The training data of the second translation model includes reconstructed samples corresponding to the original samples in the first language, translated samples in the second language, and prompt sample pairs corresponding to the original samples.

[0144] In method c, the translation model is trained in the following way:

[0145] First, a reconstructed sample corresponding to the original sample in the first language, a translated sample in the second language, and a prompt sample pair corresponding to the original sample are obtained. Then, the prompt text pair and the reconstructed sample are used as inputs of the second translation model, and the second translation model is trained based on the output and the translated sample of the second translation model to obtain the first translation model.

[0146] Of course, in method c, the low-rank adaptive fine-tuning strategy can still be used to train the second translation model to obtain the first translation model. The specific implementation method can refer to the fine-tuning strategy in method a, which will not be repeated here.

[0147] Fig.10 A diagram of a scenario for training a translation model. Fig.10, the original sample is "a low-speed signal cable for connecting the indicator board to the left mounting ear connector (J6081) of the mainboard". The target source vocabulary in the original sample determined based on the preset word set is "mounting ear plate" and "connector", and the corresponding target translation vocabulary is "mounting ear plate" and "connector". The reconstructed sample is "a low-speed signal cable for connecting the left mounting ear plate to the left mounting ear connector (J6081) of the mainboard". Based on the vector representing the semantics of the original sample and the vector representing the semantics of the source text in each text pair in the preset text set, the prompt text pair determined in the preset text set is: "a signal cable for connecting the indicator board to the right mounting ear connector (J7012) of the mainboard". In the process of training the second translation model, the prompt text pair and the reconstructed sample are used as the input of the second translation model, and the output of the second translation model (i.e., "a low-speed signal cable for connecting the left mounting ear plate to the left mounting ear connector (J6081) on the mainboard") and the translation samples, a low-rank adaptive fine-tuning strategy is adopted to train the two low-rank matrices Wa and Wb introduced in the second translation model. Meanwhile, the original parameter W in the second translation model remains unchanged, and finally the first translation model is obtained.

[0148] In method c, the reconstructed samples are used to omit the process of the translation model learning the mapping between source words and translated words in multiple word pairs in the preset word set, thereby improving the training efficiency of the translation model. At the same time, prompt sample pairs are also used to provide prompt information for the translation model, thereby further improving the translation performance of the translation model.

[0149] The above is the second part of the embodiment of the present application. The following introduces the training method of the translation model provided in the embodiment of the present application, aiming to introduce the construction method of the preset word set, preset text set and samples used in training the translation model involved in the present application.

[0150] In some embodiments, the training data of the second translation model includes a reconstructed sample corresponding to an original sample in the first language and a translated sample in the second language. Before training the translation model, the processor first needs to obtain the original sample corresponding to the reconstructed sample and the translated sample corresponding to the original sample, and then reconstruct the original sample into the reconstructed sample using a preset word set.

[0151] In a possible implementation, the processor obtains the original sample and the translation sample through c1-c5 as follows:

[0152] c1: Get multiple initial sample pairs.

[0153] Each initial sample pair includes an initial source sample in a first language and an initial translation sample in a second language corresponding to the initial source sample.

[0154] Exemplarily, the multiple initial sample pairs may be samples that have undergone preprocessing operations. Preprocessing operations include, but are not limited to, removing invalid content, symbol conversion, data deduplication, and the like. Taking the IT field as an example, a preprocessing operation is performed on IT product documents in the IT field to obtain multiple initial sample pairs. Among them, removing invalid content refers to removing invalid (hyper text markup language, html) content in the document, such as html tags, etc. Symbol conversion refers to converting special characters in IT documents into ordinary symbols, such as converting the special character "<" in the programming environment into "<" represented in ordinary text, and converting ">" and the like into ">". Data deduplication refers to deduplicating repeated Chinese content and repeated English content in IT product documents to ensure that each Chinese sample has only one corresponding English sample.

[0155] c2: For each initial sample pair, the initial source sample in the initial sample pair is input into the third translation model to obtain the initial translation text corresponding to the initial source sample.

[0156] Exemplarily, the third translation model may be the Baichuan2-13B model. For each initial sample pair, the initial source sample in the initial sample pair is input into the Baichuan2-13B model to obtain the translation text output by the Baichuan2-13B model.

[0157] c3: According to the similarity between the translation text corresponding to the initial source sample in each initial sample pair and the initial translation sample in the initial sample pair, multiple initial sample pairs are screened to obtain screened initial sample pairs.

[0158] Among them, the translated text output by the translation model is used as the standard text of the translated sample corresponding to the source sample. The greater the similarity between the translated text corresponding to the initial source sample in the initial sample pair and the initial translated sample in the initial sample pair, the more accurate the initial translated sample in the initial sample pair is. It is considered that the quality of the initial sample pair meets the requirements and can be used as a training sample to train the second translation model.

[0159] Exemplarily, a similarity threshold may be set, and initial sample pairs with a similarity greater than the similarity threshold may be used as the screened initial sample pairs.

[0160] c4: The initial source sample in the filtered initial sample pair is taken as the original sample, and the initial translation sample in the filtered initial sample pair is taken as the translation sample.

[0161] The sample pairs consisting of the original samples and the translated samples can be used as data sets for constructing preset word sets.

[0162] c5: Replace the target source vocabulary in the original sample with the target translation vocabulary to obtain a reconstructed sample.

[0163] In the embodiment of the present application, the initial source sample and the initial translation sample in the screened initial sample pair are used to train the second translation model. The sample pair removed from the initial sample pair can be used as a preset sample set in the second part, and the processor uses the removed sample pair to provide additional prompt information for the second translation model to improve the translation performance of the translation model.

[0164] In a possible implementation, the words in the preset word set are professional words in a preset field. The implementation of the processor obtaining multiple word pairs in the preset word set is as follows:

[0165] The preset prompt information and the data set are input into the extraction model to obtain multiple word pairs in the preset word set.

[0166] The preset prompt information is used to prompt the extraction model to extract professional vocabulary in the preset field from the data set. For example, for the IT field, the preset prompt information can be professional vocabulary in the IT field. For the medical field, the preset prompt information can be professional vocabulary in the medical field, etc.

[0167] The data set includes a plurality of text pairs, each of which includes a source text in a first language and a translated text in a second language. For example, the text pair can be the initial sample pair after the above screening, that is, a sample pair consisting of an original sample and a translated sample, or of course, the initial sample pair before screening. The source vocabulary in the first language in each word pair is extracted from the corresponding source text in the data set, and the translated vocabulary in the second language in each word pair is extracted from the corresponding translated text in the data set. Exemplarily, the data set can be the original sample and the translated sample, or other samples.

[0168] Exemplarily, the extraction model may be the ChatGLM-7B model.

[0169] Table 2 shows three word pairs in a text pair. First, the processor inputs the text pair (i.e., Chinese: Run the following command on each metadata server to query the MDS data disk usage) and the preset prompt information (i.e., professional vocabulary in the IT field) into the extraction model, and the extraction model outputs the three word pairs in the text pair (i.e., metadata server, data disk, usage).

[0170] Table 2 Word pairs in text pairs

[0171]

[0172] In this way, by pre-setting prompt information, the extraction model can focus on professional vocabulary in specific fields (such as information technology, medicine, law, etc.), ensuring the professionalism and accuracy of the vocabulary set, which helps the translation model generate more accurate and professional translations when processing texts in professional fields.

[0173] Of course, after the extraction model extracts the word pairs, the extracted word pairs can be further reviewed by domain experts to ensure the accuracy of the word pairs in the preset word set, thus providing a basis for training high-quality translation models.

[0174] In a possible implementation, the processor reconstructs the original sample using a preset word set, and obtains the reconstructed sample corresponding to the original sample in the following manner d1-d2:

[0175] d1: Traverse the words in the original sample and match them with the source words in the preset word set to obtain the target source words in the original sample.

[0176] d2: Determine the target translation vocabulary corresponding to the target source vocabulary in the original sample in the preset vocabulary set, replace the target source vocabulary in the original sample with the target translation vocabulary, and obtain a reconstructed sample.

[0177] Taking the reconstruction of a data set C containing multiple original samples and translation samples corresponding to the original samples into a data set C' containing reconstructed samples corresponding to multiple original samples and translation samples corresponding to the original samples as an example, in the process of reconstructing the original samples in C into reconstructed samples, first, the processor will sort the source words in the preset word set in descending order according to the length of the source words (i.e., the number of words in the source words). That is, when reconstructing the original samples, the longer words in the sample can be processed first, and then the shorter words. This is because the longer the words are, the more words they contain, and they may even contain shorter words. If the words with short words are matched first, it is very likely that a word with a long length will be split into several words with shorter lengths, resulting in inaccuracy of the reconstructed samples and affecting the training effect of the translation model. Then, the processor traverses each sample pair containing the original sample and the translation sample in C, and converts the target source word in the original sample into the target translation word corresponding to the target source word in the preset word set D to obtain the reconstructed sample. Finally, the processor obtains multiple sample pairs consisting of reconstructed samples and translation samples, i.e., C'.

[0178] In this way, the target source words in the original sample are accurately matched and replaced by the preset word set, that is, the training data is enhanced by the preset word set, which can ensure that the words in the original sample can be accurately translated during the translation process. In addition, the preset word set is used to directly replace the target source words in the original sample with the target translation words, which can reduce the time for the translation model to perform translation training on each word in the original sample separately, which can significantly improve the translation efficiency in the scenario of processing large amounts of text or quickly generating translated text.

[0179] In the third part of the embodiment of the present application, it is introduced how to obtain the original sample, how to convert the original sample into a reconstructed sample, and how to construct a preset word set. In the part of obtaining the original sample, the initial sample pairs obtained are screened to make the training data of the translation model more accurate, providing a basis for improving the translation ability of the translation model. In the part of constructing the preset word set, the words in the preset word set are professional words in the preset field, providing professional guarantees for the translation of professional words, avoiding inaccurate translation of professional words by the translation model, and making the translation process serve the expression habits and industry standards of the preset field.

[0180] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. In order to realize the above functions, the translation device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0181] The embodiment of the present application can be based on the above method, exemplarily dividing the functional modules of the translation device, for example, the translation device can include various functional modules corresponding to the various functional divisions, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic, which is only a logical function division, and there can be other division methods in actual implementation.

[0182] For example, Fig.11 A possible structural schematic diagram of a translation device involved in the above-mentioned embodiment is shown. The device includes: a first acquisition unit 1201, which is used to acquire a target text in a first language to be translated. A reconstruction unit 1202, which is used to replace the target source vocabulary in the target text with the target translation vocabulary based on a preset word set, and obtain a reconstructed text corresponding to the target text, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set. A translation unit 1203, which is used to translate the reconstructed text using a first translation model, and obtain a translation text in the second language output by the first translation model.

[0183] Optionally, in the device, the words in the preset word set are professional words in a preset field.

[0184] Optionally, the reconstruction unit 1202 is specifically used to match the vocabulary in the target text with the source vocabulary in the preset word set to obtain the target source vocabulary; the target source vocabulary is the vocabulary in the target text that successfully matches the source vocabulary in the preset word set; determine the target translation vocabulary corresponding to the target source vocabulary in the preset word set; replace the target source vocabulary in the target text with the target translation vocabulary to obtain a reconstructed text.

[0185] Optionally, the device further includes: a second acquisition unit, configured to acquire a prompt text pair from a preset text set according to the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text. The translation unit 1203 is specifically configured to input the reconstructed text and the prompt text pair into the first translation model to obtain the translation text output by the first translation model.

[0186] Optionally, a second acquisition unit is specifically used to acquire a first text vector of a target text; the first text vector is used to represent the semantic information of the target text; a second text vector whose similarity with the first text vector meets a preset threshold is determined from text vectors corresponding to source texts of multiple text pairs; the second text vector is used to represent the semantic information of the source text that is semantically related to the target text; and the text pair to which the source text corresponding to the second text vector belongs is used as a prompt text pair.

[0187] For example, Fig.12 A possible structural schematic diagram of another translation device involved in the above-mentioned embodiment is shown. The device includes: a third acquisition unit 1301, which is used to obtain a target text in a first language to be translated. A fourth acquisition unit 1302 is used to obtain a prompt text pair from a preset text set according to the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text. A determination unit 1303 is used to input the target text and the prompt text pair into the first translation model to obtain a translation text corresponding to the target text output by the first translation model.

[0188] For example, Fig.13 A possible structural schematic diagram of a training device for a translation model involved in the above-mentioned embodiment is shown. The device includes: a fifth acquisition unit 1401, which is used to obtain a reconstructed sample and a translation sample in a second language corresponding to an original sample in a first language; the reconstructed sample is a text obtained by replacing the target source vocabulary in the original sample of the first language with the target translation vocabulary using a preset word set; the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set. A training unit 1402 is used to train the second translation model using the reconstructed sample and the translation sample to obtain the first translation model.

[0189] Optionally, the vocabulary in the preset word set is professional vocabulary in a preset field; the device also includes: an extraction unit, which is used to input preset prompt information and a data set into an extraction model to obtain multiple word pairs in the preset word set; the preset prompt information is used to prompt the extraction model to extract professional vocabulary in the preset field from the data set; the data set includes multiple text pairs, each text pair includes a source text in a first language and a translated text in a second language; the source vocabulary in the first language in each word pair is extracted from the corresponding source text in the data set, and the translated vocabulary in the second language in each word pair is extracted from the corresponding translated text in the data set.

[0190] Optionally, the training unit 1402 is specifically used to obtain an original sample corresponding to the reconstructed sample; obtain a prompt text pair from a preset text set based on the original sample; the prompt text pair is a text pair in the preset text set that is semantically related to the original sample; the preset text set includes multiple text pairs, each text pair includes a source text in a first language and a translated text in a second language; use the prompt text pair and the reconstructed sample as inputs of a second translation model, and train the second translation model based on the output of the second translation model and the translation sample to obtain a translation model.

[0191] Optionally, the fifth acquisition unit 1401 is specifically used to acquire multiple initial sample pairs; each initial sample pair includes an initial source sample in a first language and an initial translation sample in a second language corresponding to the initial source sample; for each initial sample pair, the initial source sample in the initial sample pair is input into a third translation model to obtain a translation text corresponding to the initial source sample; according to the similarity between the translation text corresponding to the initial source sample in each initial sample pair and the initial translation sample in the initial sample pair, the multiple initial sample pairs are screened to obtain screened initial sample pairs; the initial source sample in the screened initial sample pair is used as the original sample, and the initial translation sample in the screened initial sample pair is used as the translation sample; the target source vocabulary in the original sample is replaced with the target translation vocabulary to obtain a reconstructed sample.

[0192] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any of the above translation devices and translation model training devices and the description of the beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.

[0193] The embodiment of the present application also provides a computing device, which includes a processor and a memory, the processor is connected to the memory, the memory stores a computer-executable instruction, and the processor implements the data processing method in the above embodiment when executing the computer-executable instruction. The embodiment of the present application does not impose any restrictions on the specific form of the computing device. For example, the computing device can be a terminal device or a network device. Among them, the terminal device can be called: terminal, user equipment (UE), terminal equipment, access terminal, user unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent or user device, etc. The terminal device can be a mobile phone, augmented reality (AR) device, virtual reality (VR) device, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. The network device can be a server, etc. Among them, the server can be a physical or logical server, or it can be two or more physical or logical servers that share different responsibilities and cooperate with each other to realize the functions of the server.

[0194] The embodiment of the present application also provides an electronic device, including: a receiver, a processor and an output device. The receiver is used to obtain a target text in a first language to be translated; the processor is used to receive a translation text sent by a computing device; the translation text is a text in a second language output by the first translation model after translating the reconstructed text using a first translation model; the reconstructed text is a text obtained by replacing the target source vocabulary in the target text with the target translation vocabulary based on a preset word set, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set. The output device is used to output the translation text.

[0195] The embodiment of the present application also provides an electronic device, including: a receiver, a processor and an output device. The receiver is used to obtain a target text in a first language to be translated; the processor is used to receive a translation text sent by a computing device; the translation text is a text corresponding to the target text output by the first translation model when the target text and the prompt text pair are input into the first translation model; the prompt text pair is obtained from a preset text set based on the target text; the preset text set includes multiple text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text. The output device is used to output the translation text.

[0196] The embodiment of the present application also provides an electronic device, including: a receiver, a processor and an output device. The receiver is used to obtain a target text in a first language to be translated; the processor is used to replace the target source vocabulary in the target text with the target translation vocabulary based on a preset word set to obtain a reconstructed text corresponding to the target text, wherein the preset word set includes a plurality of word pairs, each word pair includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; the reconstructed text is sent to a computing device; the processor is also used to receive a translation text sent by the computing device; the translation text is a text in the second language output by the first translation model after translating the reconstructed text using the first translation model. The output device is used to output the translation text.

[0197] The embodiment of the present application also provides an electronic device, including: a receiver, a processor and an output device. The receiver is used to obtain a target text in a first language to be translated; the processor is used to obtain a prompt text pair from a preset text set according to the target text; the preset text set includes a plurality of text pairs, each text pair includes a source text in a first language and a translation text in a second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; the target text and the prompt text pair are sent to a computing device; the processor is also used to receive a translation text sent by the computing device; the translation text is the text corresponding to the target text output by the first translation model when the target text and the prompt text pair are input into the first translation model. The output device is used to output the translation text.

[0198] The electronic device may include a personal digital assistant (PDA), an ultra-mobile personal computer (UMPC), a laptop, a netbook, a desktop computer, an all-in-one computer, etc. The receiver may include a microphone, a keyboard, a touch display screen, etc. When the receiver is a microphone, the user input may be a voice input. When the receiver is a keyboard or a touch display screen, the user input may be a text input. For example, the output device may be a speaker or a display screen. When the output device is a speaker, the translated text may be a translated text in a voice form. When the output device is a display screen, the translated text may be a translated text in a text form.

[0199] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed on a computer, the computer is enabled to execute any of the methods executed by the computing devices provided above.

[0200] For the explanation of the relevant contents and description of the beneficial effects of any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.

[0201] The embodiment of the present application also provides a chip. The chip integrates a control circuit and one or more ports for implementing the functions of the above-mentioned computing device. Optionally, the functions supported by the chip can be referred to above and will not be repeated here. A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned embodiment can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field programmable gate array (field programmable gatearray, FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.

[0202] The embodiment of the present application also provides a computer program product including instructions, when the instructions are run on a computer, the computer executes any one of the methods in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD), etc.

[0203] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.

[0204] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0205] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0206] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A translation method, characterized in that: The method comprises: Obtain a target text in a first language to be translated; Based on a preset word set, a target source word in the target text is replaced with a target translation word to obtain a reconstructed text corresponding to the target text, wherein the preset word set includes a plurality of word pairs, each of which includes a source word in the first language and a translation word in the second language; the target source word and the target translation word are word pairs in the preset word set; The reconstructed text is translated using a first translation model to obtain a translation text in the second language output by the first translation model.

2. The translation method according to claim 1, characterized in that: The step of replacing the target source vocabulary in the target text with the target translation vocabulary based on the preset word set to obtain a reconstructed text corresponding to the target text includes: Matching the vocabulary in the target text with the source vocabulary in the preset word set to obtain the target source vocabulary; wherein the target source vocabulary is the vocabulary in the target text that successfully matches the source vocabulary in the preset word set; Determining a target translation vocabulary corresponding to the target source vocabulary in the preset vocabulary set; The target source vocabulary in the target text is replaced with the target translation vocabulary to obtain the reconstructed text.

3. The translation method according to claim 1 or 2, characterized in that: The method further comprises: According to the target text, a prompt text pair is obtained from a preset text set; wherein the preset text set includes a plurality of text pairs, each of which includes a source text in the first language and a translation text in the second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; The step of translating the reconstructed text using the first translation model to obtain a translation text in the second language output by the first translation model includes: The reconstructed text and the prompt text pair are input into the first translation model to obtain the translated text output by the first translation model.

4. The translation method according to claim 3, characterized in that: The step of obtaining a prompt text pair from a preset text set according to the target text includes: Acquire a first text vector of the target text; the first text vector is used to represent semantic information of the target text; Determining, from the text vectors corresponding to the source texts of the plurality of text pairs, a second text vector whose similarity with the first text vector meets a preset threshold; the second text vector is used to represent semantic information of the source text that is semantically related to the target text; The text pair containing the source text corresponding to the second text vector is used as the prompt text pair.

5. A translation method, characterized in that: The method comprises: Obtain a target text in a first language to be translated; According to the target text, a prompt text pair is obtained from a preset text set; the preset text set includes a plurality of text pairs, each of which includes a source text in the first language and a translated text in the second language; the prompt text pair is a text pair in the preset text set that is semantically related to the target text; The target text and the prompt text pair are input into a first translation model to obtain a translation text corresponding to the target text output by the first translation model.

6. A method for training a translation model, characterized in that: The method comprises: Obtain a reconstructed sample and a translation sample in a second language corresponding to an original sample in a first language; the reconstructed sample is a text obtained by replacing a target source vocabulary in the original sample with a target translation vocabulary using a preset word set; the preset word set includes a plurality of word pairs, each of which includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; The second translation model is trained using the reconstructed samples and the translated samples to obtain a first translation model.

7. The training method according to claim 6, characterized in that: The words in the preset word set are professional words in a preset field; the method further includes: Inputting preset prompt information and a data set into an extraction model to obtain a plurality of word pairs in the preset word set; the preset prompt information is used to prompt the extraction model to extract professional vocabulary in the preset field from the data set; the data set includes a plurality of text pairs, each of which includes a source text in the first language and a translated text in the second language; the source vocabulary in the first language in each of the word pairs is extracted from the corresponding source text in the data set, and the translated vocabulary in the second language in each of the word pairs is extracted from the corresponding translated text in the data set.

8. The training method according to claim 6 or 7, characterized in that: The method of training the second translation model by using the reconstructed sample and the translated sample to obtain the first translation model comprises: Obtaining an original sample corresponding to the reconstructed sample; According to the original sample, a prompt text pair is obtained from a preset text set; the prompt text pair is a text pair in the preset text set that is semantically related to the original sample; the preset text set includes a plurality of text pairs, each of which includes a source text in the first language and a translated text in the second language; The prompt text pair and the reconstructed sample are used as inputs of the second translation model, and the second translation model is trained based on the output of the second translation model and the translation sample to obtain the first translation model.

9. The training method according to any one of claims 6 to 8, characterized in that: The step of obtaining a reconstructed sample and a translated sample in a second language corresponding to an original sample in a first language includes: Acquire a plurality of initial sample pairs; each of the initial sample pairs comprises an initial source sample in the first language and an initial translation sample in the second language corresponding to the initial source sample; For each initial sample pair, inputting an initial source sample in the initial sample pair into a third translation model to obtain a translation text corresponding to the initial source sample output by the third translation model; Screening the multiple initial sample pairs according to the similarity between the translation text corresponding to the initial source sample in each of the initial sample pairs and the initial translation sample in the initial sample pair to obtain screened initial sample pairs; Using the initial source sample in the screened initial sample pair as the original sample, and the initial translation sample in the screened initial sample pair as the translation sample; The target source vocabulary in the original sample is replaced with the target translation vocabulary to obtain the reconstructed sample.

10. An electronic device, characterized in that: include: A receiver, a processor and an outputter, wherein the receiver and the outputter are both connected to the processor; The receiver is used to obtain a target text in a first language to be translated; The processor is used to receive a translation text sent by a computing device; The translated text is a text in a second language output by translating the reconstructed text using a first translation model; the reconstructed text is a text obtained by replacing the target source vocabulary in the target text with the target translation vocabulary based on a preset word set, wherein the preset word set includes a plurality of word pairs, each of which includes a source vocabulary in the first language and a translation vocabulary in the second language; the target source vocabulary and the target translation vocabulary are word pairs in the preset word set; The output device is used to output the translated text.