Translation method and device based on large language model and electronic equipment

By introducing target cue words into a large language model and adjusting the direction of semantic understanding and translation, the problem of insufficient understanding of specific domains in traditional machine translation models is solved, and more accurate translation results are achieved.

CN122021667APending Publication Date: 2026-05-12GUANGZHOU LIZHI NETWORK TECH CO LTD (GUANGDONG)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411603372.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Traditional machine translation models lack an understanding of industry terminology and standards specific to a particular field, leading to translation errors and incoherence, which affects the accuracy of the translation results.

Method used

By extracting target prompts from user input, using a large language model to guide the translation process, adjusting semantic understanding weights and translation direction, and generating translation results that match specific domains.

Benefits of technology

It improves the accuracy of translation results, ensures that the translation results meet the specific needs of users in their respective fields, and avoids the problems of mistranslation and incoherence in traditional translation methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122021667A_ABST
    Figure CN122021667A_ABST
Patent Text Reader

Abstract

The invention relates to a translation method and device based on a large language model and electronic equipment. The method comprises the steps of obtaining to-be-translated text information and user input information; the user input information is used for indicating a translation demand for translating the to-be-translated text information; obtaining a corresponding target prompt word according to the user input information; and inputting the to-be-translated text information and the target cue word into a preset large language model, and outputting a target translation result matched with the user input information. According to the scheme provided by the invention, the target cue word corresponding to the to-be-translated text information can be extracted from the information input by the user, and the target cue word is utilized to guide the translation process of the large language model, so that the translation result clings to the translation requirement of the specific field, and the accuracy of the translation result is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a translation method, apparatus and electronic device based on a large language model. Background Technology

[0002] The principle of document translation is to use computer programs to analyze and process the source language text, and then generate translation results in the target language based on a pre-trained model.

[0003] In related technologies, general machine translation models are typically used to directly translate text from the source language to the target language. However, traditional machine translation models lack an understanding of specific industry terminology, industry standards, and other specific content within a particular field. They merely perform simple conversions and combinations of words and phrases according to preset rules and algorithms, which can easily lead to translation errors, incoherent translations, and other problems, affecting the accuracy of the translation results. Summary of the Invention

[0004] To address or partially address the problems existing in related technologies, this application provides a translation method, apparatus, and electronic device based on a large language model. This method can extract target prompt words corresponding to the text to be translated from user input information, and use the target prompt words to guide the translation process of the large language model, so that the translation results closely meet the translation needs of a specific domain and effectively improve the accuracy of the translation results.

[0005] The first aspect of this application provides a translation method based on a large language model, which obtains text information to be translated and user input information; the user input information is used to indicate the translation requirements for translating the text information to be translated. Based on the user input information, obtain the corresponding target prompt words; The text to be translated and the target prompt words are input into a preset large language model, and the target translation result that matches the user input information is output.

[0006] In some implementations, obtaining the corresponding target prompt word based on the user input information includes: Based on the user input information, extract the prompt word information from the user input information; wherein, the prompt word information includes at least one of: file content description information, domain description information, and translation requirement information; Based on the provided prompt information, a target prompt is generated.

[0007] In some implementations, the output of the target translation result matching the user input information includes: Based on the paragraph information in the text to be translated, the target translation results that match the user input information are output sequentially for the corresponding paragraphs.

[0008] In some implementations, the text information to be translated is obtained in the following ways: Receive files to be processed; The content of the file to be processed is recognized using an OCR text recognition method to obtain the text information to be translated; the format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format; or Receive address information; the address information is used to indicate the storage location of the file to be processed. The corresponding file to be processed is obtained based on the address information. The content of the file to be processed is then processed using an OCR text recognition method to obtain the text information to be translated. The format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format.

[0009] In some implementations, before outputting a target translation result that matches the user input information, the method further includes: Based on the file to be processed, obtain a background image that matches the text information to be translated; The output, which matches the target translation result with the user input information, includes: Based on the paragraph information in the text to be translated, the target translation results, which are covered on the background image and match the user input information, are output sequentially in a segmented manner.

[0010] In some implementations, before outputting a target translation result that matches the user input information, the method further includes: Based on the file to be processed, obtain the paragraph background color that matches the text information to be translated; The process of outputting the target translation results for each paragraph includes: Based on the paragraph information in the text to be translated, a preset shape area with the corresponding paragraph background color is covered on the background image at the corresponding paragraph position; After adding a text box to the preset shape area, fill the text box with the text information of the corresponding target translation result.

