Document translation method and system, electronic equipment and storage medium

By introducing the above information sequence pairs in the document translation system, translating sentence by sentence and checking and modifying, the problem that the sentence-level translation model cannot refer to the above information is solved, and the accuracy and coherence of document translation are improved.

CN119150890APending Publication Date: 2024-12-17IOL WUHAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411317898.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The existing machine translation system is based on the sentence level and cannot effectively utilize context information, resulting in insufficient translation consistency. Especially in the translation of different sentences in long documents, there may be inconsistencies, and the above information cannot be referenced, which reduces the translation of document. Accuracy.

Method used

By obtaining all sentences and corresponding translations before the current sentence of the document to be translated as a sequence of information above, the translation sentence by sentence is performed based on the document translation model until the document translation is completed, and the candidate translations are checked and modified to ensure the consistency of translations. Sex and accuracy.

Benefits of technology

It significantly improves the quality of document-level translation, improves the accuracy of document translation, overcomes the limitations of traditional sentence-level translation models, and makes the translation results more coherent and consistent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119150890A_ABST
    Figure CN119150890A_ABST
Patent Text Reader

Abstract

The invention provides a document translation method and system, electronic equipment and a storage medium. The method comprises the steps of obtaining a to-be-translated document; and under the condition that the current sentence of the to-be-translated document is not the first sentence, taking all sentences before the current sentence and corresponding translations of all sentences before the current sentence as previous information sequence pairs, and performing sentence-by-sentence translation on the current sentence in the to-be-translated document based on the previous information sequence pairs, obtaining candidate document translations of the to-be-translated document until the to-be-translated document is completely translated; and checking and modifying the candidate document translations to obtain a target document translation of the to-be-translated document. In the process, the previous information sequence pair is introduced into the current translation, so that the previous information can be referred to when the current sentence is translated, the limitation of a traditional sentence-level translation model is overcome, the quality of document-level translation is remarkably improved, and the accuracy of document translation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a document translation method, system, electronic device and storage medium. Background Art

[0002] Natural Language Processing (NLP) is the use of machine learning to analyze the structure and meaning of text. Natural Language Processing usually involves machine translation, which is the process of using artificial intelligence to automatically translate text from one language to another.

[0003] Existing machine translation systems are mainly based on sentence-level translation models. This approach has the following limitations: 1) Translation consistency cannot be guaranteed: Since the contextual information between sentences cannot be effectively utilized, the translation results often lack coherence, especially in long documents, where there may be inconsistencies in the translation between different sentences; 2) Unable to refer to previous context information: Traditional sentence-level translation models cannot refer to previous context information when processing each sentence. Summary of the invention

[0004] The present invention provides a document translation method, system, electronic device and storage medium, which are used to solve the defects of sentence-level translation models in the prior art that translation consistency cannot be guaranteed and context information cannot be referenced, thereby reducing the accuracy of document translation.

[0005] The present invention provides a document translation method, comprising the following steps: Get the document to be translated; In the case that the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and corresponding translations of all sentences before the current sentence are used as a context information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the context information sequence pair until the translation of the document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; The candidate document translation is checked and modified to obtain the target document translation of the document to be translated.

[0006] According to a document translation method provided by the present invention, the current sentence in the document to be translated is translated sentence by sentence based on the above information sequence until the translation of the document to be translated is completed to obtain a candidate document translation of the document to be translated, including: Based on the document translation model and the above information sequence, the current sentence in the document to be translated is translated sentence by sentence until the translation of the document to be translated is completed, thereby obtaining the candidate document translation; The training steps of the document translation model include: Obtain sentence-level parallel corpus pairs and determine the initial large language model; Based on the parallel corpus pair, the initial large language model is trained to obtain the large language model; Based on the document corpus pairs, the large language model is trained to obtain the document translation model.

[0007] According to a document translation method provided by the present invention, the large language model is trained based on the document corpus pair to obtain the document translation model, including: Obtaining a sample document in the document corpus pair and a sample label translation corresponding to the sample document; In the case where the sample current sentence of the sample document is not the first sentence, all sentences before the sample current sentence and corresponding translations of all sentences before the sample current sentence are used as sample context information sequence pairs, and the sample context information sequence pairs are input into the large language model to perform sentence-by-sentence translation of the sample current sentence in the sample document to obtain a sample predicted translation of the sample current sentence; Based on the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, the large language model is iterated on parameters to obtain the document translation model.

