Dynamic iteration document translation optimization method and system, storage medium and equipment
Through dynamic iterative document translation methods, chunked translation and loop detection, the problem of mixed source languages in long text documents is solved, the semantic coherence and purity of translation is improved, the cost of error correction is reduced, and the translation efficiency and usability is improved.
Patent Information
- Application Number
- CN202510990167.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-08-19
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In long text document translation, existing large models have mixed source language texts in translation due to insufficient semantic coherence and loss of long-distance information, which affects the availability of professional documents, and existing solutions increase translation costs or are inefficient.
The dynamic iterative document translation method is adopted to translate text blocks through block translation and loop detection, and use a large model to translate text blocks, detect and locate the source language text until the translation remains, including blocking, translation, detection and iteration processes.
It achieves the semantic coherence and translation purity of long document translation, reduces error correction costs, improves cross-language collaboration efficiency, avoids manual proofreading, and does not require additional fine-tuning of the model or building special prompt words.
Smart Images

Figure CN120509420A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of document translation, and in particular relates to a dynamic iterative document translation optimization method, system, storage medium and device. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] In the field of document translation, large models have become one of the most commonly used translation tools due to their excellent natural language understanding and generation capabilities. However, there are many technical difficulties in translating long text documents.
[0004] When translating documents, general-purpose large models often encounter the problem of mixing source and target language text. Existing large models frequently intersperse untranslated source language text in the translated text due to insufficient semantic coherence and long-range information loss when translating long documents. This mixing severely impacts the usability of professional documents such as technical manuals and legal contracts, forcing users to manually filter untranslated content, significantly reducing the efficiency of cross-language collaboration. Furthermore, when the context length exceeds the model's context window, large models are either unable to process or lose long-range dependencies and overall consistency information during processing.
[0005] To address the above issues, existing technologies generally construct professional prompt words, build professional translation large models, or engage in interactive translation. However, the method of constructing professional prompt words requires prompt word optimization to instruct the model to translate in a specific manner. However, the model's sensitivity to prompt words will still decrease as the context grows. In addition, excessively restricting the model's generation direction will cause the model to fail to leverage its advantages in natural language understanding capabilities. Constructing a professional translation large model will incur extremely high translation costs when translating documents in specific fields. Interactive translation requires manual inspection and correction of the model-generated content. The introduction of manual labor will increase translation costs, reduce translation efficiency, and may increase translation errors. Summary of the Invention
[0006] To address these issues, the present invention proposes a dynamic, iterative document translation optimization method, system, storage medium, and device. This method efficiently and effectively identifies and significantly reduces residual source language text in the translated text through fully automated methods. Through intelligent block translation and loop detection and location, it achieves semantic coherence in the translation of long documents while significantly improving the translation purity and usability of professional documents. Compared to traditional approaches, this method improves cross-language collaboration efficiency while avoiding manual secondary proofreading. It also eliminates the need for additional model fine-tuning or the construction of dedicated prompt words, significantly reducing the cost of error correction for long document translations.
[0007] According to some embodiments, the present invention adopts the following technical solutions: A dynamic iterative document translation optimization method includes the following steps: Chunking the text within the document; Use the large model to translate each text block in turn; Check whether the source language text exists in the translated file. If not, directly output the translated document. If it exists, locate the text and the text block where the text exists, organize it into a dictionary format, and translate it again using the large model. Repeat the previous step until the translated document no longer contains text in the source language.
[0008] As an optional implementation, the process of chunking the text in the document includes: calculating similarity scores between sentences using a pre-trained language model, and merging adjacent sentences or paragraphs into one text chunk if the semantic similarity scores of the adjacent sentences or paragraphs exceed a set value; When chunking, the grammatical structure is taken into consideration to ensure that noun phrases and subject-verb-object relationships are not split into different text chunks.
[0009] As an optional implementation, during the process of segmenting the text in the document, the size of each text block is adjusted through the context window mechanism to ensure that the token limit of the large model is not exceeded.
[0010] As an optional implementation method, the process of translating each text block in sequence using the large model includes: embedding each text block in the prompt word of the large model in sequence, setting the source language and target language identifiers, running the large model for translation, extracting the pure target language text, and performing preliminary processing to make it conform to the paragraph and font structure of the original text block, and writing all the translated text blocks after preliminary processing into a new document in numbered order.
[0011] As an optional implementation, the process of detecting whether the source language text before translation exists in the translated file includes: obtaining setting information of the source language and the target language, determining the Unicode encoding range and main character set corresponding to the source language and the target language; Preserve spaces and basic punctuation, remove emoticons and control characters, and split text into words or character sequences; Traverse the text and check whether the character encoding of the text is within the source language Unicode encoding range. If so, perform secondary filtering to determine whether only Chinese characters exist without spaces separating words. If so, determine it as Chinese; if not, determine whether there are Hiragana and Katakana encodings. If so, determine it as Japanese; otherwise, determine whether there is Hangul syllable encoding. If so, determine it as Korean.
[0012] As a further implementation method, in the process of determining the Unicode encoding range and main character set corresponding to the source language and the target language, if the Unicode encoding range corresponding to the source language and the target language involves multiple languages sharing the Unicode encoding range, predetermined characters in the language are extracted, and the predetermined characters include Katakana and Hangul syllables.
[0013] As an optional implementation, the process of locating the text content and the position of the text block where the text is located and organizing it into a dictionary format includes: identifying the text block where the untranslated content is located using a text positioning tool, locating the order of the text block among all text blocks in the file, and organizing the content and position of the text block into a block object in a structured format.
[0014] As an optional implementation, an iteration fuse mechanism is provided in the process of repeating the previous step until the translated document no longer contains text in the source language. When the upper limit of the number of iterations is reached or the predetermined time is reached, or when the number of residual text blocks in the source language is zero in two consecutive detections or the residual block reduction rate is lower than the set threshold, the iteration automatically stops and the final file is output. The residual block reduction rate is the ratio of the difference between the number of residual blocks in the previous round and the number of residual blocks in this round to the number of residual blocks in the previous round.
[0015] A dynamic iterative document translation optimization system, comprising: A chunking module configured to chunk text within a document; A large model translation module is configured to translate each text block in sequence using the large model; A text detection module that detects whether the translated file contains the original text of the original language. The display module is configured to directly output the translated document if it does not exist; The text location and arrangement module is configured to locate the text and the text block where the text is located, if it exists, arrange it into a dictionary format, and call the large model translation module again to translate it using the large model; The iteration module is configured to repeatedly call the text detection module and the text positioning and sorting module until the translated document no longer contains text in the source language.
[0016] A computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed by a processor, the steps in the above method are completed.
[0017] An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps in the above method are completed.
[0018] Compared with the prior art, the present invention has the following beneficial effects: The present invention extracts the text in the document in blocks. The purpose of extracting the text in blocks is to integrate and translate the text with coherent context or that needs to be combined and understood, so as to improve the accuracy of translation. Then, it is detected whether the text of the source language before translation exists in the translated file. If not, it is directly output; if so, the text content and the location of the text are located, and it is organized into a dictionary format and input into the large model for translation again. Then, the previous step is repeated until the text of the source language no longer appears. This solves the problem of mixing the source language and the target language when the large model translates long texts, and only the parts with translation problems are re-translated, which reduces waiting time and improves translation efficiency and accuracy.
[0019] This invention achieves semantic coherence in the translation of long documents, significantly improving the translation purity and usability of professional documents. Compared to traditional solutions, it avoids manual secondary proofreading while improving cross-language collaboration efficiency. It also eliminates the need for additional model fine-tuning or the development of dedicated prompts, significantly reducing the cost of error correction for long document translations.
[0020] This method chunks the document before translation to ensure that text units with coherent context are processed together, rather than isolated fragments, thereby improving the accuracy and consistency of the overall translation. It also considers grammatical structure to ensure that noun phrases or subject-verb-object relationships are not fragmented, thereby avoiding the loss of key context during translation. Furthermore, a context window mechanism is used to adjust the chunk size to ensure that the token limit of the large model is not exceeded, preventing output truncation and reducing post-translation ambiguity. It also improves the model's consistent treatment of synonyms and terms by preserving contextual continuity.
[0021] In the process of source language recognition, the present invention first determines the Unicode encoding range and main character set corresponding to the source language and the target language to ensure that the two can be clearly distinguished. If the Unicode encoding ranges of the two are the same or shared, it is necessary to additionally extract characteristic characters of the language, such as Katakana and Hangul syllables, to assist in subsequent recognition. This can ensure that the source language can be accurately detected in scenarios where the source language and the target language have a certain degree of similarity, such as Chinese to Japanese translation.
[0022] After detecting that the source language text still exists in the translated text block, the present invention marks the text block as untranslated, uses regular expressions to ignore punctuation and format characters, focuses only on the substantive content, and utilizes a cache mechanism to accelerate repeated checks. If no source language residue is found in the entire file, the final translation version is directly output, ending the process and avoiding unnecessary iterations.
[0023] The present invention sets an iterative fuse mechanism, and the upper limit of the number of iterations is controlled by a hyperparameter. When the maximum number of iterations or the time limit is reached, the iterative repetition process is exited to prevent an infinite loop; or when the number of residual text blocks in the source language is zero or the residual block reduction rate is lower than the set threshold in two consecutive detections, the iteration automatically stops and the final file is output. In this way, it can ensure that for certain field proper nouns, trademarks, and terms that have no universal translation, the large model may retain the source language. The processing method can also be set through system configuration, or the user can specify a specific processing strategy, which has a certain degree of flexibility and prevents falling into an infinite loop.
[0024] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0026] Figure 1 This is a flow chart of an embodiment. DETAILED DESCRIPTION
[0027] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0028] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0029] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0030] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.
[0031] Example 1 As mentioned in the background technology, documents generally contain long text content, and large models are prone to mixing the source language and the target language when translating, that is, the model cannot translate every sentence of the source language. Moreover, as the context length increases, the probability of mixing the source language and the target language increases, and the more content appears. This is because when the context is too long or too complex, when the large model generates target language vocabulary, its attention may accidentally and excessively focus on certain specific tags or fragments of the source language, rather than focusing completely on the target language pattern that should be generated. This may cause it to directly copy the content of the source language to the output, which may result in certain errors, and the existing solutions all have certain defects. In order to solve the above problems, this embodiment provides a dynamic iterative document translation optimization method.
[0032] A dynamic iterative document translation optimization method, such as Figure 1 As shown, the following steps are included: Step S1, dividing the text in the target document into blocks; Step S2: using the large model to translate each text block in turn; Step S3: Check whether the source language text before translation exists in the translated document. If not, directly output the translated document. If so, locate the text and the text block where the text exists, organize it into a dictionary format, and translate it again using the large model. Step S4: Step S3 is iterated and repeated continuously until the translated document no longer contains text in the source language.
[0033] In this embodiment, in step S1, the process of dividing the text in the document into blocks includes: using a pre-trained language model to calculate the similarity scores between sentences, and if the semantic similarity scores of adjacent sentences or paragraphs exceed a set value, merging them into a text block; When chunking, the grammatical structure is taken into consideration to ensure that noun phrases and subject-verb-object relationships are not split into different text chunks.
[0034] In this embodiment, during the process of dividing the text in the document into blocks in step S1, the size of each text block is adjusted through the context window mechanism to ensure that the token limit of the large model is not exceeded.
[0035] In this embodiment, in step S2, the process of using the large model to translate each text block in sequence includes: embedding each text block in the prompt word of the large model in sequence, setting the source language and target language identifiers, running the large model for translation, extracting the pure target language text, and performing preliminary processing to make it conform to the paragraph and font structure of the original text block, and writing all the translated text blocks after preliminary processing into a new document in numerical order.
[0036] In this embodiment, in step S3, the process of detecting whether the source language text before translation exists in the translated file includes: obtaining setting information of the source language and the target language, determining the Unicode encoding range and the main character set corresponding to the source language and the target language, if the Unicode encoding range corresponding to the source language and the target language involves multiple languages sharing the Unicode encoding range, extracting predetermined characters in the language, wherein the predetermined characters include Katakana and Hangul syllables; Preserve spaces and basic punctuation, remove emoticons and control characters, and split text into words or character sequences; Traverse the text and check whether the character encoding of the text is within the source language Unicode encoding range. If so, perform secondary filtering to determine whether only Chinese characters exist without spaces separating words. If so, determine it as Chinese; if not, determine whether there are Hiragana and Katakana encodings. If so, determine it as Japanese; otherwise, determine whether there is Hangul syllable encoding. If so, determine it as Korean.
[0037] In this embodiment, in step S3, the process of locating the text content and the position of the text block where the text is located and organizing it into a dictionary format includes: identifying the text block where the untranslated content is located using a text positioning tool, locating the order of the text block among all text blocks in the file, and organizing the content and position of the text block into a block object in a structured format.
[0038] In this embodiment, in step S4, an iteration fuse mechanism is set. When the upper limit of the number of iterations is reached or the predetermined time is reached, or when the number of residual text blocks of the source language is zero in two consecutive detections or the residual block reduction rate is lower than the set threshold, the iteration automatically stops and the final file is output. The residual block reduction rate is the ratio of the difference between the number of residual blocks in the previous round and the number of residual blocks in this round to the number of residual blocks in the previous round.
[0039] Example 2 A dynamic iterative document translation optimization system, comprising: A chunking module configured to chunk text within a document; A large model translation module is configured to translate each text block in sequence using the large model; A text detection module that detects whether the translated file contains the original text of the original language. The display module is configured to directly output the translated document if it does not exist; The text location and arrangement module is configured to locate the text and the text block where the text is located, if it exists, arrange it into a dictionary format, and call the large model translation module again to translate it using the large model; The iteration module is configured to repeatedly call the text detection module and the text positioning and sorting module until the translated document no longer contains text in the source language.
[0040] The following sections describe each module separately, beginning with the chunking module. This module ensures that text units with coherent context are processed together, rather than as isolated fragments, thereby improving overall translation accuracy and consistency. In practice, all modules are run by computers or processors.
[0041] First, we load the document to be translated (e.g., in PDF, doc, docx, or txt file formats), perform a preliminary analysis using a natural language processing algorithm, and calculate similarity scores between sentences using embedding techniques from a pre-trained language model. If adjacent sentences or paragraphs are highly semantically related, they are merged into a single text block.
[0042] At the same time, grammatical structure is taken into consideration to ensure that noun phrases or subject-verb-object relationships are not split to avoid losing key context during translation. For example, if a paragraph describes a sequence of events, all sentences will be integrated into one block; while for a definition paragraph in a technical document, the entire paragraph may be considered as one unit. This process can be implemented using a Python library. The script will generate a set of block objects in a structured format. Each block contains its own number and the complete text within the block, which is convenient for subsequent translation engine processing. The output format of the block object is: {"position": "block_id=1", "text": "text content"}, where block_id corresponds to the sequential identifier of the block.
[0043] In addition, this stage adjusts the chunk size through a context window mechanism to ensure that the token limit of large models is not exceeded and prevent output truncation. This intelligent chunking step not only reduces ambiguity in translation but also improves the model's consistent handling of synonyms and terms by preserving contextual continuity.
[0044] The large model translation module is used to embed the classified text blocks into the prompt words in sequence and call the large model API for translation.
[0045] Specifically, the module first processes the input dictionary {"position": "block_id=1", "text": "text content"}: extracts the source text content in the "text" field and embeds it into predefined prompt words (for example, "Please translate the following text from [source language] to [target language]:") to clarify the translation instructions and avoid model misprocessing; at the same time, when calling, it is necessary to specify large model-related parameters, that is, set the source language and target language identifiers (such as source_lang="en", target_lang="zh"), as well as optional quality control parameters (such as temperature=0.7 to reduce randomness).
[0046] After the large model API returns the translation results in JSON format, this module parses the response, extracts the clean target language text, and performs preliminary processing to ensure that the text blocks conform to the original paragraph and font structure, ensuring that the output is ready for use. Finally, all text blocks are written into a new document in numbered order. This new document is then passed to the text detection module and other modules for subsequent detection and organization. The text detection module is used to scan the entire translated document based on the document's source language to identify any remaining fragments of the source language. The source language is initially entered by the user or detected and confirmed by a large model. A hybrid detection strategy is then used for verification. The verification method is as follows: Step S301: Determine the Unicode code ranges and main character sets corresponding to the source and target languages, and identify the Unicode blocks to which the main characters of each language belong (e.g., Latin, Cyrillic, Kanji, Hiragana, etc.). If multiple languages share Unicode blocks, additional language-specific characters (e.g., Katakana, Hangeul syllables) must be extracted to assist in subsequent recognition. Step S302: retain spaces and basic punctuation marks, remove special symbols such as emoticons and control characters, and segment the text into words or character sequences to facilitate subsequent analysis; Step S303: traverse the text and check whether the character encoding of the text is within the source language Unicode encoding range. If so, execute step S304; Step S304: If the source language and the target language share a Unicode code range, a second filtering is performed. For example, Chinese, Japanese, and Korean are languages that share a Unicode block. If the source language is Chinese and the target language is Japanese, misidentification is likely, and a second filtering is required.
[0047] 1) If there are only Chinese characters and no spaces separating words, it can be determined to be Chinese; 2) If there are Hiragana and Katakana codes, it can be determined to be Japanese; 3) There are Hangul syllable codes, so it can be determined to be Korean.
[0048] If source language text is detected within a block, it is marked as untranslated. This detection mechanism is designed to be efficient and error-tolerant, using regular expressions to ignore punctuation and formatting characters, focusing only on substantive content. A caching mechanism is also employed to accelerate repeated checks. If no traces of source language are found in the entire file, the system outputs the final translation, concluding the process and avoiding unnecessary iterations.
[0049] If residual source language text is found during the detection phase, the text positioning and sorting module is triggered to accurately process these missing parts.
[0050] In this embodiment, the text positioning and sorting module selects and positions text blocks as units to better preserve context information, thereby improving the translation quality of large models.
[0051] In this embodiment, a text location tool can be used to identify the specific text block containing untranslated content and locate the order of this text block within all text blocks in the file. After locating the block, the computer organizes the content and position of the text block into a structured block object, ensuring a uniform data structure for input into downstream modules. The block object structure is: {"position":"block_id=2", "text":"untranslated original text"}.
[0052] This curation process can be implemented using Python scripts, using dictionary or JSON object serialization to ensure seamless data transfer. Intelligent matching logic is also incorporated, such as ignoring formatting control characters (such as line breaks and punctuation) and focusing only on plain text content to reduce noise. The curated dictionary data is then packaged into the API input format and ready to be fed into the large model for re-translation, meaning the large model translation module is repeatedly executed.
[0053] The newly translated segments are then integrated back into the original document, replacing the corresponding text blocks in the original document based on the location information. Because the mixing of source and target language text is highly random, the newly translated text blocks are then retested for residual source language content, essentially repeating the text detection module. This entire process repeats automatically, and if issues persist, the "location-collation-translation" cycle continues.
[0054] The iteration module sets an iteration circuit breaker mechanism. The upper limit of the number of iterations is controlled by hyperparameters. For example, a maximum number of iterations (such as 10) or a time limit (such as 5 minutes) is set to prevent infinite loops. When the number of source language residual text blocks is zero or the residual block reduction rate is less than 5% in two consecutive detections, the iteration automatically stops and the final file is output.
[0055] Among them, the residual block reduction rate = (number of residual blocks in the previous round - number of residual blocks in this round) / number of residual blocks in the previous round.
[0056] In this embodiment, the residual block reduction rate parameter is set because the large model may retain the source language for certain domain-specific terms, trademarks, and terms without a universal translation. The processing method can also be configured through system configuration, or the user can specify a specific processing strategy (such as retention, transliteration, or translation). For example, when translating from English to Chinese, for source languages without suitable Chinese translations, such as Transformer and English brand abbreviations, the large model will retain the English language during translation.
[0057] Example 3 A computer-readable storage medium is used to store computer instructions, which, when executed by a processor, complete the steps of the method provided in embodiment 1.
[0058] Example 4 An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps of the method provided in embodiment 1 are completed.
[0059] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of one or more computer-usable storage media (including but not limited to disk storage, CD - ROM , optical storage, etc.).
[0060] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0061] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0062] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0063] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made by those skilled in the art that fall within the spirit and principles of the present invention and do not require creative effort are intended to be within the scope of protection of the present invention.
Claims
1. A dynamic iterative document translation optimization method, characterized by: The following steps are involved: Chunking the text within the document; Use the large model to translate each text block in turn; Check whether the source language text exists in the translated file. If not, directly output the translated document. If it exists, locate the text and the text block where the text exists, organize it into a dictionary format, and translate it again using the large model. Repeat the previous step until the translated document no longer contains text in the source language.
2. The method for dynamic iterative document translation optimization according to claim 1, wherein: The process of chunking text in a document includes: using a pre-trained language model to calculate the similarity scores between sentences. If the semantic similarity scores of adjacent sentences or paragraphs exceed a set value, they are merged into one text chunk; When chunking, the grammatical structure is taken into consideration to ensure that noun phrases and subject-verb-object relationships are not split into different text chunks.
3. The method for dynamic iterative document translation optimization according to claim 1, wherein: In the process of chunking the text in the document, the size of each text chunk is adjusted through the context window mechanism to ensure that the token limit of the large model is not exceeded.
4. The method for dynamically iterating document translation optimization according to claim 1, wherein: The process of using the large model to translate each text block in sequence includes: embedding each text block in the prompt word of the large model in sequence, setting the source language and target language identifiers, running the large model for translation, extracting the pure target language text, and performing preliminary processing to make it conform to the paragraph and font structure of the original text block, and writing all the translated text blocks after preliminary processing into a new document in numbered order.
5. The method for dynamically iterating document translation optimization according to claim 1, wherein: The process of detecting whether the source language text before translation exists in the translated file includes: obtaining setting information of the source language and the target language, determining the Unicode encoding range and the main character set corresponding to the source language and the target language, and if the Unicode encoding range corresponding to the source language and the target language involves multiple languages sharing the Unicode encoding range, extracting predetermined characters in the language, wherein the predetermined characters include Katakana and Hangul syllables; Preserve spaces and basic punctuation, remove emoticons and control characters, and split text into words or character sequences; Traverse the text and check whether the character encoding of the text is within the source language Unicode encoding range. If so, perform secondary filtering to determine whether only Chinese characters exist without spaces separating words. If so, determine it as Chinese; if not, determine whether there are Hiragana and Katakana encodings. If so, determine it as Japanese; otherwise, determine whether there is Hangul syllable encoding. If so, determine it as Korean.
6. The method for dynamic iterative document translation optimization according to claim 1, wherein: The process of locating the text content and the position of the text block where the text is located and arranging it into a dictionary format includes: identifying the text block where the untranslated content is located by a text locating tool, locating the order of the text block in all text blocks in the file, and arranging the content and position of the text block into a block object in a structured format.
7. The method for dynamic iterative document translation optimization according to claim 1, wherein: Repeat the previous step until the translated document no longer contains text in the source language. An iterative fuse mechanism is set up. When the upper limit of the number of iterations is reached or the predetermined time is reached, or when the number of residual text blocks in the source language is zero in two consecutive detections or the residual block reduction rate is lower than the set threshold, the iteration automatically stops and the final file is output. The residual block reduction rate is the ratio of the difference between the number of residual blocks in the previous round and the number of residual blocks in this round to the number of residual blocks in the previous round.
8. A dynamic iterative document translation optimization system, characterized by: include: A chunking module configured to chunk text within a document; A large model translation module is configured to translate each text block in sequence using the large model; A text detection module that detects whether the translated file contains the original text of the original language. The display module is configured to directly output the translated document if it does not exist; The text location and arrangement module is configured to locate the text and the text block where the text is located, if it exists, arrange it into a dictionary format, and call the large model translation module again to translate it using the large model; The iteration module is configured to repeatedly call the text detection module and the text positioning and sorting module until the translated document no longer contains text in the source language.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The method comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein the steps of the method according to any one of claims 1 to 7 are completed when the computer instructions are executed by the processor.
Citation Information
Patent Citations
Program source code detection method and apparatus, and electronic device
CN106844192A
Document translation omission item processing method
CN107590140A
Machine translation method and device, electronic equipment and storage medium
CN110334360A
Machine translation method and device, equipment and storage medium
CN114936566A
Certificate translation omission detection method and device and storage medium
CN116451710A
Cited By
Man-machine collaborative interactive translation and optimization system and method for English long and difficult sentences
CN121168478A