A document translation method, apparatus and equipment

By combining a large language model with translation templates, the problem of low efficiency and insufficient accuracy in existing Chinese document translation technologies has been solved, achieving efficient and highly accurate document translation results.

CN119849517BActive Publication Date: 2026-03-10ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, document translation relies on human translation and simple machine translation, resulting in low translation accuracy, long processing time, and high cost, failing to meet the requirements for high efficiency and high accuracy.

Method used

By employing a large language model combined with translation templates, the document type is determined, the elements to be translated are extracted and translated, and finally the translated elements are spliced ​​with the template to form a complete document translation, thus avoiding the translation of all content in the document.

Benefits of technology

It improves the efficiency and accuracy of document translation, replaces human translation and simple machine translation, and reduces translation costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849517B_ABST
    Figure CN119849517B_ABST
Patent Text Reader

Abstract

This specification discloses a document translation method, apparatus, and device in its embodiments. The solution may include: upon receiving a document translation request, determining the document type of the document to be translated in response to the translation request, and determining a translation template based on the document type; then extracting elements to be translated from the document to be translated that correspond to the document type, wherein the elements to be translated are the content in the document to be translated excluding the translation template. Subsequently, translating the elements to be translated using a large language model to obtain element translations, and concatenating the element translations with the translation template to obtain the document translation of the document to be translated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of text translation, and in particular relates to a document translation method, device and equipment. BACKGROUND

[0002] With the development of the times, people's demand for translation of documents such as ID cards, diplomas and notarized documents is getting higher and higher. In the prior art, the translation process of documents usually involves manual translation first, and then manual proofreading after manual translation, which results in low translation accuracy, long translation time and high cost. With the rapid development of artificial intelligence technology, traditional manual translation and simple machine translation cannot meet the efficient and accurate needs of users for document translation.

[0003] Therefore, there is a need to provide an efficient and accurate document translation scheme. SUMMARY

[0004] Therefore, the embodiments of the present application provide a document translation method, device and equipment to provide an efficient and accurate document translation scheme.

[0005] To solve the above technical problems, the embodiments of the present application provide a document translation method, which comprises:

[0006] receiving a document translation request for requesting translation of a to-be-translated document;

[0007] determining a document type of the to-be-translated document in response to the document translation request;

[0008] determining a translation template according to the document type;

[0009] extracting a to-be-translated element corresponding to the document type from the to-be-translated document; the to-be-translated element is the content of the to-be-translated document other than the translation template;

[0010] translating the to-be-translated element using a large language model to obtain an element translation;

[0011] splicing the element translation and the translation template to obtain a document translation of the to-be-translated document.

[0012] The embodiments of the present application also provide a document translation device, which comprises:

[0013] The request receiving module is configured to receive a document translation request for requesting translation of a to-be-translated document;

[0014] The document type determining module is configured to determine a document type of the to-be-translated document in response to the document translation request;

[0015] a translation text splicing module, configured to splice the element translation text and the translation text template to obtain a document translation text of the document to be translated.

[0016] an element extraction module, configured to extract a to-be-translated element corresponding to the document type from the document to be translated, the to-be-translated element being content in the document to be translated other than the translation text template;

[0017] an element translation module, configured to translate the to-be-translated element by using a large language model to obtain an element translation text;

[0018] a translation text splicing module, configured to splice the element translation text and the translation text template to obtain a document translation text of the document to be translated.

[0019] Embodiments provided in the specification also provide a document translation device, comprising:

[0020] at least one processor; and

[0021] a memory in communication connection with the at least one processor; wherein

[0022] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0023] receive a document translation request for requesting translation of a document to be translated;

[0024] determine a document type of the document to be translated in response to the document translation request;

[0025] determine a translation text template according to the document type;

[0026] extract a to-be-translated element corresponding to the document type from the document to be translated, the to-be-translated element being content in the document to be translated other than the translation text template;

[0027] translate the to-be-translated element by using a large language model to obtain an element translation text;

[0028] splice the element translation text and the translation text template to obtain a document translation text of the document to be translated.

[0029] At least one embodiment provided in the specification can achieve the following beneficial effects:

[0030] In the embodiments of the present specification, after the document translation platform receives a document translation request for a document to be translated, the document type of the document to be translated can be determined based on the request, and then on the one hand, a translation template of the document type is obtained, and on the other hand, the elements to be translated in the document of the document type are extracted and translated using a large language model to obtain the element translation corresponding to the elements to be translated, and then the element translation and the translation template are spliced to obtain the document translation. Thus, by setting the fixed content in the document as a template and translating the variable content in the document using a large language model, it is avoided to translate all the contents in the document, which can replace manual translation and simple machine translation, not only beneficial to improve the translation efficiency of the document, but also beneficial to improve the accuracy of the document translation. BRIEF DESCRIPTION OF DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the present application, and other drawings can also be obtained according to these drawings without creative labor for those skilled in the art.

[0032] Figure 1 An application scenario diagram of a document translation method provided by the embodiments of the present specification;

[0033] Figure 2 A flowchart of a document translation method provided by the embodiments of the present specification;

[0034] Figure 3 A diagram of an embodiment for translating a graduation certificate provided by the embodiments of the present specification;

[0035] Figure 4 A diagram of an embodiment for translating a notarization provided by the embodiments of the present specification;

[0036] Figure 5 A flowchart of a document translation method provided by the embodiments of the present specification;

[0037] Figure 6 A structural diagram of a document translation device corresponding to Figure 2 provided by the embodiments of the present specification;

[0038] Figure 7 A structural diagram of a document translation device corresponding to Figure 2 provided by the embodiments of the present specification. DETAILED DESCRIPTION

[0039] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details. In other instances, well-known methods have not been described in detail in order not to unnecessarily obscure aspects of the present application.

[0040] The terminology used in this description is for the purpose of describing particular embodiments only and is not intended to limit one or more embodiments of the present application. As used in one or more embodiments of the present application and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0041] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. Pronouns in the masculine form include the feminine form, and vice versa, and the singular form also includes the plural form, unless the context clearly dictates otherwise. It is further understood that the terms "comprise" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0042] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards in the relevant region, and provide corresponding operation portal for user to choose authorization or refusal.

[0043] In the prior art, for the translation of identity cards, graduation certificates, notarization certificates and other documents, one way is to first perform manual translation, and then perform manual proofreading after manual translation. The translation of documents through this way consumes a large amount of human resources, and the translation takes a long time and has a high translation cost. Another way is to extract all the contents in the documents, and then use simple machine translation to translate the extracted contents, but the translation accuracy of simple machine translation is low, and errors are likely to occur in translation.

[0044] In order to solve the defects in the prior art, the present application provides the following embodiments.

[0045] Figure 1 An application scenario diagram of a document translation method provided by an embodiment of the present application is shown.

[0046] As shown in Figure 1 The user can upload a document to be translated to the document translation platform server 102 at the document translation platform client 101 and initiate a document translation request. For example, the document translation platform client 101 can upload a document to be translated by calling a first interface of the document translation platform server 102 for uploading a document to be translated, and initiate a document translation request by calling a second interface of the document translation platform server 102 for initiating a document translation request. In actual application, the uploading of the document to be translated and the initiation of the document translation request can be performed simultaneously; or the document to be translated can be uploaded first, and the document translation request can be sent after a period of time after the uploading of the document to be translated is completed.

