Translation method, translation model training method and electronic equipment

CN120202474APending Publication Date: 2025-06-24BOE TECHNOLOGY GROUP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380011010.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

Existing machine translation technology is difficult to effectively translate obscure content expressed in Chinese, especially online hot words and emerging terms, and most translation software mainly uses literal translation, and the translation quality is poor.

Method used

By obtaining the vocabulary interpretation of the target word in the source text and inputting it into the translation model, semantic reasoning is performed in combination with the vocabulary interpretation, and then translating it to improve the quality of translation.

Benefits of technology

It enhances the reasoning ability of the translation model and improves the accuracy and quality of the translation, especially when dealing with obscure content and online hot words expressed in Chinese.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120202474A_ABST
    Figure CN120202474A_ABST
Patent Text Reader

Abstract

The invention provides a translation method, a translation model training method and electronic equipment, which are used for prompting a translation model to capture semantics through word paraphrasing and scene description, enhancing the reasoning ability and improving the translation quality. The method comprises the steps of obtaining a source text, wherein the source text comprises at least one target word; obtaining vocabulary paraphrases of the target words; inputting the source text and the vocabulary paraphrases into a translation model, and outputting a target text corresponding to the source text; wherein the translation model is used for performing semantic reasoning on the source text in combination with vocabulary paraphrasing to obtain a semantic reasoning result, and translating the semantic reasoning result to obtain a target text; the languages used in the source text and the target text are different.
Need to check novelty before this filing date? Find Prior Art

Description

Translation method, translation model training method and electronic device Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a translation method, a translation model training method, and an electronic device. Background Art

[0002] Driven by artificial intelligence, machine translation technology has demonstrated strong capabilities and development potential, with a wide range of application scenarios. Product-level applications also have multi-domain, multi-language, and cross-modal translation capabilities. Due to language grammar rules, expressions in different languages ​​vary.

[0003] The current problem with machine translation is that Chinese expressions are difficult to understand, and some internet buzzwords and newly emerging terms are difficult for machines to translate. Most translation software on the market relies heavily on literal translation. If a word in the source text is interpreted, it will simply be translated into the target text, rather than selecting words that fit the context, resulting in poor translation quality.

[0004] Summary of the Invention

[0005] The present disclosure provides a translation method, a translation model training method, and an electronic device, which are used to prompt the translation model to grasp semantics through vocabulary interpretation and scene description, enhance reasoning ability, and improve translation quality.

[0006] In a first aspect, an embodiment of the present disclosure provides a translation method, the method comprising:

[0007] Acquire a source text, wherein the source text includes at least one target word;

[0008] Obtaining a lexical definition of the target word;

[0009] A source text and vocabulary definitions are input into a translation model, and a target text corresponding to the source text is output; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary definitions to obtain a semantic reasoning result, and then translate the semantic reasoning result to obtain a target text; the source text and the target text are written in different languages.

[0010] In a second aspect, an embodiment of the present disclosure provides a translation method, the method comprising:

[0011] Acquire a source text, wherein the source text includes at least one target word;

[0012] Obtaining a lexical definition of the target word;

[0013] A source text is input into a translation model, and a target text corresponding to the source text is output; wherein the source text and the target text are in different languages.

[0014] In a third aspect, the present disclosure also provides a method for training a translation model, the method comprising:

[0015] Acquire training data, the training data including a plurality of sample pairs, the sample pairs including input samples and output samples; the input samples including source samples and lexical interpretations of target words in the source samples; the output samples including the target samples and semantic reasoning results, the semantic reasoning results being obtained by semantic reasoning the source samples in combination with the lexical interpretations of the target words;

[0016] Input the input sample in the sample pair to the translation model to be trained, and calculate the loss function based on the output result and the output sample in the sample pair;

[0017] The model parameters of the translation model to be trained are trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

[0018] In a fourth aspect, an embodiment of the present disclosure further provides an electronic device, comprising a processor and a memory, wherein the memory is configured to store a program executable by the processor, and the processor is configured to read the program in the memory and perform the following steps:

[0019] Acquire a source text, wherein the source text includes at least one target word;

[0020] Obtaining a lexical definition of the target word;

[0021] A source text and vocabulary definitions are input into a translation model, and a target text corresponding to the source text is output; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary definitions to obtain a semantic reasoning result, and then translate the semantic reasoning result to obtain a target text; the source text and the target text are written in different languages.

[0022] In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, comprising a processor and a memory, wherein the memory is configured to store a program executable by the processor, and the processor is configured to read the program in the memory and perform the following steps:

[0023] Acquire a source text, wherein the source text includes at least one target word;

[0024] Obtaining a lexical definition of the target word;

[0025] A source text is input into a translation model, and a target text corresponding to the source text is output; wherein the source text and the target text are in different languages.

[0026] In a sixth aspect, an embodiment of the present disclosure further provides an electronic device, comprising a processor and a memory, wherein the memory is configured to store a program executable by the processor, and the processor is configured to read the program in the memory and perform the following steps:

[0027] Acquire training data, the training data including a plurality of sample pairs, the sample pairs including input samples and output samples; the input samples including source samples and lexical interpretations of target words in the source samples; the output samples including the target samples and semantic reasoning results, the semantic reasoning results being obtained by semantic reasoning the source samples in combination with the lexical interpretations of the target words;

[0028] Input the input sample in the sample pair to the translation model to be trained, and calculate the loss function based on the output result and the output sample in the sample pair;

[0029] The model parameters of the translation model to be trained are trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

[0030] In a seventh aspect, an embodiment of the present disclosure further provides a computer storage medium on which a computer program is stored, which, when executed by a processor, is used to implement the steps of the method described in the first aspect, the second aspect, or the third aspect above.

[0031] These and other aspects of the present disclosure will become more readily apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0033] FIG1 is a flowchart of an implementation of a translation method provided by an embodiment of the present disclosure;

[0034] FIG2 is an example diagram of a network search result provided by an embodiment of the present disclosure;

[0035] FIG3 is a schematic diagram of a sequence annotation format provided by an embodiment of the present disclosure;

[0036] FIG4 is a diagram of a translation interface provided by an embodiment of the present disclosure;

[0037] FIG5 is a schematic diagram of generating training data for a large language model according to an embodiment of the present disclosure;

[0038] FIG6 is a schematic diagram of calculating similarity using a semantic similarity model using a dual-tower architecture according to an embodiment of the present disclosure;

[0039] FIG7 is a flowchart of filtering semantic reasoning results provided by an embodiment of the present disclosure;

[0040] FIG8 is a diagram illustrating a principle of a translation model provided by an embodiment of the present disclosure;

[0041] FIG9 is an architecture diagram of a T5 model provided in an embodiment of the present disclosure;

[0042] FIG10 is a schematic diagram of a translation interaction system provided by an embodiment of the present disclosure;

[0043] FIG11 is a schematic diagram of an application logic of a translation model and a database provided by an embodiment of the present disclosure;

[0044] FIG12 is a schematic diagram of a human-computer interaction network provided by an embodiment of the present disclosure;

[0045] FIG13 is a before-and-after comparison diagram of a system translation interface provided by an embodiment of the present disclosure;

[0046] 14A-14B are diagrams of a translation interface of a system network provided by an embodiment of the present disclosure;

[0047] FIG15 is an interface diagram with highlight prompts and interpretation selections provided by an embodiment of the present disclosure;

[0048] FIG16 is a schematic diagram of a definition selection box displaying a list of word meanings provided by an embodiment of the present disclosure;

[0049] 17A-17B are diagrams illustrating an interface for adding a related vocabulary box according to an embodiment of the present disclosure;

[0050] FIG18 is a diagram of a translation interface with interpretation selection provided by an embodiment of the present disclosure;

[0051] FIG19 is a diagram of a translation interface with a related vocabulary box provided by an embodiment of the present disclosure;

[0052] FIG20 is a diagram of an interface for selecting a translation type provided in an embodiment of the present disclosure;

[0053] FIG21 is a flowchart of an implementation of a translation method provided in an embodiment of the present disclosure;

[0054] FIG22 is a flowchart of an implementation method of a translation model training method provided in an embodiment of the present disclosure;

[0055] FIG23 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure;

[0056] FIG24 is a schematic diagram of a translation device provided by an embodiment of the present disclosure;

[0057] FIG25 is a schematic diagram of a translation device provided by an embodiment of the present disclosure;

[0058] FIG26 is a schematic diagram of a translation device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0059] To make the objectives, technical solutions, and advantages of the present disclosure more clear, the present disclosure will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only a portion of the embodiments of the present disclosure, rather than all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure without creative effort are intended to fall within the scope of protection of the present disclosure.

[0060] In the embodiments of the present disclosure, the term "and / or" describes the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0061] The application scenarios described in the embodiments of the present disclosure are intended to more clearly illustrate the technical solutions of the embodiments of the present disclosure and do not constitute a limitation on the technical solutions provided by the embodiments of the present disclosure. Persons skilled in the art will appreciate that, as new application scenarios emerge, the technical solutions provided by the embodiments of the present disclosure will also be applicable to similar technical problems. In the description of the present disclosure, unless otherwise specified, "multiple" means two or more.

[0062] Before introducing the translation method provided by the embodiment of the present disclosure, for ease of understanding, the technical background of the embodiment of the present disclosure is first introduced in detail below.

[0063] Driven by artificial intelligence, machine translation technology has demonstrated strong capabilities and development potential, boasting a wide range of application scenarios. Product-level applications also offer multi-domain, multi-language, and cross-modal translation capabilities. Machine translation technology plays a positive role in enabling enterprise globalization, facilitating the digitalization of industries, promoting the storytelling of Chinese culture, and fostering international communication. However, Chinese is often difficult to understand in machine translation, making it difficult to directly translate it into other languages ​​without context or explanation.

[0064] Due to differences in grammatical rules, expressions vary between languages, and mechanical translation can easily lead to inaccurate semantic understanding. Current challenges with machine translation include the obscure nature of Chinese expressions, as well as the difficulty of translating certain internet buzzwords and emerging terms. Most commercially available translation software relies heavily on literal translation. If a word in the source text is interpreted, the interpretation is directly translated into the target text, rather than selecting appropriate words based on the interpretation. Linguistic translation theory suggests that translation is the process of reducing artistic facts to linguistic facts and aesthetic issues to logical questions. Therefore, machine translation can be considered a step-by-step reasoning process. Large-scale language models are extremely powerful, but for some logically complex problems, directly asking them may yield inaccurate answers. However, if a prompt is provided in the input followed by an example of a logical solution step, the large model can provide the correct answer. This involves breaking down complex problems into multiple sub-problems and extracting the answer from these sub-problems. This is how Chain of Thought (CoT) mimics the human brain's thinking process. Using human knowledge to prompt the machine to translate and analyzing the actual meaning of Chinese characters in different contexts is the intermediate process. After gradually solving the intermediate process, a translation that conforms to the current context can be obtained.

[0065] Based on this, the present disclosure provides a translation method that uses the reasoning ability of a translation model to perform semantic understanding of a source sentence based on lexical interpretations, infer the actual meaning of the source sentence, and then translate the semantic reasoning results, making it easier to obtain translation results that conform to the context of the source text. By strengthening the reasoning ability of the translation model, the accuracy of translation is improved and the human requirements for language organization are reduced.

[0066] As shown in FIG1 , the implementation process of a translation method provided in this embodiment is as follows:

[0067] Step 100: Obtain a source text, where the source text includes at least one target word;

