A contract document translation method and system based on large model

Through large-model-based text segmentation and translation algorithms, the problems of position correspondence and professional information processing in contract document translation are solved, achieving efficient and accurate translation results, and improving user experience and document quality.

CN120509421BActive Publication Date: 2025-09-12INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510998190.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-09-12
Estimated Expiration
2045-07-21

AI Technical Summary

Technical Problem

When translating contract documents, existing technologies have difficulty in accurately restoring the positional correspondence between the original text and the translated text, and are unable to effectively process the professional terms and image feature information in the contract documents, resulting in low translation efficiency, poor accuracy, and a poor user reading experience.

Method used

A large-model-based text segmentation and translation algorithm is used to identify text position features, merge text blocks of the same paragraph, split incoherent text blocks, and use pre-trained models and professional knowledge bases to translate fixed texts, ensuring the positional correspondence and professionalism of the translated documents.

Benefits of technology

It improves translation efficiency and accuracy, enhances user reading experience, ensures format consistency and professionalism of translated documents, and guarantees the correct location and integrity of image information in the new document.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509421B_ABST
    Figure CN120509421B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of contract document translation and provides a contract document translation method and system based on a large model. The method obtains a target contract document, identifies images in the target contract document, converts them into text, and uses the identified line breaks as block markers for the text in the target contract document. The text is initially segmented with page numbers as the largest unit to form multiple text blocks. During the initial segmentation, character features in each block are identified. According to the identified character features, the text blocks are corrected, text blocks belonging to the same paragraph are merged, and text blocks of incoherent text are split. The pre-trained large model is used to translate the corrected text blocks, and the translated text blocks are written into a new file in a form consistent with their corresponding character features to obtain the translated contract document. The present invention improves the professionalism, accuracy and readability of the translated document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of contract document translation, and in particular relates to a contract document translation method and system based on a large model. 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, there are many technical difficulties, especially when dealing with documents such as contracts that have special formatting and professional content.

[0004] First of all, there are various types of contract documents, including image-type documents and text-type documents. Each type of document includes many forms. For example, image-type documents include png, jpg and image-type pdf files, and text-type documents include wps, doc, docx and text-version pdf files. The text information of different types of documents is read in different ways. Image-type documents usually require the assistance of OCR technology to read text information, while text-type documents can generally be read directly. Regardless of the method, it is crucial to record the position information of the text block while reading the text information. However, when translating documents, the existing technology mostly only focuses on the translation of the document content, and rarely considers the spatial correspondence between the original text and the translated text. This results in the user being unable to accurately find the original text corresponding to the translated text when reading the translated text, reducing reading efficiency and experience.

[0005] Secondly, unlike the simple typesetting of ordinary text documents, contracts are unique in that specific information often appears in specific locations. For example, in a procurement contract, Party A's and Party B's information may appear on the same line, aligned left and right, respectively. However, these two types of information often need to be extracted as separate text blocks for translation, otherwise errors may occur. Furthermore, personalized information such as font size, alignment, indentation, margin markings, and signature watermarks can reduce the accuracy of the computer's segmentation of text blocks, further impacting translation accuracy.

[0006] On the other hand, contract texts often contain a large amount of specialized terminology and organizational information, such as company names and specific titles. This information is often concentrated in headers and footers. Existing technologies using general-purpose large language models often struggle to ensure accuracy when translating such highly specialized or specific texts. Fine-tuning the model by collecting specialized corpus is associated with high data acquisition and training costs.

[0007] Finally, how to properly handle characteristic information in the form of images, such as organization, company, and individual logos or signatures in contract documents, and ensure their correct position and integrity in the new document during the translation process is also an urgent issue that needs to be addressed. Summary of the Invention

[0008] In order to solve the above problems, the present invention proposes a contract document translation method and system based on a large model. The present invention restores the positional correspondence between the original text and the translation to the greatest extent by designing text segmentation and document translation algorithms, thereby improving the model translation efficiency and user reading experience; the present invention can improve the correctness of segmented text blocks. For special fixed information in headers and footers, the present invention uses pre-stored fixed translations as translation results to ensure consistency and accuracy, and extracts image features and position information. Before writing the translated text into the new document, the feature information is written into the new document, thereby improving the professionalism and readability of the translated document.

[0009] According to some embodiments, the present invention adopts the following technical solutions:

[0010] A method for translating contract documents based on a large model includes the following steps:

[0011] Obtain the target contract document, recognize the images in the target contract document, convert them into text, and obtain the recognized text content, text location, and character features;

[0012] The text in the target contract document is initially divided into multiple text blocks using the recognized line breaks as block markers and page numbers as the largest unit. During the initial block division, the character features within each block are identified. Based on the identified character features, the text blocks are modified, text blocks belonging to the same paragraph are merged, and text blocks with incoherent text are split.

[0013] Using the pre-trained large model, translate each corrected text block and record the translated text block information sequence list. The text block information sequence list records the order in which each text block is input into the large model and the position information of the text block;

[0014] An output information list having the same format as the text block information sequence list is constructed, wherein the output information list includes the translated text blocks, the output order of the large model, and the position information of the input text blocks. According to the output order of the large model and the position information of the input text blocks, the translated text blocks are written into a new file in a form consistent with their corresponding character features to obtain the translated contract document.

[0015] As an optional implementation, the character features include characteristic information of font, font size, alignment indentation, and character spacing and line spacing.

[0016] As an optional implementation method, the process of performing preliminary block division on the text in the target contract document using the identified line break as a block mark and the page number as the largest unit includes: performing default block division on the text in the target contract document using the identified line break as a block mark, and using the page number as the largest unit during the default block division; after the default block division, obtaining the text content and text position coordinates of the text block, wherein the horizontal and vertical coordinates of the upper or lower corners of the left and right ends of the rectangular text block are the text position coordinates, and the text position coordinates are arranged in order from top to bottom and from left to right.

[0017] As an optional implementation method, the process of correcting the text block based on the recognized character features includes: setting adjacent text blocks with similar character features as text blocks to be processed; if the difference between the left horizontal coordinate x1 of the text position coordinates in the text block to be processed and the minimum left horizontal coordinate x1 in all text blocks on the page is equal to the width of several source language characters, then the first text block is determined to be the beginning of a paragraph, the next text block and the text block are in the same natural paragraph, the two text blocks are merged, all text blocks are traversed and the above operations are performed.

[0018] As an optional implementation method, the process of correcting the text block based on the recognized character features includes: setting adjacent text blocks with similar character features as text blocks to be processed. If the left end horizontal coordinate x1 value and the right end horizontal coordinate x2 value of several consecutive text blocks in the text blocks to be processed are equal, then these text blocks are considered to be in the same natural paragraph, the text blocks are merged, all text blocks are traversed and the above operations are performed.

[0019] As a further limited implementation method, the process of merging text blocks includes: after determining all the text blocks to be merged, connecting the text block contents head to tail in sequence, deleting all line breaks, and modifying the left horizontal coordinate x1 and the left vertical coordinate y1 in the text position coordinates of the merged text block to the left horizontal coordinate x1 and the left vertical coordinate y1 of the first text block before the merge, and modifying the right horizontal coordinate x2 and the right vertical coordinate y2 in the text position coordinates of the merged text block to the right horizontal coordinate x2 and the right vertical coordinate y2 of the last text block before the merge.

[0020] As an optional implementation method, the process of correcting the text block based on the recognized character features includes: determining whether the right end horizontal coordinate x2 of the last text block on a page is the maximum value of the right end horizontal coordinate x2 of all text blocks; if not, the text block is considered to be the normal end of the page; if so, determining whether the last character in the last text block is a punctuation mark with an ending meaning in the document source language; if not, merging the text content before the punctuation mark with an ending meaning in the first text block of the next page with the last text block of the previous page, and changing the value of the left end horizontal coordinate x1 of the first text block of the next page to the minimum value of the left end horizontal coordinate x1 of all text blocks.

[0021] As an optional implementation, the process of correcting the text block based on the recognized character features includes: if the distance between adjacent characters in the same text block exceeds the width of one non-space character, then the text in this text block is judged to be semantically incoherent text, and the last character of the adjacent characters and the characters after the character are split into a new text block, and the text position coordinates are modified.

[0022] As an optional implementation method, a pre-trained large model is used to translate each corrected text block, and a retrieval enhancement generation method is used to search whether a predetermined fixed text exists. If so, the professional knowledge base is called, and the translation corresponding to the pre-stored fixed text is used as the translation of the fixed text and written into the corresponding position of the corresponding text block.