[0047] After the document translation platform server 102 receives a document translation request for requesting translation of a document to be translated, the document translation platform server 102 can generate a translation task for translating the document to be translated in response to the document translation request. In actual application, for example, the translation task can be generated immediately after receiving each document translation request. Then, the translation task can be executed on the document translation platform server 102. Alternatively, each generated document translation task can be executed immediately; or alternatively, considering that the execution process of the document translation task is a relatively time-consuming work, in order to improve the overall utilization efficiency of computing resources, the execution operation of the document translation task can be triggered at a fixed time after one or several document translation tasks are generated. Further, the process of executing the document translation task can include determining the document type of the document to be translated, and determining a translation template according to the document type; after the document translation platform server 102 determines the translation template, the document translation platform server 102 can extract the element to be translated corresponding to the document type from the document to be translated, and translate the element to be translated by using a large language model to obtain an element translation; then, the document translation platform server 102 can splice the element translation and the translation template to obtain the document translation of the document to be translated. After the document translation platform server 102 determines the document translation of the document to be translated, the document translation platform server 102 can further feed back the determined document translation of the document to be translated to the document translation platform client 101. After the document translation platform client 101 receives the document translation fed back by the document translation platform server 102, the document translation platform client 101 can display the document translation to the user.

[0048] The document translation platform server 102 includes but is not limited to any device, equipment, platform, server cluster, etc. with computing and processing capabilities. The document translation platform client 101 and the document translation platform server 102 can perform data transmission through local area network connection, wide area network connection, Internet connection or other types of data network connection, or through other means, which are not limited in this regard.

[0049] In addition, although Figure 1 In at least some embodiments of this specification, the document translation method provided in these embodiments can be executed by the document translation platform server 102. However, in other optional embodiments, if the running resources of the document translation platform client 101 can meet the deployment and running conditions of the document translation method system, the document translation platform client 101 can also have similar functions to the document translation platform server 102, thereby executing the document translation method provided in these embodiments. Furthermore, in other optional embodiments, the document translation method provided in these embodiments can also be executed jointly by the document translation platform client 101 and the document translation platform server 102. Next, taking the execution of the document translation method provided in these embodiments by the document translation platform server 102 as an example, the implementation process of the document translation method will be described.

[0050] Figure 1 The method described above involves a document translation platform receiving a translation request for a document. Based on the request, the platform determines the document type, obtains a translation template for that type, extracts the elements to be translated from the document, and uses a large language model to translate these elements. Finally, the element translations are combined with the translation template to obtain the final document translation. By setting fixed content as a template and translating variable content using a large language model, the platform avoids translating all content in the document, replacing both human translation and simple machine translation. This not only improves translation efficiency but also enhances accuracy.

[0051] Figure 2 This is a flowchart illustrating a document translation method provided in an embodiment of this specification. From a hardware perspective, the entity executing this process can be a server. From a program perspective, the entity executing this process can be an application running on the server. Figure 2 As shown, the process may include the following steps:

[0052] Step 202: Receive a document translation request for translating the document to be translated.

[0053] In the embodiments of this specification, "documents," also known as "files," refer to the general term for various official documents, contracts, agreements, letters, written agreements, certificates, and other materials formed and used by people in social interactions. In document authentication, it broadly refers to all materials that record and provide content and information related to the facts of a case in the form of text, language, graphics, and symbols. Documents can be classified according to their production method into written documents, printed documents, and electronic documents; according to their production technology into ordinary documents and special documents; according to their nature into authentic documents, altered documents, and damaged documents; and according to their state into originals and copies.

[0054] Specifically, documents to be translated may include, but are not limited to: birth certificates, ID cards, graduation certificates, degree certificates, transcripts, marriage certificates, divorce certificates, driver's licenses, scholarship certificates, competition award certificates, teacher qualification certificates, rental contracts, and notarized documents. A notarized document is a legally binding judicial certificate issued by a notary public office upon application by a party, based on facts and law, and following legal procedures. It is a type of judicial document. A notarized document is a legal document prepared and issued by a notary public office to the party concerned for use.

[0055] In practical applications, when a user needs to translate one or more documents, they can log in to the document translation platform's client, upload the document to be translated to the platform's server, and initiate a translation request. Upon receiving the translation request, the platform's server can respond by generating a translation task and then executing it.

[0056] In practical applications, document translation requests can also include a user-defined target language. The target language can be the language of the translated document content that the user wants to obtain. For example, if a user uploads a document in Chinese and wants it translated into English, they can specify English when initiating a translation request through the document translation platform's client. Correspondingly, the translation request sent from the client to the server can include instructions such as "the target language for document translation is English," allowing the server to translate the document into the desired target language based on these instructions.

[0057] Step 204: In response to the document translation request, determine the document type of the document to be translated.

[0058] In the embodiments of this specification, document type can reflect the business type of the document. Document type can include, but is not limited to: birth certificate, ID card, graduation certificate, degree certificate, transcript, marriage certificate, divorce certificate, driver's license, scholarship certificate, competition award certificate, teacher qualification certificate, driver's license, house rental contract, notarized document, etc. In practical applications, in order to improve translation accuracy, the classification of document type can be more detailed. For example, notarized documents for degree certificates and notarized documents for marriage certificates can correspond to different document types.

[0059] In practical applications, a document translation request can include the document to be translated. Upon receiving the request, the document translation platform's server can determine the document type based on the content of the document to be translated. Since subsequent embodiments in this specification will explain in detail the method for determining the document type, it will not be repeated here.

[0060] Step 206: Determine the translation template based on the document type.

[0061] In the embodiments of this specification, different document types can correspond to different translation templates. For example, a document of type "ID card" corresponds to an "ID card" translation template; while a document of type "marriage certificate" corresponds to a "marriage certificate" translation template.

[0062] In practical applications, a pre-defined mapping relationship can be established between document types and translation templates. Once the document type is determined, the corresponding translation template can be determined based on this mapping relationship. Specifically, a mapping table reflecting the mapping relationship between document types and translation templates can be created and stored on the server side of the document translation platform. During the document translation process, the server side can retrieve this mapping table and determine the corresponding translation template based on the document type.

[0063] Specifically, regarding graduation certificates and degree certificates, considering the potential differences between certificates from different universities, corresponding translation templates can be developed based on samples of graduation and degree certificates from each university. Of course, for universities with highly similar graduation and degree certificates, the same translation template can be used, thereby improving the efficiency of template creation; no specific limitations are imposed on this. For example, when the document type to be translated is determined to be "Tsinghua University Graduation Certificate," the corresponding Tsinghua University graduation certificate translation template can be retrieved.

[0064] Step 208: Extract the elements to be translated from the document to be translated that correspond to the document type; the elements to be translated are the content in the document to be translated other than the translation template.

[0065] In the embodiments of this specification, there can be a one-to-one correspondence between the document type of the document to be translated, the translation template, and the elements to be translated. That is, one document type can correspond to one translation template and a set of elements to be translated. In the translation template, the fixed fields in the document to be translated are directly translated; that is, the translation template contains the translations of the fixed fields in the document to be translated. Therefore, when translating the content of the document to be translated, it is not necessary to translate the content already in the translation template; only the non-fixed fields in the document to be translated need to be translated. This reduces the amount of content to be translated, improves translation efficiency, and also helps to shorten the translation time.

[0066] In the embodiments of this specification, the elements to be translated extracted from the document to be translated can be non-fixed fields in the document to be translated. These non-fixed fields are content not included in the translation template, that is, content outside the translation template. As an example, taking an ID card as an example, the element types in an ID card document can include "name," "address," "validity period of the document," etc. The fields corresponding to these element types, such as "name," "address," and "validity period of the document," have already been translated in the ID card translation template. The elements to be translated corresponding to these element types can include, for example, "Zhang San," "male," "Han nationality," "Beijing Haidian District xxxx," "xxxx.xx.xx-xxxx.xx.xx," etc. These elements are the content that needs to be further translated using translation tools.