[0068] Optionally, in this embodiment, the source text may be obtained by any one or more of the following methods:

[0069] Mode 1a: receiving source text information input by a user, and determining the source text information input by the user as the acquired source text;

[0070] Method 1b: collecting user voice information, converting the user voice information into text information, and determining the converted text information as the acquired source text;

[0071] Method 1c: collecting image data, recognizing text information in the image data, and determining the recognized text information as the acquired source text.

[0072] In some embodiments, after obtaining the source text, a target word in the source text may also be obtained, wherein the target word may be obtained by any one or more of the following methods:

[0073] Method 2a) Determine the vocabulary input by the user as the target word.

[0074] In implementation, an interactive interface for inputting vocabulary may be provided, or vocabulary may be input as target words in an existing interactive interface, for example, vocabulary may be input as target words in an interpretation interactive area.

[0075] Mode 2b) Displaying a segmentation sequence obtained by segmenting the source text, and in response to a user's selection operation on a segmentation in the segmentation sequence, determining the segmentation corresponding to the selection operation as a target word.

[0076] During implementation, the source text can be first segmented, and the entire sentence of the source text can be split into words arranged in order to form a segmentation sequence, which is displayed in the source interaction area. The user can select each word in the segmentation sequence and can select a word or a word composed of multiple words as the target word.

[0077] Method 2c) Input the source text into the translation model, and determine the target word from the source text based on the confidence of the target text output by the translation model.

[0078] During implementation, in the absence of lexical interpretation, the translation model directly translates the source text to obtain a confidence score for the target text. When the confidence score of the target text is lower than a threshold, such as 0.9, it indicates that the translation result of the target text does not conform to the semantic rules and may not meet the context of the above-mentioned source text. Therefore, the translation model determines the vocabulary in the source text corresponding to the translation result that does not meet the requirements based on the target text with a confidence score lower than the threshold, and uses it as the target word for subsequent interpretation query of the target word.

[0079] The target word in the source text in this embodiment may be a word input or selected by the user, or a word automatically determined by the translation model, and this embodiment does not impose any restrictions on this.

[0080] Step 101: Obtain the vocabulary definition of the target word;

[0081] After the target word is determined by the above method, the lexical interpretation of the target word is determined by any one or more of the following methods:

[0082] Mode 3a: Determine the vocabulary definition input by the user as the vocabulary definition of the target word.

[0083] In this method, the user inputs the source text and the lexical interpretation of the target word in the source text, and then inputs the source text and lexical interpretation into the translation model. The translation model is used in combination with the lexical interpretation to infer the actual meaning of the source text (i.e., the semantic reasoning result), and then the semantic reasoning result is translated to output the target text corresponding to the source text.

[0084] In some embodiments, a source text input by a user is obtained through the source interaction area, and a lexical interpretation of a target word in the source text input by the user is obtained through the first interpretation interaction area; the source text and the lexical interpretation are input into a translation model, a target text corresponding to the source text is output, and the target text is displayed through the translation interaction area.

[0085] Optionally, the semantic reasoning results corresponding to the source text may also be output and displayed in the translation interaction area.

[0086] For example, a user enters in the source interaction area: "Translate the following sentence into English: I tested positive." In the first interpretation interaction area, the user enters: "Positive" means a positive COVID-19 test result. The translation interaction area displays: "I tested positive for COVID-19." Optionally, the translation interaction area can also display: "The entire sentence means: My nucleic acid test report is positive."

[0087] Method 3b: Search the lexical meaning of the target word on the Internet, and determine the retrieved lexical meaning as the lexical meaning of the target word.

[0088] Optionally, the vocabulary definition of the target word is retrieved from the Internet, and semantic understanding is performed on the search results to obtain semantic information of the target word; information extraction is performed on the semantic information of the target word according to preset semantic rules to obtain the vocabulary definition, and the vocabulary definition is output.

[0089] It should be noted that the translation model predicts the empirical probability value of the next word based on the empirical value of learning prior knowledge. For experiences that the model has not learned, such as hot words or non-hot words that have never been seen but have been given new meanings, the model's own capabilities cannot solve them. In this case, external tools are needed, such as knowledge bases or dictionaries. The present disclosure uses the Internet to expand the functions of the model, in order to achieve the function of real-time translation of hot words or implantation of new contexts. The meaning of Internet search terms can have many different interpretations, as shown in Figure 2, which is an example diagram of a network search result provided by this embodiment. Since network search results are hidden in fragments, the system needs to extract information from large pieces of text.

[0090] Optionally, this embodiment can use a time series prediction model to perform semantic understanding on the search results to obtain the semantic information of the target word, and extract information from the semantic information of the target word according to preset semantic rules to obtain a vocabulary interpretation, and output the vocabulary interpretation. Among them, time series prediction models include but are not limited to: LSTM (Long Short-Term Memory), Bi-LSTM (Bi-directional Long Short-Term Memory), GRU (Gated Recurrent Unit), seq2seq (Sequence to Sequence), Wavenet, 1D-CNN (1D Convolutional Neural Network), transformer (a sequence model based on an attention mechanism), etc. This embodiment can extract information in a random field manner and perform sequence annotation on text containing semantic information. Optionally, the random field in this embodiment includes but is not limited to: CRF (Conditional Random Field), Markov Random Field, etc.

[0091] A random field is a set of positions. When each position is randomly assigned a value according to a certain distribution, the entire set is called a random field. For example, consider part-of-speech tagging: suppose we have a sentence consisting of ten words that needs to be tagged. The part-of-speech of each of these ten words can be selected from a known set of parts-of-speech (noun, verb, etc.). After selecting a part-of-speech for each word, a random field is formed. The randomly selected part-of-speech at each position is different, forming a different random field. A CRF is a discriminative probability model and a type of random field, commonly used to tag or analyze sequence data, such as natural language text or biological sequences. A conditional random field is a conditional probability distribution model P(Y|X), which represents the conditional probability distribution of a set of output random variables Y given a set of input random variables X. Its characteristic is that it assumes that the output random variables form a Markov random field. A Markov random field is a special case of a random field, assuming that the value assigned to a position in the random field depends only on the values ​​assigned to its adjacent positions and is independent of the values ​​assigned to non-adjacent positions. Continuing with the example of part-of-speech tagging for a ten-word sentence: If we assume that the part-of-speech of each word is only related to the part-of-speech of its adjacent words, this random field becomes specialized into a Markov random field. For example, the part-of-speech of the third word is related only to the part-of-speech of the second and fourth words, in addition to its own position.

[0092] Sequence labeling can use multiple formats, including but not limited to: BIO, BMES, BIOES, etc. Among them, BIO is a three - bit sequence labeling method (B - begin, I - inside, O - outside). B - X represents the beginning of entity X, I - X represents the end of entity X, and O represents not belonging to any type. BMES is a four - bit sequence labeling method. B represents the first position value of a word, M represents the middle position of a word, E represents the end position of a word, and S represents a single word or character. BIOES is a five - bit sequence labeling method (B - begin, I - inside, O - outside, E - end, S - single). B represents the start, I represents the inside, O represents non - entity, E represents the end of the entity, and S represents that the word itself is an entity.

[0093] For example, Bi - LSTM + Conditional Random Field (CRF) can be used to perform sequence labeling on the text of semantic information extracted by Bi - LSTM. Among them, Bi - LSTM can fully integrate the information of long context, and the conditional random field can control the output of the result through certain rules. The sequence labeling can use the BIO format. As shown in Figure 3, this embodiment provides a schematic diagram of a sequence labeling format. According to this sequence labeling, the information of the target word "yang" can be extracted and filled into the output template. The example is as follows:

[0094] The output template is "The meaning of XXX is XXX" => "The meaning of yang is sunlight, cheerful, optimistic, positive, etc." All the retrieved information is extracted and organized into a unified format according to the above method.

[0095] In some embodiments, in the way of retrieving the lexical interpretation of the target word using the Internet, the accuracy of the lexical interpretation retrieval result can also be improved by using associated words. The specific method is as follows:

[0096] Obtain the associated words of the target word, and use the Internet to retrieve the lexical interpretation of the target word in combination with the associated words.

[0097] In implementation, since the meanings expressed by some target words are different in different scenarios, associated words related to the target word can be provided. For example, when the target word is "yang", the lexical interpretations retrieved from the Internet include sunlight, cheerful, optimistic, positive, etc. However, when the source text is "I am yang", at this time, the actual meaning of yang is that the nucleic acid test result is positive. Therefore, by adding associated words such as "COVID - 19" and "nucleic acid test", when retrieving the lexical interpretation of the target word from the Internet, it can be more in line with the context of the current source text.

[0098] Optionally, the associated words can be a single word, a phrase, or multiple words or multiple phrases. This embodiment does not make excessive limitations on this.

[0099] During implementation, the user can input the associated vocabulary of the target word in the third interpretation interaction area to retrieve the vocabulary interpretation of the target word related to the semantic information of the associated vocabulary from the Internet, thereby improving the accuracy of vocabulary interpretation retrieval.

[0100] In some embodiments, if the target word retrieved through the Internet includes multiple lexical definitions, the lexical definition of the target word in the source text is determined by any one or more of the following methods:

[0101] Method 4a: Filter multiple vocabulary definitions according to the perplexity calculated for each vocabulary definition, and determine the filtered vocabulary definitions as the vocabulary definitions of the target word in the source text.

[0102] Optionally, a vocabulary interpretation whose perplexity satisfies a threshold is selected from multiple vocabulary interpretations and used as the vocabulary interpretation input to the translation model.

[0103] Due to the diversity of online search results, the translation model is required to have the ability to select information. This can be understood as requiring the translation model to select the meaning that best fits the current context as the interpretation of the target word.

[0104] For example, the retrieved data can be integrated into the following format using a fine-tuning instruction format (e.g., inputting an instruction to the translation model: select the interpretation that best fits the above context from the following interpretations):

[0105] Input: "Translate the source language text. Select the following interpretation that best fits the context above:

[0106] Yang means sunshine, cheerfulness, optimism, positivity, etc.; Yang means explanation 2; Yang means explanation 3; Yang means explanation 4.

[0107] Output: "Yang means sunshine, cheerfulness, optimism, positivity, etc."

[0108] Based on the confusion level of each queried word definition, the translation model ultimately selects "Yang means sunshine, cheerfulness, optimism, positivity, etc." from the multiple queried word definitions and outputs it as the definition that best fits the context of the source language text.

[0109] Mode 4b: receiving a user's selection operation on multiple vocabulary definitions, and determining the vocabulary definition corresponding to the selection operation as the vocabulary definition of the target word in the source text.

[0110] In this method, the translation model first needs to query the lexical meaning of the target word from the Internet, and display the lexical meaning of the target word in the source text in the second interpretation interaction area. The user then selects one from the displayed lexical meanings as the interpretation that best fits the context of the translated source language text.

[0111] Step 102: Input the source text and vocabulary definitions into a translation model, and output a target text corresponding to the source text; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary definitions to obtain a semantic reasoning result, and translate the semantic reasoning result to obtain a target text; the source text and the target text are written in different languages.

[0112] In some embodiments, this embodiment further provides any one or more of the following prompt templates for guiding the translation model to perform corresponding tasks. Specific implementations are as follows:

[0113] Method 5a: Use the first prompt template to guide the translation model to translate. The specific implementation steps are as follows:

[0114] Obtain a first prompt template; fill the source text into the first prompt template and input it into the translation model to guide the translation model to perform the translation task on the source text.

