Disclosure of Invention
Therefore, the invention provides a translation processing method, a device, a storage medium and electronic equipment under a large model, which solve the problems that the translation result of the traditional technology is easy to have errors, inaccurate or unsuitable translation and has low translation quality.
In order to achieve the above object, the present invention provides the following technical solutions: in a first aspect, a method for translation processing under a large model is provided, including:
performing transliteration on an object to be translated by adopting the machine translation capability of a large language model to obtain a translation target language text of the object to be translated as a first translation result;
adopting text generation and text understanding capability of a large language model, and utilizing the obtained first translation result to re-interpret the object to be translated by combining the context of the object to be translated to obtain a second translation result;
performing creative translation processing on the first translation result and the second translation result, wherein the creative translation processing process adopts a preset creative translation rule to process the first translation result and the second translation result, and a third translation result is obtained;
and carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of a large language model to obtain a final translation result of the object to be translated.
As a preferred scheme of the translation processing method under the large model, the machine translation capability of the large language model is adopted to understand the source language grammar and the semantics of the object to be translated, and a translation target language text of the object to be translated is generated;
and (3) carrying out an understanding process on the source language grammar and the semantics of the object to be translated, and adjusting the model weight and the parameters of the large language model.
As a preferred scheme of the translation processing method under the large model, the creative translation processing process adopts preset creative translation rules as follows: and processing the first translation result and the second translation result by adopting a pruning method.
As a preferred scheme of the translation processing method under the large model, editing a prompt word of the large language model, and transmitting the prompt word and the object to be translated into the large language model;
and endowing the large language model with professional translation and middle school Chinese teacher roles through the prompt word.
In a second aspect, there is provided a translation processing device under a large model, including:
the translation processing module is used for carrying out translation on the object to be translated by adopting the machine translation capability of the large language model to obtain a translation target language text of the object to be translated as a first translation result;
the meaning translation processing module is used for adopting text generation and text understanding capability of a large language model, and re-meaning translating the object to be translated by combining the context of the object to be translated by utilizing the obtained first translation result to obtain a second translation result;
the creative translation processing module is used for performing creative translation processing on the first translation result and the second translation result, and the creative translation processing process adopts a preset creative translation rule to process the first translation result and the second translation result so as to obtain a third translation result;
and the comprehensive translation processing module is used for carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of the large language model to obtain a final translation result of the object to be translated.
As a preferred scheme of the translation processing device under the large model, in the translation processing module, the machine translation capability of the large language model is adopted to understand the source language grammar and the semantics of the object to be translated, and a translation target language text of the object to be translated is generated;
and in the transliteration processing module, the understanding process is carried out on the source language grammar and the semantics of the object to be translated, and the model weight and the parameters of the large language model are adjusted.
As a preferred scheme of the translation processing device under the large model, in the creative translation processing module, the creative translation processing process adopts preset creative translation rules as follows: and processing the first translation result and the second translation result by adopting a pruning method.
The translation processing device under the large model is used as a preferred scheme, and further comprises a prompt word processing module which is used for editing the prompt word of the large language model and transmitting the prompt word of the prompt and the object to be translated into the large language model; and endowing the large language model with professional translation and middle school Chinese teacher roles through the prompt word.
In a third aspect, a non-transitory computer readable storage medium having stored therein program code for a large under-model translation processing method, the program code comprising instructions for performing a large under-model translation processing method of the first aspect or any possible implementation thereof.
In a fourth aspect, there is provided an electronic device comprising: a memory and a processor; the processor and the memory complete communication with each other through a bus; the memory stores program instructions executable by the processor to invoke a large model under translation processing method of the first aspect or any possible implementation thereof.
The invention has the following advantages: performing transliteration on an object to be translated by adopting the machine translation capability of a large language model to obtain a translation target language text of the object to be translated as a first translation result; adopting text generation and text understanding capability of a large language model, and utilizing the obtained first translation result to re-interpret the object to be translated by combining the context of the object to be translated to obtain a second translation result; performing creative translation processing on the first translation result and the second translation result, wherein the creative translation processing process adopts a preset creative translation rule to process the first translation result and the second translation result, and a third translation result is obtained; and carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of a large language model to obtain a final translation result of the object to be translated. The invention can better process the complexity, the context information and the diversity of the language, thereby providing more accurate and natural translation results; the invention excites the reasoning capability of a large language model and brings great performance improvement to machine translation.
Detailed Description
Other advantages and advantages of the present invention will become apparent to those skilled in the art from the following detailed description, which, by way of illustration, is to be read in connection with certain specific embodiments, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, embodiment 1 of the present invention provides a translation processing method under a large model, including the following steps:
s1, performing transliteration on an object to be translated by adopting the machine translation capability of a large language model to obtain a translation target language text of the object to be translated as a first translation result;
s2, adopting text generation and text understanding capability of a large language model, and re-translating the object to be translated by utilizing the obtained first translation result and combining the context of the object to be translated to obtain a second translation result;
s3, performing creative translation processing on the first translation result and the second translation result, wherein a preset creative translation rule is adopted in the creative translation processing process to process the first translation result and the second translation result, and a third translation result is obtained;
s4, carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of the large language model to obtain a final translation result of the object to be translated.
In this embodiment, the machine translation capability of the large language model is adopted to understand the source language grammar and the semantics of the object to be translated, and a translation target language text of the object to be translated is generated; and (3) carrying out an understanding process on the source language grammar and the semantics of the object to be translated, and adjusting the model weight and the parameters of the large language model. The creative translation processing process adopts preset creative translation rules as follows: and processing the first translation result and the second translation result by adopting a pruning method. Editing a prompt word of the large language model, and transmitting the prompt word of the prompt and the object to be translated into the large language model; and endowing the large language model with professional translation and middle school Chinese teacher roles through the prompt word.
In this embodiment, the use of the CoT thinking Chain method to improve the translation quality based on a large language model is an expression of a thinking process, which means a process in which one concept or concept in thinking triggers another concept or concept. One of the core capabilities of large language models is the key to have powerful logical reasoning, which is a Chain of Thought (CoT); the chain of thought may enhance the reasoning ability in a large language model.
In this embodiment, the translation is first split into multiple steps by the CoT method, and the result of each step is printed and output.
Specifically, in step S1, the translation is first performed, and the translation software such as Google can be used faithfully. The step S1 uses the machine translation capability of the large language model, and can realize that the large language model understands the grammar and the semantics of the source language and generates a corresponding target language text as a first translation result through the weight and the parameters of the pre-trained large language model.
Specifically, in step S2, based on the first translation result translated in step S1, the first translation result is interpreted again in combination with the context. The principle of the step S2 is that the text generation and text understanding capability of a large language model are utilized to comprehensively consider the original text and the context, so that the accuracy and the naturalness of translation are improved, and the translation is more in accordance with the grammar and the expression habit of a target language.
Specifically, in step S3, based on step S1 and step S2, a creative translation result is provided, and step S3 can be adjusted according to the needs of the user, mainly as a supplement to the meaning of step S2, so as to provide sufficient material for step S4. Step S3 may increase the diversity and richness of the translation so that subsequent steps can be more selective. Creative translations may involve a tutorial, metaphor, humor, or other literature device to increase the appeal of the translation.
Specifically, in step S4, based on the iterations of step S1, step S2 and step S3, there are three translation versions, namely a first translation result, a second translation result and a third translation result. At this time, the LLM large language model can be regarded as a Chinese teacher without considering the English original text of the reaction, has three students providing Chinese sentences and makes corrections based on the sentences, and finally forms a best Chinese version.
Thus, in step S4, the large language model is used as a chinese teacher, and the first translation result, the second translation result and the third translation result generated in the previous three steps are modified and improved by using the text editing capability of the large language model, so as to ensure grammar, smoothness and accuracy. The large language model has the text editing and modifying capabilities through the text generation and text understanding capabilities of the large language model, so that grammar errors can be detected and corrected, the naturalness of expression can be improved, and more accurate translation suggestions can be provided.
In one possible embodiment, the promptness prompt content is written, and the promptness prompt content and the text content of the object to be translated are sent to the LLM large language model, wherein the promptness prompt content is as follows:
you are a professional translation of the proficiency of simplified Chinese, i want you to help me translate the following English video subtitles into Chinese.
Rules:
(1) These subtitles may be related to machine learning or AI, etc. expertise, noting the accuracy of the terms at translation;
(2) The translation needs to be popular, simple and easy to understand;
(3) Retaining a specific English term or name and adding spaces, such as "medium English", before and after it;
(4) The caption may have wrongly written words during voice recognition, please pay attention to error correction;
(5) The message contains complete subtitle content, but you do not need to translate, only need to reply OK;
(6) I would send segments to you translations in subsequent messages, only one segment per you need to be translated.
(7) The translation adopts the following steps, and each step completely prints the result
Firstly, translating the text content according to literal meaning;
secondly, referring to the result of the first step of transliteration, combining the context and performing intent translation on the content;
thirdly, translating the result by adopting a creative mode by referring to the results of the transliteration and the intention and combining the context;
fourthly, suppose now that you are middle school Chinese teachers, read the three translation results, then merge the advantages of all the translation results, rewrite the translation results, faithfully look at the original meaning, accord with the context, and are popular and easy to understand;
Here is the full content:
"English content to be translated".
Thus, in this manner, the problems presented by the above conventional translation tools, such as semantic understanding problems, grammatical problems, cultural and custom problems, long text problems, professional, and the like, can be achieved and solved.
Referring to fig. 2 and 3, for an application example of an embodiment of the present invention, in fig. 2, a prompt content and an object to be translated are shown, and a large language model conveyed by the prompt content and the object to be translated is translated. The translation result of each step is shown in fig. 3, and the comprehensive translation is seen to rewrite the translation result, thereby being faithful to the original meaning, conforming to the context and being popular and easy to understand.
In summary, the embodiment of the invention adopts the machine translation capability of the large language model to carry out the translation of the object to be translated, and obtains the translation target language text of the object to be translated as the first translation result; adopting text generation and text understanding capability of a large language model, and utilizing the obtained first translation result to re-interpret the object to be translated by combining the context of the object to be translated to obtain a second translation result; performing creative translation processing on the first translation result and the second translation result, wherein the creative translation processing process adopts a preset creative translation rule to process the first translation result and the second translation result, and a third translation result is obtained; and carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of a large language model to obtain a final translation result of the object to be translated. The invention is based on language generating capability, language understanding capability, reasoning capability, learning capability of the large language model LLM and the thinking chain scheme of the CoT, and can better process the complexity, context information and diversity of the language, thereby providing more accurate and natural translation results; the invention excites the reasoning capability of a large language model and brings great performance improvement to machine translation.
It should be noted that the method of the embodiments of the present disclosure may be performed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene, and is completed by mutually matching a plurality of devices. In the case of such a distributed scenario, one of the devices may perform only one or more steps of the methods of embodiments of the present disclosure, the devices interacting with each other to accomplish the methods.
It should be noted that the foregoing describes some embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Example 2
Referring to fig. 4, embodiment 2 of the present invention further provides a translation processing device under a large model, including:
the translation processing module 1 is used for translating an object to be translated by adopting the machine translation capability of the large language model to obtain a translation target language text of the object to be translated as a first translation result;
the meaning translation processing module 2 is configured to use text generation and text understanding capabilities of a large language model, and use the obtained first translation result to re-meaning the object to be translated in combination with the context of the object to be translated to obtain a second translation result;
the creative translation processing module 3 is configured to perform creative translation processing on the first translation result and the second translation result, where the creative translation processing process uses a preset creative translation rule to process the first translation result and the second translation result, so as to obtain a third translation result;
and the comprehensive translation processing module 4 is used for carrying out grammar error detection and correction on the first translation result, the second translation result and the third translation result through text editing and modifying capabilities of the large language model to obtain a final translation result of the object to be translated.
In this embodiment, in the transliteration processing module 1, a machine translation capability of a large language model is adopted to understand a source language grammar and semantics of the object to be translated, so as to generate a translation target language text of the object to be translated;
in the transliteration processing module 1, an understanding process is performed on the source language grammar and the semantics of the object to be translated, and the model weight and parameters of the large language model are adjusted.
In this embodiment, in the creative translation processing module 3, the creative translation processing process adopts a preset creative translation rule as follows: and processing the first translation result and the second translation result by adopting a pruning method.
In this embodiment, the system further includes a prompt word processing module 5, configured to edit a prompt word for the large language model, and transmit the prompt word and the object to be translated together to the large language model; and endowing the large language model with professional translation and middle school Chinese teacher roles through the prompt word.
It should be noted that, because the content of information interaction and execution process between the modules of the above-mentioned apparatus is based on the same concept as the method embodiment in embodiment 1 of the present application, the technical effects brought by the content are the same as the method embodiment of the present application, and specific content can be referred to the description in the foregoing illustrated method embodiment of the present application, which is not repeated herein.
Example 3
Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium having stored therein program code of a large under-model translation processing method, the program code including instructions for executing the large under-model translation processing method of embodiment 1 or any possible implementation thereof.
Computer readable storage media can be any available media that can be accessed by a computer or data storage devices, such as servers, data centers, etc., that contain an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk, SSD), etc.
Example 4
Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
the processor and the memory complete communication with each other through a bus; the memory stores program instructions executable by the processor that invoke the program instructions to perform the large model under-translation processing method of embodiment 1 or any possible implementation thereof.
Specifically, the processor may be implemented by hardware or software, and when implemented by hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor, implemented by reading software code stored in a memory, which may be integrated in the processor, or may reside outside the processor, and which may reside separately.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.).
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a memory device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
While the invention has been described in detail in the foregoing general description and specific examples, it will be apparent to those skilled in the art that modifications and improvements can be made thereto. Accordingly, such modifications or improvements may be made without departing from the spirit of the invention and are intended to be within the scope of the invention as claimed.