[0067] In practical applications, methods for extracting elements corresponding to the document type from a document to be translated can include, but are not limited to, the following two methods: Method 1: A feature extraction model is pre-trained using document samples labeled with the elements to be translated. The document to be translated is then input into this model, which extracts the elements to be translated and outputs the results. Method 2: Elements are extracted based on rules. These rules can vary depending on the document type; different document types can have different rules. The rules can be diverse. For example, elements can be directly identified. For instance, the certificate number on a graduation certificate has a specific structure, which can be used to identify the certificate number. Alternatively, elements can be identified based on their association information; for example, the information following "name" indicates the name element. Method 2, which extracts elements based on rules, is relatively simple, but its accuracy is relatively low because it is difficult to cover all situations. Therefore, different element extraction methods can be used for different types of documents. For example, for documents of the type "ID card", given that the structure of such documents is simple and fixed and the structure of the element content is predictable, the rule-based method in Method 2 can be used to extract the elements to be translated, which can save computing resources and improve extraction efficiency. For documents of the type "notarized document", given that the structure of such documents is flexible and varied and the element content is also diverse, the element extraction model in Method 1 can be used to extract the elements to be translated, which can improve the accuracy of element extraction.

[0068] Step 210: Use a large language model to translate the elements to be translated to obtain the translated text.

[0069] In the embodiments of this specification, a Large Language Model (LLM) can refer to a deep learning model trained using a large amount of text data, capable of generating natural language text or understanding the meaning of language text. Large Language Models can handle various natural language tasks, such as text classification, text translation, question answering, and dialogue. Large Language Models are trained by processing and analyzing massive amounts of text data, which may include books, websites, news articles, etc. During training, the model learns how to understand and generate language.

[0070] In the embodiments of this specification, the large language model can be a pre-trained large language model with language translation capabilities. In practical applications, the large language model can be a model for translating document elements obtained by enhancing or fine-tuning a pre-trained basic large language model using document class samples. Specifically, a document class sample used for enhancement or fine-tuning may include a first language version and a second language version of a document, so that the enhanced or fine-tuned large language model can have the ability to translate a document from the first language to the second language, or vice versa.

[0071] In practical applications, different large language models can be trained for different language translation tasks. For example, one large language model can be trained for Chinese-to-English or English-to-Chinese translation, while another large language model can be trained for Chinese-to-Japanese or Japanese-to-Chinese translation. Alternatively, a large language model can be trained using samples from multiple languages, enabling it to translate between multiple languages. There are no specific limitations on this approach.

[0072] Step 212: Combine the translated elements with the translation template to obtain the translated document of the document to be translated.

[0073] In the embodiments of this specification, the translation template may reserve placeholders corresponding to the element translations, so that the element translations can be directly inserted into the corresponding placeholders (or, in other words, replaced) to complete the splicing between the element translations and the translation template. For example, when translating a graduation certificate from Chinese to English, if the "Institution Name" field is "Tsinghua University" before translation, the translation template will contain "College name:", with a placeholder after "College name:". "Tsinghua University" is the element to be translated, and the translated element is "TsinghuaUniversity". Therefore, "Tsinghua University" will be inserted into the placeholder after "College name:" (or, replaced) to complete the splicing. In practical applications, a splicing model can also be used to splice the element translations and the translation template, or other methods can be used; no specific limitations are imposed on this.

[0074] Figure 2The method described above involves a document translation platform receiving a translation request for a document. Based on the request, the platform determines the document type, obtains a translation template for that type, extracts the elements to be translated from the document, and uses a large language model to translate these elements. Finally, the element translations are combined with the translation template to obtain the final document translation. By setting fixed content as a template and translating variable content using a large language model, the platform avoids translating all content in the document, replacing both human translation and simple machine translation. This not only improves translation efficiency but also enhances accuracy.

[0075] based on Figure 2 In addition to the method described in the embodiments of this specification, some specific implementation schemes of the method are also provided, which will be described below.

[0076] Optional, Figure 2 In the method described above, step 204 involves determining the document type of the document to be translated in response to the document translation request. This may specifically include:

[0077] In response to the document translation request, the document content of the document to be translated is read;

[0078] Based on the content of the document, determine the document type of the document to be translated.

[0079] In practical applications, document translation requests can include the document to be translated. Upon receiving the request, the document translation platform's server can read the document's content and determine its type based on that content. Specifically, the document type can be determined based on keywords within the content. For example, if a document contains the keyword "graduation certificate," its type can be identified as a graduation certificate. Alternatively, a document classification model can be used to determine the document type. Since subsequent embodiments in this specification will explain the method for determining the document type in detail, it will not be elaborated upon here.

[0080] Correspondingly, the step of reading the document content of the document to be translated in response to the document translation request may specifically include:

[0081] Determine the file format of the document to be translated; the file format includes image format, WORD document format, or PDF document format.

[0082] The document content of the document to be translated is read using the content reading rules corresponding to the file format.

[0083] In the embodiments of this specification, the file format of the document to be translated can be determined based on its file extension. Specifically, a corresponding list of file extensions can be set for different file formats. By comparing the file extension of the document to be translated with this list, the file format of the document to be translated can be determined.

[0084] In the embodiments of this specification, the file extensions for image formats may include, but are not limited to: jpg, jpeg, jpe, png, tif, gif, bmp, pcx, tga, exif, fpx, svg, psd, cdr, pcd, dxf, ufo, eps, ai, raw, WMF, webp, avif, apng, etc. In practical applications, the document to be translated may use any of the above image formats. The file extensions for WORD document formats may include, but are not limited to: doc, docx, dot, dotx, etc. The file extensions for PDF document formats may include, but are not limited to: pdf, etc.

[0085] In practical applications, different content reading rules can be set for different file formats. For example, the content reading rules for image documents can be different from those for Word documents. Of course, the content reading rules for different file formats may also be the same; this is not specifically limited.

[0086] Optionally, the step of reading the document content of the document to be translated using content reading rules corresponding to the file format may specifically include:

[0087] If the file format is an image format, then a multimodal large model is used to perform OCR recognition to obtain the document content to be translated.

[0088] In the embodiments of this specification, Multimodal Large Models (MLMs) refer to deep learning models capable of processing and generating different types of data (such as text, images, audio, and video). Multimodal Large Models can fuse data from multiple modalities, including text, images, audio, and video, and perform comprehensive understanding and reasoning. They can not only understand information from a single modality but also fuse information across multiple modalities, enabling them to more comprehensively understand and generate diverse content. Multimodal Large Models also possess the ability to process both text and images. Using a multimodal Large Model for OCR recognition leverages its image processing capabilities; specifically, it utilizes the model's ability to extract text content from images.

[0089] In the embodiments of this specification, Optical Character Recognition (OCR) refers to the process by which electronic devices (such as scanners or digital cameras) examine characters printed on paper, determine their shapes by detecting dark and light patterns, and then translate the shapes into computer text using character recognition methods. The basic principle of OCR technology is to convert text information from visual sources such as paper documents and images into computer-editable and searchable text data through scanning or photographing. OCR technology utilizes image processing and pattern recognition techniques to scan documents and analyze the fonts, formatting, and characters in the images to identify and extract text content.

[0090] In practical applications, if the document to be translated is in image format, its content can be obtained through OCR recognition. Alternatively, traditional OCR methods can be used to read the document content, or a multimodal large-scale model can be employed to perform OCR recognition. When using a multimodal large-scale model to perform OCR recognition on images, it can also combine information from other modalities (such as text descriptions and contextual images) to further improve the accuracy and completeness of the recognition. For example, when processing images containing characters, the model can utilize contextual information to more accurately identify the characters. Furthermore, after obtaining the recognition results, the multimodal large-scale model can intelligently proofread the results based on its own language capabilities, making the recognition results even more accurate.

[0091] Optionally, the step of reading the document content of the document to be translated using content reading rules corresponding to the file format may specifically include:

[0092] If the file format is a WORD document format, then the first library function for reading WORD document content is used to read the document content to be translated.

[0093] In the embodiments described in this specification, the first library function is a function that has the ability to read the content of a Word document, and may include, but is not limited to, specific functions in the Apache POI library. Apache POI is an open-source Java library designed specifically for processing Office documents (such as Word, Excel, etc.).