[0115] Among them, the first prompt template can be generated by a template generation tool, or the template generation tool can be integrated into the translation model. Before the source text is input into the translation model, the source text is filled into the first prompt template and then input into the translation model. The prompt words in the prompt template are used to guide the translation model to perform the corresponding translation task.

[0116] This embodiment provides an example of a first prompt template, as shown below:

[0117] Input: Translate the following sentence into English: __________.

[0118] Output: The meaning of the whole sentence is _______, and the translation is ________.

[0119] Method 5b: Use the second prompt template to guide the translation model to screen vocabulary interpretations. The specific implementation steps are as follows:

[0120] Obtain a second prompt template; fill the second prompt template with multiple vocabulary interpretations of the source text and the target word and input it into the translation model to guide the translation model to select a vocabulary interpretation for the target word that is consistent with the context of the source text.

[0121] In this scenario, the translation model first translates the source text and outputs the target text. When the confidence level of the target text is lower than a threshold, the target word is determined and multiple lexical definitions of the target word are retrieved from the Internet. The source text and multiple lexical definitions are then filled into a second prompt template and input into the translation model again. Based on the prompt word in the second prompt template, the translation model selects a lexical definition for the target word from multiple lexical definitions that is consistent with the context of the source text.

[0122] This embodiment provides an example of a second prompt template, as shown below:

[0123] Enter: __________. Choose the one that best fits the context below:

[0124] XX means interpretation a; XX means interpretation b; XX means interpretation c; XX means interpretation d.

[0125] Output: "XX means __________."

[0126] Method 5c: Use the third prompt template to guide the translation model to screen vocabulary interpretations. The specific implementation steps are as follows:

[0127] Obtain a third prompt template; fill the source text and the lexical interpretation of the target word into the third prompt template and input it into the translation model to guide the translation model to perform the translation task on the source text in combination with the lexical interpretation of the target word.

[0128] In this scenario, the source text and vocabulary definitions are first filled into the third prompt template, and then the filled third prompt template is input into the translation model. The translation model performs semantic understanding of the source text based on the prompt words in the third prompt template and the vocabulary definitions to obtain a semantic understanding result, and then translates the semantic understanding result to obtain the target text.

[0129] This embodiment provides an example of a third prompt template, as shown below:

[0130] Input: Translate the following sentence into English: __________; XX means __________.

[0131] Output: The meaning of the whole sentence is _______, and the translation is ________.

[0132] Optionally, prompt information in the prompt template can be displayed on the translation interface. The prompt template includes a first prompt template, a second prompt template, and a third prompt template. The prompt information includes input prompts and output prompts. For example, an input prompt is displayed in the source interaction area: "Translate the following sentence into English, _______." In this case, the user only needs to enter the source text after the input prompt. Similarly, an output prompt is displayed in the translation interaction area: "The translation is: _______." Output prompts can also be displayed in the translation interaction area. The output prompt includes prompts for semantic reasoning results: "The meaning of the whole sentence is _______. The translation is: _______."

[0133] It should be noted that the language of the semantic reasoning result output by the translation model is the same as the language of the source text.

[0134] In some embodiments, the source text in this embodiment includes a source language text and a prompt text, wherein the prompt text is used to instruct the translation model to perform a specified task operation on the source language text. Optionally, the specified task operation includes at least one of a translation operation, a vocabulary definition query operation, and a vocabulary definition selection operation.

[0135] Optionally, the source text includes a source language text and a prompt text, and the target text includes a target language text and a template text, wherein the source language text and the target language text are in different languages.

[0136] Optionally, the prompt text may be determined based on a predefined prompt template, for example, the predefined prompt template is: "Select an interpretation from the following explanations that best fits the above context, _______." or "Translate the following sentence into English, _______." etc.

[0137] Similarly, the output of the translation model includes the target text, which includes the target language text and the template text. For example, the output of the translation model is: "The meaning of the whole sentence is _______, and the translation is ________." Or, "XX means ________."

[0138] For example, a prompt instructs the translation model to translate the source text. For example, the prompt is: "Translate the following sentence into English." The source text is "wo yang le," the target word is "yang," and the meaning is: "yang means a positive COVID-19 test result." The user input is: "Translate the following sentence into English: wo yang le." Yang means a positive COVID-19 test result. The translation model output is: "I tested positive for COVID-19."

[0139] For example, a prompt instructs the translation model to perform a lexical interpretation query on the target word in the source text. For example, the prompt might read: "Query the meaning of yang in the following sentence." The source text is "I am yang" and the target word is "yang." The user input is: "Query the meaning of yang in the following sentence: I am yang." The translation model can then query the meaning of yang online and output the query results. The translation model's output might be: "Yang means sunny, cheerful, optimistic, positive, etc."; "Yang" means a positive COVID-19 test result; "Yang" means XXXX.

[0140] For example, the prompt text is used to instruct the translation model to select a vocabulary interpretation for the target word in the source language text. For example, the prompt text is: Select a vocabulary interpretation from the following interpretations that best fits the above context. The user input is: Source text. Select a vocabulary interpretation from the following interpretations that best fits the above context:

[0141] The meaning of XX word is definition 1; the meaning of XX word is definition 2; the meaning of XX word is definition 3; the meaning of XX word is definition 4;

[0142] At this time, the translation model can semantically fuse the lexical interpretation of the target word with the source text, calculate the perplexity of the lexical interpretation in the fusion result of the semantic fusion, and output the lexical interpretation whose perplexity meets the threshold as the task result, that is, the content output by the translation model is: The meaning of XX word is interpretation 4.

[0143] This embodiment provides two methods for guiding the model to perform corresponding tasks. One method is to provide a prompt template, fill the prompt template with the source text, or the source text and vocabulary definitions, and then input the filled prompt template into the translation model to guide the translation model to perform the corresponding task. Another method is to not provide a prompt template, and the user can directly enter a prompt (prompt text). In this case, the source text contains the prompt text and the source language text, and the prompt text is used to guide the translation model to perform the corresponding task.

[0144] In some embodiments, this embodiment inputs the source text and vocabulary definitions into the translation model, outputs the target text corresponding to the source text, and also outputs the semantic reasoning results corresponding to the source text. The semantic reasoning results are obtained by semantically reasoning the source text in combination with the vocabulary definitions. The semantic reasoning results in this embodiment include the semantic reasoning results and the semantic reasoning process. The semantic reasoning results can be understood as CoT. Optionally, the output semantic reasoning results can be displayed or hidden. When the user needs to view them, the semantic reasoning results can be displayed. When the user does not need to view them, the target text is directly displayed.

[0145] For example, a user inputs the following sentence: "I am very happy today." The translation model outputs: "The entire sentence means, 'I feel very happy and blessed today.'" Here, "The entire sentence means, 'I feel very happy and blessed today.'" is the semantic inference result of the source text "I am very happy today."

[0146] Optionally, the semantic reasoning result in this embodiment can be expressed through a thought chain or other methods, and this embodiment does not impose too many restrictions on this.

[0147] In some embodiments, this embodiment also provides a translation interface for realizing human-computer interaction, as shown below:

[0148] A translation interface is displayed, comprising a source interaction area and a translation interaction area; the source interaction area is used to obtain the source text, and the translation interaction area is used to display the target text. The source text input by the user is obtained through the source interaction area, and the target text is displayed through the translation interaction area.

[0149] During implementation, the user can input source text in the source interaction area, the translation model translates the source text, and the target text obtained by translating the source text will be displayed in the translation interaction area.

[0150] In some embodiments, this embodiment may further generate a definition interaction area on the translation interface in response to a user's touch operation on the translation interface, where the definition interaction area is used to obtain relevant information of the target word.

[0151] Optionally, the user's touch operation on the translation interface is used to indicate the user's satisfaction with the target text obtained by the current translation. For example, the user can provide feedback on the satisfaction with the translation result on the translation interface. When the user is not satisfied with the translation result, the translation model will perform a semantic analysis on the target text to determine the target words in the source text that do not conform to the semantic understanding, and then use the Internet to retrieve the lexical interpretation of the target word, and select a lexical interpretation from it, and continue to translate the source text in combination with the selected lexical interpretation to output the target text.

[0152] Optionally, the relevant information of the target word includes but is not limited to one or more lexical definitions of the target word, associated words of the target word, lexical definitions of the associated words of the target word, and other information.

[0153] Optionally, the interpretation interaction area in this embodiment includes but is not limited to at least one of the first interpretation interaction area, the second interpretation interaction area and the third interpretation interaction area, wherein the user can directly enter the vocabulary interpretation of the target word in the first interpretation interaction area, or use the Internet to search the vocabulary interpretation of the target word and display it in the second interpretation interaction area, or select one from the multiple vocabulary interpretations displayed in the second interpretation interaction area as the vocabulary interpretation of the target word. The user can also enter related words of the target word in the third interpretation interaction area to improve the accuracy of Internet retrieval, thereby displaying a more accurate vocabulary interpretation of the target word in the second interpretation interaction area.

[0154] In some implementations, the translation interface further includes a first interpretation interaction area, which is used to obtain a lexical interpretation of the target word input by the user. Specifically, the source text input by the user is obtained through the source interaction area, and the lexical interpretation of the target word input by the user is obtained through the first interpretation interaction area; the target text is displayed in the translation interaction area.

[0155] During implementation, the user enters the source text in the source interaction area and the lexical interpretation of the target word in the first interpretation interaction area. The translation model translates the source text in combination with the lexical interpretation of the target word, and the target text obtained by translating the source text is displayed in the translation interaction area.

[0156] In some embodiments, the translation interface further includes a second definition interaction area, wherein the second definition interaction area is used to display the vocabulary definition of the target word, and the vocabulary definition displayed in the second definition interaction area is retrieved from the Internet.

[0157] Optionally, the second definition interaction area may display one or more vocabulary definitions.

[0158] During implementation, the user inputs the source text, the translation model obtains the target word and retrieves the lexical interpretation of the target word from the Internet, and then displays one or more lexical interpretations in the second interpretation interaction area. At the same time, the source text and the retrieved lexical interpretations are input into the translation model, and semantic reasoning is performed on the source text in combination with the lexical interpretations. The semantic reasoning results are translated to obtain the target text, and the target text is output and displayed in the translation interaction area.

[0159] In some embodiments, when the second definition interaction area displays multiple lexical definitions of the target word, in response to a user's selection operation on the second definition interaction area, the lexical definition corresponding to the selection operation may be determined as the lexical definition of the target word.

[0160] An example of an interactive scenario is that when a user inputs a source text, the translation model obtains a target word and retrieves a lexical definition of the target word from the Internet, and then displays multiple lexical definitions in the second definition interaction area. The translation model selects a lexical definition from them, translates the source text in combination with the lexical definition, and displays the translated target text in the translation interaction area. At this time, the user can select a lexical definition from the multiple lexical definitions displayed in the second definition interaction area, and the translation model re-translates the source text in combination with the lexical definition selected by the user, and updates the re-translated target text in the translation interaction area.

[0161] Optionally, the first interpretation interaction area and the second interpretation interaction area can be the same interaction area or different interaction areas, and the user can directly enter the vocabulary interpretation in the second interpretation interaction area. Optionally, the first interpretation interaction area and the source interaction area can be the same interaction area or different interaction areas, and the user can enter the source text and vocabulary interpretation in the source interaction area.

[0162] In some embodiments, the translation interface further includes a third interpretation interaction area, wherein the third interpretation interaction area is used to obtain associated vocabulary of the target word, so as to retrieve the vocabulary interpretation of the target word from the Internet in combination with the associated vocabulary.