[0011] In some implementations, the method further includes: Receive a modification instruction; the modification instruction indicates the activation of the editing function to edit the target translation result of the corresponding segment; Based on the modification instructions, the modification interface for the target translation result of the corresponding segment is displayed. The target translation result is modified based on the input content of the modified interactive interface.

[0012] In some implementations, the method further includes: Receive an export instruction; the export instruction indicates that some or all of the target translation results be exported. According to the export instruction, the target translation result is exported in part or in whole as a target file; the target file format includes either PDF format or image format.

[0013] A second aspect of this application provides a translation device based on a large language model, comprising: The information acquisition module is used to acquire the text information to be translated and user input information; the user input information is used to indicate the need to translate the text information to be translated. The prompt word acquisition module is used to acquire the corresponding target prompt word based on the user input information; and The result output module is used to input the text information to be translated and the target prompt words into a preset large language model, and output the target translation result that matches the user input information.

[0014] A third aspect of this application provides an electronic device, comprising: Processor; and A memory that stores executable code, which, when executed by the processor, causes the processor to perform the method described above.

[0015] The technical solution provided in this application may include the following beneficial effects: The technical solution of this application obtains the text information to be translated and the user input information used to indicate the translation requirements. Based on the user input information, it obtains the target prompt words corresponding to the text information to be translated. The text information to be translated and the target prompt words are input together into a preset large language model. In the subsequent translation process, the target prompt words are used to guide the translation process of the large language model, so that the translation result closely matches the translation requirements of the specific domain. This effectively avoids the problems of inaccuracy and non-compliance that may occur when traditional translation methods deal with specific requirements, making the translation result more in line with user expectations and effectively improving the accuracy of the translation result.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0017] The above and other objects, features and advantages of this application will become more apparent from the more detailed description of exemplary embodiments thereof in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments thereof.

[0018] Figure 1 This is a flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application. Figure 2 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application. Figure 3 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application. Figure 4 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application. Figure 5 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application. Figure 6 This is a schematic diagram of the structure of a translation device based on a large language model, as shown in an embodiment of this application; Figure 7 This is another schematic diagram of the structure of a translation device based on a large language model, as shown in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application. Detailed Implementation

[0019] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make this application more thorough and complete, and to fully convey the scope of this application to those skilled in the art.

[0020] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0021] It should be understood that although the terms "first," "second," "third," etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0022] In related technologies, general machine translation models are typically used to directly translate text from the source language to the target language. However, traditional machine translation models lack an understanding of specific industry terminology, industry standards, and other specific content within a particular field. They merely perform simple conversions and combinations of words and phrases according to preset rules and algorithms, which can easily lead to translation errors, incoherent translations, and other problems, affecting the accuracy of the translation results.

[0023] To address the aforementioned issues, this application provides a translation method based on a large language model. This method can extract target prompt words corresponding to the text to be translated from user input information, and use these target prompt words to guide the translation process of the large language model. This ensures that the translation results closely match the response needs of a specific domain, effectively improving the accuracy of the translation results.

[0024] The technical solutions of the embodiments of this application are described in detail below with reference to the accompanying drawings.

[0025] Figure 1 This is a flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application.

[0026] See Figure 1 The translation method based on a large language model in this application includes: S110, Obtain the text information to be translated and the user input information; the user input information is used to indicate the translation requirements for translating the text information to be translated.

[0027] In this step, based on the document to be translated, translation text information is obtained, as well as user input information, which indicates the translation requirements for translating the text information to be translated.

[0028] S120: Obtain the corresponding target prompt words based on the user input information.

[0029] In this step, based on the user input information, prompt word information is extracted to obtain the target prompt words that correspond to the translation requirements in the user input information.

[0030] In some implementations, user input can be in natural language format. It should be understood that user input can be in natural language format; for example, if the user input is "This is a car rental receipt, focusing on the terms related to fees," then based on the aforementioned natural language sentence, target prompts such as "car rental receipt" and "fee-related terms" can be obtained.

[0031] In some implementations, target prompt words can be obtained by matching from a pre-set prompt word library. It should be understood that a pre-set prompt word library contains prompt words related to a specific domain or translation task. Matching target prompt words from this library can reduce problems caused by ambiguity and parsing errors in natural language processing, while also accelerating prompt word extraction and improving the accuracy of target prompt word acquisition.