[0023] As an optional implementation method, the process of writing each translated text block into a new file in a form consistent with its corresponding character features includes: modifying the character features of each translated text block to the corresponding font, font size, alignment indentation and character spacing and line spacing according to the feature information of the font, font size, alignment indentation and character spacing and line spacing of the corresponding text block before translation, and writing them into the new file page by page. If the feature information of the font, font size, alignment indentation and character spacing and line spacing of the corresponding text block before translation is not consistent, the feature information of the font, font size, alignment indentation and character spacing and line spacing that appears most frequently in the text block is used as the character feature.

[0024] A contract document translation system based on a large model, comprising:

[0025] An image recognition module is configured to obtain a target contract document, recognize images within the target contract document, convert them into text, and obtain recognized text content, text location, and character features;

[0026] The information extraction module is configured to perform preliminary segmentation of the text in the target contract document using the recognized line breaks as segmentation markers, with page numbers as the largest unit, to form multiple text blocks. During the preliminary segmentation, the module identifies character features within each block and, based on the identified character features, modifies the text blocks, merging text blocks belonging to the same paragraph and splitting incoherent text blocks.

[0027] The machine translation module is configured to use the pre-trained large model to translate each corrected text block and record a sequence list of translated text block information, wherein the text block information sequence list records the order in which each text block is input into the large model and the position information of the text block;

[0028] The information writing module is configured to construct an output information list in the same format as the text block information sequence list, wherein the output information list includes each translated text block, the output order of the large model, and the position information of the input text block. According to the output order of the large model and the position information of the input text block, each translated text block is written into a new file in a form consistent with its corresponding character features to obtain the translated contract document.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] By designing a text segmentation and document translation algorithm, the present invention restores the positional correspondence between the original text and the translated text to the greatest extent possible, thereby improving the model translation efficiency and the user reading experience. When the document is segmented by default, the font size and other feature information in the identified text block is recorded. When writing the translated text, it is written according to the recorded font size and other features to ensure that the format of the translated document is as similar as possible to the original document. If the font size and other features in the same text block are different, the font size and other features that appear most frequently are used as the font size and other feature standards for the text block, which can ensure that the translated file is as similar as possible to the source file format.

[0031] When dividing the text into blocks, the present invention uses page numbers as the maximum unit, limits the maximum value of the blocks, improves the efficiency of translation, and is convenient for translating and displaying one page when a new translated file is formed in the later stage, thereby improving the reading effect and quality. In addition, the coordinates of each text block are arranged from top to bottom and from left to right, which is more in line with conventional document reading habits.

[0032] The present invention takes into account many situations such as first line indentation, coherent text being divided into two pages, and incoherent text appearing in the same line. It merges text blocks belonging to the same paragraph, splits text blocks of incoherent text, and corrects the preliminary block segmentation results, thereby improving the accuracy of subsequent translation, ensuring translation quality, reducing the number of large model calls, reducing translation costs, and improving translation efficiency.

[0033] The present invention uses a professional knowledge base to assist large-model machine translation. If fixed text is detected, such as the name, address, cited law, etc. of an organization, the professional knowledge base can be called and the fixed translation pre-stored in the professional knowledge base can be used as the translation result to ensure consistency and accuracy.

[0034] The present invention first converts the characteristic information in the form of an image into text and records the corresponding position information. Before writing the translated text into the new document, the characteristic information is written into the new document, thereby improving the professionalism and readability of the translated document and ensuring the correct position and integrity of the image information in the new document.

[0035] 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

[0036] 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.

[0037] Figure 1 This is a schematic diagram of a contract document translation process based on a large model in an embodiment;

[0038] Figure 2 is a schematic flow chart of an information extraction process in an embodiment;

[0039] Figure 3 The figure is a flowchart of the process of machine translation and information writing in an embodiment. DETAILED DESCRIPTION

[0040] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0041] 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.

[0042] 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.

[0043] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.

[0044] Example 1

[0045] A contract document translation method based on a large model, such as Figure 1 As shown, the following steps are included:

[0046] Step S1: Obtain a target contract document, identify images within the target contract document, convert them into text, and obtain the identified text content, text location, and character features;

[0047] Step S2: The text in the target contract document is initially divided into multiple text blocks using the recognized line breaks as block markers and the page number as the largest unit. During the initial block division, the character features within each block are identified. Based on the identified character features, the text blocks are modified. Text blocks belonging to the same paragraph are merged, and text blocks with incoherent text are split.