[0163] An example interactive scenario involves a user inputting a source text, the translation model acquiring a target word and retrieving its lexical definitions from the internet, then displaying one or more lexical definitions in the second definition interaction area. Simultaneously, the source text and the retrieved lexical definitions are input into the translation model, and the source text is translated using the lexical definitions to produce the target text, which is then displayed in the translation interaction area. The user can then provide feedback on their satisfaction with the target text. If the user is dissatisfied with the target text, a third definition interaction area is displayed in the translation interface. Alternatively, the target word in the source text can be highlighted, and when the user double-clicks the target word, a third definition interaction area is displayed in the translation interface. The user can enter related words for the target word in the third definition interaction area, and the target word's lexical definitions are retrieved from the internet using the related words. The re-retrieved lexical definitions are then updated and displayed in the second definition interaction area. The source text is then re-translated using the re-retrieved lexical definitions, and the re-translated target text is displayed in the translation interaction area.

[0164] In some embodiments, the translation interface further includes a word segmentation interaction area, which is used to display the word segmentation sequence of the source text after word segmentation processing and to determine the target word based on the word segmentation in the word segmentation sequence selected by the user. Optionally, the word segmentation interaction area and the source interaction area can be the same interaction area or different interaction areas, which is not limited in this embodiment.

[0165] During implementation, users can specify or modify target words in the word segmentation interactive area. When a user triggers a target word input or modification command, the word segmentation interactive area pops up on the translation interface. This area breaks the source text into a sequence of individual words, with each word set to a user-selectable state. Users can freely specify one or more words as target words. Once a user selects a target word, the translation model searches the internet for its lexical meaning.

[0166] As shown in Figure 4, this embodiment also provides a translation interface, including a source interaction area, a meaning interaction area, and a translation interaction area. The meaning interaction area includes at least one of a first meaning interaction area, a second meaning interaction area, and a third meaning interaction area, and also includes a word segmentation interaction area. The source interaction area is used to receive and display source text input by a user. The first meaning interaction area is used to obtain lexical meanings of target words in the source text input by the user. That is, the user can enter lexical meanings of words in the source text in the first meaning interaction area, which is used by the translation model to perform semantic understanding of the source text. The second meaning interaction area is used to display lexical meanings of target words in the source text and is also used to receive user selections of lexical meanings in the second meaning interaction area. That is, lexical meanings can be displayed in the second meaning interaction area, and the user can also select lexical meanings displayed in the second meaning interaction area, which is used by the translation model to perform semantic understanding of the source text based on the selected lexical meanings. The translation interaction area is used to display the target text obtained by translating the source text. The third interpretation interaction area is used to obtain related words of the target word input by the user, and the word segmentation interaction area is used to display the word segmentation sequence of the source text, obtain the word segmentation selected by the user, and use the word segmentation selected by the user as the target word.

[0167] Optionally, the timing for the translation model to search for the lexical definition of the target word from the Internet can be that the translation network automatically performs semantic analysis on the target text of the currently output source text, and when it is detected that the currently output target text has semantic errors or does not conform to semantic rules, the target word is determined and the lexical definition of the target word is searched from the Internet; or, the lexical definition of the target word can be searched from the Internet when the target word in the source text indicated by the user is received. This embodiment does not impose too many restrictions on the timing for the translation model to search for the lexical definition of the target word. The translation model can use a retrieval plug-in to retrieve the lexical definition of the target word from the Internet. The retrieval plug-in can be integrated into the translation model or can be outside the translation model to implement the retrieval function of the lexical definition through real-time access.

[0168] Optionally, when the translation model finds multiple lexical definitions for the target word, the multiple lexical definitions may be arranged in a certain order and displayed in that order. For example, the lexical definitions may be arranged according to their corresponding perplexity, or according to other rules, which are not specifically limited in this embodiment. When the translation model finds multiple lexical definitions for the target word, the lexical definitions whose perplexity satisfies a threshold may be selected as the lexical definitions input into the translation model based on the perplexity calculated from the lexical definitions.

[0169] Optionally, the translation model can search for the meaning of one or more target words at the same time, and the second interpretation interaction area can display the vocabulary interpretations of the one or more target words. This embodiment does not impose too many restrictions on this.

[0170] The translation model provided in this embodiment allows users to provide feedback on translation results. If unsatisfactory, users can search for word definitions online or manually select a word to adjust the translation. Meanwhile, the corresponding vocabulary explanations for satisfactory translations are entered into a dictionary database, and the explanations are recommended based on the user's translation history, making it easier for users to select and use them next time.

[0171] The following describes in detail the training process of the translation model and the generation of training data provided by the embodiments of the present disclosure.

[0172] The training data of the translation model disclosed in the present invention is generated using a language model. The language model in this embodiment includes but is not limited to a large-scale language model, referred to as a large language model. The language model in this embodiment can be any large language model with a parameter scale of more than 100B. The language model in this embodiment includes but is not limited to GPT3.5, GPT4.0, PaLM, LLAMA, Chatglm, etc. Due to the outstanding contextual ability of the large language model, giving fine-tuning instructions can achieve the ability to continue writing with few or even zero samples. The process of the model reasoning about complex problems step by step imitates the thinking of humans in solving difficult problems, splitting large problems into multiple intermediate small problems, and gradually solving them to obtain the final result. This process is also called "Chain-of-Thought (CoT)".

[0173] Machine translation can also be considered as a process of gradual reasoning, and parsing the actual meaning of Chinese characters in different contexts is the intermediate process. After gradually solving the intermediate process, a translation that conforms to the current context can be obtained. Machine translation can be regarded as a simple end-to-end task. The source language is mapped to the target language sentence by sentence. Once a word that has not appeared before is added, the prediction of the target language will be wrong. In the final analysis, the model lacks reasoning ability and cannot understand the true meaning of the "new word" in the source language. In order to improve the reasoning ability of the model, it is necessary to use reasoning data to train the model. Artificially created reasoning data not only consumes a lot of manpower, but also has different understandings of the same problem for different people, and the data quality is worrying. The present disclosure mainly considers using a pre-trained large language model to generate a large number of semantic reasoning results to be used as training data for a small model (i.e., a translation model) to improve the reasoning ability of the translation model.

[0174] In implementation, the source sample is a text, and the target sample is also a text. The source sample includes a source language sample text and a prompt text, and the target sample includes a target language sample text and a template text. For example, this embodiment sets the translation scenario to a dialogue mode, and uniformly sets the prompt text Prompt in the source sample input by the user to "Translate the following sentence into English, _______." The source language sample text to be translated is filled in the horizontal line. In order to solve the problem that some words are hot words or words OOV (out of vocabulary, words not logged in the network) that have not been seen by the large language model, and to translate in the correct context, the meaning of the word can be placed after the source text by "XX means _______." This helps the model enter the context and reduce the confusion of the target text. However, it is difficult for the model to achieve this in one step, that is, it is difficult to translate the real target text, and the model needs to be guided step by step. Therefore, the translation model of this embodiment divides the translation task into two steps:

[0175] The first step is to perform semantic inference on the source text based on the lexical interpretations. This involves semantically fusing the lexical interpretations with the source text, thereby more accurately understanding the source context of the source text containing the target word. The second step is to translate the semantically fusing results into the target text, translating the semantically fusing source text into the target text. During this step-by-step process, the translation model needs to be prompted to perform semantic fusion, guiding it to understand the lexical interpretations of the target word within the context of the source text. This results in a semantic inference of "the entire sentence means _____."

[0176] In some embodiments, the translation model is trained using training data, where the training data includes multiple sample pairs, each of which includes an input sample and an output sample; the input sample includes a source sample and a semantic reasoning result, the output sample includes a target sample, and the semantic reasoning result is obtained by performing semantic reasoning on the source sample.

[0177] In some embodiments, the input sample also includes the lexical interpretation of the target word in the source sample, the output sample includes the target sample, and the semantic reasoning result is obtained by performing semantic reasoning on the source sample in combination with the lexical interpretation of the target word.

[0178] In practice, input samples come in two types: the first, consisting of a source sample and semantic inference results; the second, consisting of a source sample, semantic inference results, and the lexical interpretation of the target word in the source sample. These two types form sample pairs with the output sample and can serve as training data for the translation model. When using a trained translation model, you can translate either the source text input or the source text input and the lexical interpretation of the target word.

[0179] Optionally, the training data in this embodiment is generated by a pre-trained large language model. As shown in Figure 5, this embodiment provides a schematic diagram of a large language model generating training data. The input includes source samples and lexical interpretations of target words, and the output includes semantic reasoning results and translated target samples. The text in the rectangular box is an example provided to the large language model, which is used for the large language model to continue writing according to the example, that is, when input again: "Translate the following sentence into English, I am Yang Kang. Yang Kang means that the nucleic acid test result is negative, indicating that the body has recovered." At this time, the large language model will translate the source language text "I am Yang Kang" based on the example and the lexical interpretation of "Yang Kang", thereby outputting the semantic reasoning result and the predicted text, that is, outputting "The whole sentence means that my nucleic acid test result is negative, indicating that I have recovered. I tested negative for COVID-19 and have recovered." In implementation, the source text can also be directly input into the large language model to output the predicted text and its corresponding semantic reasoning result. For example, consider the input question: "Translate the following sentence into English: Today is so bad for me." The large language model outputs the answer: "The whole sentence means: Today's experience makes me feel very painful. Today is so bad for me." Translation without interpretation is usually suitable for most context-insensitive sentence translations.

[0180] In the implementation, the source samples and target samples input to the large language model are arranged into pairs, for example, the question of the i-th source sample and the answer of the i-th target sample are composed (q i , a i ), the source sample q i Input to the large language model, the output result contains not only the prediction of the answer a i , also includes the reasoning process generated in the process of solving the problem, that is, the semantic reasoning result f i At this point, the semantic reasoning results can be filtered according to the prediction results of the language model, and the filtered semantic reasoning results, source samples, and target samples are combined into a sample pair as training data for the translation model.

[0181] In some embodiments, the first sample pair includes an input sample and an output sample, wherein the input sample includes a source sample and a semantic reasoning result, and the output sample includes a target sample. The first sample pair can be generated as follows:

[0182] (1a) Input the source sample into the language model, perform semantic reasoning on the source sample and translate the semantic reasoning results, and output the prediction results and the corresponding semantic reasoning results;

[0183] (1b) Based on the similarity between the prediction results and the target sample, the semantic reasoning results corresponding to the prediction results with similarity greater than the similarity threshold are screened out;

[0184] (1c) Generate sample pairs based on the filtered semantic reasoning results, source samples, and target samples.

[0185] In some embodiments, the second sample pair includes an input sample and an output sample, wherein the input sample includes a source sample, a semantic inference result, and a lexical interpretation of a target word in the source sample, and the output sample includes the target sample. The second sample pair can be generated as follows:

[0186] (2a) Input the source sample and the vocabulary interpretation into the language model, perform semantic reasoning on the source sample in combination with the vocabulary interpretation and translate the semantic reasoning results, and output the prediction results and the corresponding semantic reasoning results;

[0187] (2b) Based on the similarity between the prediction results and the target sample, the semantic reasoning results corresponding to the prediction results whose similarity is greater than the similarity threshold are screened out;

[0188] (2c) Generate sample pairs based on the filtered semantic reasoning results, the source sample, the lexical meaning of the target word in the source sample, and the target sample.

