Translation method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- PCT/CN2025/076553
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-06
- Filing Date
- 2025-02-08
- Publication Date
- 2025-10-02
AI Technical Summary
Existing translation methods have problems such as high labor costs, low translation accuracy and low efficiency, especially when dealing with complex language structures and low-frequency words.
By retrieving information related to the target original text in historical translation records, generating translation prompt information, and inputting it into the language model to obtain the target translation information, the training time cost of the deep model is reduced, and the translation requirement information is combined to improve the translation accuracy and flexibility.
It improves translation efficiency and accuracy, can quickly generate diverse translations that meet expectations, simplifies user operations, and enhances the flexibility and diversity of translation methods.
Smart Images

Figure CN2025076553_02102025_PF_FP_ABST
Abstract
Description
Translation method, device, storage medium and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application number 202410257206.6, filed on March 6, 2024, entitled “Translation method, device, storage medium and electronic device”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of computer technology, and in particular to a translation method, a translation device, a computer-readable storage medium, and an electronic device. Background Art
[0004] Translating multimedia data, such as speech, text, and text in images, is often used in film, television, gaming, and animation. For example, in gaming scenarios, game text can be translated to generate an overseas version of the game. Related technologies offer manual translation, but this approach requires a large number of translation experts and is labor-intensive. Therefore, machine translation methods have been proposed. However, existing machine translation methods are ineffective for translating low-frequency words and long sentences, and are unable to handle complex language structures, resulting in low overall translation accuracy. Clearly, these technologies result in inefficient translation methods. Summary of the Invention
[0005] According to one aspect of the present disclosure, a translation method is provided, comprising: obtaining target original text information and translation requirement information corresponding to the target original text information; retrieving information related to the target original text information from historical translation records to obtain first reference translation information; combining the translation requirement information with the first reference translation information to generate translation prompt information; inputting the translation prompt information into a language model, and obtaining target translation information corresponding to the target original text information based on an output result of the language model.
[0006] According to one aspect of the present disclosure, a translation device is provided, comprising: an information acquisition module configured to acquire target original text information and translation requirement information corresponding to the target original text information; an information retrieval module configured to retrieve information related to the target original text information from historical translation records to obtain first reference translation information; a prompt information generation module configured to combine the translation requirement information with the first reference translation information to generate translation prompt information; and a language model processing module configured to input the translation prompt information into a language model and obtain target translation information corresponding to the target original text information based on an output result of the language model.
[0007] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the translation method of the first aspect and possible implementation methods thereof are implemented.
[0008] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor, wherein the processor is configured to execute the translation method of the first aspect and possible implementations thereof by executing the executable instructions.
[0009] The technical solution disclosed in this disclosure has the following beneficial effects:
[0010] On the one hand, by retrieving information related to the target original text in the historical translation records to obtain the first reference translation information, a translation reference can be provided for the target original text to be translated based on the translation records. At the same time, after generating translation prompt information based on the translation requirement information and the reference translation information, only the translation prompt information needs to be input into the language model to determine the target translation information based on the output of the language model. Compared with related technologies, there is no need to waste time and cost on training deep models, which can effectively improve the accuracy and speed of text translation, thereby improving translation efficiency. On the other hand, by adding translation requirement information to the translation prompt information and inputting the translation prompt information into the language model to obtain the translation result of the target original text information, compared with related technologies, while inputting the original text information, additional information related to the translation requirement can also be input, so that the obtained target translation information is more in line with the expected translation needs. By modifying the translation requirement information, target translation information of different styles can be obtained, thereby improving the flexibility of the translation method and increasing the diversity of the target translation information.
[0011] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] FIG1 shows one system operation architecture of this exemplary embodiment;
[0013] FIG2 shows a flowchart of a translation method according to the exemplary embodiment;
[0014] FIG3 shows a flow chart of a method for generating first reference translation information according to this exemplary embodiment;
[0015] FIG4 shows a flowchart of a method for generating a historical translation record according to this exemplary embodiment;
[0016] FIG5 is a schematic diagram showing an initial historical translation record according to this exemplary embodiment;
[0017] FIG6 is a schematic diagram showing a translation record in one of the historical translation records according to this exemplary embodiment;
[0018] FIG7 shows a flowchart of a method for generating second reference translation information according to this exemplary embodiment;
[0019] FIG8 is a flowchart illustrating a method for updating historical translation records according to the present exemplary embodiment;
[0020] FIG9 shows a flowchart of another translation method according to the present exemplary embodiment;
[0021] FIG10 is a schematic structural diagram of a translation device according to this exemplary embodiment;
[0022] FIG. 11 is a schematic structural diagram of an electronic device according to this exemplary embodiment. DETAILED DESCRIPTION
[0023] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or that other methods, components, devices, steps, etc. may be employed. In other cases, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0024] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0025] In addition to manual translation, related technologies also provide the following machine translation methods:
[0026] Rule-Based Machine Translation (RBMT): This method uses manually defined grammatical rules and dictionaries to map the text from the source language to the target language. While this method reduces the labor cost of manual translation, it cannot handle complex language structures and polysemy.
[0027] Statistical Machine Translation (SMT): This method analyzes large bilingual parallel corpora to learn the correspondence between the source and target languages and predict the target language translation of the text. While it can handle complex language structures and polysemy, it requires a large amount of parallel corpora and is less effective for translating low-frequency words and long sentences.
[0028] Neural Machine Translation (NMT): This method uses a neural network model to calculate the translation probability of a source language sentence into a target language sentence, and selects the translation result with the highest probability as the output. Compared to SMT, NMT can handle longer sentences and more complex language structures, resulting in better translation results. Furthermore, NMT requires relatively little parallel corpus and can learn translation patterns from a large amount of monolingual corpus through end-to-end training. However, because NMT's translation results rely on neural network models, its translation quality is easily affected by the quality and scale of the training data.
[0029] Pretrained Machine Translation (PMT): A type of NMT, PMT primarily uses a large-scale corpus to train a neural network model, enabling it to learn the mapping between the source language and the target language. It also incorporates an attention mechanism to improve translation quality. However, PMT requires significant computing resources and time to train the neural network model.
[0030] It can be seen that among the existing translation methods, although the manual translation method has a high translation accuracy rate, it requires high labor costs. The machine translation method has poor translation quality for texts to be translated with complex language structures, and if a high translation quality is to be achieved, it requires a lot of time to train the translation model. Therefore, the existing translation methods have low accuracy rates and require high labor and time costs, resulting in low translation efficiency.
[0031] In view of one or more of the above problems, the exemplary embodiment of the present disclosure first provides a translation method. The system architecture of the operating environment of the exemplary embodiment will be described below with reference to FIG1 .
[0032] As shown in Figure 1, the system architecture 100 may include a terminal device 110 and a server 120. The terminal device 110 may be an electronic device such as a tablet computer, a laptop computer, or a desktop computer, and the terminal device 110 may be used to generate translation prompt information. The server 120 generally refers to a backend system that provides translation-related services in this exemplary embodiment, such as a server that implements a translation method. The server 120 may be a single server or a cluster formed by multiple servers, which is not limited in this disclosure. The terminal device 110 and the server 120 may be connected via a wired or wireless communication link to exchange data.
[0033] The translation method of this exemplary embodiment can be executed by the terminal device 110. For example, in a game scenario, the terminal device 110 can be a computer on which the translation method is deployed, and the target original information can be the game text to be translated. The terminal device 110 can execute the translation method and input the translation prompt information obtained by combining the translation requirement information with the first reference translation information into the language model to obtain the target translation information corresponding to the target original information.
[0034] In one embodiment, after the terminal device 110 obtains the target original text information and the translation requirement information, the terminal device 110 sends the target original text information to the server 120, so that the server searches the historical translation records for information related to the target original text information to obtain the first reference translation information, and combines the translation requirement information with the first reference translation information to generate translation prompt information, and then inputs the translation prompt information into the language model, obtains the target translation information corresponding to the target original text information according to the output result of the language model, and finally sends the target translation information to the terminal device 110 for display.
[0035] As can be seen from the above, the translation method in this exemplary embodiment can be executed by the terminal device 110 or the server 120 .
[0036] The translation method is described below with reference to FIG2 . FIG2 shows an exemplary process of the translation method, including the following steps S210 to S240 :
[0037] Step S210: Acquire target original text information and translation requirement information corresponding to the target original text information.
[0038] Step S220 : searching the historical translation records for information related to the target original text information to obtain first reference translation information.
[0039] Step S230: Combining the translation request information with the first reference translation information to generate translation prompt information.
[0040] Step S240: input the translation prompt information into the language model, and obtain target translation information corresponding to the target original information according to the output result of the language model.
[0041] Based on the above method, on the one hand, information related to the target original text information is retrieved from the historical translation records to obtain the first reference translation information, which can provide a translation reference for the target original text to be translated based on the translation records; at the same time, after generating translation prompt information based on the translation requirement information and the reference translation information, it is only necessary to input the translation prompt information into the language model to determine the target translation information based on the output result of the language model. Compared with related technologies, there is no need to waste time and cost to train a deep model, which can effectively improve the accuracy and speed of text translation, thereby improving translation efficiency. On the other hand, by adding translation requirement information to the translation prompt information and inputting the translation prompt information into the language model to obtain the translation result of the target original text information, compared with related technologies, while inputting the original text information, additional information related to the translation requirement can also be input, so that the obtained target translation information is more in line with the expected translation needs. By modifying the translation requirement information, target translation information of different styles can be obtained, thereby improving the flexibility of the translation method and increasing the diversity of the target translation information.
[0042] Each step in FIG2 is described in detail below.
[0043] 2 , in step S210 , target original text information and translation requirement information corresponding to the target original text information are acquired.
[0044] The target original text information includes the original text to be translated, or the text obtained by content extraction of the multimedia data to be translated, wherein the multimedia data may include voice, images, etc. For example, the target original text information can be obtained by converting the voice into text and filtering the text for content, correcting grammatical errors, and modifying typos. The translation requirement information includes the standards or criteria that the translation process must follow. This disclosure does not specifically limit the translation requirement information. For example, the translation requirement information may include information such as the language of the translation and the translation style. For example, in a game scenario, the translation style of a gunfight game text may include "cold", the translation style of a two-dimensional style game text may include "playful and youthful", and the translation style of a party game text may include "casual", etc.
[0045] In one embodiment, the above-mentioned obtaining of the target original text information and the translation requirement information corresponding to the target original text information may include the following steps:
[0046] In response to an editing operation on the information interface, target original text information and translation requirement information are acquired; or target original text information and translation requirement information corresponding to the target original text information are automatically identified based on input information.
[0047] The information interface may include visual input controls for target original text information and translation requirement information. For example, the information interface may include an input box for target original text information, a translation language selection box, a translation style selection box, and other visual input controls such as a custom translation requirement input box. The input information may include information input by the user, including target original text information and translation requirement information.
[0048] For example, the user can enter the text to be translated in the input box of the target original text in the information interface, and select the language of the translation in the translation language selection box and the translation language style selection box respectively. The background can automatically obtain the target original text information and translation requirement information based on the information entered by the user in the information interface.
[0049] By obtaining the target original text information and translation requirement information, it provides the possibility of generating diverse translations. In addition, the target original text information and translation requirement information are automatically extracted based on the user's editing operations on the information interface or input information, which simplifies user operations and effectively improves the speed of obtaining the target original text information and translation requirement information, thereby improving the user experience.
[0050] Continuing to refer to FIG. 2 , in step S220 , information related to the target original information is retrieved from the historical translation records to obtain first reference translation information.
[0051] Among them, the historical translation record can be a database for storing relevant information of the original text that has been translated, and information related to the translation corresponding to the original text; exemplarily, each translation record in the historical translation record can include a sentence obtained by decomposing the original text, and the translation corresponding to the sentence; or each translation record can include a sentence vector corresponding to a sentence obtained by decomposing the original text, and the translation corresponding to the sentence. Information related to the target original text information may include sentences retrieved in the historical translation record that are identical or similar to the sentences in the target original text information. The first reference translation information can provide a reference for the translation of the sentences in the target original text information. For example, the first reference translation information can be "the translation that sentence A can refer to is translation A", wherein sentence A is a sentence in the target original text information, and translation A is the translation corresponding to the sentence related to sentence A in the historical translation record.
[0052] In one embodiment, the historical translation records include historical translation original information and corresponding historical translation translated text information; searching the historical translation records for information related to the target original information to obtain the first reference translation information includes: searching the historical translation records for historical translation original information similar to the target original information, and obtaining the first reference translation information based on the search results.
[0053] The historical translation source information may include the translated sentence text, and the historical translation target information may include the translated text of the sentence text. The search results may include historical translation source information that is identical or similar to the sentence in the target source information, and its corresponding historical translation target information.
[0054] By directly searching for sentences similar to the target original information in historical translation records, the complexity of the retrieval method can be effectively reduced, thereby improving the efficiency of system operation.
[0055] To further improve the search speed, in one embodiment, the historical translation records may store historical translation text vectors corresponding to the historical translation text information. The historical translation records are searched for historical translation text information similar to the target text information, and first reference translation information is obtained based on the search results. Referring to FIG. 3 , steps S310 to S340 may be included:
[0056] Step S310 , performing text vectorization processing on the target original text information to obtain a target original text vector.
[0057] Step S320 : searching the historical translation records for the target original text vector, and determining the search result in the historical translation records based on the similarity between the target original text vector and the historical translation original text vector.
[0058] Step S330 : generating first reference translation information based on the historical translation information corresponding to the historical translation original text vector in the search result.
[0059] The historical translation original text vector may include a feature vector corresponding to the historical translation original text information, and the target original text vector includes a feature vector corresponding to the target original text information.
[0060] For example, the target original text information can be word-embedded and vectorized to obtain a target original text vector, and based on a similarity matching condition, the target original text vector can be retrieved in the historical translation records, and the translation records in the historical translation records can be sorted in descending order according to the similarity between the target original text vector and the historical translation original text vector. The first N translation records in the historical translation records after descending order are selected as the retrieval results (N is a positive integer), and the first reference translation information is generated based on the sentence corresponding to the historical translation original text vector in the retrieval result in the target original text information, and the historical translation information corresponding to the historical translation original text vector.
[0061] Based on the method shown in FIG3 , vector retrieval is performed in historical translation records. This not only increases the retrieval speed but also further improves the accuracy of the retrieval results, effectively improving the efficiency of obtaining the first reference translation information, thereby further improving translation efficiency.
[0062] In one embodiment, referring to FIG4 , the method may further include steps S410 to S420:
[0063] Step S410: performing text vectorization processing on the historical translation original text information to obtain a historical translation original text vector corresponding to the historical translation original text information;
[0064] Step S420 : Associating the historical translation original text vector with the historical translation information corresponding to the historical translation original text information and adding the result to the historical translation record to generate the historical translation record.
[0065] For example, the historical translation original data may include the Chinese original sentence (historical translation original information) obtained by splitting the historical translation original text, the original sentence unique identifier, and the translation of the Chinese original sentence into multiple target languages, where the target languages may include Japanese, Korean, English, etc. The original Chinese sentence and its corresponding translation in any target language can be extracted to obtain an initial database; taking English as an example, the original Chinese sentence in the historical translation original data and its corresponding English translation (historical translation information) can be extracted to generate an initial historical translation record as shown in Figure 5, wherein translate_txt represents the original Chinese sentence and its corresponding English translation, check_flag can be a modification mark, indicating whether the translation record is correct, when check_flag is 1, it indicates that the translation record is correct, if the translation record is subsequently modified or deleted, check_flag will be set to 0; in order to facilitate the update and maintenance of the translation record, the data in the initial historical translation record can be exported and stored in the SQLite database to obtain an intermediate historical translation record; in order to further speed up the retrieval speed, the original Chinese sentence in the SQLite database can be vectorized to obtain a historical translation original text vector, and the code shown in Figure 6 associates the historical translation original text vector with the historical translation information to write the historical translation record; referring to Figure 6, "Not enough star coins to purchase the item." is the original Chinese sentence stored in the SQLite database ... ISK.Cannot purchase this item." is the English translation stored in the SQLite database. "Not enough star coins, unable to purchase this item." can be mapped to a vector and stored in the item_cn index, and "Not enough ISK.Cannot purchase this item." is stored in the index item_lang. Then, item_doc can represent the translation record associated with item_cn and item_lang. self.text_splitter.create_document() is a method for adding a translation record to the historical translation record. 'lang': self.lang indicates the language in which translation information can be obtained through self.lang. 'trans': item_lang indicates that the original text vector indexed by item_cn can be translated into the translation corresponding to the index item_lang. 'time': now.strftime('%Y-%m-%d %H:%M:%S') indicates the creation time of the translation record. By parsing the code in Figure 6, a translation record of "original text vector-translation-translation record creation time" can be generated in the historical translation record.
[0066] Since historical translation records store historical translation original text vectors and their corresponding historical translation information, during retrieval, retrieval can be performed in historical translation records based on the target original text vector, effectively improving retrieval speed and accuracy.
[0067] Based on the method in FIG. 4 , a historical translation record including a historical translation original text vector and its corresponding historical translation information can be generated, thereby providing a possibility for accelerating the retrieval process.
[0068] During the translation process, the text to be translated often includes domain-specific nouns. For example, in the field of gaming, the names of game characters, equipment names, and accessory names are all domain-specific nouns. To improve translation efficiency and unify the translations of these domain-specific nouns, the domain-specific nouns in the text to be translated can be extracted before translation, and relevant translations of these domain-specific nouns can be retrieved from historical translations. In one embodiment, after obtaining the target original text information, the above method can further include the following steps:
[0069] Retrieving terms related to keywords in the target original text information from the term translation records to obtain second reference translation information; combining the translation requirement information with the first reference translation information to generate translation prompt information, including: combining the translation requirement information, the first reference translation information, and the second reference translation information to generate translation prompt information; wherein the first reference translation information includes reference translation information of sentences and / or phrases in the target original text information, and the second reference translation information includes reference translation information of terms in the target original text information.
[0070] The term translation record can be a database that stores information related to domain terminology and the translations of the terms. For example, the term translation record can store the original term and its translation, or store the term vector obtained by mapping the original term and its translation. Keywords include domain terms extracted from the target original information. This disclosure does not specifically limit the method for obtaining keywords. For example, the target original information can be segmented using a deep model to extract keywords from the target original information. The above-mentioned sentence can be a long sentence in the target original information, for example, the sentence can be "Insufficient star coins, unable to purchase this item" in Figure 6. Phrases can include words in the target original information that are not domain terms, such as "item" and "purchase" in Figure 6. When translating, using a unified translation for the same phrase can ensure a consistent translation style. Terminology includes domain-specific terms, such as "star coins" in Figure 6. The second reference translation information can include keywords that exist in both the target original information and the term translation record, as well as translations of the keywords retrieved from the term translation record. Since there is no established standard answer for terminology in specialized fields, if you want to translate correctly, you must refer to the translation information in the terminology translation record.
[0071] It should be noted that the term translation records and historical translation records in this exemplary embodiment may be stored in the same database or in different databases, and this disclosure does not impose any particular limitation on this.
[0072] In one embodiment, the term translation record includes a term vector generated from a term in a first language and a term in a second language corresponding to the term vector; the first language is the language of the target original information, and the second language is the language of the target translation information; searching the term translation record for terms related to keywords in the target original information to obtain second reference translation information, as shown in FIG. 7 , may include steps S710 to S720:
[0073] Step S710 , performing word segmentation processing on the target original text information and extracting keywords from the target original text information.
[0074] Step S720: Perform text vectorization processing on the keyword to obtain a keyword vector.
[0075] Step S730 : Match the keyword vector in the term translation record, and generate second reference translation information based on the matched term vector and the term in the second language corresponding to the term vector.
[0076] Based on the method of Figure 7, the translation of the terms in the target original information can be determined from past translation data, so that the translation process no longer needs to translate the terms in the target original information, which reduces the difficulty of the translation process. At the same time, it ensures that the translation of the terms in the target translation information is consistent with past translation records, which is conducive to improving translation accuracy.
[0077] In one embodiment, before matching the keyword vector in the term translation record, the above method may further include the following steps:
[0078] The terms in the historical translation records are extracted and mapped into term vectors; the corresponding relationship between the term vectors and the term translations is established to generate term translation records.
[0079] By establishing a term translation record that stores term vectors and their corresponding term translations, it provides the possibility for keyword vector retrieval, thereby accelerating the term matching process and effectively improving the efficiency of obtaining the second reference translation information.
[0080] After the translation requirement information and the first reference translation information are obtained, referring to FIG. 2 , step S230 is to combine the translation requirement information with the first reference translation information to generate translation prompt information.
[0081] The translation prompt information may include prompt words input into the language model.
[0082] In one embodiment, the above-mentioned combining of the translation request information and the first reference translation information to generate the translation prompt information may include the following steps:
[0083] The translation requirement information and the first reference translation information are correspondingly filled into a designated position in the prompt information template to generate translation prompt information.
[0084] The prompt information template may be a template including reference translation information, translation requirement information and other information related to the translation process, and the translation prompt information may be generated by filling in the reference translation information and translation requirement information in designated locations in the prompt information template.
[0085] Exemplarily, a prompt information template can be generated based on general expression information, as well as placeholders corresponding to translation requirement information, placeholders corresponding to the first reference translation information, and / or placeholders corresponding to the second reference translation information; wherein, the general expression information may include text that frequently appears in translation prompt words, such as if the prompt information template includes "Please serve as a senior Chinese-{foreign_language} translation expert", then "Please serve as a senior Chinese-" and "translation expert" belong to the general expression content, and {foreign_language} can be the placeholder for the translation language information in the translation requirement information. General expression information can also include small sample translation examples. If the large language model is directly asked to "do not modify the text format, keep special placeholders", the large language model cannot follow the rules well, but if a simple example is given, it can learn better. For example, the prompt information template for the complete game text can be as follows:
[0086] "Please assume the role of a senior Chinese-to-{foreign_language} translation expert. Your goal is to translate user-provided Chinese text into {foreign_language}. Avoid a lingering tone when translating, and ensure your translation is natural, fluent, and authentic. {preset}. You will need to translate in-game Chinese text into the corresponding localized text. Because the game contains many specialized terms, we have provided some reference content to help you translate better: {content}. For specialized terms found in the reference content, use them directly instead of inventing your own. If there are multiple relevant references, please select the most appropriate one. {chat_style}. Your output will be populated directly into the game, so the output will only contain the localized translation. There is no need to paraphrase the original text or add markers like 'translation' or 'To be translated:'."
[0087] Each part enclosed by {} in the prompt message template can be customized by referring to the translation information and translation requirement information:
[0088] foreign_language: the language of the target translation information;
[0089] Preset: The overall translation style extracted from the translation requirement information. For example, in a game scenario, the translation style can be determined by combining the game type. For example, if the game text is in an 2D style, the preset can be set to the 2D language style in the translation requirement information to make the game text match the game style.
[0090] content: includes the first reference translation information and the second reference translation information.
[0091] chat_style: Style guidelines for the translation extracted from the translation request information, which may include special translation requirements for certain words or phrases. For example, chat_style may include four-character Chinese nouns, many of which are names of in-game equipment, scenes, or skins, and require a similarly concise translation. For example, chat_style may include: If a user says "Frenzy will come," you could refer to "Imminent Frenzy" instead of "The Frenzy is coming." If a user says "Dark Alleyway," you could refer to "Dark Alleyway" instead of "Walk in the dark alley." If a user says "Future Gospel," you could refer to "Future Gospel" instead of "Gospel of the Future." If a user says "Treasure Chest," you could refer to "Treasure Box of Hidden Gems."
[0092] In one embodiment, the above method may further include: filling the translation requirement information, the first reference translation information, and the second reference translation information into a designated position in a prompt information template to generate translation prompt information.
[0093] By filling the translation requirement information, the first reference translation information, and the second reference translation information into the designated position of the prompt information template to obtain translation prompt information, and then inputting the translation prompt information into the language model to obtain the target translation information, the translation speed can be effectively improved.
[0094] In addition, to improve the generality of the translation prompt template, in one implementation, filling the translation requirement information, the first reference translation information, and the second reference translation information into the specified positions in the prompt information template to generate translation prompt information may further include:
[0095] Obtain the memory address identifiers corresponding to the translation requirement information, the first reference translation information, and the second reference translation information respectively; and fill the memory address identifiers corresponding to the translation requirement information, the first reference translation information, and the second reference translation information into the specified positions in the prompt information template to generate translation prompt information.
[0096] For example, {preset} may represent the memory address identifier of the overall translation style. By directly writing {preset} into the specified position in the prompt information template, during the process of parsing the translation prompt information, the overall translation style can be obtained through the memory address pointed to by {preset}. To prevent the language model from translating the memory address identifier during the translation process, the following content can be added to the translation prompt information:
[0097] Among them, the special characters are all placeholders and need to be retained. For example, the user says: "Strengthen the next [{cur_spell[106411].show_name}] or [{cur_spell[106431].show_name}].", and the translation you can refer to is: "強化して1度「{cur_spell[106411].show_name}」または「{cur_spell[106431].show_name}」を打つ".
[0098] By writing the memory address identifiers corresponding to the translation requirement information and the reference translation information into the prompt information template, when a new translation task arrives, it is only necessary to store the translation requirement information and the reference translation information corresponding to the new translation task in the corresponding memory addresses, rather than writing the translation requirement information and the reference translation information corresponding to the new translation task into the specified positions in the prompt information template, reducing the memory consumption caused by repeated information writing, effectively improving the acquisition speed of the translation prompt information, and further improving the translation speed.
[0099] Continuing to refer to FIG. 2, in step S240, the translation prompt information is input into the language model, and the target translation information corresponding to the target original text information is obtained according to the output result of the language model.
[0100] Among them, the target translation information may include the translation obtained by translating the target original text information.
[0101] In practical applications, if game versions are constantly iterating, new game texts to be translated are likely to appear. After translating the game text to be translated and obtaining the corresponding target translation information, the target translation information can be automatically or manually confirmed and applied in the game. It is then necessary to write it into the historical translation record to improve the translation efficiency of subsequent translation processes. In one embodiment, after obtaining the target translation information corresponding to the target original text information based on the output results of the language model, the above method may further include the following steps:
[0102] Update the historical translation records based on the target original text information and the target translation information.
[0103] The above-mentioned updating of the historical translation record based on the target original text information and the target translation information may include steps S810 to S820, as shown in FIG8 :
[0104] Step S810, determining whether there is historical translation original text information identical to the target original text information in the historical translation record;
[0105] Step S820: If so, modify the historical translation text information corresponding to the historical translation original text information to the associated content of the historical translation original text information in the target translation information; otherwise, add the target original text information and the target translation information to the historical translation record.
[0106] That is, the historical translation record may be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0107] The associated content may include the corresponding translation of the historical translated original text information identical to the target original text information in the target translated text information.
[0108] In one embodiment, the above-mentioned determining whether there is historical translation original information identical to the target original information in the historical translation record includes:
[0109] The original text information to be written is determined based on the target original text information; and it is determined in the historical translation records whether there is historical translated original text information that is identical to the original text information to be written.
[0110] Among them, the original information to be written may include the above-mentioned long sentences, phrases and / or terms. The present disclosure does not specifically limit the specific steps of determining the original information to be written based on the target original information. For example, the target original information can be segmented to extract the terms and phrases in the target original information; after obtaining the target translation information, the original information to be written in the target original information can also be manually extracted.
[0111] In one embodiment, the above-mentioned modification of the historical translation information corresponding to the historical translation original information into the target translation information may include the following steps:
[0112] In the historical translation record, a modification mark is added to the modified historical translation information, and the modification mark is used to indicate the modification record of the historical translation information.
[0113] Exemplarily, the modification flag can identify whether the translation record has been modified. Different values can be assigned to the modification flag to indicate whether the translation record has been modified. If check_flag is used to represent the modification flag, then when check_flag = 1, it indicates that the translation record has not been modified. When the translation record is modified, the value of check_flag can be changed to "0" to indicate that the translation record has been modified.
[0114] Here are several ways to add content to the historical translation records:
[0115] (1) Since the above-mentioned historical translation records may include a historical translation database and a historical translation vector library, the historical translation database is used to persistently store historical translation original information and corresponding historical translation information, and the historical translation vector library is used to store historical translation original text vectors corresponding to the historical translation original information; there is a mapping relationship between the historical translation database and the historical translation vector library; therefore, in one embodiment, the above-mentioned determination of whether there is historical translation original information identical to the target original information in the historical translation record may include the following steps:
[0116] In the historical translation vector library, it is determined whether there is a historical translation original text vector that is identical to the text vector of the target original text information; accordingly, the above-mentioned adding the target original text information and the target translation information to the historical translation record may include the following steps: adding the target original text information and the target translation information to the historical translation database, and adding the text vector of the target original text information to the historical translation vector library.
[0117] Furthermore, since the historical translation records include a historical translation database and a historical translation vector library, if there is a historical translation original text vector in the historical translation vector library that is identical to the text vector of the target original text information, the above-mentioned modification of the historical translation translated text information corresponding to the historical translation original text information into the target translated text information may include the following steps:
[0118] The historical translation database is modified according to the associated content in the target translation information.
[0119] That is to say, the historical translation original text vector to be modified can be determined in the historical translation vector library, and based on the mapping relationship between the historical translation vector library and the historical translation database, the historical translation original text information to be modified corresponding to the historical translation original text vector to be modified can be indexed in the historical translation database, and the historical translation text information corresponding to the historical translation original text information to be modified can be modified to the related content in the target translation information.
[0120] The above-mentioned setting of the historical translation database and the historical translation vector library with a mapping relationship in the historical translation records makes the process of updating the historical translation records clearer and more organized, and effectively improves the updating efficiency of the historical translation records.
[0121] (2) Since the historical translation record may also include the historical translation original text vector and the historical translation translation information corresponding to the historical translation original text information, in one embodiment, the above-mentioned adding of the target original text information and the target translation information to the historical translation record may include the following steps:
[0122] Performing text vectorization processing on the target original text information to obtain a text vector of the target original text information; determining first tag information corresponding to the text vector of the target original text information and second tag information corresponding to the target translation information; filling the first tag information and the second tag information into corresponding positions in the translation record template to generate a translation record to be added, and writing the translation record to be added into the historical translation record to update the historical translation record.
[0123] That is to say, since the historical translation records sentence vectors and their translations, when adding the target original text information to the historical translation record, the target original text information can be converted into a sentence vector and stored in the historical translation record.
[0124] Among them, the first tag information can be the index corresponding to the text vector of the target original information, that is, the text vector of the target original information can be found in the historical translation record through the first tag information, such as item_cn in Figure 6, and the second tag information can be the index corresponding to the target translation information, such as item_lang in Figure 6; the translation record template can be a fixed format for adding translation records in the historical translation record. The present disclosure does not specifically limit the specific content of the translation record template. For example, the translation record template can be "self.text_splitter.create_document(item_cn,{'lang':self.lang,'tr ans':item_lang,'time':now.strftime('%Y_%m-%d%H:%M:%S'),})"; wherein, item_cn and item_lang can respectively index the text vector of the target original information and its corresponding target translation information, now.strftime('%Y_%m-%d%H:%M:%S') can obtain the creation time of the translation record to be added, then item_doc in Figure 6 is the index of the translation record to be added. By parsing item_doc, a translation record of "text vector of target original information - target translation information - translation record creation time" can be added to the historical translation record.
[0125] (3) Since the historical translation record may also include historical translation original text information and historical translation translation information, the target original text information and target translation information may also be directly added to the historical translation record.
[0126] For example, after obtaining the target translation information, the target original information can be split into sentences, and the sentences can be retrieved in the historical translation records to confirm whether the sentence already exists in the historical translation records; for sentences that already exist in the historical translation records, it can be further determined whether the translation record corresponding to the sentence needs to be modified according to the target translation information; if modification is required, the translation corresponding to the sentence in the current historical translation record is replaced with the translation corresponding to the sentence in the target translation information, and the value of the check_flag (modification mark) corresponding to the translation record is set to 0; if the sentence does not exist in the historical translation record, a new translation record is formed based on the sentence and its corresponding translation in the target translation information, and the translation record is added to the current historical translation record to update the historical translation record.
[0127] Furthermore, in one embodiment, the above method may further include updating the terminology translation record based on the target original text information and the target translation text information.
[0128] Since the method of updating terminology translation records based on target original text information and target translation information is similar to the process of updating historical translation records, it will not be described in detail.
[0129] After obtaining the target translation information corresponding to the target original information based on the output results of the language model, the historical translation records and terminology translation records are updated according to the target original information and the target translation information, so as to provide more reference translation information for the subsequent translation process, thereby improving the overall translation efficiency.
[0130] In one embodiment, as shown in FIG9 , the translation method may include steps S901 to S907:
[0131] Step S901: Generate a terminology database and a historical translation database based on historical translation data.
[0132] Step S902: vectorize the original terminology in the terminology database to obtain a terminology vector, and generate a terminology translation record based on the terminology vector and its corresponding terminology translation; vectorize the historical translation original information in the historical translation database to obtain a historical translation original vector, and associate the historical translation original vector and its corresponding historical translation translation to generate a historical translation record.
[0133] Step S903: Obtain target original text information and its corresponding translation requirement information.
[0134] Step S904 : searching the term translation records and historical translation records based on the target original text information to obtain first reference translation information and second reference translation information.
[0135] Step S905 : Writing the translation request information, the first reference translation information, and the second reference translation information into a designated location of a prompt information template to generate translation prompt information.
[0136] Step S906: Input the translation prompt information into the language model, and determine the target translation information according to the output result of the language model.
[0137] Step S907: After manually or automatically confirming the target translation information, the target translation information is applied, and the terminology translation record and the historical translation record are updated according to the confirmed target translation information and its corresponding target original text information.
[0138] The method based on FIG9 can translate complex syntactic structures in the text to be translated, effectively improving the translation accuracy.
[0139] Based on the above method, the efficiency of the translation method is improved, and the flexibility of the translation method and the diversity of the target translation information are improved.
[0140] Furthermore, exemplary embodiments of the present disclosure further provide a translation apparatus. As shown in FIG10 , the translation apparatus 1000 may include an information acquisition module 1010 , an information retrieval module 1020 , a prompt information generation module 1030 , and a language model processing module 1040 .
[0141] Among them, the information acquisition module 1010 is configured to execute acquisition of target original text information and translation requirement information corresponding to the target original text information; the information retrieval module 1020 is configured to execute retrieval of information related to the target original text information in historical translation records to obtain first reference translation information; the prompt information generation module 1030 is configured to execute combination of the translation requirement information and the first reference translation information to generate translation prompt information; the language model processing module 1040 is configured to execute input of the translation prompt information into the language model, and obtain target translation information corresponding to the target original text information based on the output result of the language model.
[0142] Through the above-mentioned translation device, on the one hand, information related to the target original text information is retrieved from the historical translation records to obtain the first reference translation information, which can provide a translation reference for the target original text to be translated based on the translation records; at the same time, after generating translation prompt information based on the translation requirement information and the reference translation information, it is only necessary to input the translation prompt information into the language model to determine the target translation information based on the output result of the language model. Compared with the existing technology, there is no need to waste time and cost to train the deep model, which can effectively improve the text translation accuracy and text translation speed, thereby improving translation efficiency. On the other hand, by adding translation requirement information to the translation prompt information and inputting the translation prompt information into the language model to obtain the translation result of the target original text information, compared with the existing technology, while inputting the original text information, additional information related to the translation requirement can also be input, so that the obtained target translation information is more in line with the expected translation needs. By modifying the translation requirement information, target translation information of different styles can be obtained, thereby improving the flexibility of the translation method and increasing the diversity of the target translation information.
[0143] In one embodiment, the historical translation records include historical translation original information and corresponding historical translation translated information; the information retrieval module 1020 is specifically configured to execute: searching the historical translation original information similar to the target original information in the historical translation records, and obtaining the first reference translation information according to the retrieval results.
[0144] Through the above-mentioned information retrieval module, by directly searching for sentences similar to the target original information in the historical translation records, the complexity of the retrieval method can be effectively reduced, thereby improving the operating efficiency of the system.
[0145] In one embodiment, the historical translation record stores a historical translation original text vector corresponding to the historical translation original text information; the information retrieval module 1020 is specifically configured to execute: performing text vectorization processing on the target original text information to obtain a target original text vector; retrieving the target original text vector in the historical translation record, and determining a retrieval result in the historical translation record based on the similarity between the target original text vector and the historical translation original text vector; and generating first reference translation information based on the historical translation translation information corresponding to the historical translation original text vector in the retrieval result.
[0146] Through the above-mentioned information retrieval module, vector retrieval is performed in historical translation records, which not only improves the retrieval speed but also further improves the accuracy of the retrieval results, effectively improving the efficiency of obtaining the first reference translation information, thereby further improving translation efficiency.
[0147] In one embodiment, the above-mentioned device may further include a processing module, which is configured to execute: performing text vectorization processing on the historical translation original information to obtain a historical translation original text vector corresponding to the historical translation original text information; associating the historical translation original text vector with the historical translation text information corresponding to the historical translation original text information and adding it to the historical translation record to generate a historical translation record.
[0148] Through the above processing module, a historical translation record including a historical translation original text vector and its corresponding historical translation information can be generated, thereby providing a possibility for accelerating the retrieval process.
[0149] In one embodiment, after obtaining the target original text information, the processing module can be further configured to execute: searching for terms related to the keywords of the target original text information in the term translation record to obtain second reference translation information; and the prompt information generation module 1030 is configured to execute combining the translation requirement information, the first reference translation information, and the second reference translation information to generate translation prompt information; wherein the first reference translation information includes reference translation information of sentences and / or phrases in the target original text information, and the second reference translation information includes reference translation information of terms in the target original text information.
[0150] In one embodiment, the term translation record includes a term vector generated from a term in a first language and a term in a second language corresponding to the term vector; the first language is the language of the target original information, and the second language is the language of the target translation information; the processing module can also be configured to execute: performing word segmentation processing on the target original information and extracting keywords from the target original information; performing text vectorization processing on the keywords to obtain a keyword vector; matching the keyword vector in the term translation record, and generating second reference translation information based on the matched term vector and the term in the second language corresponding to the term vector.
[0151] Through the above-mentioned processing module, the translation of the terms in the target original information can be determined from the past translation data, so that the translation process no longer needs to translate the terms in the target original information, which reduces the difficulty of the translation process. At the same time, it ensures that the translation of the terms in the target translation information is consistent with the past translation records, which is conducive to improving the translation accuracy.
[0152] In one embodiment, the prompt information generating module 1030 is configured to execute: filling the translation requirement information and the first reference translation information into a designated position in the prompt information template corresponding to each other, so as to generate translation prompt information.
[0153] By filling the translation requirement information and reference translation information into the designated positions in the prompt information template to obtain translation prompt information, and then inputting the translation prompt information into the language model to obtain the target translation information, the translation speed can be effectively improved.
[0154] In one embodiment, after obtaining the target translation information corresponding to the target original information according to the output result of the language model, the processing module in the above device may be further configured to execute: updating the historical translation record based on the target original information and the target translation information.
[0155] Through this embodiment, after obtaining the target translation information corresponding to the target original information based on the output results of the language model, the historical translation records and terminology translation records are updated according to the target original information and the target translation information, so as to provide more reference translation information for subsequent translation processes, thereby improving the overall translation efficiency.
[0156] In one embodiment, the above-mentioned processing module can also be configured to execute: determining whether there is historical translation original information that is identical to the target original information in the historical translation record; if so, modifying the historical translation translation information corresponding to the historical translation original information to the associated content of the historical translation original information in the target translation information; otherwise, adding the target original information and the target translation information to the historical translation record.
[0157] Through the above embodiment, the historical translation record can be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0158] In one embodiment, the processing module may be further configured to execute: adding a modification mark to the modified historical translation information in the historical translation record, where the modification mark is used to indicate a modification record of the historical translation information.
[0159] In one embodiment, the above-mentioned historical translation records include a historical translation database and a historical translation vector library. The historical translation database is used to persistently store historical translation original text information and corresponding historical translation translation information, and the historical translation vector library is used to store historical translation original text vectors corresponding to the historical translation original text information; there is a mapping relationship between the historical translation database and the historical translation vector library; the above-mentioned processing module can also be configured to execute: in the historical translation vector library, determine whether there is a historical translation original text vector that is identical to the text vector of the target original text information; modify the historical translation database according to the associated content in the target translation information; add the target original text information and the target translation information to the historical translation database accordingly, and add the text vector of the target original text information to the historical translation vector library.
[0160] Through the above embodiment, the historical translation database and the historical translation vector library having a mapping relationship are set in the historical translation records, which makes the process of updating the historical translation records clearer and more organized, and effectively improves the updating efficiency of the historical translation records.
[0161] The specific details of each part of the above device have been described in detail in the method part of the implementation method, so they will not be repeated here.
[0162] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium, which can be implemented in the form of a program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure.
[0163] Specifically, target original text information and translation requirement information corresponding to the target original text information are obtained; information related to the target original text information is retrieved from historical translation records to obtain first reference translation information; the translation requirement information is combined with the first reference translation information to generate translation prompt information; the translation prompt information is input into a language model, and target translation information corresponding to the target original text information is obtained based on the output result of the language model.
[0164] On the one hand, by retrieving information related to the target original text in the historical translation records to obtain the first reference translation information, a translation reference can be provided for the target original text to be translated based on the translation records. At the same time, after generating translation prompt information based on the translation requirement information and the reference translation information, only the translation prompt information needs to be input into the language model to determine the target translation information based on the output of the language model. Compared with related technologies, there is no need to waste time and cost on training deep models, which can effectively improve the accuracy and speed of text translation, thereby improving translation efficiency. On the other hand, by adding translation requirement information to the translation prompt information and inputting the translation prompt information into the language model to obtain the translation result of the target original text information, compared with related technologies, while inputting the original text information, additional information related to the translation requirement can also be input, so that the obtained target translation information is more in line with the expected translation needs. By modifying the translation requirement information, target translation information of different styles can be obtained, thereby improving the flexibility of the translation method and increasing the diversity of the target translation information.
[0165] Optionally, the historical translation record includes historical translation original information and corresponding historical translation translated text information; searching the historical translation record for information related to the target original information to obtain the first reference translation information includes: searching the historical translation record for historical translation original information similar to the target original information, and obtaining the first reference translation information based on the search results.
[0166] In this embodiment, by directly searching for sentences similar to the target original text in the historical translation records, the complexity of the retrieval method can be effectively reduced, thereby improving the operating efficiency of the system.
[0167] Optionally, historical translation original text vectors corresponding to historical translation original text information are saved in historical translation records; historical translation original text information similar to target original text information is retrieved in the historical translation records, and first reference translation information is obtained based on the retrieval results, including: performing text vectorization processing on the target original text information to obtain a target original text vector; retrieving the target original text vector in the historical translation records, and determining the retrieval results in the historical translation records based on the similarity between the target original text vector and the historical translation original text vector; and generating first reference translation information based on the historical translation text information corresponding to the historical translation original text vector in the retrieval results.
[0168] In this embodiment, vector retrieval is performed in historical translation records, which not only increases the retrieval speed but also further improves the accuracy of the retrieval results, effectively improving the efficiency of obtaining the first reference translation information, thereby further improving translation efficiency.
[0169] Optionally, the method also includes: performing text vectorization processing on the historical translation original information to obtain a historical translation original text vector corresponding to the historical translation original text information; associating the historical translation original text vector with the historical translation text information corresponding to the historical translation original text information and adding the result to the historical translation record to generate a historical translation record.
[0170] Based on this embodiment, a historical translation record including a historical translation original text vector and its corresponding historical translation information can be generated, thereby providing a possibility for accelerating the retrieval process.
[0171] Optionally, the method further includes: searching for terms related to keywords of the target original text information in the term translation record to obtain second reference translation information; combining the translation requirement information with the first reference translation information to generate translation prompt information includes: combining the translation requirement information, the first reference translation information, and the second reference translation information to generate translation prompt information; wherein the first reference translation information includes reference translation information of sentences and / or phrases in the target original text information, and the second reference translation information includes reference translation information of terms in the target original text information.
[0172] In this embodiment, by filling the translation requirement information, the first reference translation information, and the second reference translation information into the designated position of the prompt information template to obtain the translation prompt information, and then inputting the translation prompt information into the language model to obtain the target translation information, the translation speed can be effectively improved.
[0173] Optionally, the term translation record includes a term vector generated from a term in a first language and a term in a second language corresponding to the term vector; the first language is the language to which the target original information belongs, and the second language is the language to which the target translation information belongs; searching the term translation record for terms related to the keywords of the target original information to obtain second reference translation information, including: performing word segmentation processing on the target original information and extracting keywords from the target original information; performing text vectorization processing on the keywords to obtain keyword vectors; matching the keyword vectors in the term translation record, and generating second reference translation information based on the matched term vectors and the terms in the second language corresponding to the term vectors.
[0174] In this embodiment, the translation of the term in the target original information can be determined from past translation data, so that the translation process no longer needs to translate the term in the target original information, which reduces the difficulty of the translation process. At the same time, it ensures that the translation of the term in the target translation information is consistent with the past translation records, which is conducive to improving the translation accuracy.
[0175] Optionally, combining the translation requirement information with the first reference translation information to generate translation prompt information includes: filling the translation requirement information and the first reference translation information into designated positions in a prompt information template corresponding to each other to generate translation prompt information.
[0176] In this embodiment, the translation request information and the first reference translation information are filled into the designated position of the prompt information template to obtain translation prompt information, and then the translation prompt information is input into the language model to obtain the target translation information, thereby effectively improving the translation speed.
[0177] Optionally, after obtaining the target translation information corresponding to the target original information according to the output result of the language model, the method further includes: updating the historical translation record based on the target original information and the target translation information.
[0178] In this embodiment, the historical translation record may be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0179] Optionally, updating the historical translation record based on the target original text information and the target translation information includes: determining whether there is historical translation original text information identical to the target original text information in the historical translation record; if so, modifying the historical translation translation information corresponding to the historical translation original text information to the associated content of the historical translation original text information in the target translation information; otherwise, adding the target original text information and the target translation information to the historical translation record.
[0180] Through this embodiment, the historical translation record can be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0181] Optionally, modifying the historical translation information corresponding to the historical translation original information into the target translation information includes: adding a modification mark to the modified historical translation information in the historical translation record, where the modification mark is used to indicate the modification record of the historical translation information.
[0182] Through this embodiment, the process of updating historical translation records is made clearer and more organized, and the updating efficiency of historical translation records is effectively improved.
[0183] Optionally, the historical translation record includes a historical translation database and a historical translation vector library, the historical translation database is used to persistently store the historical translation original text information and the corresponding historical translation translation information, and the historical translation vector library is used to store the historical translation original text vector corresponding to the historical translation original text information; there is a mapping relationship between the historical translation database and the historical translation vector library; determining whether there is historical translation original text information identical to the target original text information in the historical translation record includes: determining whether there is a historical translation original text vector identical to the text vector of the target original text information in the historical translation vector library; modifying the historical translation translation information corresponding to the historical translation original text information to the target translation information, including: modifying the historical translation database according to the associated content in the target translation information; adding the target original text information and the target translation information to the historical translation record, including: adding the target original text information and the target translation information corresponding to the historical translation database, and adding the text vector of the target original text information to the historical translation vector library.
[0184] Through the above embodiments, complex syntactic structures in the text to be translated can be translated, which effectively improves the translation accuracy while increasing the flexibility of the translation method and the diversity of target translation information.
[0185] In an alternative embodiment, the program product can be implemented as a portable compact disc read-only memory (CD-ROM) and includes program code, and can be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0186] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0187] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0188] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
[0189] The program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a standalone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0190] The exemplary embodiments of the present disclosure further provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions for the processor, such as program code. The processor executes the executable instructions to perform the method of the exemplary embodiment.
[0191] 11 , an electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that the electronic device 1100 shown in FIG11 is merely an example and should not limit the functionality and scope of use of the embodiments of the present disclosure.
[0192] As shown in FIG. 11 , the electronic device 1100 may include a processor 1110 , a memory 1120 , a bus 1130 , an I / O (input / output) interface 1140 , and a network adapter 1150 .
[0193] Processor 1110 may include one or more processing units, such as a central processing unit (CPU), an application processor (AP), a modem processor, a display processor (DPU), a graphics processing unit (GPU), an image signal processor (ISP), a controller, an encoder, a decoder, a digital signal processor (DSP), a baseband processor, and an artificial intelligence processor. In one embodiment, the artificial intelligence processor may obtain target original text information and translation requirement information corresponding to the target original text information; retrieve information related to the target original text information from historical translation records to obtain first reference translation information; then combine the translation requirement information with the first reference translation information to generate translation prompt information; and finally input the translation prompt information into a language model to obtain target translation information corresponding to the target original text information based on the output of the language model.
[0194] On the one hand, by retrieving information related to the target original text in the historical translation records to obtain the first reference translation information, a translation reference can be provided for the target original text to be translated based on the translation records. At the same time, after generating translation prompt information based on the translation requirement information and the reference translation information, only the translation prompt information needs to be input into the language model to determine the target translation information based on the output of the language model. Compared with related technologies, there is no need to waste time and cost on training deep models, which can effectively improve the accuracy and speed of text translation, thereby improving translation efficiency. On the other hand, by adding translation requirement information to the translation prompt information and inputting the translation prompt information into the language model to obtain the translation result of the target original text information, compared with related technologies, while inputting the original text information, additional information related to the translation requirement can also be input, so that the obtained target translation information is more in line with the expected translation needs. By modifying the translation requirement information, target translation information of different styles can be obtained, thereby improving the flexibility of the translation method and increasing the diversity of the target translation information.
[0195] Optionally, the historical translation record includes historical translation original information and corresponding historical translation translated text information; searching the historical translation record for information related to the target original information to obtain the first reference translation information includes: searching the historical translation record for historical translation original information similar to the target original information, and obtaining the first reference translation information based on the search results.
[0196] In this embodiment, by directly searching for sentences similar to the target original text in the historical translation records, the complexity of the retrieval method can be effectively reduced, thereby improving the operating efficiency of the system.
[0197] Optionally, historical translation original text vectors corresponding to historical translation original text information are saved in historical translation records; historical translation original text information similar to target original text information is retrieved in the historical translation records, and first reference translation information is obtained based on the retrieval results, including: performing text vectorization processing on the target original text information to obtain a target original text vector; retrieving the target original text vector in the historical translation records, and determining the retrieval results in the historical translation records based on the similarity between the target original text vector and the historical translation original text vector; and generating first reference translation information based on the historical translation text information corresponding to the historical translation original text vector in the retrieval results.
[0198] In this embodiment, vector retrieval is performed in historical translation records, which not only increases the retrieval speed but also further improves the accuracy of the retrieval results, effectively improving the efficiency of obtaining the first reference translation information, thereby further improving translation efficiency.
[0199] Optionally, the method also includes: performing text vectorization processing on the historical translation original information to obtain a historical translation original text vector corresponding to the historical translation original text information; associating the historical translation original text vector with the historical translation text information corresponding to the historical translation original text information and adding the result to the historical translation record to generate a historical translation record.
[0200] Based on this embodiment, a historical translation record including a historical translation original text vector and its corresponding historical translation information can be generated, thereby providing a possibility for accelerating the retrieval process.
[0201] Optionally, the method further includes: searching for terms related to keywords of the target original text information in the term translation record to obtain second reference translation information; combining the translation requirement information with the first reference translation information to generate translation prompt information includes: combining the translation requirement information, the first reference translation information, and the second reference translation information to generate translation prompt information; wherein the first reference translation information includes reference translation information of sentences and / or phrases in the target original text information, and the second reference translation information includes reference translation information of terms in the target original text information.
[0202] In this embodiment, by filling the translation requirement information, the first reference translation information, and the second reference translation information into the designated position of the prompt information template to obtain the translation prompt information, and then inputting the translation prompt information into the language model to obtain the target translation information, the translation speed can be effectively improved.
[0203] Optionally, the term translation record includes a term vector generated from a term in a first language and a term in a second language corresponding to the term vector; the first language is the language to which the target original information belongs, and the second language is the language to which the target translation information belongs; searching the term translation record for terms related to the keywords of the target original information to obtain second reference translation information, including: performing word segmentation processing on the target original information and extracting keywords from the target original information; performing text vectorization processing on the keywords to obtain keyword vectors; matching the keyword vectors in the term translation record, and generating second reference translation information based on the matched term vectors and the terms in the second language corresponding to the term vectors.
[0204] In this embodiment, the translation of the term in the target original information can be determined from past translation data, so that the translation process no longer needs to translate the term in the target original information, which reduces the difficulty of the translation process. At the same time, it ensures that the translation of the term in the target translation information is consistent with the past translation records, which is conducive to improving the translation accuracy.
[0205] Optionally, combining the translation request information with the first reference translation information to generate translation prompt information includes: entering the translation request information and the first reference translation information into designated locations in a prompt information template to generate the translation prompt information. In this embodiment, by entering the translation request information and the first reference translation information into designated locations in the prompt information template to generate the translation prompt information, and then inputting the translation prompt information into the language model to obtain the target translation information, translation speed can be effectively improved.
[0206] Optionally, after obtaining the target translation information corresponding to the target original information according to the output result of the language model, the method further includes: updating the historical translation record based on the target original information and the target translation information.
[0207] In this embodiment, the historical translation record may be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0208] Optionally, updating the historical translation record based on the target original text information and the target translation information includes: determining whether there is historical translation original text information identical to the target original text information in the historical translation record; if so, modifying the historical translation translation information corresponding to the historical translation original text information to the associated content of the historical translation original text information in the target translation information; otherwise, adding the target original text information and the target translation information to the historical translation record.
[0209] Through this embodiment, the historical translation record can be updated by modifying and / or adding content to the historical translation record using the target original text information and its corresponding target translation information.
[0210] Optionally, modifying the historical translation information corresponding to the historical translation source information to the target translation information includes adding a modification mark to the modified historical translation information in the historical translation record, where the modification mark is used to indicate the modification record of the historical translation information. This embodiment makes the process of updating the historical translation record clearer and more organized, effectively improving the efficiency of updating the historical translation record.
[0211] Optionally, the historical translation record includes a historical translation database and a historical translation vector library, the historical translation database is used to persistently store the historical translation original text information and the corresponding historical translation translation information, and the historical translation vector library is used to store the historical translation original text vector corresponding to the historical translation original text information; there is a mapping relationship between the historical translation database and the historical translation vector library; determining whether there is historical translation original text information identical to the target original text information in the historical translation record includes: determining whether there is a historical translation original text vector identical to the text vector of the target original text information in the historical translation vector library; modifying the historical translation translation information corresponding to the historical translation original text information to the target translation information, including: modifying the historical translation database according to the associated content in the target translation information; adding the target original text information and the target translation information to the historical translation record, including: adding the target original text information and the target translation information corresponding to the historical translation database, and adding the text vector of the target original text information to the historical translation vector library.
[0212] Through the above embodiments, complex syntactic structures in the text to be translated can be translated, which effectively improves the translation accuracy while increasing the flexibility of the translation method and the diversity of target translation information.
[0213] The memory 1120 may include volatile memory, such as RAM 1121 and cache unit 1122, and may also include non-volatile memory, such as ROM 1123. The memory 1120 may also include one or more program modules 1124. Such program modules 1124 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. For example, the program modules 1124 may include the modules in the aforementioned apparatus 1000.
[0214] The bus 1130 is used to realize the connection between different components of the electronic device 1100 and may include a data bus, an address bus, and a control bus.
[0215] The electronic device 1100 can communicate with one or more external devices 1200 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 1140 .
[0216] The electronic device 1100 can communicate with one or more networks via a network adapter 1150. For example, the network adapter 1150 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication. The network adapter 1150 can communicate with other modules of the electronic device 1100 via the bus 1130.
[0217] Although not shown in FIG. 11 , other hardware and / or software modules may be provided in the electronic device 1100 , including but not limited to: a display, microcode, device drivers, redundant processors, an external disk drive array, a RAID system, a tape drive, and a data backup storage system.
[0218] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0219] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented as the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module" or "system". Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to encompass any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0220] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A translation method comprising: Obtaining target original text information and translation requirement information corresponding to the target original text information; Retrieving information related to the target original information in historical translation records to obtain first reference translation information; combining the translation requirement information with the first reference translation information to generate translation prompt information; The translation prompt information is input into a language model, and target translation information corresponding to the target original information is obtained according to an output result of the language model.
2. The method according to claim 1, wherein The historical translation record includes historical translation original information and corresponding historical translation information; The step of searching for information related to the target original text information in the historical translation records to obtain first reference translation information includes: The historical translation records are searched for the historical translation original information similar to the target original information, and the first reference translation information is obtained according to the search result.
3. The method according to claim 2, wherein: The historical translation record stores a historical translation original text vector corresponding to the historical translation original text information; searching the historical translation original text information similar to the target original text information in the historical translation record, and obtaining the first reference translation information according to the search result, includes: Performing text vectorization processing on the target original text information to obtain a target original text vector; Retrieving the target original text vector in the historical translation records, and determining the search result in the historical translation records based on the similarity between the target original text vector and the historical translation original text vector; The first reference translation information is generated according to the historical translation information corresponding to the historical translation original text vector in the search result.
4. The method according to claim 3, wherein: The method further comprises: Performing text vectorization processing on the historical translation original text information to obtain a historical translation original text vector corresponding to the historical translation original text information; The historical translation original text vector is associated with the historical translation text information corresponding to the historical translation original text information and then added to the historical translation record to generate the historical translation record.
5. The method according to claim 1, wherein After obtaining the target original text information, the method further includes: Retrieving terms related to the keywords of the target original information in the term translation records to obtain second reference translation information; The combining the translation requirement information with the first reference translation information to generate translation prompt information includes: The translation request information, the first reference translation information, and the second reference translation information are combined to generate the translation prompt information; wherein the first reference translation information includes reference translation information of sentences and / or phrases in the target original information, and the second reference translation information includes reference translation information of terms in the target original information.
6. The method according to claim 5, wherein: The term translation record includes a term vector generated from a term in a first language and a term in a second language corresponding to the term vector; the first language is the language of the target original information, and the second language is the language of the target translation information; The step of searching the term translation record for terms related to the keywords of the target original text information to obtain second reference translation information includes: Performing word segmentation processing on the target original text information and extracting keywords from the target original text information; Performing text vectorization processing on the keywords to obtain keyword vectors; The keyword vector is matched in the term translation record, and the second reference translation information is generated based on the term vector matched to the term vector and the term in the second language corresponding to the term vector.
7. The method according to claim 1, wherein The combining the translation requirement information with the first reference translation information to generate translation prompt information includes: The translation requirement information and the first reference translation information are correspondingly filled into a designated position in a prompt information template to generate the translation prompt information.
8. The method according to claim 1, wherein After obtaining target translation information corresponding to the target original information according to the output result of the language model, the method further includes: The historical translation record is updated based on the target original text information and the target translation information.
9. The method according to claim 8, wherein The updating of the historical translation record based on the target original text information and the target translation information includes: Determining whether there is historical translation original text information identical to the target original text information in the historical translation record; If so, the historical translation text information corresponding to the historical translation original text information is modified to the associated content of the historical translation original text information in the target translation information; otherwise, the target original text information and the target translation information are added to the historical translation record.
10. The method according to claim 9, wherein: The modifying of the historical translation information corresponding to the historical translation original information into the target translation information includes: In the historical translation record, a modification mark is added to the modified historical translation information, and the modification mark is used to indicate the modification record of the historical translation information.
11. The method according to claim 9, wherein The historical translation records include a historical translation database and a historical translation vector library. The historical translation database is used to persistently store the historical translation original information and the corresponding historical translation information. The historical translation vector library is used to store the historical translation original vector corresponding to the historical translation original information. There is a mapping relationship between the historical translation database and the historical translation vector library. The determining whether there is historical translation original text information identical to the target original text information in the historical translation record includes: determining whether there is a historical translation original text vector identical to the text vector of the target original text information in the historical translation vector library; The modifying of the historical translation information corresponding to the historical translation original information into the target translation information includes: modifying the historical translation database according to the associated content in the target translation information; Adding the target original text information and the target translation information to the historical translation record includes: adding the target original text information and the target translation information to the historical translation database accordingly, and adding the text vector of the target original text information to the historical translation vector library.
12. A translation device comprising: an information acquisition module configured to acquire target original text information and translation requirement information corresponding to the target original text information; an information retrieval module configured to retrieve information related to the target original information in historical translation records to obtain first reference translation information; a prompt information generating module configured to combine the translation requirement information with the first reference translation information to generate translation prompt information; The language model processing module is configured to input the translation prompt information into a language model, and obtain target translation information corresponding to the target original information according to an output result of the language model.
13. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
14. An electronic device comprising: processor; a memory for storing executable instructions of the processor; The processor is configured to perform the method according to any one of claims 1 to 11 by executing the executable instructions.