[0048] For the convenience of description, the above steps can be referred to as the information extraction process.

[0049] Step S3: Using the pre-trained large model, translate each corrected text block and record a translated text block information sequence list. The text block information sequence list records the order in which each text block is input into the large model and the position information of the text block;

[0050] For the convenience of description, step S3 can be referred to as a machine translation process.

[0051] Step S4: Construct an output information list in the same format as the text block information sequence list. The output information list includes the translated text blocks, the output order of the large model, and the position information of the input text blocks. According to the output order of the large model and the position information of the input text blocks, the translated text blocks are written into a new file in a form that matches their corresponding character features to obtain the translated contract document.

[0052] For the convenience of description, step S4 can be simply referred to as the information writing process.

[0053] Each process is described in detail below.

[0054] The first is the information extraction process, such as Figure 2 shown.

[0055] In this embodiment, the document types are first defined, namely, divided into two categories: image type and text type, and information extraction is performed on the two types of documents respectively.

[0056] First, for image-based documents, OCR or other recognition technologies can be used to identify the document content and generate rule-compliant text blocks, including information such as text content, text location, and character features. Then, according to the text block segmentation rules established for text-based documents, the text blocks can be merged and corrected. Subsequent steps are the same as for text-based documents.

[0057] For text-based documents, the text within the document is extracted in blocks. The purpose of this block extraction is to integrate and translate text that has a coherent context or requires a combined understanding, thereby improving translation accuracy. In this embodiment, a computer reads the Unicode character encoding of the document, parses the document's internal structure, and automatically extracts information such as text information, location information, and font features within the document.

[0058] In this embodiment, a large number of historical contract texts in various industries are collected through legal channels. Combined with various contract templates and the requirements for contract specifications in current laws and regulations, the arrangement and rules of the contract text are summarized through a combination of large models and manual extraction, and a corresponding algorithm is constructed to help correctly segment text blocks.

[0059] The specific block segmentation algorithm includes: By default, the computer will use the recognized line break as the sign of text block. Based on the above default block segmentation standard, the following new text block rules are also proposed:

[0060] (1) When the document is divided into blocks by default, the font size and other feature information of the identified text blocks are recorded. When writing the translated text, the font size and other features are written according to the recorded features to ensure that the format of the translated document is as similar as possible to the original document.

[0061] If the font, font size and other features in the same text block are different, the font, font size and other features that appear most frequently will be used as the font, font size and other feature standards for the text block.

[0062] (2) Divide the text into blocks using page numbers as the largest unit. After the document is divided into blocks by default, two types of information about the text blocks are obtained: text content and text position coordinates. The text position coordinates are represented by a combination of (x1, y1, x2, y2).

[0063] Among them, x1, y1, x2, and y2 represent the horizontal coordinate of the upper left (lower) corner of the rectangular text block (because the text block is rectangular, the horizontal coordinate of the upper left corner and the horizontal coordinate of the lower left corner are the same, the same below), the vertical coordinate of the upper left (right) corner, the horizontal coordinate of the upper right (lower) corner, and the vertical coordinate of the lower left (right) corner, respectively.

[0064] According to the top-to-bottom, left-to-right arrangement rule, the text position coordinates are: [(x1, y1), (x2, y1), (x1, y2), (x2, y2)]. Then, the text blocks are arranged in ascending order by the size of the y2 coordinate, and then the x1 coordinate. The purpose is to sort the text blocks in a top-to-bottom, left-to-right order to conform to the conventional document reading habit.

[0065] (3) Within the same page range, obtain the differences in font size, alignment indentation, character spacing, and line spacing between each text block and the text in other text blocks, and set adjacent text blocks with similar text features as "to be processed" text blocks. Figure 2 As shown in the figure, text feature similarity is scored by a large model that is capable of summarizing the layout and regularity of contract texts. A scoring threshold is set. Scores above the threshold indicate similar text features and are set as "pending" text blocks. At this point, a text block processing algorithm must be determined. The core concept of this algorithm is to merge text blocks belonging to the same paragraph and split text blocks that are incoherent. Therefore, the position coordinates (x1, y1, x2, y2) of the "pending" text blocks are analyzed, focusing on the x1 and x2 parameters.