[0032] S130: Input the text information to be translated and the target prompt words into the preset large language model, and output the target translation result that matches the user input information.

[0033] In this step, the acquired text information to be translated and the target prompt words are input into a preset large language model. The target prompt words guide the translation process of the preset large language model, so that when the preset large language model is translating the text information to be translated, it can automatically correct the relevant translation process based on the input target prompt words and output the target translation result that matches the user input information.

[0034] It should be understood that the process of guiding the translation process of a pre-defined large language model using target prompts can be achieved in at least the following ways: adjusting semantic understanding weights and correcting translation direction and logical relationships based on prompts.

[0035] Among them, adjusting the semantic understanding weight based on the prompt word can be done by adjusting the understanding weight of the semantic part related to the target prompt word by the preset large language model, so that the preset large language model will assign a higher semantic understanding weight when translating sentences containing the target prompt word.

[0036] For sentences containing target prompt words, the model assigns higher weights to semantic understanding. Taking the semantic vector space model in natural language processing as an example, when the prompt word "rental period" exists, the importance of the semantic vectors related to this prompt word in the entire text's semantic vector space is increased. Thus, when constructing semantic understanding and performing translation, the model will be more inclined to conform to the semantic logic related to these prompt words.

[0037] Among them, correcting the translation direction and logical relationship can be done by correcting the translation direction of the preset large language model and the logical relationship in the text information to be translated based on the target prompt words, so as to ensure that the translation result output by the model can be closer to the logical connection in the source text, so that the output target translation result matches the target translation result of the user input information.

[0038] The implementation processes for guiding the translation process of the pre-defined large language model described above can be achieved using relevant technologies, and will not be elaborated here.

[0039] In this embodiment, the translation method based on a large language model of this application obtains the text information to be translated and user input information indicating the translation requirements. Based on the user input information, it obtains the target prompt words corresponding to the text information to be translated. The text information to be translated and the target prompt words are input together into a preset large language model. In the subsequent translation process, the target prompt words are used to guide the translation process of the large language model, so that the translation result closely matches the translation requirements of the specific domain. This effectively avoids the problems of inaccuracy and non-compliance that may occur when traditional translation methods deal with specific requirements, making the translation result more in line with user expectations and effectively improving the accuracy of the translation result.

[0040] Figure 2 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application.

[0041] See Figure 2 The translation method based on a large language model in this application includes: S210, Obtain the text information to be translated and the user input information, the user input information being used to indicate the translation requirements for translating the text information to be translated.

[0042] In this step, based on the document to be translated, translation text information is obtained, as well as user input information, which indicates the translation requirements for translating the text information to be translated.

[0043] Specifically, the text information to be translated can be obtained in the following ways: S211, Receive the file to be processed; S212, The content of the file to be processed is recognized by the OCR text recognition method to obtain the text information to be translated; the format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format.

[0044] It is understood that the method of this application can directly receive a file to be processed in a preset format, perform text recognition processing on the file to be processed using a preset text recognition method, and obtain the text information to be translated corresponding to the content of the file to be processed.

[0045] Furthermore, the text information to be translated can also be obtained through the following methods: S213, Receive address information; the address information is used to indicate the storage location of the file to be processed; S214. Obtain the corresponding file to be processed based on the address information, and use the OCR text recognition method to recognize the content of the file to be processed to obtain the text information to be translated; the format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format.

[0046] It should be understood that the method of this application can also obtain address information corresponding to the storage location of the file to be processed, such as the link information of the file to be processed stored locally or on the network, and obtain the corresponding file to be processed based on the address information, thereby further performing text recognition processing on the file to be processed using a preset text recognition method. It should be noted that the format of the file to be processed can also be other file formats set according to the user's actual needs, besides the aforementioned PDF, Word, Excel, and image formats; no restrictions are imposed here.

[0047] The method of this application can obtain the text information to be translated based on the file to be processed or the address information corresponding to the file to be processed, thereby enabling convenient acquisition of the text information to be translated, effectively simplifying the user operation process, improving the convenience of user experience, and the format of the file to be processed is widely applicable, meeting more translation needs of users.

[0048] S220, based on the user input information, extract the prompt word information from the user input information; wherein, the prompt word information includes at least one of the following: document content description information, domain description information, and translation requirement information.