[0189] Since the pre-trained large language model is still uncontrollable, its erroneous reasoning process will inevitably mislead the translation results, thereby affecting the training quality of the small model. Therefore, in order to ensure the accuracy of the reasoning process, it is necessary to filter the results generated by the pre-trained large language model. Since the reasoning process is unsupervisable, there is an inevitable direction between the reasoning process and the results. Based on this, the present invention filters the prediction results based on the target sample, and the real target sample a i The prediction result b of the final prediction of the large model i Compare and select the semantic reasoning result that best matches the context of the source sample.

[0190] As shown in FIG6 , this embodiment provides a schematic diagram of calculating similarity using a semantic similarity model of a dual-tower architecture. In implementation, the similarity between the prediction result and the target sample can be calculated using the semantic similarity model. First, the target sample a i and the predicted result b iThe vector representation is converted into a target sample vector and a prediction result vector. The target sample vector and prediction result vector are then fed into the semantic similarity model. The outputs are passed through a pooling layer, and the cosine function is used to calculate the similarity between the target sample vector and the prediction result vector, with a value in the range (-1, 1). For example, semantic inference results corresponding to prediction results with a similarity below 0.9 to the target sample can be filtered out, while those corresponding to prediction results with a similarity above 0.9 can be retained. High-quality inference significantly improves prediction accuracy and success rate.

[0191] Optionally, the semantic similarity model in this embodiment includes but is not limited to a Bert-like semantic representation model, and the pooling layer includes but is not limited to a mean pooling layer, a maximum pooling layer, a random pooling layer, etc.

[0192] As shown in FIG7 , this embodiment also provides a flowchart for filtering semantic reasoning results. Due to the diversity of language expressions, translation problems undergo different reasoning processes and ultimately lead to the same semantics. Therefore, after pre-training the large language model, multiple CoTs (including semantic reasoning results) and their corresponding prediction results will be generated. The present disclosure can extract CoTs with similar semantic expressions and filter their corresponding semantic reasoning results. i Extracted, and then together with the source sample and the target sample, form a set of samples (q i ,f i ,a i ), where q i is the input sample (source sample) of the translation model, and (f i ,a i ) is the output sample of the translation model. Optionally, you can also add vocabulary interpretations to the target words i , so in (q i ,f i ,a i ) and then add different vocabulary definitions i , that is, the sample (q i ,e i ,f i ,a i ), where (q i ,e i ) as the input sample of the translation model, (f i ,a i ) as the output sample of the translation model. Therefore, the output samples of the two sample pairs are the same, and the input samples are slightly different.

[0193] In some embodiments, the training data includes multiple sample pairs, each sample pair includes an input sample and an output sample, wherein the input sample includes two forms: one input sample includes a source sample and a semantic inference result, and the other input sample includes a source sample, a lexical interpretation, and a semantic inference result, and the output sample includes a target sample. The training data is used to train a translation model in the following manner:

[0194] The input sample in the sample pair is input into the translation model to be trained, and the loss function is calculated based on the similarity between the output result and the output sample in the sample pair; the model parameters of the translation model to be trained are trained according to the loss function, and the training is stopped when the loss function value meets the preset requirements or the number of training iterations reaches a threshold, thereby obtaining a trained translation model.

[0195] Since the present disclosure is primarily used in the field of machine translation, it is more inclined towards generative models. The characteristic of generative language models is that they comprehensively utilize the above information to predict the next token (word). In the field of natural language processing (NLP), generative pre-trained language models have become a powerful tool. Generative pre-trained language models are a type of model based on deep learning. By pre-training on large-scale unsupervised data, they learn rich language knowledge and potential semantics. These models use neural network structures, such as transformers, to effectively capture the correlation between words, phrases, and sentences. The core idea of ​​generative pre-trained language models is to use large-scale text data to build a universal language model. During the pre-training phase, the model learns from massive amounts of text data to master grammatical rules, semantic relationships, and common expressions. This enables the model to gradually understand the meaning of the text and generate coherent and reasonable sentences. In language understanding tasks, generative pre-trained language models can automatically complete complex tasks such as word sense disambiguation, entity recognition, and sentiment analysis. In language generation tasks, the model can generate natural and fluent text. Generative pre-trained language models are pre-trained using massive amounts of text data, thereby acquiring extensive linguistic knowledge. These datasets include a variety of text resources on the internet, such as news articles, encyclopedias, and social media. This broad coverage of text allows the model to learn diverse language patterns and information.

[0196] Generative pre-trained language models typically employ a two-stage training strategy. First, they are pre-trained on large-scale unsupervised data to capture the underlying structure and regularities of language. Then, they are fine-tuned on labeled data for specific tasks to adapt the model to the specific requirements. This strategy allows the model to perform well with a small amount of labeled data and exhibit strong generalization capabilities. By modeling contextual information, generative pre-trained language models can better understand the meaning of sentences and paragraphs. By learning from historical context and the dependencies between previously generated words, the model performs word-by-word prediction and generation, resulting in coherent and reasonable text.

[0197] The translation model in the embodiment of the present disclosure adopts a generative pre-trained language model, and the pre-trained translation model is fine-tuned by the training data generated by the large language model, so that the translation model can have the ability to accurately translate in the translation task. The translation model in this embodiment adopts a generative pre-trained language model, including but not limited to one of the GPT model and its series, the T5 model and its series, and the Bard model and its series. The generative model is simply divided into three types according to the architecture. The first is the model architecture of the GPT series, which adopts a Decode-only (self-encoding) autoregressive generative model; the second is the model architecture of the T5 series, which is similar to the Transformer and adopts a typical Seq2Seq (sequence to sequence) generative model; the third is the Bard model, which combines the generative models of BERT (autoencoding model) and GPT (autoregressive model), and has more advantages in understanding context.

[0198] As shown in FIG8 , this embodiment provides a schematic diagram of the principle of a translation model, including an encoder and a decoder, wherein the source text and vocabulary interpretation are input to the encoder, the semantic vector output by the encoder is input to the decoder for semantic reasoning, the semantic reasoning result is translated, and the target text and semantic reasoning result obtained by the translation are output. <s>The output target text and the semantic reasoning results are separated. When displayed, the target text can be directly displayed while the semantic reasoning results are hidden. Optionally, the decoder can be any semantic representation model such as RNN (Rerrent Neural Network), CNN (Convolutional Neural Network), LSTM (Long short-term memory), BERT (Bidirectional Encoder Representation from Transformers), GPT (Generative Pre-Trained Transformer), etc. The encoder can be a generative model. When making predictions, the generative model uses the information of K-1 words as prior information, without considering the information of the Kth and subsequent words, to directly predict the Kth word. This is also a self-supervised learning method. The kth word (token) is used as the K-1th target, and the loss value is calculated. The calculation formula of the loss function is as follows:

[0199] In formula (1), m represents the total number of words, k represents the kth word, and L k Represents the loss value between the predicted k-th word and the k-th word in the target sample, and loss represents the sum of the loss values ​​of m words, that is, the loss function value loss is the sum of the loss values ​​of m words.

[0200] Based on whether the input sample of the sample pair contains the lexical interpretation of the target word, the embodiment of the present disclosure designs two prompt templates. The prompt template is used to guide the user to input according to the prompt text through pre-configured prompt text and template text, and guide the translation model to output according to the template text. The specific form of the prompt template is as follows:

[0201] The first type of prompt template is used by the translation model to translate the content without adding additional vocabulary definitions. The first type of prompt template includes but is not limited to the first prompt template.

[0202] ①Input: Translate the following sentence into English: __________.

[0203] Output: The meaning of the whole sentence is _______, and the translation is ________.

[0204] This prompt template allows users to simply input the source text to be translated. The output includes the semantic inference result (the meaning of the entire sentence is _______) and the target text (the translation is ________). When displaying the output, the semantic inference result can be hidden, with only the target text displayed. The semantic inference result will then be displayed when the user needs to view it.

[0205] The format of the sample pair corresponding to the first prompt template is (q i ,f i ,a i );q i represents the input sample (source sample), (f i ,a i ) represents the output sample, f i Represents the result of semantic reasoning, a i represents the target sample.

[0206] For the second type of prompt template, the translation model needs to add additional vocabulary definitions. The second type of prompt template includes but is not limited to the second prompt template and the third prompt template.

[0207] ② Input: __________. Choose the one that best fits the context below:

[0208] XX means interpretation a; XX means interpretation b; XX means interpretation c; XX means interpretation d.

[0209] Output: "XX means __________."

[0210] This prompt template requires the translation model to filter out a vocabulary interpretation that matches the input source language text context from multiple vocabulary interpretations of "XX". Among them, multiple vocabulary interpretations of "XX" can be retrieved by the translation model from the Internet or input by the user. This embodiment does not impose too many restrictions on this.

[0211] The format of the sample pair corresponding to this prompt template is: (q i ,[e i1 ,e i2 ,…,e in ],e ij ), where the input sample is (q i ,[e i1 ,e i2 ,…,e in ]),q i Represents the source sample, and the output sample is e ij , e ij Indicates the jth lexical meaning of the i-th word, and "[]" indicates n alternative lexical meanings.

[0212] ③Input: Translate the following sentence into English: __________; XX means __________.

[0213] Output: The meaning of the whole sentence is _______, and the translation is ________.

[0214] This prompt template translation model uses the lexical interpretation of the target word "XX" to perform semantic reasoning on the source language text, thereby outputting the semantic reasoning results and the target text.

[0215] The format of the sample pair corresponding to this prompt template is: (q i ,e ij ,f i ,a i ), where the input sample is (q i ,e ij ), q i represents the source sample, e ij Represents the jth lexical interpretation of the i-th word, and the output sample is (f i ,a i ), f i Represents the result of semantic reasoning, a i represents the target sample.

[0216] Optional, since the final translation model output includes the semantic reasoning result f i and target sample a i , a special symbol can be used when splicing the two <s>Isolation, for example, by f i + <s>+a i The semantic reasoning result f i and target sample a i The concatenation is performed as the overall output of the translation model. Since the semantic reasoning result f i is the same language as the source text, and a i is the target text in the language that is ultimately required, so the output semantic reasoning result f i and target sample a i Afterwards, you can also <s>Symbols are separated and the target sample a is retained i The character string is displayed.

[0217] ② and ③ in the second prompt template can be used in combination. The specific usage is divided into the following categories:

[0218] In the first case, the user first inputs the source language text, and then the translation model retrieves the meaning of the target word in the source language text from the Internet and outputs multiple vocabulary interpretations. The user can select the one that best fits the context from the multiple vocabulary interpretations as the vocabulary interpretation input to the translation model. The translation model combines the vocabulary interpretation selected by the user to perform semantic reasoning on the source language text again, and outputs the semantic reasoning results and the target text.

[0219] The second situation is that the user first inputs the source language text, and then the translation model retrieves the meaning of the target word in the source language text from the Internet and outputs multiple vocabulary interpretations. The translation model automatically selects the one that best fits the context from the multiple vocabulary interpretations, and performs semantic reasoning on the source language text again based on the selected vocabulary interpretation, and outputs the semantic reasoning results and the target text.

[0220] In the third case, the user first inputs the source language text and then inputs multiple lexical definitions of the target word. The translation model performs semantic reasoning on the source language text based on the lexical definitions input by the user and outputs the semantic reasoning results and the target text.