[0066] (a) Applicable to the case where the first line is indented. If the difference between the x1 of the first text block in the "to be processed" text block and the smallest x1 of all text blocks on the page is equal to the width of several source language characters, that is, ,in a Represents the first text block, i Indicates that the text block a Any text block other than k The number of characters varies according to the indentation conventions of different languages, but should be the same in the same document. is the source language character width, the first text block is considered to be the beginning of a paragraph. At this time, if the next text block b x1 with text block a The x1 difference is equal to k The width of the source language characters, that is , then the text block is considered b With text blocks a Text blocks need to be merged if they are in the same paragraph.

[0067] Then loop through all text blocks and perform the above operation.

[0068] (b) Applicable to the case where there is no indentation in the first line. If there are several consecutive text blocks in the "to be processed" text block, for the convenience of description, they are recorded as text blocks A~ N , the x1 values ​​and x2 values ​​of these consecutive text blocks are equal, then it is considered that the text block A~ NIn the same paragraph, the text blocks need to be merged. At this time, the x1 value of the text blocks is the same as the next text block (recorded as text block Z ) is equal to the x1 value, the text block Z Add to the merged text block. Z With A~ N They may not be in the same paragraph, but merging text blocks does not affect the machine translation results, so this method is feasible. Then, traverse all text blocks and perform the above operations.

[0069] After determining all the text blocks to be merged, concatenate the text blocks in order and delete all line breaks. At this point, the x1 and y1 coordinates of the text position are changed to the x1 and y1 of the first text block, and the x2 and y2 coordinates are changed to the x2 and y2 of the last text block.

[0070] (c) Applicable to the case where a coherent text is divided into two pages. Determine whether the x2 value of the last text block on a page is the maximum x2 value of all text blocks. If not, this text block is considered to be the normal end of the page. A normal end means that the last paragraph of semantically coherent text on the page is not truncated to the next page due to length limitations. If so, determine whether the last character in the last text block is a punctuation mark with ending significance in the document source language. For example, punctuation marks with ending significance in Chinese include: period, question mark, exclamation mark, ellipsis, etc. If not, merge the text content before the punctuation mark with ending significance in the first text block of the next page with the last text block of the previous page. In this case, the text position coordinates of the page are not modified, and the x1 value of the first text block of the next page is changed to the minimum value of all x1 values.