[0049] In this step, natural language processing (NLP) is performed on the natural language format data corresponding to the user input information to identify the prompt words in the user input content. These prompt words may include, but are not limited to, descriptions of the document content, translation requirements, and domain limitations. For example, if the user inputs "This is the content of a car rental receipt. Do not translate trademarks, car dealership brands, logos, meaningless text (such as serial numbers), and currency symbols.", NLP can then retrieve "car rental receipt," "do not translate," "trademarks," "car dealership brands," "logo," "meaningless text," "serial number," and "currency symbols."

[0050] In some embodiments, the prompt information may include, but is not limited to: file content description, translation requirements, and domain limitations.

[0051] To facilitate the understanding of the technical solution of this application, taking a car rental receipt as an example, the above-mentioned file content description, translation requirements, and domain limitations will be described respectively: The file content description may refer to the type of text content. For example, if the text information to be translated corresponds to a car rental receipt contract, the file content description may be a car rental receipt.

[0052] The translation requirements may refer to the user-set requirements for the translation process, such as the scope of translation or non-translation, and the translation order of the text information to be translated. Among them, the translation limitation scope may be, for example, specifying not to translate contents such as advertisements, car dealership brands, Logos, meaningless texts, currency symbols, etc. on the receipt. The translation idea may be, for example, to translate according to the logical order of the car rental business. First, translate the basic car rental information, such as the renter's information and the car rental company's information, and then translate the core terms of the car rental, such as the corresponding relationship between the car rental duration and the charging standard. It should be understood that the translation requirements may also be other translation requirement contents other than the above two requirements, which are not limited here.

[0053] The domain limitation may refer to the specific domain corresponding to the text content type, so as to match the preset and relevant preset prompt word libraries. For example, if the file content description is a car rental receipt, it can be confirmed that the domain limitation is the car rental domain, and then the preset prompt word library related to the car rental domain is matched. Specifically, the preset prompt word library may at least include the translation relationships of industry terms and internal terms. Among them, the translation relationship of industry terms may refer to the corresponding translation relationship between the source text and the translated text in a specific domain or industry. For example, it can be specified that "daily rental fee" is translated as "日租费", "insurance surcharge" is translated as "保险附加费", "excess mileage fee" is translated as "超额里程费", "vehicle deposit" is translated as "车辆押金", etc. Among them, the internal terms may refer to the corresponding translation relationship between the source text and the translated text in a specific area (such as within a specific car rental company). For example, if a specific car rental company calls the upgrade service of a specific vehicle model "Elite Upgrade Package", then it can be specified that "Elite Upgrade Package" is translated as "精英升级包".

[0054] It should be noted that the prompt information may also include other contents other than the above. According to the actual application process, it is set according to actual needs. For example, the translation text format is not limited here.

[0055] In some implementations, user input can be empty. It should be understood that in actual use, users can begin translating the text without entering any corresponding information, i.e., the user input is empty. In other implementations, when user input can be empty, a preset default input can be used as the user input for prompt word extraction, thus obtaining preset target prompt words. For example, using "This is the content of a car rental receipt; do not translate trademarks, car dealership brands, logos, meaningless text (such as serial numbers), or currency symbols" as the preset default input, when the obtained user input is empty, the above preset default input is used as the final value of the user input to ensure that the corresponding target prompt words can be extracted and used to guide the translation process of the preset large language model.

[0056] S230, Generate target prompt words based on prompt word information.

[0057] In this step, the final target prompt word is generated based on the prompt word information extracted from the user input information.

[0058] It should be understood that target prompts include all content corresponding to the prompt information. Specifically, target prompts may include text content type, translation requirements, and all pre-defined prompt word libraries matched based on domain limitations.

[0059] S240: Input the text information to be translated and the target prompt words into the preset large language model, and output the target translation results that match the user input information in the corresponding paragraphs according to the paragraph information in the text information to be translated.

[0060] In this step, the acquired text to be translated and all target prompt words are input into a preset large language model. The preset large language model then streams and sequentially outputs the target translation results, matching the user's input, based on the paragraph information in the text to be translated. During the translation process, due to the input of corresponding target prompt words, the preset large language model automatically adjusts its translation process based on all target prompt word content to ensure that the output target translation result better meets the user's needs.

[0061] It should be understood that the text content in the text information to be translated is generally distributed in different paragraphs, and the text content of different paragraphs generally has different themes and logical structures.