[0221] The above-mentioned prompt templates all perform the same translation task and have the same output format, which can be unified as a "Text to Text" task. Therefore, this embodiment can use the T5 model as the translation model and fine-tune the T5 model with fewer parameters. The T5 model is a typical transformer architecture, consisting of two basic modules: an encoder and a decoder. As shown in Figure 9, this embodiment provides an architecture diagram of the T5 model. In this example, an adapter layer is added to each block of the T5 encoder. This layer freezes the parameters of the pre-trained model and, by fine-tuning the adapter layer parameters, improves the performance of the entire T5 model for downstream tasks. This technique can reduce the number of parameter updates to a certain extent and increase the speed of fine-tuning. In addition, the adapter layer is highly robust to the number of layers in the T5 model. Simply put, the adapter layer mainly consists of five components: two FF layers: the first FF layer (FF1) Feed Forward Down and the second FF layer (FF2) Feed Forward Up, a nonlinear layer (ReLU), a residual connection, and the score of the attention layer.

[0222] The first FF layer is a dimensionality reduction process for the semantic vector representation, and the second FF layer is a dimensionality increase process. The two FF layers are used to map the input text into a vector, where Δh represents the mapping vector. The processing algorithm of the FF layer is as follows: Δh←f(xW1+b1)W2+b2 Formula (2);

[0223] In formula (2), x 1×M represents a 1-dimensional vector of the hidden layer, Represents the M×D-dimensional weight matrix of the first FF layer, Indicates the deviation corresponding to the first FF layer, f is the nonlinear function Softmax, Represents the D×M-dimensional weight matrix of the second FF layer, Represents the deviation corresponding to the second FF layer, where M>D, M represents the vector dimension of the input source text, and D represents the vector dimension of the FF layer output.

[0224] The purpose of the residual connection is to prevent the randomly initialized parameters from excessively affecting the difference between the model output and the pre-trained model output: h1←h+Δh Formula (3);

[0225] In formula (3), h represents the vector of the source text, Δh represents the mapping vector of the source text after two FF layers, and h1 represents the intermediate vector of the source text accumulated mapping vector.

[0226] Since this disclosure designs two prompt templates, and different prompt texts extract different semantics, the adapter layer and the attention layer are combined. Similar to a gated unit, the adapter layer and the attention layer are proportionally connected through residual connections. The final result score (Score) of the self-attention layer is divided into two parts: the template text (the prompt template character sequence) and the non-template text (the non-prompt character sequence). The residual connection algorithm is as follows:

[0227] In formula (4), ∑ i exp(x i s i ) represents the sum of the attention scores corresponding to the template text, ∑ j exp(x i s i ) represents the sum of the attention scores corresponding to the non-template text, and μ(x) represents the output result after the residual connection. The latent vector after weighting by the gated unit is expressed as: h2←(1-μ(x))h1+μ(x)·Δh Formula (5);

[0228] In formula (5), h2 represents the latent vector after weighting by the gated unit, h1 represents the intermediate vector of the source text accumulated mapping vector, μ(x) represents the output result after residual connection, and Δh represents the mapping vector of the source text after two FF layers.

[0229] The semantic representation capability of the Mean Pooling operation is added to the final encoder output. The semantic representation vector obtained by the Mean Pooling operation is then input into the Decoder for decoding, and the final output of the translation model is obtained:

[0230] In formula (6), Output represents the output result of the translation model. Represents the result of semantic reasoning, represents the target text, <s>Indicates special characters, used for isolation and

[0231] As shown in Figure 10, this embodiment provides a translation interaction system, including a training module, an application module and an interaction module, wherein the training module first uses a pre-trained large language model to obtain training data, then screens out high-quality training data based on semantic similarity, and uses the screened training data to train the translation model of the small model. After the training is completed, when using the translation model to perform a translation task, the user can input the source text to be translated through the source interaction area in the interaction module, and can also input the vocabulary interpretation through the first interpretation interaction area. The target text obtained by translating the source text is displayed through the translation interaction area in the interaction module, and the vocabulary interpretation of the target word can be displayed through the second interpretation interaction area, or the vocabulary interpretation selected by the user can be obtained through the second interpretation interaction area. The associated vocabulary of the target word entered by the user can also be obtained through the third interpretation interaction area.

[0232] The training model in this embodiment performs the following steps: First, the source sample is input into a pre-trained large language model (for example, GPT-3.5, GPT-4.0, PaLM, LLAMA, Chatglm, etc. with a model parameter size greater than 100B) to generate semantic reasoning results (i.e., thought chain CoT) and prediction samples (predicted translations); Second, a semantic similarity model (for example, Sentence_Bert) is used to determine the similarity between the target sample and the predicted sample, and then a high-quality CoT is extracted to help the large language model obtain the correct translation; Third, the high-quality CoT and its corresponding source sample, target sample, and vocabulary interpretation are used to fine-tune a small language model (for example, the T5 model) to finally obtain a translation model with reasoning capabilities.

[0233] The application module in the present embodiment is used to translate using the small model (i.e., translation model) after fine-tuning, and the user can provide feedback on the result of the translation. If the result of the feedback is not satisfactory, the vocabulary interpretation of the target word can be retrieved through the Internet, and the meaning of the target word can even be confirmed by manual selection to adjust the translation. The vocabulary interpretation corresponding to the translation that the user is satisfied with can be recorded in the dictionary database at the same time, and the vocabulary interpretation can also be recommended according to the historical number of times the user translates, which is convenient for the user to choose and use next time.

[0234] The interaction module in this embodiment mainly implements interaction with the user by utilizing the source interaction area, the first interpretation interaction area, the second interpretation interaction area, and the translation interaction area.

[0235] As shown in Figure 11, this embodiment also provides a schematic diagram of the application logic of a translation model and database. In this embodiment, the database and network search module are shared. The database is a user-specific database, in which lexical definitions of target words are added based on the user's translation history. The specific application logic of the translation model and database is as follows: the source text and lexical definitions require manual user input, and the target text is output.

[0236] During implementation, when the lexical interpretation of the target word in the source text is not obtained, the above-mentioned first prompt template is selected, and the translation model predicts the translation (i.e., the target text). If the generated target text can reach a confidence level of 0.9, the target text is directly output. If the confidence level of the target text is lower than 0.9, the translation model automatically searches for the target word through the network retrieval module, and automatically organizes it into ② in the second prompt template for interpretation selection, and outputs the target text that reaches the confidence level. Users can also use ② in the second prompt template for interpretation selection, fill the selected lexical interpretation and source text into ③ in the second prompt template, input it into the translation model for translation, and output the target text.

[0237] Users can provide feedback on the target text. If satisfied, the vocabulary definitions obtained via the internet are added to the database for future use. If the translation of the target text, as prompted by the internet, is still unsatisfactory, the user can provide feedback and request that the system retrieve and display vocabulary definitions online. This will lead to the next step, where the user can manually select from a list of definitions to help the translation model correctly understand the meaning of the words. The translation model then obtains the target text. If the user is satisfied, the vocabulary definitions obtained via the internet are added to the database and the target text is output.

[0238] If the user is dissatisfied with the target text or the online interpretations do not capture the intended meaning, they can improve the accuracy of the translation model during online search by adding related terms. The system retrieves and displays the online interpretations, and the user selects one. This effectively increases the probability of the user selecting the correct interpretation. The translation model retrieves the target text, and if the user is satisfied, the target text is output. If not, the user can continue adding related terms until the final translation meets the user's expectations.

[0239] Referring to Figure 12, this embodiment also provides a network diagram for human-computer interaction. Although the database imposes certain restrictions on the scope of content generated by the translation model, translating entire sentences based on existing vocabulary that is not in the database may result in words that do not convey the intended meaning, especially in Chinese, where context is crucial. Therefore, the user is required to interpret incorrect words in the target text to reflect the current context.

[0240] In implementation, the user's translation interface includes two most basic interaction areas: the source interaction area and the target text interaction area. These two interaction areas are areas that users must use and are also available in most current software. For example, you can click the "Start Translation" button to start translation. By triggering the "light bulb icon", you can annotate the target word. "Clicking" on this "light bulb icon" can enter the interface of the second paraphrase interaction area and highlight the target word that affects the meaning of the sentence in "yellow background" to prompt the user which words the system currently has ambiguous understanding of; you can also trigger the "thumb up icon" to indicate the user's feedback that they are satisfied with the translation; or use the "thumb down icon" to indicate that the user is dissatisfied with the translation.

[0241] Optionally, the user can implement the translation function through at least the following three modes, including but not limited to: system translation, system retrieval translation, and human-machine collaborative translation, etc.

[0242] Mode 1: System translation mode.

[0243] As shown in Figure 13, this embodiment provides a comparison diagram of the system translation interface before and after. In the system translation mode, the translation interface includes a source interaction area and a target text interaction area. Among them, the original text input box in the figure represents the source interaction area in this embodiment, and the target text output box represents the target text interaction area in this embodiment. In the system translation mode, the user can input the source text (original text) to be translated in the source interaction area of the translation interface, such as "A few days ago, I was Yang. Now, I have Yang kang." Click the "Start Translation" button, and the translated target text (i.e., the translation) will be given in the target text interaction area. If the translation model can clearly understand the meaning of the source text, an accurate translation will be given, and the translation process ends at this time. However, if the translation model has only a superficial understanding of the source text and the meaning of some words affects the translation model's understanding of the whole sentence, it will lead to more literal translations. For example, "A few days ago, I was Yang. Now, I have Yang kang.", obviously the translation model does not understand the meaning of "Yang le" and "Yang kang" and can only give Chinese pinyin. The user can click the icon to indicate dissatisfaction with the target text (translation). After receiving the user's feedback that they are dissatisfied with the translation, it indicates that the knowledge of the translation model itself has limitations and cannot update the vocabulary explanation, and external help is needed. Therefore, the translation model solves this by connecting to the network.

[0244] Mode 2: System retrieval translation

[0245] As shown in Figures 14A-14B, this embodiment provides a translation interface diagram for a networked system. In the system search and translation mode, the translation interface includes a source interaction area and a translation interaction area. The original text input box in the figure represents the source interaction area in this embodiment, and the translation output box represents the translation interaction area in this embodiment. In this mode, after translating the source text, the system runs a grammatical error correction algorithm (GECToR) on the resulting target text to identify target words that may be erroneous. For example, such words may be hot words or words that have not been previously encountered by the translation model. For example, the sentence "A few days ago, I had yang. But now, I am yang and healthy" does not conform to traditional Chinese expression conventions. This usage of "yang" is uncommon, so the character "yang" is a potential source of error. Internet searches reveal multiple meanings of "yang": representing the sun; the front of an object; the opposite of "yin"; positive; prominent, etc. The system analyzes which of these meanings this word most closely resembles, making the sentence more natural and smooth to understand, ultimately determining that "yang" means "positive." Then, we insert "positive" into the second prompt template (③): Yang means positive. This results in the new target text: "A few days ago, I was in a bad state. But now I am in a positive state." Without context, these two sentences alone can convey multiple meanings, and even different interpretations by different people. The above translation cannot determine the specific context of the source text, as this sentence can appear in multiple contexts, while the original text was written in the context of the COVID-19 pandemic.

[0246] Because some words have common meanings that apply to many scenarios, the system inevitably misselects the meaning of a word, leading to incorrect translations. Furthermore, because some words are newly emerging "hot words" that haven't yet been included in dictionaries, or appear less frequently than existing definitions, online searches often fail to find their meaning. For example, the meaning of "yang" doesn't include the context of the "COVID-19 pandemic." In these cases, no matter how the system analyzes, it won't find the desired interpretation. Therefore, users must collaborate with the system to improve search accuracy.