[0094] In practical applications, reading the content of a document to be translated using the first library functions can include the following stages: 1. Preparation stage: In the preparation stage, ensure that the Apache POI library is installed and correctly configured on the computer system. 2. Document loading stage: In the document loading stage, the classes and methods provided by the Apache POI library can be used to load the Word document to be processed into memory. 3. Text extraction stage: After the document is successfully loaded, by traversing all paragraphs (XWPFParagraph objects) contained in the XWPFDocument object and using the getText method of each paragraph object, all text content in the Word document can be extracted. The extracted text content can be saved to a string variable for subsequent processing or analysis.

[0095] In practical applications, if the document to be translated in WORD format also contains images, multimodal large model or other methods can be used to perform OCR recognition on the images to obtain the recognized text results. For the remaining text in the document to be translated, the first library function can be used to read it directly.

[0096] Optionally, the step of reading the document content of the document to be translated using content reading rules corresponding to the file format may specifically include:

[0097] If the file format is PDF document format, then the second library function for reading PDF document content is used to read the document content to be translated.

[0098] In the embodiments of this specification, the second library function is a function that has the ability to read the content of a PDF document, and may include, but is not limited to, specific functions in the iText library. The iText library is a powerful PDF processing library that supports various operations such as creating, modifying, and extracting text content from PDF documents.

[0099] In practical applications, using second-library functions to read the content of a document to be translated can include the following stages: 1. Preparation stage: In the preparation stage, ensure that the iText library is installed and correctly configured on the computer system. 2. Document loading stage: In the document loading stage, relevant classes in the iText library (such as PdfReader) can be used to load the PDF document into memory. This stage typically involves creating a PdfReader object and reading the content of the PDF file through that object. 3. Text extraction stage: After the document is successfully loaded, iterate through the pages and page content of the PDF document (for example, using the getNumberOfPages and getPage methods of the PdfDocument object), and use the getTextFromPage method of the PdfTextExtractor class to extract the text content from each page. The extracted text content can be stored in string variables for subsequent processing or analysis.

[0100] In the embodiments of this specification, the content of the PDF document may be directly readable by the second library function, or it may be a PDF document in image format. For PDF documents in image format, the second library function may read empty characters as the result. For PDF documents in image format, or images in PDF documents, traditional OCR recognition methods can be used to read the document content, or a multimodal large model can be used to perform OCR recognition to obtain the document content to be translated.

[0101] Based on this, if the file format is a PDF document format, then a second library function for reading PDF document content is used to read the document content to be translated, which may specifically include:

[0102] If the file format is PDF document format, then the content of the document to be translated is read using the second library function used to read PDF document content, and the reading result of the second library function is obtained;

[0103] Determine the percentage of null characters in the results read by the second library function;

[0104] Determine whether the proportion of empty characters is less than a preset empty character proportion threshold to obtain the empty character determination result;

[0105] If the result of the empty character determination indicates that the proportion of empty characters is less than a preset empty character proportion threshold, then the result of the second library function is determined as the document content of the document to be translated.

[0106] Correspondingly, after determining whether the proportion of empty characters is less than a preset empty character proportion threshold and obtaining the empty character determination result, the method further includes:

[0107] If the result of the empty character determination indicates that the proportion of empty characters is greater than or equal to the preset empty character proportion threshold, then a multimodal large model is used to perform OCR recognition to obtain the document content of the document to be translated.

[0108] In the embodiments described in this specification, the preset whitespace character ratio threshold reflects the proportion of whitespace characters in a typical PDF file and is an empirical parameter. Of course, the whitespace character ratio threshold can also be set and adjusted according to actual needs, and no specific limitation is made thereto.

[0109] In the embodiments of this specification, if the proportion of empty characters in the reading result of the second library function is less than a preset empty character proportion threshold, it can be said that the PDF document is a document that the second library function can directly read. In this case, the reading result of the second library function can be directly determined as the document content of the document to be translated.

[0110] In the embodiments of this specification, for PDF documents in image format, the second library function reads empty characters as the result. Therefore, when the proportion of empty characters in the result read by the second library function is greater than or equal to a preset empty character proportion threshold, it can be indicated that the PDF document is an image-format PDF document that the second library function cannot directly read. For image-format PDF documents, a multimodal large model can be used to perform OCR recognition to obtain the document content to be translated. Since the content of using a multimodal large model to perform OCR recognition has been described in detail in the foregoing embodiments, it will not be repeated here.

[0111] In practical applications, if the document to be translated is in PDF format and contains multiple pages, in order to improve processing and translation efficiency, the multiple pages can be split into multiple pages, and then each page can be processed separately.

[0112] Based on this, if the file format is a PDF document format, then a second library function for reading PDF document content is used to read the document content to be translated, which may specifically include:

[0113] If the file format is PDF document format, then the document to be translated, which contains two or more pages, is split to obtain sub-documents;

[0114] For each sub-document, determine whether the content of the document to be translated is readable.

[0115] In practical applications, considering the complexity of PDF processing and the limited number of files that OCR can process at a time, multi-page PDFs can be split into smaller, single-page documents to improve efficiency. The resulting sub-documents are typically single-page documents, obtained by splitting by page. Of course, besides splitting by page number, other splitting methods can be used depending on the specific needs, such as splitting by content sections; there are no specific limitations. Single-page PDF documents can be processed directly without splitting.

[0116] In the embodiments of this specification, the threshold for the proportion of empty characters corresponding to each sub-document can reflect the proportion of empty characters in a typical PDF page, and is an empirical parameter. Of course, the threshold for the proportion of empty characters in a PDF page can also be set and adjusted according to actual needs, and no specific limitation is made thereto.

[0117] In the embodiments of this specification, after performing a splitting operation on the document to be translated, which contains two or more pages, to obtain multiple sub-documents, some of the sub-documents may be readable. For these readable documents, the content of the document can be directly read from these sub-documents using the second library function. However, some sub-documents may be documents that cannot be directly read by the second library function, that is, documents that are not readable. For these sub-documents, OCR recognition can be used.

[0118] In practical applications, a document containing two or more pages to be translated is split into multiple sub-documents. Each sub-document is then evaluated for readability. These sub-documents can be processed in parallel, significantly improving processing speed and efficiency while saving time. Furthermore, processing each sub-document is equivalent to refining the overall document, which also helps improve translation accuracy.

[0119] In practical applications, a document classification model can be trained in advance using document content samples labeled with document type tags, and then the document classification model can be used to determine the document type of the document to be translated.

[0120] Based on this, determining the document type of the document to be translated according to the document content may specifically include:

[0121] The document content is input into the document classification model to obtain the document type of the document to be translated as determined by the document classification model; the document classification model is trained based on document content samples labeled with document type.

[0122] In the embodiments of this specification, the document content samples can be in text form, each sample being labeled with a document type tag. By using these document content samples labeled with document type tags to train an initial document classification model, a trained document classification model with document classification capabilities can be obtained. In practical applications, document classification models can include, but are not limited to, the following types: clustering models, neural network models, logistic regression models, decision tree models, random forest models, Naive Bayes models, etc.

[0123] In practical applications, the document type of the document to be translated can also be determined based on one or more keywords in the document's content. For example, if the document contains the keyword "graduation certificate," then the document type is determined to be a graduation certificate. Similarly, if the document contains the keyword "notarized document," then the document type is a notarized document. Furthermore, if the document contains both the keywords "notarized document" and "graduation certificate," then the document type is a notarized document related to a graduation certificate. Determining the document type based on keywords in the document's content is more efficient than using document classification models, requires no computation, saves computational resources, and improves the speed of document type determination.

[0124] In practical applications, using document classification models to determine the document type of a document to be translated is more accurate than directly determining the document type based on keywords in the document's content. For example, a document containing the phrase "marriage certificate" could be classified as either a "marriage certificate" document or a "notarized document related to a marriage certificate." Determining the type by setting keywords could lead to errors, and preventing errors would require complex judgment rules. Using a document classification model, however, can directly obtain a more accurate identification result.