[0062] By sequentially outputting the target translation results for each paragraph in a streaming manner, the corresponding target translation result can be output at the corresponding paragraph position after the translation of a section of text is completed. This allows the large language model to translate in stages across different paragraphs, effectively enhancing the impact of grammatical structure, lexical semantics, and target cue words on individual paragraph content, thereby improving the translation accuracy of the corresponding target translation results.

[0063] In addition, since users generally read from top to bottom, outputting the target translation results of corresponding paragraphs sequentially in a streaming manner is closer to users' actual reading habits. This allows users to obtain part of the translation content more quickly without having to wait for the entire text to be translated, thereby effectively improving the user experience.

[0064] In some implementations, before outputting the target translation result matching the user input information, a background image matching the text information to be translated can be obtained based on the file to be processed. When the target translation result of the preset large language model is used, the target translation result matching the user input information can be output sequentially, covering the corresponding paragraph positions on the background image, based on the paragraph information in the text information to be translated. It can be understood that the background image matching the text information to be translated can be obtained after the file to be processed.

[0065] The method in this application uses a background image matched with the text to be translated as a "canvas." Upon completion of each section of translation, the corresponding target translation result is overlaid on the background image at the corresponding paragraph position. By presenting the translation process in this way, users can see the real-time progress of the translation; that is, users can see a page gradually completing the translation process, achieving a dynamic presentation of the translation process and further improving the user experience.

[0066] In some implementations, before outputting the target translation result matching the user input information, the background color of the paragraph matching the text information to be translated can be obtained based on the file to be processed; the output process of the target translation result for each paragraph may include: S241, based on the paragraph information in the text to be translated, overlay a preset shape area with the corresponding paragraph background color onto the background image at the corresponding paragraph position. The preset shape area can be a rectangle, a circle, or other regular or irregular shape.

[0067] S242, after adding a text box to the preset shape area, fill the text box with the text information corresponding to the target translation result. Specifically, the text information related to the characters in the text information corresponding to the target translation result can be matched with the text information to be translated, such as font format, size, color, etc.

[0068] By implementing steps S241 and S242 above, the target translation result for each segment is output, ensuring a closer match between the output target translation result and the source text content in the file to be processed. Furthermore, each segment has its own independent presentation area, making the translation result clearer and more readable, thereby effectively improving the user's understanding of the translation result, reducing information confusion and further enhancing the user experience.

[0069] Figure 3 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application.

[0070] See also Figure 3 In some implementations, after performing step S240, the following steps may also be performed: S250, Receive modification command; the modification command instructs to activate the editing function to edit the target translation result of the corresponding segment.

[0071] In this step, modification instructions generated within a specified range are received. These instructions can be generated by mouse clicks. Specifically, the specified range can be the area corresponding to the target translation result, such as the area of ​​a text box, or a preset shape area.

[0072] S260, based on the modification instructions, displays the modification interface for the target translation results of the corresponding segment.

[0073] In this step, based on the received modification instructions, an interactive modification interface is displayed for modifying the target translation result of the corresponding segment. It can be understood that users can use this interface to perform editing operations such as deletion and alteration on the target translation result.

[0074] S270, Modify the target translation result based on the input content of the modified interactive interface.

[0075] In this step, the user's input on the interactive interface is used as the final target translation result to achieve the modified target translation result.

[0076] The interactive interface can display both the source text and the target translation result simultaneously. The source text is not editable, while the target translation result is editable, allowing users to modify the target translation result by referring to the source text.

[0077] Figure 4 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application.

[0078] See also Figure 4In some implementations, after performing step S240, the following steps may also be performed: S280, Receive export command; the export command indicates that some or all of the target translation results are exported.

[0079] In this step, an export command issued by the user is received. This export command can instruct that some or all of the target translation results be exported to the same output file.

[0080] S290, according to the export instruction, export part or all of the target translation result as a target file; the target file format includes either PDF or image format.

[0081] In this step, according to the export instructions, the target translation result is partially or completely exported as a target file and stored in the specified location. The format of the target file can default to the same as the file to be processed (i.e., the source file). That is, if the file to be processed is in PDF format, the target file will default to PDF format; if the file to be processed is in image format, the target file will default to image format. Alternatively, the target file can default to either PDF or image format, meaning that regardless of the format of the file to be processed, the target file will always be output in either PDF or image format.

[0082] Figure 5 This is another flowchart illustrating a translation method based on a large language model, as shown in an embodiment of this application.

