Translation model training method, business information translation method and device
Patent Information
- Application Number
- CN202510475879.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2026-10-23
AI Technical Summary
然而,在实际应用中,获取高质量的训练语料往往面临诸多挑战,低质量的训练语料会干扰模型的学习过程,导致模型难以从语料中捕捉到数据之间的规律
[0028]本申请可将多语种源语料中的多个待处理语句分别输入到目标语言模型,对于包含多个目标词的待处理语句,在给定每个目标词的基础上,目标语言模型能够预测在预测语句中可能出现在该目标词之后且与目标词相邻的关联词的预测概率分布,也即在对每个词的预测过程中,均是基于待处理语句中的真实目标词进行下一词的预测,即每个词的预测基础均是真实目标词,从而能够避免基于关联词对下一词进行预测所导致的错误累积与错误传播,使得对每个目标词的关联词的预测概率分布更加准确;在预测得到准确的预测概率分布的基础上进行语句的信息熵计算,并将信息熵满足预设信息熵条件的待处理语句确定为目标语句,能够提高目标语句的筛选效率以及筛选准确性,即基于词的预测概率分布以及基于语句的信息熵计算所确定的目标语句为高质量的训练语料;进而基于目标语句进行翻译模型训练,能够提高模型训练的效率、提高目标翻译模型的翻译稳定性以及翻译准确性。
Smart Images