[0125] In practical applications, the document type of the document to be translated can be determined based on keywords in the document content, or a document classification model can be used to determine the document type of the document to be translated. Alternatively, the document type of the document to be translated can be roughly classified based on keywords in the document content, and then a document classification model can be used to further classify the document type of the document to be translated. No specific limitations are made for this.

[0126] In the embodiments of this specification, the purpose of classifying documents is to assign different translation templates to documents of different types. Therefore, in practical applications, documents that can use the same translation template can be classified into the same document type.

[0127] For example, for nationally standardized documents such as ID cards, marriage certificates, and divorce certificates, a translation template can be set for each. Therefore, the classification model needs to identify all ID card documents as the same type (i.e., ID card type), and so on. Of course, if the application scenario requires the identification of ID cards from different countries, and the formats of ID cards from different countries are not uniform, then in the embodiments of this specification, corresponding translation templates need to be set for ID cards from different countries. In this case, the document classification model needs to have the ability to identify ID cards from different countries as different types.

[0128] For example, documents such as graduation certificates and birth certificates, which vary depending on the issuing region or institution, can be divided into different translation templates according to their format. For instance, for graduation certificates, multiple templates, such as horizontal and vertical versions, can be created. Furthermore, the horizontal version can be further divided into multiple translation templates based on differences in content format.

[0129] For example, for documents such as notarized documents, which vary depending on the notarized matter and the issuing institution, different translation templates can be created based on the issuing institution and / or based on the notarized matter.

[0130] In practical applications, the more detailed the translation templates for the documents are divided, the more accurate the final translation will be, and the closer the format of the final translation will be to the format of the original document. However, the more detailed the translation templates are divided, the greater the workload of creating them will be. Therefore, translation templates should be divided according to actual needs, taking into account both accuracy and workload.

[0131] In practical applications, the multimodal large language model can be pre-trained using document samples labeled with document type tags, and then the document type of the document to be translated can be determined using the pre-trained multimodal large language model.

[0132] Based on this Figure 2 In the method described above, step 204 involves determining the document type of the document to be translated in response to the document translation request. This may specifically include:

[0133] In response to the document translation request, the document to be translated is input into a pre-trained multimodal large language model to obtain the document type of the document to be translated as determined by the multimodal large language model; the multimodal large language model is trained based on document samples labeled with document type labels.

[0134] In the embodiments of this specification, Multimodal Large Language Models (MLLMs) are a class of artificial intelligence models capable of processing and understanding multiple types of data (such as text, images, audio, etc.). Unlike traditional unimodal language models, multimodal models combine different kinds of information, enabling them to better capture complex contexts and semantic relationships. Multimodal Large Language Models are extensions of Large Language Models (LLMs) and have the ability to receive and reason about multimodal information. Here, "modal" refers to the way things are experienced and occur; people live in a world composed of multiple modalities of information, including visual, auditory, textual, and olfactory information. Multimodal Large Language Models can jointly analyze different types of data, such as images, videos, sounds, and text, enabling a more comprehensive understanding of rich information.

[0135] In the embodiments of this specification, the document samples labeled with document type used for pre-training the multimodal large language model can be documents of any file format, including but not limited to: image format, Word document format, and PDF document format.

[0136] In the embodiments of this specification, after training the multimodal large language model using document samples labeled with document type tags, the multimodal large language model can acquire document classification capabilities. Since the document samples used for pre-training the multimodal large language model can be documents of any file format, documents can be directly used as training samples without extracting the document content and then using the content as training samples. Correspondingly, when using the multimodal large language model to classify documents, only the document needs to be input; there is no need to extract the document content first and then input the content into the model. Therefore, classifying documents using the multimodal large language model is more convenient and efficient than classifying documents using a document classification model.

[0137] Optional, Figure 2 In the method described above, before step 210, where a large language model is used to translate the elements to be translated to obtain the translated text, the following may also be included:

[0138] Determine a translation library corresponding to the document type; the translation library contains standard translations of candidate elements;

[0139] Correspondingly, the process of translating the elements to be translated using a large language model to obtain the translated text may specifically include:

[0140] The element to be translated and the translation library are input into the large language model to obtain the element translation of the element to be translated, which is output by the large language model with reference to the translation library.

[0141] In the embodiments of this specification, the purpose of setting up a translation library corresponding to a document type is that when a word from the translation library appears in a document of that document type, the pre-stored standard translation in the translation library can be used directly for translation. In practical applications, some content that requires fixed translation can be set in the translation library. For example, entity names such as university names, institution names, and company names, and their corresponding fixed translations, can be set in the translation library. When a large language model is used to translate the elements to be translated, the translation can be based on the accurate translations in the translation library, thereby reducing the possibility of translation errors when using the large language model for translation. Similarly, for some abbreviated content that is not easily translated based on literal meaning, to avoid errors in the large language model's translation of these abbreviated content, which is not easily translated based on literal meaning, these contents and their corresponding translations can also be set in the translation library.

[0142] In practical applications, different translation libraries can be set up for different document types. This is because even for the same candidate elements, the corresponding translations may differ depending on the document type. For example, the term "World Bank" is usually translated as "World Bank" in most documents; however, in certain specific contexts, to emphasize its nature as an international bank for reconstruction and development, it may be translated as "International Bank for Reconstruction and Development." Therefore, in practical applications, different translation libraries can be set up for different document types to accommodate their translation styles. Of course, a single translation library can also be used for multiple document types; there is no specific limitation on this.

[0143] For example, taking a document of type "graduation certificate" as an example, such documents usually contain elements such as "school name", "principal" and "certificate number". The alternative elements corresponding to the "school name" element are entity names. Therefore, standard translations of common (or easily mistranslated) entity names corresponding to the "school name" element can be set in the translation library. For example, the standard translation of "Tsinghua University" can be set as "Tsinghua University" in the translation library; and the standard translation of "Peking University" can be set as "Peking University" in the translation library.

[0144] Correspondingly, the step of inputting the element to be translated and the translation library into the large language model to obtain the element translation of the element to be translated output by the large language model with reference to the translation library may specifically include:

[0145] Based on the element to be translated and the translation library, prompt information is generated for input into the large language model; the prompt information is used to instruct the large language model to translate the element to be translated based on the content of the translation library;

[0146] The prompt information is input into the large language model to obtain the element translation of the element to be translated, which is output by the large language model with reference to the translation library.

[0147] In the embodiments of this specification, determining the translation library corresponding to the document type may involve determining the library identifier information or storage location information of the translation library corresponding to the document type. Correspondingly, generating prompt information for input to the large language model based on the element to be translated and the translation library may involve generating prompt information for input to the large language model based on the element to be translated and the library identifier information or storage location information representing the translation library. In this case, it is not necessary to directly provide the specific content of the translation library to the large speech model; instead, the library identifier information or storage location information of the translation library can be provided to the large speech model, allowing the large language model to obtain the specific content of the translation library based on the library identifier information or storage location information.

[0148] In practical applications, when the element to be translated matches a candidate element in the translation library—for example, if the element to be translated contains "Tsinghua University," and the candidate element in the translation library also contains "Tsinghua University" with the standard translation being "Tsinghua University"—then the large speech model can refer to the translation library and determine the element translation of "Tsinghua University" as "Tsinghua University" instead of directly translating it as "Qinghua University." This demonstrates that referencing a translation library when translating can effectively improve the accuracy of element translation and ensure consistency in element translation.