[0083] See also Figure 5 It should be noted that this application can execute steps S250-S270 followed by steps S280-S290, thus satisfying the user's requirement to modify the target translation results for different segments before exporting the target file. Steps S250-S270 can be executed repeatedly.

[0084] In this implementation, the translation method based on a large language model of this application adopts a streaming approach to sequentially output the target translation results of corresponding paragraphs. After each paragraph of text content is translated, the target translation result is output at the corresponding paragraph position in real time, realizing step-by-step translation on a paragraph-by-paragraph basis, which effectively improves the translation accuracy of the target translation results; it can also fit the user's top-to-bottom reading habits and improve the user experience; in addition, by using the above method to present the translation process, users can obtain the real-time progress of the translation process, that is, users can see a page gradually completing the translation process, realizing dynamic presentation of the translation process, further improving the user experience.

[0085] Corresponding to the aforementioned application function implementation method embodiments, this application also provides a translation device, electronic device, and corresponding embodiments based on a large language model.

[0086] Figure 6 This is a schematic diagram of the structure of a translation device based on a large language model, as shown in an embodiment of this application.

[0087] See Figure 6 The translation device 300 based on a large language model of this application includes: an information acquisition module 310, a prompt word acquisition module 320, and a result output module 330.

[0088] The information acquisition module 310 is used to acquire the text information to be translated and the user input information; the user input information is used to indicate the need to translate the text information to be translated.

[0089] The prompt word acquisition module 320 is used to acquire the corresponding target prompt words based on user input information. In some implementations, the acquisition module 320 can extract prompt word information from the user input information based on the user input information; wherein, the prompt word information includes at least one of file content description information, domain description information, and translation requirement information; and generate target prompt words based on the prompt word information.

[0090] The result output module 330 is used to input the text information to be translated and the target prompt words into the preset large language model and output the target translation result that matches the user input information.

[0091] In some implementations, the result output module 330 can output the target translation result that matches the user input information in the corresponding paragraphs according to the paragraph information in the text information to be translated.

[0092] In some implementations, the information acquisition module 310 acquires the text information to be translated in the following ways: receiving a file to be processed; performing text recognition on the content of the file to be processed using an OCR text recognition method to acquire the text information to be translated; the format of the file to be processed includes any one of PDF, Word, Excel, and image formats; or receiving address information; the address information is used to indicate the storage location of the file to be processed; acquiring the corresponding file to be processed based on the address information, performing text recognition on the content of the file to be processed using an OCR text recognition method to acquire the text information to be translated; the format of the file to be processed includes any one of PDF, Word, Excel, and image formats.

[0093] In some implementations, before the result output module 330 outputs the target translation result that matches the user input information, the information acquisition module 310 can also acquire a background image that matches the text information to be translated based on the file to be processed; the result output module 330 can output the target translation result that matches the user input information by sequentially overlaying the corresponding paragraph position on the background image based on the paragraph information in the text information to be translated in a segmented output manner.

[0094] In some implementations, before the result output module 330 outputs the target translation result that matches the user input information, the information acquisition module 310 can also acquire the paragraph background color that matches the text information to be translated based on the file to be processed; during the output of the target translation result for each paragraph, the result output module 330 can cover the corresponding paragraph position on the background image with a preset shape area having the corresponding paragraph background color based on the paragraph information in the text information to be translated; after adding a text box in the preset shape area, the text information of the corresponding target translation result is filled into the text box.

[0095] Figure 7 This is another schematic diagram of the translation device based on a large language model shown in the embodiments of this application.

[0096] See Figure 7 The translation device based on a large language model in this application includes: an information acquisition module 310, a prompt word acquisition module 320, a result output module 330, a result modification module 340, and a result export module 350.

[0097] The result modification module 340 is used to receive modification instructions; the modification instructions indicate the activation of the editing function to edit the target translation result of the corresponding segment; according to the modification instructions, the modification interface of the target translation result of the corresponding segment is displayed; and the target translation result is modified according to the input content of the modification interface.

[0098] The result export module 350 is used to receive export instructions; the export instructions indicate that some or all of the target translation results should be exported; according to the export instructions, some or all of the target translation results should be exported as target files; the target file format includes either PDF format or image format.