[0247] Mode three: human-machine collaborative translation.

[0248] As shown in Figure 15, this embodiment provides an interface with highlighting prompts and paraphrase selection. In the human-machine collaborative translation mode, the translation interface includes a source interaction area, a translation interaction area, and a second paraphrase interaction area. Among them, the original text input box in the figure represents the source interaction area in this embodiment, the translation output box represents the translation interaction area in this embodiment, and the paraphrase selection box represents the second paraphrase interaction area in this embodiment. The user can also perform collaborative translation with the machine. By "clicking" the "light bulb icon" with the mouse, the user enters the highlighted word interface. The system highlights the keywords (target words) in the original text (source text), prompting the user that they can re-annotate the meanings of these words. At the same time, the page expands to enter the interface with paraphrase options, and each word paraphrase with paraphrase options is displayed in the second paraphrase interaction area. As shown in Figure 16, this embodiment provides a schematic diagram of a paraphrase selection box displaying a list of word meanings. When the mouse approaches the highlighted word "Yang", the meanings retrieved from the network will appear in the paraphrase box. The user can check the small box on the far right, thus helping the system model obtain the correct meaning and greatly reducing the probability of misselection by the system.

[0249] However, it can be found from the several meanings given in the paraphrase selection box that there is no explanation of "Yang" in the context of the COVID-19 pandemic. However, this word has been widely used in daily life and is default related to things related to the COVID-19 pandemic. This indicates that during the retrieval process, the search engine filters out those explanations with relatively low frequencies or unofficial ones, which is not very helpful for the translation results of "hot words". Therefore, human intervention is needed to narrow the retrieval scope and improve the retrieval accuracy.

[0250] As shown in Figures 17A and 17B, this embodiment provides an interface diagram for adding a related vocabulary box. The translation interface includes a source interaction area, a translation interaction area, a second interpretation interaction area, and a third interpretation interaction area. For example, when a user double-clicks a highlighted word, a related vocabulary box (i.e., the third interpretation interaction area in this embodiment) will be expanded while the original text input box (source interaction area), the translation output box (translation interaction area), and the interpretation selection box (second interpretation interaction area) are displayed. Double-clicking a highlighted word automatically enters the related vocabulary window. Users can fill in the box with words relevant to the context of the original text to ensure that interpretations in the relevant context are detected. For example, "I tested positive" is a Chinese expression that emerged in the context of the COVID-19 pandemic, and "yang" indicates the result of a COVID-19 nucleic acid test. Therefore, words such as "new crown" and "nucleic acid test" can be added to the related vocabulary. The meaning of "yang" is ranked based on the strength of its semantic similarity with the related words. The first meaning is "COVID-19 nucleic acid test positive." "yang" can also be considered an abbreviation for this meaning. At this point, the specific meaning of the highlighted word is clear with the user's help. The system inserts the target word's lexical definition along with the source text into the second prompt template (③: Yang means positive) and inputs it into the translation model, outputting the translation "A few days ago, I tested positive for COVID-19. However, now I am recovered." This translation is now concise and fluent, and the context is clear.

[0251] In some embodiments, users can add definitions to self-selected words. If the user wants to customize part of the vocabulary based on his or her understanding of the original text, he or she can "double-click" the "light bulb icon" with the mouse to enter the translation interface. As shown in Figure 18, this embodiment provides a translation interface with definition selection, and the translation interface includes a word segmentation interaction area, a translation interaction area, and a second definition interaction area. Among them, the original text (source text) is pre-segmented by the N-gram algorithm, and the processed word segmentation sequence is displayed in the word segmentation interaction area, wherein the word segmentation interaction area and the source interaction area have the same position, and the source interaction area can be updated to display as the word segmentation interaction area. The user then clicks on a "single word" in the word segmentation interaction area, or drags and selects all "multiple words" words, and then clicks to put the word into the definition selection box (second definition interaction area) as the user-defined target word to find the corresponding vocabulary definition.

[0252] As shown in Figure 19, the present embodiment also provides a kind of translation interface that adds associated vocabulary frame, and translation interface includes word segmentation interaction area, translation text interaction area, second interpretation interaction area and third interpretation interaction area.Wherein, word segmentation sequence that source text is carried out word segmentation processing is displayed in word segmentation interaction area (i.e. original text input frame), the vocabulary interpretation of the target word selected by the user from word segmentation interaction area is displayed in the second interpretation interaction area (interpretation selection frame), the associated vocabulary of the target word input by the user is obtained in the third interpretation interaction area (associated vocabulary frame), and the translation result (target text) is displayed in the translation text interaction area (translation output frame).For example, the user wants to interpret the word "yang" in a special context, and only needs to click on the word "yang"; If "yangkang" is to be interpreted, it is necessary to select the word "yangkang" first and then click on it, and the interpretation selection frame will show all the meanings of the word. If there is a interpretation that the user needs in the interpretation, it can be checked in the small box on the far right, otherwise the user can automatically enter the associated vocabulary frame (i.e. the third interpretation interaction area) by double-clicking the word "yang". The user enters several related words for the word and searches the internet for explanations related to "coronavirus" and "nucleic acid test." This step is the same as searching for explanations for the prompt word. The resulting translation is "A few days ago, I tested positive for COVID-19. However, now I am recovered."

[0253] If the user is satisfied with the current translation, they can click the "thumbs-up" icon, and the system will automatically enter the user's personalized interpretation of certain words into a database. This database will assist the system's translation model, allowing it to more quickly identify contextual interpretations in subsequent translations, reducing the number of manual input and selection operations and improving translation efficiency. The disclosed translation solution not only supports multilingual translation but also supports translation between classical Chinese and vernacular Chinese. As shown in Figure 20, this embodiment also provides an interface for selecting the translation type.

[0254] The translation method and system provided in this embodiment are used to train the model to reason in the same way as the human brain thinks, thereby enhancing the model's reasoning ability. A human-computer interactive translation mode is proposed. In response to the phenomenon of literal translation and random translation due to the lack of context, users can adjust the wording of the translation in real time by selecting vocabulary annotations, thereby improving translation accuracy. Internet search is added to the model to expand its ability to translate hot words. It is proposed to reversely screen high-quality thought chains through semantic similarity, enriching the model's reasoning process and improving robustness. The translation method provided by this disclosure can be integrated into various translation software and has a wide range of application scenarios, such as classical Chinese translation, hot word translation, etc.

[0255] Based on the same inventive concept, the embodiment of the present disclosure further provides a translation method, as shown in FIG21 . The specific implementation process of the method is as follows:

[0256] Step 2100: Acquire a source text, where the source text includes at least one target word;

[0257] Step 2101: Obtain the vocabulary definition of the target word;

[0258] Step 2102: Input the source text into the translation model, and output a target text corresponding to the source text; wherein the source text and the target text are written in different languages.

[0259] Based on the same inventive concept, the present disclosure also provides a translation model training method, as shown in FIG22 . The specific implementation process of the method is as follows:

[0260] Step 2200: Acquire training data, wherein the training data includes a plurality of sample pairs, each of which includes an input sample and an output sample; the input sample includes a source sample and a lexical interpretation of a target word in the source sample; the output sample includes the target sample and a semantic inference result, wherein the semantic inference result is obtained by performing semantic inference on the source sample in combination with the lexical interpretation of the target word;

[0261] Step 2201: Input the input sample in the sample pair to the translation model to be trained, and calculate the loss function based on the output result and the output sample in the sample pair;

[0262] Step 2202: Train the model parameters of the translation model to be trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

[0263] Based on the same inventive concept, the embodiment of the present disclosure also provides an electronic device. Since the electronic device is the device in the method in the embodiment of the present disclosure, and the principle of solving the problem by the electronic device is similar to that of the method, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts are not repeated. It should be noted that the electronic device in this embodiment includes a terminal device or a display device. Referring to Figure 23, the electronic device in this embodiment is introduced.

[0264] The display device 100 in this embodiment includes a display unit 1040, a processor 1080 and a memory 1020, wherein the display unit 1040 includes a display panel 1041, which is used to display information input by the user or information provided to the user and various operation interfaces of the application, etc. In the embodiment of the present disclosure, it is mainly used to display the interface, shortcut window, three-dimensional menu model, menu information of menu items, etc. of the client installed in the display device 100.

[0265] Optionally, the display panel 1041 may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0266] The processor 1080 is configured to read a computer program and then execute the method defined by the computer program. For example, the processor 1080 reads an application, thereby running the application on the display device 100 and displaying the application interface on the display unit 1040. The processor 1080 may include one or more general-purpose processors and may also include one or more DSPs (Digital Signal Processors) to perform related operations to implement the technical solutions provided by the embodiments of the present disclosure.

[0267] The memory 1020 generally includes internal memory and external memory. The internal memory can be a random access memory (RAM), a read-only memory (ROM), and a cache (CACHE), etc. The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive, etc. The memory 1020 is used to store computer programs and other data. The computer program includes an application corresponding to the client, etc. Other data may include data generated after the operating system or application is run, and the data includes system data (such as configuration parameters of the operating system) and user data. In the embodiment of the present disclosure, program instructions are stored in the memory 1020, and the processor 1080 executes the program instructions in the memory 1020 to implement any one of the three-dimensional menu display methods provided by the present disclosure.

[0268] In addition, the display device 100 may further include a touch unit 1100 for receiving input digital information, word information, contact touch operations, or contactless gestures, and generating signal inputs related to user settings and function control of the display device 100. The touch unit 1100 includes, but is not limited to, an infrared touch unit, a capacitive touch unit, an electromagnetic touch unit, a camera acquisition unit, etc., wherein the camera acquisition unit is used to capture gestures of the user without touching the display screen. When the touch unit 1100 includes an infrared touch unit or an electromagnetic touch unit, the touch unit 1100 and the display unit 1040 may be stacked. For example, when a user performs a touch operation on the touch screen, the touch unit 1100 may collect the user's touch operation on or near it (such as an operation performed by the user using a finger, a stylus, or any other suitable object or accessory on the display panel 1041) and drive the corresponding connection device according to a pre-set program.

[0269] Optionally, the touch control unit 1100 may include two parts: a touch detection device and a touch processor. The touch detection device detects the user's touch direction, detects the signal caused by the touch operation, and transmits the signal to the touch processor; the touch processor receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 1080. It can also receive commands sent by the processor 1080 and execute them. In the embodiment of the present disclosure, if the user clicks on the application, the touch detection device in the touch control unit 1100 detects a touch operation, and sends the signal corresponding to the detected touch operation to the touch processor. The touch processor converts the signal into touch point coordinates and sends them to the processor 1080. The processor 1080 determines the operation that the user needs to perform based on the received touch point coordinates.

[0270] The display panel 1041 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 1040 and the touch unit 1100, the display device 100 can also include an input unit 1030. The input unit 1030 can include an image input device 1031 and other input devices 1032. The other input devices 1032 can be, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, a joystick, and the like.

[0271] In addition to the above, the display device 100 may also include a power supply 1090 for powering other modules, an audio circuit 1060, a near-field communication module 1070, and an RF circuit 1010. The display device 100 may also include one or more sensors 1050, such as an accelerometer, a light sensor, a pressure sensor, etc. The audio circuit 1060 specifically includes a speaker 1061 and a microphone 1062. For example, the display device 100 can collect the user's voice through the microphone 1062 to perform corresponding operations.