[0149] In practical applications, the translation library can not only set up candidate elements and their corresponding standard translations, but also further record the target element type corresponding to the candidate element. The target element type of the candidate element is included in the element types contained in the document of that document type. The advantage of this setup is that when the same element to be translated appears multiple times in a document, the required translation format differs depending on its location. For example, a full translation could be used when it appears as the first element type, and an abbreviated translation as it appears as the second element type. Based on the specific element type corresponding to the element to be translated, a more refined translation can be adopted according to actual business needs, improving the accuracy of the translation.

[0150] Optional, Figure 2 In the method described above, step 212 involves concatenating the translated elements with the translation template to obtain the translated document of the document to be translated. Specifically, this may include:

[0151] The corresponding placeholders in the translation template are replaced with the element translations of each of the elements to be translated to obtain the document translation of the document to be translated.

[0152] In the embodiments of this specification, the translation template may reserve placeholders corresponding to the element translations. This allows the element translations to be replaced with the corresponding placeholders in the translation template to complete the splicing between the element translations and the translation template, resulting in the document translation. For example, when translating a graduation certificate from Chinese to English, if the "Institution Name" field was "Peking University" before translation, the translation template would contain "College name:", followed by a placeholder. "Peking University" is the element to be translated, and the translated element is "Peking University". Replacing the placeholder after "College name:" with "Peking University" completes the splicing, resulting in "College name: Peking University".

[0153] In practical applications, a splicing model can also be used to splice the element translation and the translation template, or other methods can be used to splice the element translation and the translation template; no specific limitations are imposed on this. In the embodiments of this specification, by introducing a translation template, since the translation template contains the translation of some content, it is unnecessary to translate the existing content in the translation template, thereby reducing the amount of translation, improving translation efficiency, and minimizing translation errors. In addition, by introducing a translation template, the format of the resulting document translation can be ensured to be consistent with the format of the document to be translated.

[0154] Optional, Figure 3The method described herein involves a translation template that is consistent with the page format of the document to be translated.

[0155] Page formatting specifically reflects the layout of content on a page. More specifically, it reflects the relative positions of different content items on the page. For example, for a graduation certificate, if the document to be translated is landscape format and the graduate's photo is in the upper right corner, then the translation template will also be landscape format with the graduate's photo in the upper right corner. This is just an example; in actual application, all fixed content appearing in the translation template and its corresponding content in the document to be translated can be positioned identically on the page. This ensures that the translated document has a consistent page format with the original document.

[0156] In practical applications, some elements requiring standardized translation can have their standardized translations set in a translation library, such as the names of notary offices and universities. If a particular candidate element requiring standardized translation has a large workload, it can be used as a dimension for classifying document types, creating new document types, and the translated content of that candidate element can be set in a translation template. For example, a notarized document might contain phrases like "Xiamen Notary Office, Fujian Province, People's Republic of China" and "certificate number," and the corresponding translations can be set directly in a translation template or in a translation library; there are no specific limitations on this.

[0157] Figure 3 This is a schematic diagram illustrating an embodiment of translating a graduation certificate, provided as an example of this specification. Figure 3 As shown, the document to be translated is a graduation certificate, in Chinese, and needs to be translated into English. The elements to be translated, such as "Zhang San," "Male," "Civil Engineering," "Tsinghua University," "100xxxxxxxxxxx," and the specific year, month, and date, are highlighted in the dotted lines on the graduation certificate. These elements are translated using a large language model, resulting in corresponding translated elements. For example, "Zhang San" is translated as "Zhang San"; "Male" as "male"; and "Civil Engineering" as "Civil Engineering." These are not listed individually here. In the translated document, the content highlighted in the dotted lines represents the translated elements corresponding to the dotted lines on the graduation certificate. However, in the translation template, these dotted-line areas are empty characters or placeholders. Figure 4It can also be seen that the page format of the document translation is the same as that of the document to be translated, and the translation template is in the same format as the document translation. Therefore, the page format of the translation template is also the same as that of the document to be translated. The consistent page format of the three is conducive to improving the accuracy of translation, facilitating the verification by the verification personnel, and also conducive to enhancing the user satisfaction.

[0158] Figure 4 It is a schematic diagram of an embodiment for translating a notarial certificate provided in the embodiment of this specification. As Figure 4 shown, the document type of the document to be translated is a notarial certificate, and the document to be translated is in Chinese and needs to be translated into English. The "Yang xx", "female", "130xxxxxxxxxxxxxxx", "XX Middle School", "1xx" and specific year, month, and date enclosed by the dashed line in this notarial certificate are the elements to be translated. After translating these elements to be translated using a large language model, the corresponding element translations are obtained. For example, the corresponding element translation for "Yang xx" is "Yang xx"; the corresponding element translation for "female" is "female"; the corresponding element translation for "XX Middle School" is "XX Middle School", and they are not listed one by one here. In the document translation obtained after translating the document to be translated, the content enclosed by the dashed line is the corresponding element translation of the element to be translated enclosed by the dashed line in the graduation certificate. And the content at these positions enclosed by the dashed line in the translation template is an empty character or a placeholder. From Figure 2 It can also be seen that the page format of the document translation is the same as that of the document to be translated, and the translation template is in the same format as the document translation. Therefore, the page format of the translation template is also the same as that of the document to be translated. The consistent page format of the three is conducive to improving the accuracy of translation, facilitating the verification by the verification personnel, and also conducive to enhancing the user satisfaction.

[0159] Optionally, Figure 2 in the method in, after splicing the element translation and the translation template to obtain the document translation of the document to be translated in step 212, it may further include:

[0160] Feedback the document translation to the requesting device that sent the document translation request.

[0161] In the embodiments of this specification, the requesting device sending the document translation request can be a client of the document translation platform. Users can upload documents to be translated to the document translation platform server through the client and initiate a document translation request. Upon receiving the document translation request, the document translation platform server can respond by generating a translation task for the document, executing the translation task, and obtaining the translated document. The translated document is then sent back to the requesting device (the document translation platform client). In practical applications, data transmission between the document translation platform client and server can be based on wired network communication such as Ethernet or fiber optic communication, or on wireless network communication such as Wi-Fi or mobile networks; no specific limitation is made.

[0162] In practical applications, even using a large language model to translate the document cannot guarantee that the translation result is completely accurate. Therefore, in order to improve the accuracy of the document translation provided to users, a large language model is used to translate the document. After obtaining the document translation, the translation can be manually reviewed and corrected.

[0163] Based on this Figure 5 In the method described above, after step 212, where the translated element text is concatenated with the translation template to obtain the translated text of the document to be translated, the method may further include:

[0164] Obtain manual correction operations for the translated document;

[0165] In response to the manual correction operation, the document translation is modified to obtain the corrected document translation;

[0166] The corrected translation of the document is fed back to the requesting device that sent the document translation request.

[0167] In the embodiments of this specification, a large language model is used to translate the document to be translated. After obtaining the translated document, the document translation proofreader can review the translation. If translation errors are found, manual correction operations can be performed. These manual correction operations may include, but are not limited to, deleting characters, adding characters, and replacing characters. In practical applications, for each manual correction operation, a corresponding manual correction operation record can be generated and stored for later review.

[0168] In practical applications, after the document translation is modified by manual proofreading, the corrected translation can be stored on the server side of the document translation platform or in other data storage space to retain a backup of the corrected translation.

[0169] Optionally, after modifying the document translation in response to the manual correction operation to obtain the corrected document translation, the process may further include:

[0170] In response to the manual correction operation, determine the element to be corrected and the element correction translation corresponding to the element to be corrected;

[0171] The corrected element and its corresponding element-corrected translation are updated to the translation library.

[0172] In the embodiments of this specification, the elements targeted by the manual correction operation are those that have translation errors in the large language model, and these elements are also those not originally included in the translation library. Therefore, after updating the translation library with the elements to be corrected and their corresponding element-corrected translations, the large language model will translate the elements to be corrected based on the updated translation library. The resulting translation is the element-corrected translation corresponding to the elements to be corrected, which is an accurate translation, thus further improving the accuracy and efficiency of translation.