[0008] According to a document translation method provided by the present invention, the initial large language model is trained based on the parallel corpus pair to obtain the large language model, including: Obtaining sample sentences and labeled translations of the sample sentences in the parallel corpus pair, and determining an initial large language model; The sample sentence is input into the initial large language model to obtain a predicted translation output by the initial large language model, and based on the difference between the predicted translation and the label translation, the parameters of the initial large language model are iterated to obtain the large language model.

[0009] According to a document translation method provided by the present invention, the checking and modifying the candidate document translation to obtain the target document translation of the document to be translated includes: Based on the large language model and the first prompt text, a consistency check is performed on the candidate document translation to obtain modification suggestions; Based on the modification suggestions, the candidate document translation is modified to obtain the target document translation.

[0010] According to a document translation method provided by the present invention, the candidate document translation is modified based on the modification suggestion to obtain the target document translation, including: Based on the large language model, the second prompt text, and the modification suggestion, the candidate document translation is modified to obtain the target document translation.

[0011] The present invention also provides a document translation system, comprising the following modules: An acquisition unit, used for acquiring a document to be translated; A candidate document translation determination unit is used to, when the current sentence of the document to be translated is not the first sentence, use all sentences before the current sentence and corresponding translations of all sentences before the current sentence as a context information sequence pair, and translate the current sentence in the document to be translated sentence by sentence based on the context information sequence pair until the translation of the document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; The target document translation determination unit is used to check and modify the candidate document translation to obtain the target document translation of the document to be translated.