[0071] (d) Applies to situations where incoherent text appears within the same line. If the distance between adjacent characters within the same text block (for ease of description, let's call them a and b) exceeds the width of a non-space character, the text within this block is considered semantically incoherent. The characters after a and b are split into a new text block, and the text position coordinates are modified accordingly.

[0072] Following the above text segmentation rules, the computer can segment and integrate the text blocks on each page as accurately as possible. Through the above information extraction algorithm, it is possible to obtain processed text block information for each page of the document, including information such as text content, text location, and character features. Taking English-Chinese translation as an example, the entire input information list, denoted as List_source, or LS, is as follows:

[0073] LS=[LS1, LS2, …, LSn];

[0074] Among them, LSi represents the text block information of the i-th page in the input information, and n is the total number of document page numbers.

[0075] At the same time, the text block information of LSi is used to record the page number parameter where the text block is located, record the text font and font size parameters of the text block it belongs to, record the text font of the text block it belongs to, such as whether it is italic, bold, and underlined, record the text content of the text block it belongs to, and record the position information of the text block it belongs to.

[0076] Next, machine translation is performed. When users use the document translation function, they cannot tolerate a long waiting time. If translation is performed in units of text blocks, although it can reduce the waiting time of users, it requires multiple calls to the large model capabilities, reducing the translation efficiency and increasing the usage cost; if translation is performed in units of documents, although it can only call the large model capabilities once and improve the translation efficiency, it will significantly increase the waiting time of users. Therefore, in this embodiment, translation and output are performed in units of page numbers, which can improve the translation efficiency of the large model while shortening the waiting time of users, achieving a balance between the two.

[0077] In this embodiment, the content of each page is sorted, that is, the sub-list LSi of LS, and input into the preset large model prompt words, then the large model is called for translation, and the established external knowledge base is used for assisted translation. During translation, by designing the prompt words, the large model is only allowed to focus on the text content information and output the text content that conforms to the original character format. Finally, the translated content is written with information.

[0078] In addition, during translation, it is automatically detected whether there is already fixed text, such as official or standard translations of organization names, addresses, laws and regulations, etc. If such fixed translations are detected, corresponding translation rules are established and incorporated into the professional knowledge base. During the subsequent full-text translation process, once the specific text appears in the original text, the fixed translation pre-stored in the professional knowledge base is directly used as the translation result to ensure consistency and accuracy.

[0079] For example: when "北京航空航天大学" (Beijing University of Aeronautics and Astronautics) appears in the header and footer corresponding to "BeiHang University", all "北京航空航天大学" in the full text should be translated as "BeiHang University", rather than the literal translation "BeijingUniversity of Aeronautics and Astronautics".

[0080] During the process of writing information, as Figure 3 shown, an output information list with the same format as the input information list is constructed, denoted as List_Trans, that is, LT. The example is as follows:

[0081] LT=[LT1,LT2,…,LTn];

[0082] Where LTi represents the text block information of page i in the output information, and n is the total number of document pages. The content translated by the large model is then written to the corresponding position of the text content information.

[0083] Based on the position information in the text block information, the translated text content is written to a newly created file. The specific file type can be PDF, docx, png, etc. After writing is completed, the content of the first page will be displayed on the front-end page, thus reducing user waiting time.

[0084] Example 2

[0085] A contract document translation system based on a large model, comprising:

[0086] An image recognition module is configured to obtain a target contract document, recognize images within the target contract document, convert them into text, and obtain recognized text content, text location, and character features;

[0087] The information extraction module is configured to perform preliminary segmentation of the text in the target contract document using the recognized line breaks as segmentation markers, with page numbers as the largest unit, to form multiple text blocks. During the preliminary segmentation, the module identifies character features within each block and, based on the identified character features, modifies the text blocks, merging text blocks belonging to the same paragraph and splitting incoherent text blocks.

[0088] The machine translation module is configured to use the pre-trained large model to translate each corrected text block and record a sequence list of translated text block information, wherein the text block information sequence list records the order in which each text block is input into the large model and the position information of the text block;

[0089] The information writing module is configured to construct an output information list in the same format as the text block information sequence list, wherein the output information list includes each translated text block, the output order of the large model, and the position information of the input text block. According to the output order of the large model and the position information of the input text block, each translated text block is written into a new file in a form consistent with its corresponding character features to obtain the translated contract document.

[0090] 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.).

[0091] 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.

[0092] 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.

[0093] 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.

[0094] 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 contract document translation method based on a large model, characterized by: The following steps are involved: Obtain the target contract document, recognize the images in the target contract document, convert them into text, and obtain the recognized text content, text location, and character features; The text in the target contract document is initially divided into multiple text blocks using the recognized line breaks as block markers and page numbers as the largest unit. During the initial block division, the character features within each block are identified. Based on the identified character features, the text blocks are modified, text blocks belonging to the same paragraph are merged, and text blocks with incoherent text are split. Using the pre-trained large model, translate each corrected text block and record the translated text block information sequence list. The text block information sequence list records the order in which each text block is input into the large model and the position information of the text block; An output information list having the same format as the text block information sequence list is constructed, wherein the output information list includes the translated text blocks, the output order of the large model, and the position information of the input text blocks. According to the output order of the large model and the position information of the input text blocks, the translated text blocks are written into a new file in a form consistent with their corresponding character features to obtain the translated contract document.

2. A contract document translation method based on a large model as claimed in claim 1, characterized in that: The character features include feature information of font, font size, alignment indentation, and character spacing and line spacing.

3. The method for translating contract documents based on a large model as claimed in claim 1, wherein: The process of performing preliminary block division on the text in the target contract document using the recognized line break as a block mark and the page number as the largest unit includes: performing default block division on the text in the target contract document using the recognized line break as a block mark, and using the page number as the largest unit during the default block division; after the default block division, obtaining the text content and text position coordinates of the text block, wherein the horizontal and vertical coordinates of the upper or lower corners of the left and right ends of the rectangular text block are the text position coordinates, and the text position coordinates are arranged in order from top to bottom and from left to right.