Figure CN122964571A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to a translation model training method, a business information translation method, and an apparatus. Background Technology
[0002] In the current field of machine learning, the training effect of a model is highly dependent on the quality of the training corpus; the training corpus is the foundation of model learning, and its quality directly determines the model's performance. However, in practical applications, obtaining high-quality training corpus often faces many challenges. Low-quality training corpus can interfere with the model's learning process, making it difficult for the model to capture patterns between data. Although existing data cleaning and preprocessing techniques can improve corpus quality to some extent, these methods often require a lot of manual intervention, are inefficient, and cannot guarantee the quality of the processed corpus. Summary of the Invention
[0003] The technical problem to be solved by this application is to provide a translation model training method, a business information translation method and apparatus, which can improve the efficiency and accuracy of corpus screening, ensure that the screened corpus is of high quality, and then improve the training effect of the translation model by training the model based on the screened corpus.
[0004] To address the aforementioned technical problems, this application provides a translation model training method, comprising:
[0005] Obtain multilingual source corpus; the multilingual source corpus includes multiple sentences to be processed, and each sentence to be processed includes multiple target words;
[0006] Each statement to be processed is input into the target language model, and the prediction probability distribution of the associated words corresponding to each target word is predicted based on the target language model. The associated words corresponding to each target word are words that may appear after the target word and are adjacent to each target word.
[0007] Based on the predicted probability distribution of the associated words corresponding to each target word, the information entropy of each statement to be processed is determined;
[0008] The target statement is determined from the plurality of statements to be processed based on the information entropy of each statement to be processed; the information entropy of the target statement satisfies a preset information entropy condition.
[0009] The target translation model is obtained by training the preset model based on the target statement.
[0010] On the other hand, embodiments of this application provide a business information translation method, implemented based on a target translation model obtained by the above-described translation model training method, the method comprising:
[0011] Receive a translation model access request; the translation model access request includes business training corpus corresponding to the target business scenario;
[0012] The target translation model is fine-tuned based on the business training corpus to obtain a translation model corresponding to the target business scenario;
[0013] The business information in the target business scenario is translated based on the translation model corresponding to the target business scenario to obtain the translated business information.
[0014] On the other hand, embodiments of this application provide a translation model training apparatus, characterized in that it includes:
[0015] A multilingual source corpus acquisition module is used to acquire multilingual source corpora; the multilingual source corpora include multiple sentences to be processed, and each sentence to be processed includes multiple target words;
[0016] The probability distribution prediction module is used to input each statement to be processed into the target language model, and predict the probability distribution of the associated words corresponding to each target word based on the target language model. The associated words corresponding to each target word are words that may appear after the target word and are adjacent to each target word.
[0017] The information entropy determination module is used to determine the information entropy of each statement to be processed based on the predicted probability distribution of the associated words corresponding to each target word.
[0018] The target statement determination module is used to determine the target statement from the plurality of statements to be processed based on the information entropy of each statement to be processed; the information entropy of the target statement satisfies a preset information entropy condition;
[0019] The model training module is used to train a preset model based on the target sentence to obtain a target translation model.
[0020] On the other hand, embodiments of this application provide a business information translation device, implemented based on a target translation model obtained by the above-described translation model training method, the device comprising:
[0021] The request receiving module is used to receive translation model access requests; the translation model access request includes business training corpus corresponding to the target business scenario;
[0022] The model fine-tuning module is used to fine-tune the target translation model based on the business training corpus to obtain a translation model corresponding to the target business scenario;
[0023] The information translation module is used to translate the business information in the target business scenario based on the translation model corresponding to the target business scenario, so as to obtain the translated business information.
[0024] On the other hand, this application provides an electronic device including a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the translation model training method or the business information translation method described above.
[0025] On the other hand, this application provides a computer storage medium storing at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor as described above for the translation model training method or the business information translation method.
[0026] On the other hand, this application provides a computer program product, which includes computer instructions stored in a computer-readable storage medium; a processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the above-described translation model training method or business information translation method.
[0027] Implementing the embodiments of this application has the following beneficial effects:
[0028] This application allows multiple sentences to be processed from multilingual source corpora to be input into a target language model. For a sentence containing multiple target words, given each target word, the target language model can predict the probability distribution of related words that may appear after and be adjacent to the target word in the predicted sentence. That is, in the prediction process of each word, the prediction of the next word is based on the real target word in the sentence, and the prediction basis of each word is the real target word. This avoids the accumulation and propagation of errors caused by predicting the next word based on related words, making the prediction probability distribution of related words of each target word more accurate. Based on the accurate prediction probability distribution, the information entropy of the sentence is calculated, and the sentences to be processed that meet the preset information entropy conditions are determined as target sentences. This can improve the selection efficiency and accuracy of target sentences. That is, the target sentences determined based on the prediction probability distribution of words and the information entropy calculation of sentences are high-quality training corpora. Furthermore, the translation model is trained based on the target sentences, which can improve the efficiency of model training, the translation stability of the target translation model, and the translation accuracy. Attached Figure Description
[0029] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a schematic diagram of the implementation environment provided in the embodiments of this application;
[0031] Figure 2 This is a flowchart of a translation model training method provided in an embodiment of this application;
[0032] Figure 3 This is a flowchart of a probability distribution prediction method provided in an embodiment of this application;
[0033] Figure 4 This is a flowchart of another translation model training method provided in an embodiment of this application;
[0034] Figure 5 This is a flowchart of a method for processing multilingual source corpora provided in an embodiment of this application;
[0035] Figure 6 This is a flowchart of the hierarchical training process of the target translation model provided in the embodiments of this application;
[0036] Figure 7This is a flowchart of a business information translation method provided in an embodiment of this application;
[0037] Figure 8 This is a schematic diagram of a translation model training device provided in an embodiment of this application;
[0038] Figure 9 This is a schematic diagram of a business information translation device provided in an embodiment of this application;
[0039] Figure 10 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0041] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0042] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0043] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0044] Please see Figure 1 The illustration shows an implementation environment provided in the embodiments of this application. The implementation environment may include at least one service terminal 110 and a server 120, which can communicate with each other via a network.
[0045] Specifically, server 120 can train a preset model based on the acquired multilingual source corpus to obtain a target translation model. Specifically, server 120 can calculate the information entropy of multiple sentences to be processed in the multilingual source corpus, then select the target sentence based on the information entropy of the sentences to be processed, and train the preset model based on the target sentence to obtain the target translation model. Business terminal 110 can send a translation model access request to server 120. Server 120 can fine-tune the target translation model based on the business training corpus of the target business scenario included in the translation model access request to obtain a translation model corresponding to the target business scenario. Then, based on the translation model corresponding to the target business scenario, it can translate the business information of the target business scenario to obtain the translated business information.
[0046] The service terminal 110 can communicate with the server 120 based on a browser / server (B / S) or client / server (C / S) model. The service terminal 110 may include physical devices such as smartphones, tablets, laptops, digital assistants, smart wearable devices, in-vehicle terminals, and servers, and may also include software running on the physical device, such as applications. The operating system running on the service terminal 110 in this embodiment may include, but is not limited to, Android, iOS, Linux, and Windows.
[0047] Server 120 and business terminal 110 can establish a communication connection via wired or wireless means. Server 120 may include a stand-alone server, a distributed server, or a server cluster consisting of multiple servers, wherein the server may be a cloud server.
[0048] To address the technical problems of existing methods for improving corpus quality requiring significant manual intervention, resulting in low efficiency and difficulty in guaranteeing the quality of the processed corpus, this application provides a translation model training method. The execution entity of this method can be the aforementioned server; specifically, please refer to... Figure 2 The method may include:
[0049] S210. Obtain multilingual source corpus; the multilingual source corpus includes multiple sentences to be processed, and each sentence to be processed includes multiple target words.
[0050] In the translation model training scenario, sentences in various languages are generally available as multilingual source corpora, which are used as corpus information for subsequent translation model training; the multiple to-be-processed sentences in this embodiment may refer to all sentences in the multilingual source corpora, or may refer to partial sentences in the multilingual source corpora, which may be determined according to specific implementation conditions. Further, the multilingual source corpora may further include a plurality of words, or phrases and the like in addition to the multiple to-be-processed sentences, that is, the multilingual source corpora may include corpus information such as words, phrases, and sentences.
[0051] The target words included in each to-be-processed sentence may be obtained based on word segmentation processing, and different word segmentation methods may lead to different word segmentation results; in the specific process of word segmentation processing, the implementation may be based on word segmentation methods in the prior art. For example, in one example, a to-be-processed sentence is "The weather is really nice today", and the corresponding word segmentation results are "today", "weather", and "really nice".
[0052] S220. Input each of the to-be-processed sentences into a target language model respectively, and predict, based on the target language model, the predicted probability distribution of associated words corresponding to each target word on the basis that each target word is given; wherein the associated word corresponding to each target word is a word that may appear after the target word and is adjacent to each said target word.
[0053] In this embodiment, the target language model may be a Large Language Model (LLM) dedicated to understanding and generating natural language texts, which is trained with massive text data, can capture complex rules of language, and complete a variety of language tasks. In one example, word segmentation processing may be performed on the multiple to-be-processed sentences in advance to obtain a plurality of target words corresponding to each to-be-processed sentence, and then when processing each to-be-processed sentence, the multiple target words of the to-be-processed sentence are directly input into the target language model for probability distribution prediction; in another example, the to-be-processed sentence may be directly input into the target language model, and the target language model may first perform word segmentation processing on the to-be-processed sentence to obtain a plurality of target words, and then perform probability distribution prediction based on the plurality of target words.
[0054] When the to-be-processed sentence is input into the target language model, the target language model may predict the predicted probability distribution of associated words that may appear after the target word on the basis that each target word is given, that is, each prediction of an associated word is based on the real target word, rather than predicting the next word based on the associated word.
[0055] It should be noted that, based on the target language model prediction, given each target word, the predicted probability distribution of the associated words corresponding to each target word can be understood as follows: according to the order of multiple target words in the sentence to be processed, regardless of whether there are other target words before the current target word in the sentence to be processed, the target language model can make a prediction based on the current target word each time it predicts the next word after the current target word. For example, if the sentence to be processed is "The weather is really nice today", the corresponding word segmentation results are "today", "weather", and "really nice", so the target words include the three words "today", "weather", and "really nice". If the current target word is "today" and there are no other target words before "today", words that may appear after "today" can be predicted based on "today". If the current target word is "weather" and there is a target word "today" before "weather", words that may appear after "weather" can still be predicted based on "weather".
[0056] Based on the target language model prediction, given each target word, the prediction probability distribution of the associated words corresponding to each target word can also be understood as follows: according to the order of multiple target words in the sentence to be processed, if there are other target words before the current target word in the sentence to be processed, the next word after the current target word can be predicted based on the other target words before the current target word and the current target word; if there are no other target words before the current target word in the sentence to be processed, the next word after the current target word can be predicted based on the current target word. For example, if the sentence to be processed is "The weather is really nice today", the corresponding word segmentation results are "today", "weather", and "really nice", so the target words include the three words "today", "weather", and "really nice". If the current target word is "today" and there are no other target words before "today", the words that may appear after "today" can be predicted based on "today"; if the current target word is "weather" and there is a target word "today" before "weather", the words that may appear after "weather" can be predicted based on the two target words "today" and "weather".
[0057] The predicted probability distribution of the associated words corresponding to each target word may include at least one associated word and the probability corresponding to each associated word; the associated words corresponding to each target word may be words predicted based on the target language model, which may appear after the target word and are adjacent to the target word.
[0058] S230. Based on the predicted probability distribution of the associated words corresponding to each target word, determine the information entropy of each statement to be processed.
[0059] In this embodiment, the information entropy of a word can be determined based on the predicted probability distribution of the associated words corresponding to each target word, and then the information entropy of each statement to be processed can be determined based on the information entropy of the word.
[0060] Specifically, by predicting each target word in the statement to be processed, a predicted word corresponding to each target word can be obtained. The associated word corresponding to the current target word can be the predicted word corresponding to the next target word. The current target word and the next target word are adjacent in the statement to be processed, and the next target word is located after the current target word. Thus, based on the prediction probability distribution of the predicted words corresponding to each target word in the statement to be processed, the information entropy corresponding to each target word can be obtained, and then the information entropy of the statement to be processed can be obtained based on the information entropy corresponding to each target word.
[0061] For example, if the sentence to be processed is "The weather is really nice today", the corresponding word segmentation results are "today", "weather", and "really nice". Therefore, the target words include these three words: "today", "weather", and "really nice". The current target word is "weather", and its related words can include "really nice" and "not nice". The next target word is "really nice", and its corresponding predicted words include "really nice" and "not nice". The information entropy of the target word "really nice" can be calculated based on the prediction probabilities of the predicted words "really nice" and "not nice". The information entropy of other target words can also be calculated based on the prediction probabilities of their respective predicted words.
[0062] S240. Determine the target statement from the plurality of statements to be processed based on the information entropy of each statement to be processed; the information entropy of the target statement satisfies a preset information entropy condition.
[0063] In this embodiment, the preset information entropy condition can be that the information entropy is less than a preset entropy value, which can be 0.4, 0.5, etc., and the specific entropy value can be determined based on the actual implementation. It can be understood that the smaller the information entropy of a statement, the lower its uncertainty and the more stable it is; conversely, the larger the information entropy of a statement, the higher its uncertainty and the less stable it is. Therefore, in this embodiment, statements with information entropy less than the preset entropy value can be selected from multiple statements to be processed, and statements with lower uncertainty can be chosen as target statements for training the translation model.
[0064] S250. Train the preset model based on the target statement to obtain the target translation model.
[0065] This application allows multiple sentences to be processed from multilingual source corpora to be input into a target language model. For a sentence containing multiple target words, given each target word, the target language model can predict the probability distribution of related words that may appear after and be adjacent to the target word in the predicted sentence. That is, in the prediction process of each word, the prediction of the next word is based on the real target word in the sentence, and the prediction basis of each word is the real target word. This avoids the accumulation and propagation of errors caused by predicting the next word based on related words, making the prediction probability distribution of related words of each target word more accurate. Based on the accurate prediction probability distribution, the information entropy of the sentence is calculated, and the sentences to be processed that meet the preset information entropy conditions are determined as target sentences. This can improve the selection efficiency and accuracy of target sentences. That is, the target sentences determined based on the prediction probability distribution of words and the information entropy calculation of sentences are high-quality training corpora. Furthermore, the translation model is trained based on the target sentences, which can improve the efficiency of model training, the translation stability of the target translation model, and the translation accuracy.
[0066] In this embodiment, the process of predicting the probability distribution of associated words for each target word includes multiple prediction time steps, with each target word corresponding to one of the multiple prediction time steps. The execution order of the multiple prediction time steps is determined by the position order of the multiple target words in the statement to be processed. For example, if the statement to be processed is "The weather is really nice today", the corresponding word segmentation results are "today", "weather", and "really nice", so the target words include the three words "today", "weather", and "really nice". Accordingly, there may be three prediction time steps: prediction time step 1 corresponds to "today", prediction time step 2 corresponds to "weather", and prediction time step 3 corresponds to "really nice". The execution order of the three prediction execution steps is prediction time step 1 → prediction time step 2 → prediction time step 3.
[0067] Accordingly, please refer to Figure 3 It illustrates a probability distribution prediction method, which may include:
[0068] S310. Input each statement to be processed into the target language model respectively.
[0069] In one example, multiple statements to be processed can be pre-segmented to obtain multiple target words corresponding to each statement. Then, when processing each statement, the multiple target words of the statement to be processed are directly input into the target language model for probability distribution prediction. In another example, the statements to be processed can be directly input into the target language model. The target language model can first segment the statements to be processed to obtain multiple target words, and then perform probability distribution prediction based on the multiple target words.
[0070] S320. Determine the target word corresponding to the current prediction time step.
[0071] Based on the execution order of multiple prediction execution steps and the correspondence between multiple prediction execution steps and multiple target words, the target word corresponding to the current prediction time step is determined. The target word corresponding to the first prediction time step is the first target word in the statement to be processed.
[0072] S330. Based on the target language model, predict the associated words and their occurrence probabilities for the next prediction time step, given the target word at the current prediction time step; the associated words for the next prediction time step are the associated words corresponding to the target word at the current prediction time step.
[0073] The next prediction time step can be determined based on the execution order of multiple prediction time steps. The next prediction time step is the prediction time step that follows and is adjacent to the current prediction time step in the execution sequence of multiple prediction time steps. For example, if the execution order of multiple prediction time steps is prediction time step 1 → prediction time step 2 → prediction time step 3, and the current prediction time step is prediction time step 2, then the corresponding next prediction time step is prediction time step 3.
[0074] When the statement to be processed is input into the target language model, the target language model can predict the related words that may appear in the next prediction time step and the probability of the related words appearing based on the target word corresponding to the current prediction time step at each prediction time step. That is, each prediction of related words for the next prediction time step is based on the actual target word of the current prediction time step, rather than predicting the next word based on the related words of the current prediction time step predicted by the target word of the previous prediction time step.
[0075] S340. The next prediction time step is determined as the current prediction time step.
[0076] S350. Determine whether the current prediction time step is the last prediction time step among the plurality of prediction time steps; if yes, execute step S360; if no, execute step S330.
[0077] S360. Determine the completion of probability distribution prediction.
[0078] In this embodiment, the process of predicting the probability distribution of each target word in the statement to be processed is divided into multiple prediction time steps, and each prediction time step corresponds one-to-one with a target word in the statement to be processed. Thus, the probability distribution prediction of the associated words of each target word can be performed sequentially based on the execution order of the multiple prediction time steps until the last prediction time step is completed. Therefore, the prediction of associated words based on the execution order of the prediction time steps can realize the automatic flow of the prediction process, improve prediction efficiency, avoid process errors, and improve prediction accuracy.
[0079] In the training scenario of translation models, multilingual source corpora may include multilingual corpus information that serves as translations of each other. Specifically, multilingual source corpora may include multiple corpus groups, each corpus group may include statements in multiple languages, and these statements in multiple languages are translations of each other. The languages of the statements contained in each corpus group are different, and each corpus group includes at least two statements. For example, a corpus group includes statement a corresponding to language 1 and statement b corresponding to language 2. Thus, statement a and statement b are in different languages, but their semantics are the same. Statement a and statement b are translations of each other. Statement a in language 1 can be translated into statement b in language 2, and correspondingly, statement b in language 2 can also be translated into statement a in language 1. The statement to be processed is a statement in any one of the multiple languages in each corpus; correspondingly, each statement to be processed is input into the target language model, and the prediction probability distribution of the associated words corresponding to each target word based on the target language model includes:
[0080] The sentence in any one of the multiple languages is input into the target language model. Based on the target language model, the predicted probability distribution of the associated words corresponding to each target word in the sentence in any one language is obtained.
[0081] When determining the sentences to be processed, sentences in any language within each corpus can be identified as the sentences to be processed. Correspondingly, sentences in any language within each corpus can be input into the target language model for probability distribution prediction. Since sentences in multiple languages within each corpus are translations of each other, meaning they have the same semantics and format, the process of performing probability distribution prediction on sentences in these multiple languages is similar, and the prediction results are also similar. Therefore, it is only necessary to perform probability distribution prediction processing on sentences in any one language.
[0082] Accordingly, training the preset model based on the target sentence to obtain the target translation model includes:
[0083] Obtain the associated statements corresponding to the target statement; the associated statements are statements that are in the same corpus as the target statement but are different from the target statement.
[0084] The target translation model is obtained by training the preset model based on the target statement and the associated statements.
[0085] A corpus containing the target statement can be considered a target corpus. The information entropy of the target statement satisfies a predefined information entropy condition, and the information entropy of related statements within the target corpus may also satisfy this condition. Within the target corpus, a lower information entropy for the target statement indicates lower uncertainty and stability; similarly, the information entropy of related statements may also be lower, indicating lower uncertainty and stability. Therefore, a predefined model can be trained based on statements from various languages contained within the target corpus to obtain a target translation model.
[0086] In this embodiment, since sentences in multiple languages within each corpus are translations of each other—that is, expressions with the same semantics and format—the process of probability distribution prediction for these sentences in multiple languages is similar, and the prediction results are also similar. Therefore, only sentences in any one language need to be processed for probability distribution prediction, improving the efficiency of target sentence selection and thus improving the training efficiency of the translation model. Furthermore, model training is performed based on the target sentence and related sentences in the same corpus. Assuming the target sentence meets the preset information entropy condition, the related sentences also meet the preset information entropy condition. Therefore, model training based on the target sentence and related sentences can improve the translation stability and accuracy of the target translation model.
[0087] Furthermore, given the target sentence and its related sentences, since they are mutually translated, a translation score can be assigned to each other. This score can be any value between 0 and 1, representing the translation accuracy and matching degree between the target sentence and its related sentences. Based on these scores, target sentences and related sentences with translation scores greater than a preset threshold can be selected. The selected target sentences and related sentences are then used to train a preset model, resulting in a target translation model. This model can utilize a cue-based learning approach to guide the large language model in scoring the translation of the target sentences and related sentences, thus obtaining a translation score.
[0088] The following is a specific example illustrating the information entropy calculation process for the statements to be processed in this application:
[0089] The statement to be processed is "The cat sat on the mat.";
[0090] 1. Predict the probability distribution of each word.
[0091] For each target word w t The target language model outputs a probability distribution P(w) t |w1,w2,…,w t-1 ).For example:
[0092] For cat, P(cat|The) = [cat:0.8, dog:0.1, rabbit:0.1]
[0093] For sat, P(sat|Thecat) = [sat:0.7,stood:0.2,lay:0.1]
[0094] ...
[0095] 2. Calculate the information entropy of each word.
[0096] The formula for calculating the information entropy of a word is as follows:
[0097]
[0098] For the word "cat", its probability distribution is [cat: 0.8, dog: 0.1, rabbit: 0.1]. The information entropy of this word is: H(cat) = -(0.8log0.8 + 0.1log0.1 + 0.1log0.1) = 0.28
[0099] For the word "sat", its probability distribution is [sat:0.7, stood:0.2, lay:0.1], and its information entropy is:
[0100] H(sat)=-(0.7log0.7+0.2log0.2+0.1log0.1)=0.8
[0101] ...
[0102] 3. Calculate the average information entropy of the statement to be processed.
[0103] The formula for calculating the average information entropy of a statement is as follows:
[0104]
[0105] Where T is the number of words in the statement to be processed.
[0106] The information entropy of each word in the statement to be processed is as follows:
[0107] H(The) = 0.28
[0108] H(cat) = 0.8
[0109] H(sat) = 0.6
[0110] H(on) = 0.2
[0111] H(the) = 0.1
[0112] H(mat) = 0.3
[0113] The information entropy of the statement to be processed can be
[0114]
[0115] If the preset information entropy condition is that the information entropy of the statement to be processed is less than or equal to 0.5, and the information entropy of the statement to be processed, “The catsat on the mat.”, is 0.38, which is less than 0.5, then this statement can be identified as the target statement.
[0116] In this embodiment, the multilingual source corpus also includes a first document in a first language and a second document in a second language; the first document and the second document are translation documents of each other; please refer to the relevant documentation. Figure 4 It demonstrates another method for training translation models, which may include:
[0117] S410. Read the first document by region to obtain a first document array corresponding to the first document; each element in the first document array is a document string in a region of the first document.
[0118] In this embodiment, reading by region can be reading by page, that is, reading each page to obtain the document string in each page, and the document string in each page can be used as an element in the first document array; reading by region can also be reading by line, for example, reading N lines each time to obtain the document string in N lines, and the document string in each N lines can be used as an element in the first document array.
[0119] S420. Read the second document by region to obtain the second document array corresponding to the second document; each element in the second document array is a document string in a region of the second document.
[0120] In this embodiment, reading by region can be reading by page, that is, reading each page to obtain the document string in each page, and the document string in each page can be used as an element in the second document array; reading by region can also be reading by line, for example, reading N lines each time to obtain the document string in N lines, and the document string in each N lines can be used as an element in the second document array.
[0121] Taking page-by-page reading by region as an example, we will read the first language string in the first document and the second language string in the second document page by page, resulting in a first document array and a second document array:
[0122] First document array: ['First page string', 'Second page string', 'Third page string', ..., 'Nth page string'];
[0123] Second document array: ['First page string', 'Second page string', 'Third page string', ... 'Nth page string'].
[0124] The order of elements in the first and second document arrays can be consistent with the order of each region in the corresponding document. Taking reading by region as an example of reading by page, the order of elements in the first document array is consistent with the order of page numbers in the first document from smallest to largest, and the order of elements in the second document array is consistent with the order of pages in the second document from smallest to largest.
[0125] S430. Traverse each element in the first document array and determine the currently traversed element from the first document array.
[0126] The traversal order of each element in the first document array can be determined based on the order in which each element appears in the first document array, with each element being visited once.
[0127] S440. Match the currently traversed element with the element to be matched in the second document array.
[0128] The target position is the position of the currently traversed element in the first document array. At the start of element matching for the currently traversed element, the element to be matched in the second document array is the element at the target position in the second document array.
[0129] S450. Determine whether the currently traversed element matches the element to be matched in the second document array; if yes, proceed to step S480; otherwise, proceed to step S460.
[0130] S460. Determine whether the number of times the currently traversed element matches the element in the second document array is greater than the preset number; if yes, proceed to step S430; if no, proceed to step S470.
[0131] In other words, for each traversed element, the number of times it is matched with elements in the second document array is less than or equal to a preset number. If the preset number of matches is reached, the search for a matching element in the second document array stops, indicating that no matching element was found. If the preset number of matches is not reached, the search for a matching element in the second document array can continue.
[0132] S470. Determine the next element of the element to be matched in the second document array as the element to be matched, and execute step S440.
[0133] The elements in the second document array are ordered in ascending order according to the page order of the second document. The next element after the element to be matched in the second document array can be the element in the second document array that is adjacent to the element to be matched. For example, if the element to be matched is 'second page string', the next element could be 'third page string'. If the next element is determined to be the element to be matched, the currently traversed elements can be matched against the element to be matched.
[0134] S480. The element that matches the currently traversed element is determined as the translation element corresponding to the currently traversed element, and a translation pair corpus is established based on the currently traversed element and the translation element.
[0135] If a translation element corresponding to the currently traversed element is found in the second document array, a correspondence between the currently traversed element and the translation element can be established, thus forming a translation pair corpus of the currently traversed element and the translation element.
[0136] S490. The preset model is trained based on the target sentence and the translation pair corpus to obtain the target translation model.
[0137] By collecting first documents in the first language and second documents in the second language, and where the first and second documents are translation documents for each other, document arrays can be generated accordingly. This allows for matching of translation strings based on their respective document arrays, thereby establishing translation pair corpora. These corpora can then be used to train a pre-defined model to obtain the target translation model. This approach is suitable for training in low-resource languages, as the available corpora for low-resource languages are relatively limited. By using document matching, new translation pair corpora can be generated, thereby increasing the amount of corpora for low-resource languages and improving the translation model's ability to translate low-resource languages.
[0138] Furthermore, in this embodiment, each element in the first document array is traversed, and the translation element corresponding to the currently traversed element is searched in the second document array, including:
[0139] The target prompt information is determined; the target prompt information represents the matching of elements in the first document array and elements in the second document array based on multiple sentence features; the multiple sentence features include semantic features, format features, and length features;
[0140] The target language model is invoked so that it searches for a translation element in the second document array that matches the currently traversed element based on the semantic features, format features, and length features of the currently traversed element.
[0141] In this embodiment, the target language model can be guided to perform document array matching through prompt learning. Specifically, by adding semantic features, format features, and length features to the target prompt information, the target language model can match the semantic features of the currently traversed element with the semantic features of the elements to be matched in the second document array, match the format features of the currently traversed element with the format features of the elements to be matched, and match the length features of the currently traversed element with the length features of the elements to be matched. The elements to be matched that match the semantic features, format features, and length features of the currently traversed element are determined as translation elements. Semantic features can refer to the meaning information of the sentence, format features can refer to information such as sentence type and sentence grammar, and length features can refer to the number of words or characters contained in the sentence.
[0142] In this embodiment, by using a prompting learning method, the matching conditions used in the element matching process are preset in the target prompt information. This allows for flexible setting of the corresponding matching conditions according to the actual implementation situation, thereby improving the flexibility of element matching based on the target language model.
[0143] The following example illustrates the specific process of generating translation pairs from bilingual documents:
[0144] 1. Collect bilingual documents, which can be electronic documents in any form, such as doc, pdf, etc. The collected electronic documents can include document 1 in the first language and document 2 in the second language, and the first language and the second language are different.
[0145] 2. Read document 1 page by page to obtain the document 1 array:
[0146] ['First page string', 'Second page string', 'Third page string', ... 'Nth page string'];
[0147] Read document 2 page by page, resulting in a document 2 array:
[0148] ['First page string', 'Second page string', 'Third page string', ... 'Nth page string'].
[0149] The code iterates through the document 1 array, for example, reading the text string of the first page. Then, it combines the text of the first page of document 2 array with the text of the first page of document 1 array, and feeds them together as {src_txt} and {tgt_txt} into the large language model for alignment and segmentation. If no matching text is found for the first page of document 2 array, the code jumps to the second page of document 2 array as {tgt_txt} and feeds it into the large language model to continue alignment and segmentation. This process continues until no matching text is found, proceeding to the next N pages. If no matching text is found, the alignment of the first page of document 1 array is stopped, and the code repeats starting from the second page of document 1 array. This continues until all the first pages of document 1 arrays have been traversed.
[0150] Specifically, large language models can be guided to perform alignment and segmentation through prompting learning:
[0151] Target hint: You are a translator of {src_lang} and {tgt_lang}. Given two documents, one in {src_lang} and one in {tgt_lang}, each wrapped in a backslash (``).
[0152] 1. Each line of the article is separated by a newline character;
[0153] 2. The two documents may have different line counts;
[0154] 3. Based on the semantics, format, and length of different sentences in {src_lang}, find the semantically correct text in the {tgt_lang} document. If no match is found, leave it blank.
[0155] 4. Finally, output the results in a table with two columns. The first column contains all rows with the {src_lang} name, and the second column contains the matched {tgt_lang} names. If no match is found, neither column will be displayed.
[0156] 5. If no match is found, output: "None";
[0157] 6. Output example:
[0158] |First Language|Second Language|
[0159] |---|---|
[0160] |×××|×××|
[0161] The {src_lang} documentation is:
[0162] ```
[0163] {src_txt}
[0164] ```
[0165] The {tgt_lang} documentation is:
[0166] ```
[0167] {tgt_txt}
[0168] ```
[0169] Using the methods described above, translation pairs can be parsed from bilingual documents and stored in a database for subsequent model training. For each element in the document 1 array that does not find a matching translation element, that element can be deleted and not used as training data.
[0170] For the collected multilingual source corpora, there may be a style conflict problem, i.e., style inconsistency. For example, multiple words in the multilingual corpus may have the same or similar meanings, but these words are applicable to different styles or different scenarios. To address this, this embodiment also provides a method for processing multilingual source corpora to resolve the style conflict problem. Please refer to [link to relevant documentation]. Figure 5 The method may specifically include:
[0171] S510. Perform duplicate word detection on the multilingual source corpus to obtain multiple duplicate words and the target number of times the multiple duplicate words appear in the multilingual source corpus.
[0172] When performing duplicate word detection on multilingual corpora, detection can be performed by language. For example, detecting duplicate words in the first language source corpus yields duplicate words in the first language, and detecting duplicate words in the second language source corpus yields duplicate words in the second language, and so on. For duplicate words in each language, the frequency of each duplicate word in the multilingual corpus can be counted. For example, if duplicate word 1 and duplicate word 2 exist in the first language, the frequency of duplicate word 1 in the multilingual corpus is n1, the frequency of duplicate word 2 in the multilingual corpus is n2, and so on.
[0173] S520. Generate at least one combination of repeated words based on the plurality of repeated words; each combination of repeated words includes at least two repeated words, and the at least two repeated words have similar or identical semantics.
[0174] For repeated words in each language, repeated words with the same or similar meanings can be merged into a repeated word combination. For example, in the first language, repeated word 1 and repeated word 2 have the same or explicit meaning, and repeated word 1 and repeated word 2 can be in the same repeated word combination.
[0175] S530. The word with the highest target frequency in each combination of repeated words is determined as the target repeated word.
[0176] For the repeated word combination [repeated word 1, repeated word 2], where repeated word 1 appears n1 times in the multilingual corpus and repeated word 2 appears n2 times in the multilingual corpus, and n1 > n2, repeated word 1 can be identified as the target repeated word. That is, in this embodiment, for each language, only one word with the same or similar meaning needs to be retained.
[0177] S540. Delete the corpus containing non-target repeated words from the multilingual source corpus to obtain the target corpus; the non-target repeated words are repeated words in each repeated word combination other than the target repeated word; the target corpus includes the plurality of sentences to be processed.
[0178] Once the target repeated words are identified, sentences containing non-target repeated words in the repeated word combinations can be removed from the multilingual corpus to obtain the target corpus. That is, the target corpus no longer includes non-target repeated words, nor does it include sentences containing non-target repeated words, thus achieving style adversarial processing from words to sentences.
[0179] For each combination of repeated words, the multiple repeated words in the combination may correspond to different styles or scenarios. By retaining the most frequently occurring repeated word in the combination, the target corpus can be made to correspond to the style or scenario of the target repeated word.
[0180] In this embodiment, by detecting repeated words in multilingual corpora, for multiple repeated words with the same or similar meanings, the repeated word with the most occurrences can be retained to obtain the target corpus. This makes the style or scene corresponding to the target corpus more concentrated, avoiding the problem of style conflict. As a result, the sentences to be processed in the target corpus are sentences without style conflict. Correspondingly, the target sentences obtained after probability distribution prediction based on the sentences to be processed also do not have the problem of style conflict. This makes the scenes and styles targeted by the trained target translation model more concentrated, and the target translation model has a better and more professional way of expressing related terms, thus improving the accuracy of the target translation model.
[0181] It should be noted that the translation model training method in this embodiment can be for a general translation model or a sub-category translation model. The training logic for both is the same; that is, the target translation model can be either a general translation model or a sub-category translation model. Correspondingly, the application scenario in this embodiment can be a game scenario, and the general translation model can be a general translation model for various types of games. Games can include various types, such as casual puzzle, action-adventure, sandbox, open-world, traditional Chinese style, simulation management, etc., and corresponding sub-category models can be created for each type of game. A general translation model is defined as a large model for a game vertical category. It may not possess all game terminology and style capabilities, but users can immediately experience that the model has a game-like writing style. A sub-category translation model can translate text unique to its own category into a unique style, which will be more prominent than the style of a general translation model applied to a specific category. Please refer to [link / reference]. Figure 6 It shows a flowchart of the hierarchical training process for the target translation model, using a game scenario as an example, which may include:
[0182] 1. Base preparation
[0183] The model was trained using bilingual translation pairs aligned with publicly available datasets and bilingual books.
[0184] 2. Weakly labeled pre-training
[0185] Large-scale enhancement of game corpora is carried out. The sources of game corpora include: extracting text from game images using OCR; crawling game-related forums to obtain game-related information; and reading information from some publicly available game encyclopedia websites. After extracting this information, bilingual translation pairs are aligned based on the corpus alignment method to generate a large amount of game training corpora.
[0186] 3. Detailed adjustment of strong annotations
[0187] We selected high-quality portions from the weakly labeled dataset for use; by extracting the information entropy of each sentence, we extracted the dataset with low entropy separately, considering this portion to be a potentially high-quality dataset.
[0188] 4. Vertical fine-tuning
[0189] Vertical fine-tuning is performed based on the corpus corresponding to each type.
[0190] Accordingly, this embodiment also provides a business information translation method. The execution entity of this method can be the aforementioned server, implemented based on the target translation model in this embodiment. The target translation model can be a general translation model or a sub-category translation model. Please refer to [link to relevant documentation]. Figure 7The method may include:
[0191] S710. Receive a translation model access request; the translation model access request includes business training corpus corresponding to the target business scenario.
[0192] The target business scenario in this embodiment can be a game scenario, an e-commerce scenario, etc., and this embodiment does not make specific limitations; taking the game scenario as an example, the business training corpus can be corpus information related to the game scenario.
[0193] S720. Fine-tune the target translation model based on the business training corpus to obtain a translation model corresponding to the target business scenario.
[0194] Taking a game scenario as an example, in one example, if the target translation model is a general-purpose translation model, it can be fine-tuned based on the received business training corpus to obtain a general-purpose translation model adapted to the game scenario. In another example, the translation model access request may also include a scenario identifier of the target business scenario. Specifically, the scenario identifier of the target business scenario can be the game type identifier of the target game. The target translation model may include multiple sub-category translation models. Accordingly, based on the scenario identifier, the target sub-category translation model adapted to the game type identifier can be determined from the multiple sub-category translation models. Then, the target sub-category translation model can be fine-tuned based on the business training corpus to obtain a sub-category translation model adapted to the target game.
[0195] S730. Based on the translation model corresponding to the target business scenario, translate the business information in the target business scenario to obtain the translated business information.
[0196] Once a translation model corresponding to the target business scenario is obtained, the business side can use the corresponding translation model to translate the business information while running the target business, and obtain the translated business information.
[0197] Specific access methods may include:
[0198] 1. The business side selects the base model based on the game's genre and style.
[0199] 2. Use the base model to translate game terminology and perform micro-proofing.
[0200] 3. Use game terminology + base model to perform a preliminary training. The trained model can be directly deployed online as a translation service for the game.
[0201] 4. The continuously produced new versions of the translated and proofread content constantly feed back into the model training and optimization, leading to continuous improvement.
[0202] In this embodiment, a target translation model with stable translation performance and accurate translation results is generated based on the translation model training method described above. When the business end accesses the target translation model in the target business scenario to translate business information, the stability and accuracy of the translation results can be improved. In the specific process of model access, each business end can fine-tune the target translation model based on its corresponding business training corpus, so that the fine-tuned translation model is more suitable for the business scenario.
[0203] It should be noted that any of the methods described above in this embodiment can be combined based on the actual implementation situation and have corresponding beneficial effects, which will not be elaborated here.
[0204] Please see Figure 8 This embodiment also provides a translation model training device, which includes:
[0205] The multilingual source corpus acquisition module 810 is used to acquire multilingual source corpus; the multilingual source corpus includes multiple sentences to be processed, and each sentence to be processed includes multiple target words;
[0206] The probability distribution prediction module 820 is used to input each statement to be processed into the target language model, and predict the probability distribution of the associated words corresponding to each target word based on the target language model; the associated words corresponding to each target word are words that may appear after the target word and are adjacent to each target word;
[0207] The information entropy determination module 830 is used to determine the information entropy of each statement to be processed based on the predicted probability distribution of the associated words corresponding to each target word.
[0208] The target statement determination module 840 is used to determine the target statement from the plurality of statements to be processed based on the information entropy of each statement to be processed; the information entropy of the target statement satisfies a preset information entropy condition;
[0209] The model training module 850 is used to train a preset model based on the target sentence to obtain a target translation model.
[0210] Furthermore, the process of predicting the probability distribution of the associated words of each target word includes multiple prediction time steps, and the multiple target words correspond one-to-one with the multiple prediction time steps; the execution order of the multiple prediction time steps is determined by the position order of the multiple target words in the statement to be processed.
[0211] The probability distribution prediction module is used for:
[0212] Each statement to be processed is input into the target language model;
[0213] Identify the target words corresponding to the current prediction time step;
[0214] Based on the target language model, predict the associated words and their occurrence probabilities for the next prediction time step, given the target word at the current prediction time step; the associated words for the next prediction time step are the associated words corresponding to the target word at the current prediction time step.
[0215] The next prediction time step is determined as the current prediction time step;
[0216] Repeat the following steps: Based on the target language model, predict the associated words and their occurrence probabilities for the next prediction time step given the target word at the current prediction time step; determine the next prediction time step as the current prediction time step, until the current prediction time step is the last prediction time step among the plurality of prediction time steps.
[0217] Furthermore, the multilingual source corpus includes multiple corpus groups, each corpus group includes sentences in multiple languages, and the sentences in the multiple languages are translation sentences to each other; the sentence to be processed is a sentence in any of the multiple languages.
[0218] The probability distribution prediction module is used for:
[0219] The sentence of any one of the multiple languages is input into the target language model. Based on the target language model, the predicted probability distribution of the associated words corresponding to each target word in the sentence of any one language is obtained.
[0220] The model training module is used for:
[0221] Obtain the associated statements corresponding to the target statement; the associated statements are statements that are in the same corpus as the target statement but are different from the target statement.
[0222] The target translation model is obtained by training the preset model based on the target statement and the associated statements.
[0223] Furthermore, the multilingual source corpus also includes a first document in a first language and a second document in a second language; the first document and the second document are translation documents of each other;
[0224] The device also includes a translation pair corpus creation module, used for:
[0225] The first document is read by region to obtain a first document array corresponding to the first document; each element in the first document array is a document string in a region of the first document.
[0226] The second document is read by region to obtain a second document array corresponding to the second document; each element in the second document array is a document string in a region of the second document.
[0227] For each element in the first document array, traverse it and find the translation element corresponding to the currently traversed element in the second document array;
[0228] A translation pair corpus is established based on the currently traversed elements and the translation elements;
[0229] The model training module is used for:
[0230] The preset model is trained based on the target sentence and the translation pair corpus to obtain the target translation model.
[0231] Furthermore, the translation corpus creation module is used for:
[0232] The target prompt information is determined; the target prompt information represents the matching of elements in the first document array and elements in the second document array based on multiple sentence features; the multiple sentence features include semantic features, format features, and length features;
[0233] The target language model is invoked so that it searches for a translation element in the second document array that matches the currently traversed element based on the semantic features, format features, and length features of the currently traversed element.
[0234] Furthermore, the device also includes a repeat word processing module, used for:
[0235] Repeat word detection is performed on the multilingual source corpus to obtain multiple repeated words and the target number of times the multiple repeated words appear in the multilingual source corpus;
[0236] At least one combination of repeated words is generated based on the plurality of repeated words; each combination of repeated words includes at least two repeated words, and the at least two repeated words have similar or identical semantics;
[0237] The word with the highest frequency in each combination of repeated words is identified as the target repeated word;
[0238] The target corpus is obtained by deleting corpora containing non-target repeated words from the multilingual source corpus; the non-target repeated words are repeated words other than the target repeated words in each repeated word combination; the target corpus includes the plurality of sentences to be processed.
[0239] Please see Figure 9 This embodiment also provides a business information translation device, which is implemented based on the target translation model obtained by the above-described translation model training method. The device includes:
[0240] The request receiving module 910 is used to receive a translation model access request; the translation model access request includes business training corpus corresponding to the target business scenario.
[0241] The model fine-tuning module 920 is used to fine-tune the target translation model based on the business training corpus to obtain a translation model corresponding to the target business scenario;
[0242] The information translation module 930 is used to translate the business information in the target business scenario based on the translation model corresponding to the target business scenario, so as to obtain the translated business information.
[0243] The apparatus provided in the above embodiments can execute the methods provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be found in the methods provided in any embodiment of this application.
[0244] This embodiment also provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded by a processor and executed as any of the methods described above in this embodiment.
[0245] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the methods described above.
[0246] Figure 10 This is a block diagram illustrating an electronic device for a translation model training method or a business information translation method, according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as follows: Figure 10As shown, this electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a translation model training method or a business information translation method.
[0247] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the electronic device to which the present disclosure is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0248] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but more or fewer operational steps may be included based on conventional or non-inventive labor. The steps and order listed in the embodiments are merely one possible execution order among many steps and do not represent the only execution order. In actual system or interrupt product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment).
[0249] The structure shown in this embodiment is only a partial structure related to the solution of this application and does not constitute a limitation on the device to which the solution of this application is applied. Specific devices may include more or fewer components than shown, or combinations of certain components, or arrangements of different components. It should be understood that the methods, apparatuses, etc., disclosed in this embodiment can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or unit modules through some interfaces.
[0250] Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0251] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0252] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for training a translation model, characterized in that, include: Obtain multilingual source corpus; the multilingual source corpus includes multiple sentences to be processed, and each sentence to be processed includes multiple target words; Each statement to be processed is input into the target language model, and the prediction probability distribution of the associated words corresponding to each target word is predicted based on the target language model. The associated words corresponding to each target word are words that may appear after the target word and are adjacent to each target word. Based on the predicted probability distribution of the associated words corresponding to each target word, the information entropy of each statement to be processed is determined; The target statement is determined from the plurality of statements to be processed based on the information entropy of each statement to be processed; The information entropy of the target statement satisfies the preset information entropy condition; The target translation model is obtained by training the preset model based on the target statement.
2. The method according to claim 1, characterized in that, The process of predicting the probability distribution of the associated words of each target word includes multiple prediction time steps, and the multiple target words correspond one-to-one with the multiple prediction time steps; the execution order of the multiple prediction time steps is determined by the position order of the multiple target words in the statement to be processed. The step of inputting each statement to be processed into the target language model, and predicting the probability distribution of associated words corresponding to each target word based on the target language model, includes: Each statement to be processed is input into the target language model; Identify the target words corresponding to the current prediction time step; Based on the target language model, predict the associated words and their occurrence probabilities for the next prediction time step, given the target word at the current prediction time step; the associated words for the next prediction time step are the associated words corresponding to the target word at the current prediction time step. The next prediction time step is determined as the current prediction time step; Repeat the following steps: Based on the target language model, predict the associated words and their occurrence probabilities for the next prediction time step given the target word at the current prediction time step; determine the next prediction time step as the current prediction time step, until the current prediction time step is the last prediction time step among the plurality of prediction time steps.
3. The method according to claim 1, characterized in that, The multilingual source corpus includes multiple corpus groups, and each corpus group includes sentences in multiple languages. The sentences in the multiple languages are translation sentences to each other. The sentence to be processed is a sentence in any one of the multiple languages. The step of inputting each statement to be processed into the target language model, and predicting the probability distribution of associated words corresponding to each target word based on the target language model, includes: The sentence of any one of the multiple languages is input into the target language model. Based on the target language model, the predicted probability distribution of the associated words corresponding to each target word in the sentence of any one language is obtained. The step of training a preset model based on the target statement to obtain a target translation model includes: Obtain the associated statements corresponding to the target statement; the associated statements are statements that are in the same corpus as the target statement but are different from the target statement. The target translation model is obtained by training the preset model based on the target statement and the associated statements.
4. The method according to claim 1, characterized in that, The multilingual source corpus also includes a first document in a first language and a second document in a second language; the first document and the second document are translation documents of each other; The method further includes: The first document is read by region to obtain a first document array corresponding to the first document; each element in the first document array is a document string in a region of the first document. The second document is read by region to obtain a second document array corresponding to the second document; each element in the second document array is a document string in a region of the second document. For each element in the first document array, traverse it and find the translation element corresponding to the currently traversed element in the second document array; A translation pair corpus is established based on the currently traversed elements and the translation elements; The step of training a preset model based on the target statement to obtain a target translation model includes: The preset model is trained based on the target sentence and the translation pair corpus to obtain the target translation model.
5. The method according to claim 4, characterized in that, The step of iterating through each element in the first document array and searching for the translation element corresponding to the currently iterated element in the second document array includes: The target prompt information is determined; the target prompt information represents the matching of elements in the first document array and elements in the second document array based on multiple sentence features; the multiple sentence features include semantic features, format features, and length features; The target language model is invoked so that it searches for a translation element in the second document array that matches the currently traversed element based on the semantic features, format features, and length features of the currently traversed element.
6. The method according to claim 1, characterized in that, The method further includes: Repeat word detection is performed on the multilingual source corpus to obtain multiple repeated words and the target number of times the multiple repeated words appear in the multilingual source corpus; At least one combination of repeated words is generated based on the plurality of repeated words; each combination of repeated words includes at least two repeated words, and the at least two repeated words have similar or identical semantics; The word with the highest frequency in each combination of repeated words is identified as the target repeated word; The target corpus is obtained by deleting corpora containing non-target repeated words from the multilingual source corpus; the non-target repeated words are repeated words other than the target repeated words in each repeated word combination; the target corpus includes the plurality of sentences to be processed.
7. A method for translating business information, characterized in that, Based on the target translation model as described in any one of claims 1-6, the method includes: Receive a translation model access request; the translation model access request includes business training corpus corresponding to the target business scenario; The target translation model is fine-tuned based on the business training corpus to obtain a translation model corresponding to the target business scenario; The business information in the target business scenario is translated based on the translation model corresponding to the target business scenario to obtain the translated business information.
8. A translation model training device, characterized in that, include: The multilingual source corpus acquisition module is used to acquire multilingual source corpora. The multilingual source corpus includes multiple sentences to be processed, and each sentence to be processed includes multiple target words. The probability distribution prediction module is used to input each statement to be processed into the target language model, and predict the probability distribution of the associated words corresponding to each target word based on the target language model. The associated words corresponding to each target word are words that may appear after the target word and are adjacent to each target word. The information entropy determination module is used to determine the information entropy of each statement to be processed based on the predicted probability distribution of the associated words corresponding to each target word. The target statement determination module is used to determine the target statement from the plurality of statements to be processed based on the information entropy of each statement to be processed; The information entropy of the target statement satisfies the preset information entropy condition; The model training module is used to train a preset model based on the target sentence to obtain a target translation model.
9. A business information translation device, characterized in that, Based on the target translation model as described in claim 8, the apparatus includes: The request receiving module is used to receive translation model access requests; the translation model access request includes business training corpus corresponding to the target business scenario; The model fine-tuning module is used to fine-tune the target translation model based on the business training corpus to obtain a translation model corresponding to the target business scenario; The information translation module is used to translate the business information in the target business scenario based on the translation model corresponding to the target business scenario, so as to obtain the translated business information.
10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the translation model training method as described in any one of claims 1 to 6, or the business information translation method as described in claim 7.
11. A computer storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor using the translation model training method as described in any one of claims 1 to 6, or the business information translation method as described in claim 7.