[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the document translation methods described above is implemented.

[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the document translation method described in any one of the above is implemented.

[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the document translation method described above is implemented.

[0015] The document translation method, system, electronic device and storage medium provided by the present invention obtain a document to be translated; when the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and the corresponding translations of all sentences before the current sentence are used as a previous information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the previous information sequence pair until the translation of the entire document to be translated is completed, and a candidate document translation of the document to be translated is obtained, and finally, the candidate document translation is checked and modified to obtain a target document translation of the document to be translated. This process introduces the previous information sequence pair into the current translation, so that the previous information can be referenced when translating the current sentence, overcomes the limitations of the traditional sentence-level translation model, significantly improves the quality of document-level translation, and improves the accuracy of document translation. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0017] Figure 1 This is one of the flow charts of the document translation method provided by the present invention.

[0018] Figure 2 This is the second flowchart of the document translation provided by the present invention.

[0019] Figure 3 It is a structural diagram of the document translation system provided by the present invention.

[0020] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0022] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or precedence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type.

[0023] Figure 1 It is one of the flowcharts of the document translation method provided by the present invention, such as Figure 1 As shown, the method includes step 110 , step 120 and step 130 .

[0024] Step 110: Obtain the document to be translated.

[0025] Specifically, a document to be translated may be obtained, where the document to be translated here is a document that needs to be translated later. The document to be translated may be a document formed by text directly input by a user, or a document formed by text obtained by voice transcription of collected audio, or a document formed by text obtained by performing OCR (Optical Character Recognition) on an image obtained by an image acquisition device such as a scanner, mobile phone, or camera. The embodiment of the present invention does not specifically limit this.

[0026] Step 120, when the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and the corresponding translations of all sentences before the current sentence are used as a context information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the context information sequence pair until the translation of the entire document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated.

[0027] Specifically, when the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and the corresponding translations of all sentences before the current sentence can be used as the above-text information sequence pair, and based on the document translation model and the above-text information sequence pair, the current sentence in the document to be translated is translated sentence by sentence until the entire document to be translated is completed, thereby obtaining the candidate document translation of the document to be translated.

[0028] For example, when translating each sentence of a document to be translated (such as the Nth sentence), the original text and the translated text of the previous sentence (the N-1th sentence) are input into the document translation model as a previous information sequence pair (historical information). This enables the document translation model to refer to the previous information, so that in long documents, the coherence of the translation between different sentences is guaranteed, thereby generating a coherent and accurate translation, thereby improving the accuracy of document translation.

[0029] Here, the document translation model may be a Large Language Model (LLM), etc., which is not specifically limited in the embodiment of the present invention.

[0030] It should be noted that, when the current sentence of the document to be translated is the first sentence, the current sentence can be translated directly based on the document translation model to obtain the corresponding translation of the current sentence, and then the subsequent translation of the subsequent sentences of the current sentence can use the first sentence and the corresponding translation of the first sentence as a reference to the above information sequence pair.

[0031] Step 130: Check and modify the candidate document translation to obtain the target document translation of the document to be translated.

[0032] Specifically, after obtaining the candidate document translation, the candidate document translation may be checked and modified to obtain the target document translation of the document to be translated. Here, the target document translation is the final translation of the document to be translated.

[0033] For example, the document translation model itself can be used to perform a consistency check on the entire document. At this time, the document translation model will analyze the entire translation and make modification suggestions.

[0034] Combined with the modification suggestions proposed by the document translation model, the candidate document translation is revised to finally generate a high-quality target document translation.

[0035] It can be understood that the embodiments of the present invention can utilize the multi-round translation capability of the document translation model to introduce the above information into the current translation, so that the above information can be referenced when translating the current sentence, overcoming the limitations of the traditional sentence-level translation model and significantly improving the quality of document-level translation.

[0036] The method provided by the embodiment of the present invention obtains a document to be translated; when the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and the corresponding translations of all sentences before the current sentence are used as a previous information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the previous information sequence pair until the translation of the entire document to be translated is completed, and a candidate document translation of the document to be translated is obtained, and finally, the candidate document translation is checked and modified to obtain a target document translation of the document to be translated. This process introduces the previous information sequence pair into the current translation, so that the previous information can be referenced when translating the current sentence, which overcomes the limitations of the traditional sentence-level translation model, significantly improves the quality of document-level translation, and improves the accuracy of document translation.

[0037] Based on the above embodiment, the step 120 of translating the current sentence in the document to be translated sentence by sentence based on the above information sequence until the translation of the document to be translated is completed to obtain the candidate document translation of the document to be translated includes: Step 121, based on the document translation model and the above information sequence, the current sentence in the document to be translated is translated sentence by sentence until the translation of the document to be translated is completed, thereby obtaining the candidate document translation; The training steps of the document translation model include: Step 1211, obtaining sentence-level parallel corpus pairs and determining an initial large language model; Step 1212: training the initial large language model based on the parallel corpus pair to obtain the large language model; Step 1213: training the large language model based on the document corpus pair to obtain the document translation model.

[0038] Specifically, after obtaining the above information sequence pair, the current sentence in the document to be translated can be translated sentence by sentence based on the document translation model and the above information sequence pair until the document to be translated is completely translated to obtain the candidate document translation.

[0039] The training steps of the document translation model include: Obtain sentence-level parallel corpus pairs and determine the initial large language model.

[0040] Based on the parallel corpus pairs, the initial large language model is trained to obtain a large language model; Based on the document corpus pairs, a large language model is trained to obtain a document translation model.

[0041] For example, given a parallel corpus pair, the original text in the parallel corpus pair consists of three consecutive sentences (s1, s2, s3), and the corresponding translation part consists of (t1, t2, t3). During the training process, (s1:t1, s2:t2) is used as the historical dialogue information, and (s3:t3) is used as the current content to be translated to construct the training sample. In this way, the large language model can learn how to use the previous information for more accurate translation, thereby improving its multi-round translation performance.

[0042] The method provided by the embodiment of the present invention 1. fine-tunes a large language model by constructing multi-round translation data, so that the large language model has multi-round translation capabilities; 2. utilizes the multi-round translation capabilities of the large language model to introduce the above information into the current translation, so that the above information can be referenced when translating the current sentence.

[0043] Based on the above embodiment, step 1213 includes: Step 210, obtaining a sample document in the document corpus pair and a sample label translation corresponding to the sample document; Step 220, when the sample current sentence of the sample document is not the first sentence, all sentences before the sample current sentence and corresponding translations of all sentences before the sample current sentence are used as sample context information sequence pairs, and the sample context information sequence pairs are input into the large language model to perform sentence-by-sentence translation of the sample current sentence in the sample document to obtain a sample predicted translation of the sample current sentence; Step 230 , based on the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, iterate the parameters of the large language model to obtain the document translation model.

[0044] Specifically, first, a sample document in a document corpus pair and a sample label translation corresponding to the sample document are obtained.

[0045] When the sample current sentence of the sample document is not the first sentence, all sentences before the sample current sentence and the corresponding translations of all sentences before the sample current sentence are taken as sample context information sequence pairs, and the sample context information sequence pairs are input into the large language model to perform sentence-by-sentence translation of the sample current sentence in the sample document to obtain a sample predicted translation of the sample current sentence.

[0046] After obtaining a sample predicted translation based on a large language model, a loss function value may be determined based on a difference between the sample predicted translation and a sample label translation corresponding to the sample predicted translation.

[0047] It can be understood that the greater the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, the greater the loss function value; the smaller the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, the smaller the loss function value.

[0048] Then, the parameters of the large language model are iterated based on the loss function value, and the large language model after the parameter iteration is used as the document translation model.

[0049] It is understandable that in this way, the document translation model can learn how to use previous information for more accurate translation, thereby improving its multi-round translation performance.

[0050] Based on the above embodiment, step 1212 includes: Step 310, obtaining sample sentences in the parallel corpus pair and labeled translations of the sample sentences, and determining an initial large language model; Step 320: input the sample sentence into the initial large language model to obtain a predicted translation output by the initial large language model, and perform parameter iteration on the initial large language model based on the difference between the predicted translation and the label translation to obtain the large language model.

[0051] Specifically, current open source large models usually have some translation capabilities, taking the qwen2 7b model as an example. Input sentence: Translate the following sentence into English. The weather is quite nice today. The answer will be: The weather is quite nice today. However, in general, the translation quality of general models is not particularly good. Therefore, the embodiment of the present invention needs to use a large amount of sentence-level parallel corpus to perform supervised fine-tuning (SFT) on the large model to improve the basic translation performance of the model.

[0052] Furthermore, in order to improve the basic translation performance of the large language model, we can first train the large language model to translate a single sentence, improve the accuracy of the large language model in translating a single sentence, and lay a solid foundation for subsequent multiple rounds of translation fine-tuning.

[0053] First, sample sentences and labeled translations of the sample sentences can be obtained, and an initial large language model can be determined.

[0054] The parameters of the initial large language model here may be randomly generated or preset, and the embodiment of the present invention does not specifically limit this.

[0055] After obtaining the sample sentences, the sample sentences can be input into the large language model to obtain the predicted translation output by the large language model. After obtaining the predicted translation, the loss function value can be calculated based on the difference between the predicted translation and the label translation, and the parameters of the initial large language model can be iterated based on the loss function value, and the initial large language model after the parameter iteration is used as the large language model.

[0056] Furthermore, a target loss can be determined based on the difference between the predicted translation and the label translation, and parameters of the initial large language model can be iterated based on the target loss to obtain a large language model.

[0057] It is understandable that the greater the difference between the predicted translation and the labeled translation, the greater the target loss; the smaller the difference between the predicted translation and the labeled translation, the smaller the target loss. The target loss here can be a cross entropy loss, etc., which is not specifically limited in the embodiment of the present invention.

[0058] Based on the above embodiment, step 130 includes: Step 131, based on the large language model and the first prompt text, performing consistency check on the candidate document translation to obtain modification suggestions; Step 132: based on the modification suggestion, modify the candidate document translation to obtain the target document translation.

[0059] Specifically, based on the large language model and the first prompt text, the candidate document translations can be checked for consistency to obtain modification suggestions.

[0060] Here, the first prompt text prompt may be "You are a translation assistant. Please carefully analyze the given original text and translation, and point out the inappropriate translation parts, especially the translation consistency errors, and give modification suggestions."

[0061] Then, based on the modification suggestions, the candidate document translation is revised to obtain the target document translation.

[0062] It should be noted that the large language model plays the role of translation checking in this process, so that the large language model can check the translation consistency errors in the candidate document translations.

[0063] Among them, the candidate document translations can be d1, d2, d3, and the target document translations can be k1, k2, k3.

[0064] Based on the above embodiment, step 132 includes: Step 1321: based on the large language model, the second prompt text, and the modification suggestion, the candidate document translation is modified to obtain the target document translation.

[0065] Specifically, the candidate document translation may be corrected using a large language model and a prompt text. For example, based on the large language model and the second prompt text, as well as modification suggestions, the candidate document translation may be corrected to obtain a target document translation.

[0066] It should be noted that the large language model plays the role of translation modification in this process, so that the large language model can modify the candidate document translation based on the modification suggestions to obtain a more accurate target document translation.

[0067] Here, the second prompt text may be "You are a translation assistant, please modify the translation according to the revision suggestions of the translation expert."

[0068] Based on any of the above embodiments, Figure 2 This is the second flowchart of the document translation provided by the present invention. Figure 2 As shown, the method includes: The first step is to obtain a large open source model with dialogue function, such as Qwen2-7B-Instruct, and obtain authorization according to the application scenario.

[0069] The second step is to collect sentence-level parallel corpus pairs (s, t), where s is the original text and t is the translation. For example (Today is a nice day).

[0070] The third step is to construct training data to fine-tune the large language model (document translation model) to improve basic translation capabilities. A training example is as follows: [{"role": "system", "content": "You are a translation assistant."},

[0071] {"role": "user", "content": "Translate text into English\nIt's a nice day today"} ,

[0072] {"role": "assistant", "content": “Today is a nice day”}]

[0073] The third step is to collect paragraph-level parallel corpus pairs (s, t), where s is the source document and t is the target document. s and t consist of consecutive sentences.

[0074] The fourth step is to construct a multi-round translation training set, fine-tune the large language model, and improve the multi-round translation capability of the large language model. A training example is as follows: [{"role": "system", "content": "You are a translation assistant."},

[0075] {"role": "user", "content": "Translate text into English\n s1"} ,

[0076] {"role": "assistant", "content": t1},

[0077] {"role": "user", "content": "Translate text into English\n s2"} ,

[0078] {"role": "assistant", "content": t2},

[0079] {"role": "user", "content": "Translate text into English\n s3"} ,

[0080] {"role": "assistant", "content": t3} ]

[0081] Step 6: For a given document d to be translated, which consists of (d1, d2, d3), use the large language model to translate sentence by sentence. First, translate d1 into k1, and then use (d1, k1) as historical information to translate d2. This process continues until all translations are completed.

[0082] Step 7: Construct prompts to make the large language model act as a translation checker. For example, if you are a translation assistant, please carefully analyze the given original text and translation, and point out the inappropriate translations, especially the translation consistency errors, and give modification suggestions. Original text: d1, d2, d3 Translation: k1, k2, k3.

[0083] Step 8: Construct prompts to make the big model play the role of translation modification. For example: You are a translation assistant. Please modify the translation according to the modification suggestions of the translation expert. Original text: d1, d2, d3 Translation: k1, k2, k3. Modification suggestions: (output of step 7).

[0084] Step 9. The output of step 8 is the final translation of the target document.

[0085] The method provided by the embodiment of the present invention comprises the following steps: 1. fine-tuning a large language model by constructing multi-round translation data, so that the large language model has the ability of multi-round translation; 2. using the multi-round translation ability of the large language model, introducing the previous information into the current translation, so that the previous information can be referred to when translating the current sentence; 3. using the instruction ability of the general large model itself, checking and correcting the consistency of the translation results. This further improves the accuracy of document translation.

[0086] That is, the embodiment of the present invention proposes a document translation method based on a large language model technology to address the deficiencies of the prior art. The method fine-tunes the large language model so that the large language model has the ability to perform multiple rounds of translation, thereby achieving the effect of document translation. In addition, the candidate document translation is further corrected in combination with the ability characteristics of the large language model itself.

[0087] The document translation system provided by the present invention is described below. The document translation system described below and the document translation method described above can be referenced to each other.

[0088] Based on any of the above embodiments, the present invention provides a document translation system. Figure 3 is a schematic diagram of the structure of the document translation system provided by the present invention, such as Figure 3 As shown, the system includes: An acquisition unit 301 is used to acquire a document to be translated; The candidate document translation determination unit 302 is used for, when the current sentence of the document to be translated is not the first sentence, taking all sentences before the current sentence and corresponding translations of all sentences before the current sentence as a context information sequence pair, and translating the current sentence in the document to be translated sentence by sentence based on the context information sequence pair until the translation of the document to be translated is completed, thereby obtaining the candidate document translation of the document to be translated; The target document translation determination unit 303 is used to check and modify the candidate document translation to obtain the target document translation of the document to be translated.

[0089] The system provided by the embodiment of the present invention obtains a document to be translated; when the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and the corresponding translations of all sentences before the current sentence are used as a previous information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the previous information sequence pair until the translation of the entire document to be translated is completed, and a candidate document translation of the document to be translated is obtained, and finally, the candidate document translation is checked and modified to obtain a target document translation of the document to be translated. This process introduces the previous information sequence pair into the current translation, so that the previous information can be referenced when translating the current sentence, which overcomes the limitations of the traditional sentence-level translation model, significantly improves the quality of document-level translation, and improves the accuracy of document translation.

[0090] Based on any of the above embodiments, the candidate document translation determination unit 302 is specifically used to: Based on the document translation model and the above information sequence, the current sentence in the document to be translated is translated sentence by sentence until the translation of the document to be translated is completed, thereby obtaining the candidate document translation; It also includes a document translation model training unit, which is specifically used to: Determine an initial model unit for obtaining sentence-level parallel corpus pairs and determining an initial large language model; Determine a large language model unit, which is used to train the initial large language model based on the parallel corpus pair to obtain the large language model; A document translation model unit is determined, which is used to train the large language model based on the document corpus pair to obtain the document translation model.

[0091] Based on any of the above embodiments, the unit for determining the document translation model is specifically used for: Obtaining a sample document in the document corpus pair and a sample label translation corresponding to the sample document; In the case where the sample current sentence of the sample document is not the first sentence, all sentences before the sample current sentence and corresponding translations of all sentences before the sample current sentence are used as sample context information sequence pairs, and the sample context information sequence pairs are input into the large language model to perform sentence-by-sentence translation of the sample current sentence in the sample document to obtain a sample predicted translation of the sample current sentence; Based on the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, the large language model is iterated on parameters to obtain the document translation model.

[0092] Based on any of the above embodiments, the determining of the initial model unit is specifically used for: Determine an initial model unit, which is used to obtain a sample sentence and a labeled translation of the sample sentence, and determine an initial large language model; A parameter iteration unit is used to input the sample sentence into the initial large language model to obtain a predicted translation output by the initial large language model, and based on the difference between the predicted translation and the label translation, perform parameter iteration on the initial large language model to obtain the large language model.

[0093] Based on any of the above embodiments, the target document translation determination unit 303 is specifically used for: Determine a modification suggestion unit, which is used to perform consistency check on the candidate document translation based on the large language model and the first prompt text to obtain modification suggestions; The correction unit is used to correct the candidate document translation based on the modification suggestion to obtain the target document translation.

[0094] Based on any of the above embodiments, the correction unit is specifically used to: Based on the large language model, the second prompt text, and the modification suggestion, the candidate document translation is modified to obtain the target document translation.

[0095] Figure 4 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the document translation method, which includes: obtaining a document to be translated; when the current sentence of the document to be translated is not the first sentence, taking all sentences before the current sentence and the corresponding translations of all sentences before the current sentence as a pair of above-text information sequences, and translating the current sentence in the document to be translated sentence by sentence based on the above-text information sequence pairs until the translation of the document to be translated is completed, and obtaining the candidate document translation of the document to be translated; checking and modifying the candidate document translation to obtain the target document translation of the document to be translated.

[0096] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0097] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the document translation method provided by the above methods, which method includes: obtaining a document to be translated; when the current sentence of the document to be translated is not the first sentence, taking all sentences before the current sentence and the corresponding translations of all sentences before the current sentence as a context information sequence pair, and translating the current sentence in the document to be translated sentence by sentence based on the context information sequence pair until the translation of the entire document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; and checking and modifying the candidate document translation to obtain a target document translation of the document to be translated.