[0272] As an embodiment, the number of the processors 1080 may be one or more, and the processor 1080 and the memory 1020 may be coupled or relatively independently configured.

[0273] As an embodiment, the processor 1080 is configured to perform the following steps:

[0274] Acquire a source text, wherein the source text includes at least one target word;

[0275] Obtaining a lexical definition of the target word;

[0276] A source text and vocabulary definitions are input into a translation model, and a target text corresponding to the source text is output; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary definitions to obtain a semantic reasoning result, and then translate the semantic reasoning result to obtain a target text; the source text and the target text are written in different languages.

[0277] As an embodiment, the processor 1080 is configured to perform the following steps:

[0278] Acquire a source text, wherein the source text includes at least one target word;

[0279] Obtaining a lexical definition of the target word;

[0280] A source text is input into a translation model, and a target text corresponding to the source text is output; wherein the source text and the target text are in different languages.

[0281] As an embodiment, the processor 1080 is configured to perform the following steps:

[0282] Acquire training data, the training data including a plurality of sample pairs, the sample pairs including input samples and output samples; the input samples including source samples and lexical interpretations of target words in the source samples; the output samples including the target samples and semantic reasoning results, the semantic reasoning results being obtained by semantic reasoning the source samples in combination with the lexical interpretations of the target words;

[0283] Input the input sample in the sample pair to the translation model to be trained, and calculate the loss function based on the output result and the output sample in the sample pair;

[0284] The model parameters of the translation model to be trained are trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

[0285] Based on the same inventive concept, the embodiment of the present disclosure also provides a translation device. Since the device is the device in the method in the embodiment of the present disclosure, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0286] As shown in FIG24 , the device includes:

[0287] A text acquisition module 2400 is configured to acquire a source text, wherein the source text includes at least one target word;

[0288] Obtaining interpretation module 2401, for obtaining the vocabulary interpretation of the target word;

[0289] The text translation module 2402 is used to input the source text and vocabulary definitions into the translation model and output the target text corresponding to the source text; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary definitions to obtain a semantic reasoning result, and translate the semantic reasoning result to obtain the target text; the source text and the target text are written in different languages.

[0290] Based on the same inventive concept, the embodiment of the present disclosure also provides a translation device. Since the device is the device in the method in the embodiment of the present disclosure, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0291] As shown in FIG25 , the device includes:

[0292] A text acquisition module 2500 is configured to acquire a source text, wherein the source text includes at least one target word;

[0293] Obtaining interpretation module 2501, for obtaining the vocabulary interpretation of the target word;

[0294] The text translation module 2502 is configured to input a source text into a translation model and output a target text corresponding to the source text; wherein the source text and the target text are in different languages.

[0295] Based on the same inventive concept, the embodiment of the present disclosure also provides a training device for a translation model. Since the device is the device in the method in the embodiment of the present disclosure, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0296] As shown in FIG26 , the device includes:

[0297] The data acquisition module 2600 is configured to acquire training data, wherein the training data includes a plurality of sample pairs, each of which includes an input sample and an output sample; the input sample includes a source sample and a lexical interpretation of a target word in the source sample; the output sample includes the target sample and a semantic inference result, wherein the semantic inference result is obtained by semantically inferring the source sample in combination with the lexical interpretation of the target word;

[0298] A loss calculation module 2601 is configured to input the input sample of the sample pair into the translation model to be trained, and calculate a loss function based on the output result and the output sample of the sample pair;

[0299] The model training module 2602 is used to train the model parameters of the translation model to be trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

[0300] Based on the same inventive concept, embodiments of the present disclosure provide a computer storage medium comprising computer program code. When executed on a computer, the computer program code causes the computer to execute any of the aforementioned translation methods or translation model training methods. Because the principles underlying the problems solved by the aforementioned computer storage medium are similar to those of the translation methods or translation model training methods, the implementation of the aforementioned computer storage medium can be referenced to the implementation of the methods, and any repetitions will be omitted.

[0301] In a specific implementation process, computer storage media may include: Universal Serial Bus Flash Drive (USB), mobile hard disk, Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disk or optical disk, and other storage media that can store program code.

[0302] Based on the same inventive concept, embodiments of the present disclosure further provide a computer program product comprising: computer program code that, when executed on a computer, causes the computer to execute any of the translation methods or translation model training methods discussed above. Because the principles underlying the problems solved by these computer program products are similar to those of the translation methods or translation model training methods, the implementation of these computer program products can be referenced to the implementation of the methods, and any repetitions will not be repeated.

[0303] The computer program product can employ any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0304] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.

[0305] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0306] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0307] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0308] Obviously, those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is intended to include these modifications and variations.< / s> < / s> < / s> < / s> < / s>

Claims

1. A translation method, wherein: The method includes: Acquire a source text, wherein the source text includes at least one target word; Obtaining a lexical definition of the target word; The source text and the vocabulary interpretation are input into the translation model, and the target text corresponding to the source text is output; wherein the translation model is used to perform semantic reasoning on the source text in combination with the vocabulary interpretation to obtain a semantic reasoning result, and translate the semantic reasoning result to obtain a target text; the languages ​​used in the source text and the target text are different.

2. The method according to claim 1, wherein: The method further includes: Displaying a translation interface, wherein the translation interface includes a source interaction area and a translation interaction area; The source interaction area is used to obtain the source text, and the translation interaction area is used to display the target text.

3. The method according to claim 2, wherein: The method further includes: In response to a user's touch operation on the translation interface, a definition interaction area is generated on the translation interface, where the definition interaction area is used to obtain relevant information of the target word.

4. The method according to claim 2, wherein: The translation interface further includes a first interpretation interaction area, which is used to obtain a vocabulary interpretation of a target word input by a user.

5. The method according to claim 2, wherein: The translation interface also includes a second interpretation interaction area, which is used to display the vocabulary interpretation of the target word. The vocabulary interpretation displayed in the second interpretation interaction area is retrieved from the Internet.

6. The method according to claim 5, wherein: The method further includes: The second interpretation interaction area displays multiple vocabulary interpretations of the target word; In response to a user's selection operation on the second interpretation interaction area, the vocabulary interpretation corresponding to the selection operation is determined as the vocabulary interpretation of the target word.

7. The method according to claim 5 or 6, wherein: The translation interface also includes a third interpretation interaction area, and the third interpretation interaction area is used to obtain the associated vocabulary of the target word, so as to retrieve the vocabulary interpretation of the target word from the Internet in combination with the associated vocabulary.

8. The method according to any one of claims 2 to 6, wherein: The translation interface also includes a word segmentation interaction area, which is used to display the word segmentation sequence of the source text after the word segmentation processing, and determine the target word according to the word segmentation in the word segmentation sequence selected by the user.

9. The method according to claim 1, wherein: The method further includes: Get the target word in the source text by any one or more of the following methods: Determine the word input by the user as the target word; or, Displaying a segmentation sequence obtained by segmenting the source text, and in response to a user's selection operation of a segmentation in the segmentation sequence, determining the segmentation corresponding to the selection operation as a target word; or, The source text is input into the translation model, and the target word is determined from the source text according to the confidence of the target text output by the translation model.

10. The method according to claim 1, wherein: The lexical meaning of the target word is determined as follows: The vocabulary definition input by the user is determined as the vocabulary definition of the target word.

11. The method according to claim 1, wherein: The lexical meaning of the target word in the source text is determined as follows: The lexical meaning of the target word is searched on the Internet, and the retrieved lexical meaning is determined as the lexical meaning of the target word.

12. The method according to claim 11, wherein: The method of searching the vocabulary meaning of the target word using the Internet includes: Obtain the associated words of the target word, and use the Internet to search for the lexical interpretation of the target word in combination with the associated words.

13. The method according to claim 11, wherein: The method of searching the vocabulary meaning of the target word using the Internet includes: Retrieve the lexical meaning of the target word from the Internet, and perform semantic understanding on the search results to obtain the semantic information of the target word; The semantic information of the target word is extracted according to preset semantic rules to obtain a vocabulary interpretation, and the vocabulary interpretation is output.

14. The method according to claim 11, wherein: If the target word retrieved through the Internet includes multiple lexical definitions, the lexical definition of the target word in the source text is determined by any one or more of the following methods: Screening multiple vocabulary definitions according to the perplexity calculated for each vocabulary definition, and determining the screened vocabulary definitions as the vocabulary definitions of the target words in the source text; or, A selection operation of the user is received, and the vocabulary interpretation corresponding to the selection operation is determined as the vocabulary interpretation of the target word in the source text.

15. The method according to claim 1, wherein: The method further includes: Obtaining a first prompt template, where the first prompt template is used to guide the translation model to perform a translation task on a source text; The source text is filled into the first prompt template and then input into the translation model.

16. The method according to claim 1, wherein: The method further includes: Obtaining a second prompt template, wherein the second prompt template is used to guide the translation model to select a lexical interpretation for the target word that is consistent with the context of the source text; The source text and multiple vocabulary definitions of the target word are filled into the second prompt template and then input into the translation model.

17. The method according to claim 1, wherein: The method further includes: Acquire a third prompt template, wherein the third prompt template is used to guide the translation model to perform a translation task on the source text in combination with the lexical interpretation of the target word; The lexical interpretations of the source text and the target words are filled into the third prompt template and then input into the translation model.

18. The method according to claim 1, wherein: The source text includes a source language text and a prompt text, wherein the prompt text is used to instruct the translation model to perform a specified task on the source language text; The designated task includes at least one of a translation task, a vocabulary definition query task, and a vocabulary definition selection task.

19. The method according to claim 1, wherein: The translation model is obtained by training using training data, wherein the training data includes a plurality of sample pairs, and the sample pairs include an input sample and an output sample; The input sample includes a source sample and a lexical interpretation of a target word in the source sample, and the output sample includes a target sample and a semantic reasoning result. The sample pair is generated in the following manner: Input the source sample into the language model, perform semantic reasoning on the source sample in combination with the vocabulary interpretation to obtain the semantic reasoning result, translate the semantic reasoning result to obtain the prediction result, and output the prediction result and the corresponding semantic reasoning result; According to the similarity between the prediction result and the target sample, the semantic reasoning results corresponding to the prediction results whose similarity is greater than the similarity threshold are screened out; Sample pairs are generated according to the filtered semantic reasoning results, the source samples, the lexical interpretations of the target words in the source samples, and the target samples.

20. A translation method, wherein: The method includes: Acquire a source text, wherein the source text includes at least one target word; Obtaining a lexical definition of the target word; A source text is input into a translation model, and a target text corresponding to the source text is output; wherein the source text and the target text are in different languages.

21. A method for training a translation model, wherein: The method includes: Acquire training data, the training data including multiple sample pairs, the sample pairs including input samples and output samples; the input samples including source samples and lexical interpretations of target words in the source samples, the output samples including target samples and semantic reasoning results, the semantic reasoning results being obtained by semantically reasoning the source samples in combination with the lexical interpretations of the target words; Input the input sample in the sample pair to the translation model to be trained, and calculate the loss function based on the output result and the output sample in the sample pair; The model parameters of the translation model to be trained are trained according to the loss function. When the loss function value meets the preset requirements or the number of training iterations reaches a threshold, the training is stopped to obtain a trained translation model.

22. An electronic device, wherein: The electronic device comprises a processor and a memory, wherein the memory is used to store a program executable by the processor, and the processor is used to read the program in the memory and execute the steps of any one of the methods of claims 1 to 21.

23. A computer storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 21 are implemented.