[0099] The technical solution of this application obtains the text information to be translated and the user input information used to indicate the translation requirements. Based on the user input information, it obtains the target prompt words corresponding to the text information to be translated. The text information to be translated and the target prompt words are input together into a preset large language model. In the subsequent translation process, the target prompt words are used to guide the translation process of the large language model, so that the translation result closely matches the translation requirements of the specific domain. This effectively avoids the problems of inaccuracy and non-compliance that may occur when traditional translation methods deal with specific requirements, making the translation result more in line with user expectations and effectively improving the accuracy of the translation result.

[0100] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated further here.

[0101] Figure 8 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application.

[0102] See Figure 8 The electronic device 1000 includes a memory 1010 and a processor 1020.

[0103] The processor 1020 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0104] Memory 1010 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by processor 1020 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 1010 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 1010 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, an ultra-high density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.

[0105] The memory 1010 stores executable code, which, when processed by the processor 1020, can cause the processor 1020 to execute part or all of the methods described above.

[0106] Furthermore, the method according to this application can also be implemented as a computer program or computer program product, which includes computer program code instructions for performing some or all of the steps in the method described above.

[0107] Alternatively, this application may be implemented as a computer-readable storage medium (or a non-transitory machine-readable storage medium or a machine-readable storage medium) storing executable code (or computer program or computer instruction code) thereon, which, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the steps of the methods described above according to this application.

[0108] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A translation method based on a large language model, characterized in that, include: Obtain the text to be translated and the user input information; The user input information is used to indicate the translation requirements for translating the text information to be translated; Based on the user input information, obtain the corresponding target prompt words; The text to be translated and the target prompt words are input into a preset large language model, and the target translation result that matches the user input information is output.

2. The method according to claim 1, characterized in that, The step of obtaining the corresponding target prompt word based on the user input information includes: Based on the user input information, extract the prompt word information from the user input information; wherein, the prompt word information includes at least one of: file content description information, domain description information, and translation requirement information; Based on the provided prompt information, a target prompt is generated.

3. The method according to claim 1, characterized in that, The output, which matches the user input information, includes the target translation result: Based on the paragraph information in the text to be translated, the target translation results that match the user input information are output sequentially for the corresponding paragraphs.

4. The method according to claim 1, characterized in that, The text information to be translated is obtained through the following methods: Receive files to be processed; The content of the file to be processed is recognized using an OCR text recognition method to obtain the text information to be translated; the format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format; or Receive address information; the address information is used to indicate the storage location of the file to be processed. The corresponding file to be processed is obtained based on the address information. The content of the file to be processed is then processed using an OCR text recognition method to obtain the text information to be translated. The format of the file to be processed includes any one of the following: PDF format, Word format, Excel format, and image format.

5. The method according to claim 4, characterized in that, Before outputting the target translation result that matches the user input information, the method further includes: Based on the file to be processed, obtain a background image that matches the text information to be translated; The output, which matches the user input information, includes the target translation result: Based on the paragraph information in the text to be translated, the target translation results, which are covered on the background image and match the user input information, are output sequentially in a segmented manner.

6. The method according to claim 5, characterized in that, Before outputting the target translation result that matches the user input information, the method further includes: Based on the file to be processed, obtain the paragraph background color that matches the text information to be translated; The process of outputting the target translation results for each paragraph includes: Based on the paragraph information in the text to be translated, a preset shape area with the corresponding paragraph background color is covered on the background image at the corresponding paragraph position; After adding a text box to the preset shape area, fill the text box with the text information of the corresponding target translation result.

7. The method according to claim 5 or 6, characterized in that, The method also includes: Receive a modification instruction; the modification instruction indicates the activation of the editing function to edit the target translation result of the corresponding segment; Based on the modification instructions, the modification interface for the target translation result of the corresponding segment is displayed. The target translation result is modified based on the input content of the modified interactive interface.

8. The method according to claim 1, characterized in that, The method also includes: Receive an export instruction; the export instruction indicates that some or all of the target translation results be exported. According to the export instruction, the target translation result is exported in part or in whole as a target file; the target file format includes either PDF format or image format.

9. A translation device based on a large language model, characterized in that, include: The information acquisition module is used to acquire information about the text to be translated and user input. The user input information is used to indicate the need for translation of the text information to be translated; The prompt word acquisition module is used to acquire the corresponding target prompt word based on the user input information; as well as The result output module is used to input the text information to be translated and the target prompt words into a preset large language model, and output the target translation result that matches the user input information.

10. An electronic device, characterized in that, include: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1-8.