[0098] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the document translation method provided by the above-mentioned methods, the method comprising: obtaining a document to be translated; when a current sentence of the document to be translated is not the first sentence, taking all sentences before the current sentence and corresponding translations of all sentences before the current sentence as a context information sequence pair, and translating the current sentence in the document to be translated sentence by sentence based on the context information sequence pair until the translation of the entire document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; and checking and modifying the candidate document translation to obtain a target document translation of the document to be translated.

[0099] The system embodiment described above is merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A document translation method, characterized in that: include: Get the document to be translated; In the case that the current sentence of the document to be translated is not the first sentence, all sentences before the current sentence and corresponding translations of all sentences before the current sentence are used as a context information sequence pair, and the current sentence in the document to be translated is translated sentence by sentence based on the context information sequence pair until the translation of the document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; The candidate document translation is checked and modified to obtain the target document translation of the document to be translated.

2. The document translation method according to claim 1, characterized in that: The step of translating the current sentence in the document to be translated sentence by sentence based on the above information sequence until the translation of the document to be translated is completed to obtain a candidate document translation of the document to be translated includes: Based on the document translation model and the above information sequence, the current sentence in the document to be translated is translated sentence by sentence until the translation of the document to be translated is completed, thereby obtaining the candidate document translation; The training steps of the document translation model include: Obtain sentence-level parallel corpus pairs and determine the initial large language model; Based on the parallel corpus pair, the initial large language model is trained to obtain the large language model; Based on the document corpus pairs, the large language model is trained to obtain the document translation model.