4. The method for translating contract documents based on a large model as claimed in claim 1, wherein: The process of correcting the text block based on the recognized character features includes: setting adjacent text blocks with similar character features as to-be-processed text blocks; if the difference between the left horizontal coordinate x1 of the text position coordinates in the to-be-processed text block and the minimum left horizontal coordinate x1 of all text blocks on the page is equal to the width of a number of source language characters, then the first text block is determined to be the beginning of a paragraph, the next text block and the first text block are in the same paragraph, the two text blocks are merged, and the above operation is performed on all text blocks; If the left end horizontal coordinate x1 value and the right end horizontal coordinate x2 value of several consecutive text blocks in the text block to be processed are equal, then these text blocks are considered to be in the same natural segment, the text blocks are merged, and all text blocks are traversed and the above operation is performed.

5. A contract document translation method based on a large model as claimed in claim 4, characterized in that: The process of merging text blocks includes: after determining all the text blocks to be merged, connecting the text block contents head to tail in order, deleting all line breaks, and changing the left horizontal coordinate x1 and left vertical coordinate y1 in the text position coordinates of the merged text block to the left horizontal coordinate x1 and left vertical coordinate y1 of the first text block before the merge, and changing the right horizontal coordinate x2 and right vertical coordinate y2 in the text position coordinates of the merged text block to the right horizontal coordinate x2 and right vertical coordinate y2 of the last text block before the merge.

6. The method for translating contract documents based on a large model as claimed in claim 1, wherein: The process of correcting the text block based on the recognized character features includes: judging whether the right end horizontal coordinate x2 of the last text block of a certain page is the maximum value of the right end horizontal coordinate x2 of all text blocks; if not, the text block is considered to be the normal end of the page; if so, judging whether the last character in the last text block is a punctuation mark with an ending meaning in the document source language; if not, merging the text content before the punctuation mark with an ending meaning in the first text block of the next page with the last text block of the previous page, and changing the value of the left end horizontal coordinate x1 of the first text block of the next page to the minimum value of the left end horizontal coordinate x1 of all text blocks.

7. The method for translating contract documents based on a large model as claimed in claim 1, characterized in that: The process of correcting the text block based on the recognized character features includes: if the distance between adjacent characters in the same text block exceeds the width of one non-space character, the text in this text block is judged to be semantically incoherent text, and the last character of the adjacent characters and the characters after the character are split into a new text block, and the text position coordinates are modified.

8. The method for translating contract documents based on a large model as claimed in claim 1, wherein: Using the pre-trained large model, during the translation process of each revised text block, the retrieval enhancement generation method is used to search whether there is a predetermined fixed text. If so, the professional knowledge base is called, and the translation corresponding to the pre-stored fixed text is used as the translation of the fixed text and written into the corresponding position of the corresponding text block.

9. The method for translating contract documents based on a large model as claimed in claim 1, wherein: The process of writing each translated text block into a new file in a form consistent with its corresponding character features includes: modifying the character features of each translated text block to the corresponding font, font size, alignment indentation and character spacing and line spacing according to the feature information of the font, font size, alignment indentation and character spacing and line spacing of the corresponding text block before translation, and writing them into the new file page by page. If the feature information of the font, font size, alignment indentation and character spacing and line spacing of the corresponding text block before translation is inconsistent, the feature information of the font, font size, alignment indentation and character spacing and line spacing that appears most frequently in the text block is used as the character feature.

10. A contract document translation system based on a large model, characterized by: include: An image recognition module is configured to obtain a target contract document, recognize images within the target contract document, convert them into text, and obtain recognized text content, text location, and character features; The information extraction module is configured to perform preliminary segmentation of the text in the target contract document using the recognized line breaks as segmentation markers, with page numbers as the largest unit, to form multiple text blocks. During the preliminary segmentation, the module identifies character features within each block and, based on the identified character features, modifies the text blocks, merging text blocks belonging to the same paragraph and splitting incoherent text blocks. The machine translation module is configured to use the pre-trained large model to translate each corrected text block and record a sequence list of translated text block information, wherein the text block information sequence list records the order in which each text block is input into the large model and the position information of the text block; The information writing module is configured to construct an output information list in the same format as the text block information sequence list, wherein the output information list includes each translated text block, the output order of the large model, and the position information of the input text block. According to the output order of the large model and the position information of the input text block, each translated text block is written into a new file in a form consistent with its corresponding character features to obtain the translated contract document.

Citation Information

Patent Citations

  • Hydropower engineering document text vectorization conversion method based on spatial semantic correction

    CN118675178A

  • Data processing method and device, electronic equipment and storage medium

    CN119578367A