[0173] To verify the beneficial effects of this application, the inventors used the document translation method described in this application to conduct translation tests on eight document types: birth certificate, ID card, graduation certificate, degree certificate, transcript, marriage certificate, divorce certificate, and driver's license. The test results are shown in Table 1.

[0174] Table 1:

[0175]

[0176] In Table 1, the element accuracy rate refers to the accuracy rate of extracting the elements corresponding to the document type from the document to be translated, i.e., the element extraction accuracy rate; the translation accuracy rate refers to the accuracy rate of the translated element obtained by translating the elements using a large language model, i.e., the element translation accuracy rate. The overall accuracy rate can be the product of the element accuracy rate and the translation accuracy rate, which can comprehensively reflect the final translation accuracy rate. In practical applications, considering that the template has fixed content and does not need to be translated, the overall accuracy rate described in Table 1 can reflect the accuracy rate of translating documents based on the document translation method of this application. As can be seen from the results in Table 1, the document translation method of this application can ensure that the overall accuracy rate of document translation reaches more than 85%.

[0177] Figure 5This is an overall flowchart of a document translation method provided in the embodiments of this specification. Figure 5 As shown, the document translation method can specifically include the following steps:

[0178] Step 502: Receive the document translation request from the requesting party.

[0179] Step 504: Determine the file format of the document to be translated.

[0180] Step 506: Read the document content of the document to be translated using the content reading rules corresponding to the file format.

[0181] Step 508: Input the document content into the document classification model to obtain the document type of the document to be translated as determined by the document classification model.

[0182] Step 510: Extract the elements to be translated from the document that correspond to the document type.

[0183] Step 512: Determine the translation template based on the document type.

[0184] Step 514: Determine the translation library corresponding to the document type.

[0185] Step 516: Based on the elements to be translated and the translation library, generate prompts for input into the large language model.

[0186] Step 518: Input the prompt information into the large language model to obtain the element translation of the element to be translated, output by the large language model reference translation library.

[0187] Step 520: Replace the corresponding placeholders in the translation template with the element translations of each element to be translated to obtain the document translation of the document to be translated.

[0188] Step 522: Obtain the manual correction operation for the document translation, and modify the document translation based on the manual correction operation to obtain the document corrected translation.

[0189] Step 524: Send the corrected translation of the document back to the requesting device.

[0190] Step 526: Determine the elements to be corrected and their corresponding element-corrected translations for the manual correction operation; and update the elements to be corrected and their corresponding element-corrected translations to the translation library.

[0191] In step 506, if the file format is an image format, a multimodal large model is used to perform OCR recognition to obtain the document content of the document to be translated; if the file format is a WORD document format, a first library function for reading WORD document content is used to read the document content of the document to be translated; if the file format is a PDF document format, a second library function for reading PDF document content is used to read the document content of the document to be translated.

[0192] Figure 6 The method described above involves a document translation platform receiving a translation request for a document. Based on the request, the platform determines the document type, obtains a translation template for that type, extracts the elements to be translated from the document, and uses a large language model to translate these elements. Finally, the element translations are combined with the translation template to obtain the final document translation. By setting fixed content as a template and translating variable content using a large language model, the platform avoids translating all content in the document, replacing both human translation and simple machine translation. This not only improves translation efficiency but also enhances accuracy.

[0193] Based on the same idea, embodiments of this specification also provide apparatus corresponding to the above methods.

[0194] Figure 2 The embodiments provided in this specification correspond to Figure 6 A schematic diagram of the structure of a document translation device. (See diagram below.) Figure 6 As shown, the device may include:

[0195] The request receiving module 602 is used to receive a document translation request for translating a document to be translated.

[0196] The document type determination module 604 is used to determine the document type of the document to be translated in response to the document translation request.

[0197] The translation template determination module 606 is used to determine the translation template according to the document type.

[0198] The element extraction module 608 is used to extract elements to be translated from the document to be translated that correspond to the document type. The elements to be translated are the content in the document to be translated other than the translation template.

[0199] The element translation module 610 is used to translate the elements to be translated using a large language model to obtain the translated text of the elements.

[0200] The translation splicing module 612 is used to splice the translated elements with the translation template to obtain the translated document of the document to be translated.

[0201] based on Figure 7 The embodiments of this specification also provide some specific implementations of the device, which will be described below.

[0202] Optionally, the document type determination module 604 may specifically include:

[0203] The document content reading submodule is used to read the document content of the document to be translated in response to the document translation request.

[0204] The document type determination submodule is used to determine the document type of the document to be translated based on the document content.

[0205] Optionally, the document content reading submodule may specifically include:

[0206] The file format determination unit is used to determine the file format of the document to be translated; the file format includes image format, WORD document format or PDF document format.

[0207] The document content reading unit is used to read the document content of the document to be translated using content reading rules corresponding to the file format.

[0208] Optionally, the document content reading unit may specifically include:

[0209] The first reading subunit is used to perform OCR recognition using a multimodal large model if the file format is an image format, in order to obtain the document content of the document to be translated.

[0210] Optionally, the document content reading unit may specifically include:

[0211] The second reading subunit is used to read the document content of the document to be translated by employing a first library function for reading WORD document content if the file format is WORD document format.

[0212] Optionally, the document content reading unit may specifically include:

[0213] The third reading subunit is used to read the document content of the document to be translated by employing a second library function for reading PDF document content if the file format is PDF document format.

[0214] Optionally, the third reading subunit is configured as follows:

[0215] If the file format is PDF document format, then the content of the document to be translated is read using the second library function used to read PDF document content, and the reading result of the second library function is obtained;

[0216] Determine the percentage of null characters in the results read by the second library function;

[0217] Determine whether the proportion of empty characters is less than a preset empty character proportion threshold to obtain the empty character determination result;

[0218] If the result of the empty character determination indicates that the proportion of empty characters is less than a preset empty character proportion threshold, then the result of the second library function is determined as the document content of the document to be translated.

[0219] Optionally, the third reading subunit is further configured as follows:

[0220] If the result of the empty character determination indicates that the proportion of empty characters is greater than or equal to the preset empty character proportion threshold, then a multimodal large model is used to perform OCR recognition to obtain the document content of the document to be translated.

[0221] Optionally, the third reading subunit is configured as follows:

[0222] If the file format is PDF document format, then the document to be translated, which contains two or more pages, is split to obtain sub-documents;

[0223] For each sub-document, determine whether the content of the document to be translated is readable.

[0224] Optionally, the document type determination submodule may specifically include:

[0225] The document type determination unit is used to input the document content into the document classification model to obtain the document type of the document to be translated as determined by the document classification model; the document classification model is trained based on document content samples labeled with document type tags.

[0226] Optionally, the document type determination module 604 may specifically include:

[0227] The document type determination submodule is used to respond to the document translation request by inputting the document to be translated into a pre-trained multimodal large language model to obtain the document type of the document to be translated as determined by the multimodal large language model; the multimodal large language model is trained based on document samples labeled with document type labels.

[0228] Optionally, the device may further include:

[0229] The translation library determination module is used to determine the translation library corresponding to the document type; the translation library contains standard translations of candidate elements.

[0230] Correspondingly, the element translation module 610 specifically includes:

[0231] The element translation submodule is used to input the element to be translated and the translation library into the large language model to obtain the element translation of the element to be translated, which is output by the large language model with reference to the translation library.

[0232] Optionally, the element translation submodule may specifically include:

[0233] The prompt information generation unit is used to generate prompt information for input into the large language model based on the element to be translated and the translation library; the prompt information is used to instruct the large language model to translate the element to be translated based on the content of the translation library.

[0234] The element translation acquisition unit is used to input the prompt information into the large language model to obtain the element translation of the element to be translated, which is output by the large language model with reference to the translation library.

[0235] Optionally, the translation splicing module 612 may specifically include:

[0236] The translation splicing submodule is used to replace the corresponding placeholders in the translation template with the element translations of each of the elements to be translated, so as to obtain the document translation of the document to be translated.

[0237] Optionally, in the device, the translation template is consistent with the page format of the document to be translated.

[0238] Optionally, the device further includes:

[0239] The result feedback module is used to send the translated document back to the requesting device that sent the document translation request.

[0240] Optionally, the device further includes:

[0241] The correction operation acquisition module is used to acquire manual correction operations for the translated document.

[0242] The proofread translation acquisition module is used to modify the document translation in response to the manual proofreading operation and obtain the proofread translation of the document.

[0243] The proofreading translation feedback module is used to provide the proofread translation of the document to the requesting device that sent the document translation request.

[0244] Optionally, the device further includes:

[0245] The module for determining the element to be corrected is used to determine, in response to the manual correction operation, the element to be corrected targeted by the manual correction operation and the element correction translation corresponding to the element to be corrected.

[0246] The corrected element update module is used to update the corrected element and the corresponding element-corrected translation to the translation library.

[0247] It is understood that the modules mentioned above refer to computer programs or program segments used to perform one or more specific functions. Furthermore, the distinction between these modules does not imply that the actual program code must also be separate.

[0248] Based on the same idea, this specification also provides devices corresponding to the above methods in its embodiments.

[0249] Figure 2 The embodiments provided in this specification correspond to Figure 7 A schematic diagram of the structure of a document translation device. (See diagram below.) Figure 7 As shown, device 700 may include:

[0250] At least one processor 710; and,

[0251] Memory 730 communicatively connected to the at least one processor; wherein,

[0252] The memory 730 stores instructions 720 that can be executed by the at least one processor 710, the instructions being executed by the at least one processor 710 to enable the at least one processor 710 to:

[0253] Receive a document translation request that requests the translation of the document to be translated;

[0254] In response to the document translation request, the document type of the document to be translated is determined;

[0255] Determine the translation template based on the document type;

[0256] Extract the elements to be translated from the document to be translated, which correspond to the document type; the elements to be translated are the content in the document to be translated other than the translation template.

[0257] The elements to be translated are translated using a large language model to obtain the translated text.

[0258] The translated elements are combined with the translation template to obtain the translated document of the document to be translated.

[0259] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, for... Figure 1 As the device shown is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0260] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0261] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages ​​and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.

[0262] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0263] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0264] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.

[0265] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0266] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0267] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0268] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0269] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0270] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0271] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0272] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0273] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0274] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A document translation method, comprising: receiving a document translation request for requesting translation of a document to be translated; determining a document type of the document to be translated in response to the document translation request; determining a translation template according to the document type; the translation template containing translations of fixed fields in the document to be translated; the translation template is consistent with the page format of the document to be translated; extracting translated elements corresponding to the document type from the document to be translated; the translated elements are contents of the document to be translated other than the translation template; adopting a large language model to translate the translated elements to obtain element translations; splicing the element translations and the translation template to obtain a document translation of the document to be translated, specifically including: adopting each of the element translations to replace a corresponding placeholder in the translation template to obtain the document translation of the document to be translated.

2. The method of claim 1, wherein the document type of the document to be translated is determined in response to the document translation request, specifically comprising: reading document content of the document to be translated in response to the document translation request; determining the document type of the document to be translated according to the document content.

3. The method of claim 2, wherein the document content of the document to be translated is read in response to the document translation request, specifically comprising: determining a file format of the document to be translated; the file format includes a picture format, a WORD document format, or a PDF document format; reading the document content of the document to be translated using a content reading rule corresponding to the file format.

4. The method of claim 3, wherein the document content of the document to be translated is read using the content reading rule corresponding to the file format, specifically comprising: if the file format is a picture format, performing OCR recognition using a multi-modal large model to obtain the document content of the document to be translated; if the file format is a WORD document format, reading the document content of the document to be translated using a first library function for reading WORD document content; if the file format is a PDF document format, reading the document content of the document to be translated using a second library function for reading PDF document content.

5. The method of claim 3, wherein the document content of the document to be translated is read using the content reading rule corresponding to the file format, specifically comprising: if the file format is a PDF document format, performing a splitting operation on the document to be translated containing two or more pages to obtain sub-documents; for each sub-document, determining whether the content in the document to be translated is readable.

6. The method of claim 2, wherein the document type of the document to be translated is determined according to the document content, specifically comprising: inputting the document content into a document classification model to obtain the document type of the document to be translated determined by the document classification model; the document classification model is trained based on document content samples labeled with document type labels. ​ 7. The method of claim 1, wherein the determining the document type of the document to be translated in response to the document translation request comprises: inputting the document to be translated into a pre-trained multi-modal large language model to obtain a document type of the document to be translated determined by the multi-modal large language model in response to the document translation request; and wherein the multi-modal large language model is trained based on document samples labeled with document type labels.

8. The method of claim 1, wherein the translating the element to be translated using a large language model to obtain an element translation further comprises: determining a translation library corresponding to the document type; and wherein the translation library includes standard translations of alternative elements; and wherein the translating the element to be translated using a large language model to obtain an element translation comprises: inputting the element to be translated and the translation library into a large language model to obtain an element translation of the element to be translated output by the large language model with reference to the translation library.

9. The method of claim 8, wherein the inputting the element to be translated and the translation library into a large language model to obtain an element translation of the element to be translated output by the large language model with reference to the translation library comprises: generating prompt information for inputting into a large language model based on the element to be translated and the translation library; wherein the prompt information is used to instruct the large language model to translate the element to be translated based on content of the translation library; and wherein the inputting the prompt information into the large language model to obtain an element translation of the element to be translated output by the large language model with reference to the translation library.

10. The method of claim 1, wherein the splicing the element translation with the translation template to obtain a document translation of the document to be translated further comprises: obtaining a manual correction operation for the document translation; modifying the document translation to obtain a document corrected translation in response to the manual correction operation; and feeding back the document corrected translation to a requestor device that sent the document translation request.

11. The method of claim 10, wherein the modifying the document translation to obtain a document corrected translation in response to the manual correction operation further comprises: determining a corrected element to which the manual correction operation is directed and an element corrected translation corresponding to the corrected element in response to the manual correction operation; and updating the corrected element and the element corrected translation corresponding to the corrected element to a translation library.

12. A document translation apparatus, comprising: a request receiving module configured to receive a document translation request for requesting translation of a document to be translated; a document type determining module configured to determine a document type of the document to be translated in response to the document translation request; a translation template determining module configured to determine a translation template according to the document type; wherein the translation template includes translations of fixed fields in the document to be translated; and wherein the translation template is consistent with a page format of the document to be translated; and an element extracting module configured to extract an element to be translated corresponding to the document type from the document to be translated. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ The element to be translated is content in the document to be translated other than the translation template; An element translation module is configured to translate the element to be translated by using a large language model to obtain an element translation; A translation splicing module is configured to splice the element translation and the translation template to obtain a document translation of the document to be translated, specifically including: replacing a corresponding placeholder in the translation template with each element translation to obtain the document translation of the document to be translated.

13. A document translation device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: receive a document translation request for requesting translation of a document to be translated; determine a document type of the document to be translated in response to the document translation request; determine a translation template according to the document type; the translation template contains translations of fixed fields in the document to be translated; the translation template is consistent with a page format of the document to be translated; extract an element to be translated corresponding to the document type from the document to be translated; the element to be translated is content in the document to be translated other than the translation template; translate the element to be translated by using a large language model to obtain an element translation; splice the element translation and the translation template to obtain a document translation of the document to be translated, specifically including: replacing a corresponding placeholder in the translation template with each element translation to obtain the document translation of the document to be translated.

Citation Information

Patent Citations

  • Multi-language translation method and system based on templates

    CN106708809A

  • Text translation method and device and equipment

    CN107391500A