3. The document translation method according to claim 2, characterized in that: The step of training the large language model based on the document corpus pair to obtain the document translation model includes: Obtaining a sample document in the document corpus pair and a sample label translation corresponding to the sample document; In the case where the sample current sentence of the sample document is not the first sentence, all sentences before the sample current sentence and corresponding translations of all sentences before the sample current sentence are used as sample context information sequence pairs, and the sample context information sequence pairs are input into the large language model to perform sentence-by-sentence translation of the sample current sentence in the sample document to obtain a sample predicted translation of the sample current sentence; Based on the difference between the sample predicted translation and the sample label translation corresponding to the sample predicted translation, the large language model is iterated on parameters to obtain the document translation model.

4. The document translation method according to claim 3, characterized in that: The step of training the initial large language model based on the parallel corpus pair to obtain the large language model comprises: Obtaining sample sentences and labeled translations of the sample sentences in the parallel corpus pair, and determining an initial large language model; The sample sentence is input into the initial large language model to obtain a predicted translation output by the initial large language model, and based on the difference between the predicted translation and the label translation, the parameters of the initial large language model are iterated to obtain the large language model.

5. The document translation method according to any one of claims 1 to 3, characterized in that: The checking and modifying the candidate document translation to obtain the target document translation of the document to be translated includes: Based on the large language model and the first prompt text, a consistency check is performed on the candidate document translation to obtain modification suggestions; Based on the modification suggestions, the candidate document translation is modified to obtain the target document translation.

6. The document translation method according to claim 5, characterized in that: The step of modifying the candidate document translation based on the modification suggestion to obtain the target document translation includes: Based on the large language model, the second prompt text, and the modification suggestion, the candidate document translation is modified to obtain the target document translation.

7. A document translation system, characterized in that: include: An acquisition unit, used for acquiring a document to be translated; A candidate document translation determination unit is used to, when the current sentence of the document to be translated is not the first sentence, use all sentences before the current sentence and corresponding translations of all sentences before the current sentence as a context information sequence pair, and translate the current sentence in the document to be translated sentence by sentence based on the context information sequence pair until the translation of the document to be translated is completed, thereby obtaining a candidate document translation of the document to be translated; The target document translation determination unit is used to check and modify the candidate document translation to obtain the target document translation of the document to be translated.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the document translation method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the document translation method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the document translation method according to any one of claims 1 to 6 is implemented.