A text translation method and related device

By combining the translation mapping relationship between the source language and the target language, the problem that the translation model in the prior art cannot reflect the text meaning of the source language is solved, and a more accurate translation effect is achieved.

CN113761952BActive Publication Date: 2025-08-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110558951.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-21
Publication Date
2025-08-12
Estimated Expiration
2041-05-21

AI Technical Summary

Technical Problem

The existing translation model fails to effectively reflect the text meaning of the source language text during training, resulting in unsatisfactory translation results.

Method used

By combining the translation mapping relationship between the source language and the target language, the relevant parameters of the initial translation model are adjusted so that the training model can translate based on the mapping relationship, thereby improving the translation effect.

Benefits of technology

Improve the fit between the translation results and the meaning of the text in the source language, and enhance the accuracy and quality of the translation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761952B_ABST
    Figure CN113761952B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a text translation method and related devices. In order to improve the translation quality, the processing device can adjust the relevant parameters used to train the initial translation model based on the translation mapping relationship between the corresponding word segments in the source language and the target language, and train the initial translation model through AI technology based on the adjusted relevant parameters, so that the trained translation model can translate the source language text based on the translation mapping relationship, so that the translated text in the target language is more consistent with the text meaning of the source language text, thereby improving the translation effect. At the same time, the trained translation model and the associated parameters determined in the process can be stored on the chain through blockchain technology to facilitate the training and translation application of other models in the subsequent process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of translation technology, and in particular to a text translation method and related devices. Background Art

[0002] With the rapid development of AI technology, more and more AI technologies are being applied to text translation. For example, through translation models, a first text in a source language can be translated into a second text in a target language.

[0003] In related technologies, when training a translation model through text pairs, a text pair usually includes a source language text as the model input and a target language text as the training label. However, the training effect is poor, resulting in unsatisfactory translation results when the source language text is translated through the translation model. Summary of the Invention

[0004] In order to solve the above technical problems, an embodiment of the present application provides a text translation method, in which a processing device can adjust the relevant parameters used to train the initial translation model based on the translation mapping relationship between the corresponding word fragments in the source language and the target language, so that the trained translation model can translate the source language text based on the translation mapping relationship, thereby making the translated text in the target language more consistent with the text meaning of the source language text, thereby improving the translation effect.

[0005] The embodiments of this application disclose the following technical solutions:

[0006] In a first aspect, an embodiment of the present application discloses a text translation method, which obtains a translation text training set, wherein the translation text training set includes multiple text sample pairs, each of which includes a first text in a source language and a second text in a target language, wherein the second text is a translation text of the first text in the target language;

[0007] Determining association parameters of the word segments included in the second text in the text sample pair to which they belong, wherein the target text sample pair is any one of the multiple text sample pairs, and the association parameters are used to reflect the translation mapping relationship between the target word segment in the second text of the target text sample pair and the word segment in the first text of the target text sample pair; the method comprising:

[0008] Determining a model translation text in the target language using an initial translation model based on the first text in the target text sample pair;

[0009] Determining, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively;

[0010] Training the initial translation model according to the word loss parameter to obtain a translation model;

[0011] The text to be processed in the source language is translated into a translated text in the target language by using the translation model.

[0012] In a second aspect, an embodiment of the present application discloses a text translation device, comprising an acquisition unit, a first determination unit, a second determination unit, a third determination unit, a training unit, and a translation unit:

[0013] The acquisition unit is configured to acquire a translation text training set, wherein the translation text training set includes a plurality of text sample pairs, each of which includes a first text in a source language and a second text in a target language, wherein the second text is a translation of the first text in the target language;

[0014] The first determining unit is configured to determine an association parameter of a word segment included in the second text in a corresponding text sample pair, wherein the target text sample pair is any one of the plurality of text sample pairs, and the association parameter is configured to reflect a translation mapping relationship between a target word segment in the second text of the target text sample pair and a word segment in the first text of the target text sample pair;

[0015] The second determining unit is configured to determine a model translation text in the target language using an initial translation model based on the first text in the target text sample pair;

[0016] The third determining unit is configured to determine, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively;

[0017] The training unit is configured to train the initial translation model according to the word loss parameter to obtain a translation model;

[0018] The translation unit is configured to translate the to-be-processed text in the source language into a translated text in the target language using the translation model.

[0019] In a third aspect, an embodiment of the present application discloses a computer device, comprising a processor and a memory:

[0020] The memory is used to store program code and transmit the program code to the processor;

[0021] The processor is configured to execute the text translation method described in the first aspect according to instructions in the program code.

[0022] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the text translation method described in the first aspect.

[0023] It can be seen from the above technical solution that in order to improve the translation quality, a translation text training set can be obtained, which includes multiple text sample pairs, each of which includes a first text in the source language and a second text in the target language, and the second text is the translation text of the first text in the target language. Subsequently, the association parameters of the word segments included in the second text in the text sample pair to which it belongs can be determined, and the target text sample pair is any one of the multiple text sample pairs. The association parameters are used to reflect the translation mapping relationship between the target word segment in the second text of the target text sample pair and the word segment in the first text of the target text sample pair. When performing model training, the model translation text in the target language can be determined by the initial translation model based on the first text in the target text sample pair. The model translation text and the second text in the target text sample pair can reflect the difference of the initial translation model when translating. Based on the corresponding association parameters, the word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text can be determined. Because the translation mapping relationship can be used to analyze the accuracy of word segment translations between two languages, the word loss parameter can, based on the translation mapping relationship, reflect the degree of influence of the word segments included in the second text on translation accuracy. The initial translation model can be trained based on the word loss parameter, so that it can use different learning intensities for word segments with different degrees of influence on translation accuracy, thereby obtaining a translation model. This translation model can then translate the source language text to be processed into the target language translation text. Furthermore, through more accurate word translation, the translation text can be made to conform to the corresponding meaning of the source language text to be processed, thereby improving translation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0025] Figure 1 A schematic diagram of a text translation method in a practical application scenario provided by an embodiment of the present application;

[0026] Figure 2A flowchart of a text translation method provided in an embodiment of the present application;

[0027] Figure 3 A graph of experimental results provided in an embodiment of the present application;

[0028] Figure 4 A graph of experimental results provided in an embodiment of the present application;

[0029] Figure 5 A schematic diagram of an initial translation model provided in an embodiment of the present application;

[0030] Figure 6 A structural block diagram of a text translation device provided in an embodiment of the present application;

[0031] Figure 7 A structural diagram of a computer device provided in an embodiment of the present application;

[0032] Figure 8 A structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The embodiments of the present application are described below with reference to the accompanying drawings.

[0034] Language translation is a popular application of AI technology. In related technologies, when training a translation model, only the frequency information of the target language's words is typically referenced to adjust the training weights corresponding to each word, so that the target language text translated by the translation model conforms to the linguistic characteristics of the target language. However, this training method prevents the translation model from learning the linguistic characteristics of the source language, resulting in poor translation results that fail to accurately reflect the textual meaning of the source language text.

[0035] In order to solve the above technical problems, an embodiment of the present application provides a text translation method, in which a processing device can adjust the relevant parameters used to train the initial translation model based on the translation mapping relationship between the corresponding word fragments in the source language and the target language, so that the trained translation model can translate the source language text based on the translation mapping relationship, thereby making the translated text in the target language more consistent with the text meaning of the source language text, thereby improving the translation effect.

[0036] It is understandable that the method can be applied to a processing device, which is a processing device with a data processing function, for example, a terminal device or a server with a data processing function. The method is independently executed by a terminal device or a server, and can also be applied to a network scenario in which a terminal device and a server communicate, and is operated in conjunction with the terminal device and the server. Among them, the terminal device can be a mobile phone, a desktop computer, a personal digital assistant (PDA), a tablet computer and other devices. The server can be understood as an application server or a web server. In actual deployment, the server can be an independent physical server or a server cluster or distributed system composed of multiple physical servers. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.

[0037] The embodiments of the present application can apply blockchain technology. For example, in the text translation method disclosed in the present application, the determined associated parameters and the trained translation model can be saved in the blockchain so that relevant personnel or relevant equipment can more conveniently obtain the parameters or model to perform text translation, model training and other operations.

[0038] In addition, this application also relates to artificial intelligence (AI) technology. Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to achieve the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0039] Artificial intelligence technology is a comprehensive discipline covering a wide range of fields, encompassing both hardware and software technologies. Basic AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning. This application primarily addresses natural language processing and machine learning technologies.

[0040] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.

[0041] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.

[0042] For example, in an embodiment of the present application, through natural language processing technology, the processing device can enable the initial translation model to understand and recognize the text meaning of the first text and determine the corresponding model translation text; through machine learning technology, the processing device can train a more accurate translation model, thereby making the translated text more accurate and improving the translation effect.

[0043] In order to facilitate understanding of the technical solution provided by the embodiment of the present application, a text translation method provided by the embodiment of the present application will be introduced below in combination with an actual application scenario.

[0044] See also Figure 1 , Figure 1 This is a schematic diagram of a text translation method in an actual application scenario provided by an embodiment of the present application. In this actual application scenario, the processing device is a server 101.

[0045] The server 101 may first obtain a translation text training set, which includes a plurality of text sample pairs, for example, text sample pairs 1 to text sample pairs n. Each text sample pair includes a first text in a source language and a second text in a target language. Taking text sample pair 1 as an example, the second text is a translation text of the first text in the target language.

[0046] In order to improve the translation effect of the translation model, the server 101 can use the translation mapping relationship between the source language and the target language as a reference factor for model training, so that the trained translation model can output an output result that is more consistent with the linguistic meaning of the source language based on the translation mapping relationship. The server 101 can use the text sample pair 1 as the target text sample pair, and determine the association parameters of the target word segment included in the second text in the text sample pair to which it belongs. The association parameters are used to reflect the translation mapping relationship between the target word segment and the first text word segment of the target text sample pair. The translation mapping relationship can reflect the degree of mapping diversity between the target word segment and the first text word segment.

[0047] In the training process, server 101 can determine the model translation text under the target language by the initial translation model according to the first text in the target text sample pair.It is understandable that, when the first text in the target text sample pair is translated, if there is a mapping relationship of more diversity between the word fragment in the target word segment and the first text, even if the word fragment in the model translation text is inconsistent with the target word segment, there is also a greater possibility of having a word fragment with the same meaning as the target word segment, which is lower in the impact of embodying the first text meaning.And when the word fragment in the target word segment and the first text has a more single mapping relationship, it is explained that when the model translation text does not include the target word segment, then there is a greater probability for the initial translation model to translate the word fragment with lower accuracy, which is larger in the impact of embodying the first text meaning.Therefore, server 101 can determine the word loss parameter corresponding to the model translation text of the second text of the target text sample pair, which includes the word fragment respectively.

[0048] The server 101 can train the initial translation model based on the word loss parameter, so that the initial translation model can adjust the learning intensity of different word segments based on the translation mapping relationship. For example, the learning intensity of some word segments with a single translation mapping relationship can be increased, while the learning intensity of some word segments with diverse translation mapping relationships can be reduced while ensuring the translation effect, thereby obtaining a translation model. The server 101 can use the translation model to translate the to-be-processed text in the source language into a translated text in the target language. The translated text can combine the translation mapping relationship to more accurately reflect the meaning of the to-be-processed text in the source language, thereby improving the translation effect.

[0049] Next, a text translation method provided in an embodiment of the present application will be introduced with reference to the accompanying drawings.

[0050] See also Figure 2 , Figure 2 A flowchart of a text translation method provided in an embodiment of the present application, the method comprising:

[0051] S201: Obtain a translation text training set.

[0052] It is understandable that the translation mapping relationship between the word fragments (tokens) included in the two languages can be used to a certain extent to analyze the accuracy of the translation results, and can be used to measure the difficulty of the model to learn the word fragment. A word fragment refers to a fragment composed of one or more words, and the translation mapping relationship refers to the mapping relationship between the word fragments included in the source language text and the word fragments included in the corresponding target language text, and the target language text is obtained by translating the source language text. For example, "happy" in the English text can be translated into word fragments such as "happy" and "happy" in the Chinese text, and there is a certain translation mapping relationship between "happy" and "happy" and "happy".

[0053] Among them, some word segments may have a more complex translation mapping relationship between the source language and the target language due to reasons such as the diversity of their meanings. For example, "happy" can be translated as "happy" or "happy" in Chinese text. The multiple word segments corresponding to such word segments with translation mapping relationships can usually replace each other, and have a lower impact on the meaning of the source language text expressed by the translation result; some word segments may have a relatively simple translation relationship. For example, some technical word segments in the source language may only accurately express the meaning of the word segment when translated into fixed word segments in the target language. For example, the Chinese word "bearing" is more accurately translated into "bearing" in English. If other word segments are obtained in the translation result, it is likely that the translation is inaccurate. It can be seen from this that based on the translation mapping relationship, the processing device can determine the degree of influence of different word segments on the meaning of the source language text, so that the translation model that outputs the translation result can be targeted based on the degree of influence, so that the trained translation model can restore the text meaning of the source language text as much as possible.

[0054] First, the processing device can obtain a translation text training set, which includes multiple text sample pairs, each of which includes a first text in a source language and a second text in a target language, where the second text is a translation of the first text in the target language. Using the first and second texts, the processing device can analyze and obtain a translation mapping relationship between word segments in the two languages. This allows the model to be trained not only by considering the linguistic characteristics of the target language, but also by integrating the translation mapping relationship between the source and target languages. This ensures that the resulting translation model, through the output of the translation results, can restore the textual meaning of the source language text as closely as possible.

[0055] S202: Determine association parameters of the word segments included in the second text in the corresponding text sample pairs.

[0056] Among them, the target text sample pair can be any one of multiple sample pairs, and the associated parameter is used to reflect the translation mapping relationship between the target word segment in the second text of the target text sample pair and the word segment in the first text of the target text sample pair. The value of the associated parameter can reflect the complexity of the translation mapping relationship to a certain extent.

[0057] If the word segment in the first text can be translated into other word segments in addition to the target word segment, or if there are other word segments in the source language that can be translated into the target word segment in addition to the word segment, then the target word segment and the word segment in the first text may have a more complex translation mapping relationship; if in the texts included in the translation text training set, the word segment in the first text and the target word segment have a nearly one-to-one mapping relationship, then the translation mapping relationship between the target word segment and the word segment in the first text may be relatively simple.

[0058] It is understandable that, since the second text in the same text sample pair is the translated text of the first text in the target language, there are word segments in the first text that have a translation mapping relationship with the word segments included in the second text. Based on this, when the processing device determines the associated parameters, by determining the associated parameters of the word segments included in the second text in the text sample pair to which it belongs, it can more accurately reflect the complexity of the translation mapping relationship between the word segments included in the second text and the word segments included in the first text. If the determination is not made for the text sample pair to which it belongs, but the associated parameters of the word segments included in the second text in the entire translation text training set are determined, the determined associated parameters will be difficult to accurately reflect the complexity of the translation mapping relationship due to the lack of specificity for the word segments with a translation mapping relationship, and then when the relevant parameters for model training are subsequently determined, the parameter accuracy will be low and the model training effect will be poor.

[0059] It is understood that the steps of determining the training set and the associated parameters in S201-S202 are not required before model training. For example, after the initial model training, the translation text training set and the associated parameters determined for that training can be used to train another initial translation model without having to obtain a new translation text training set and re-determine the associated parameters, thereby improving the convenience of model training.

[0060] S203: Determine a model translation text in the target language using an initial translation model according to the first text in the target text sample pair.

[0061] During the training process, the processing device may first obtain an initial translation model, and then translate the first text in the target text sample pair using the initial translation model to obtain a model translated text in the target language.

[0062] S204: Based on the corresponding association parameters, determine the word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively.

[0063] As mentioned above, through the translation mapping relationship between word fragments, the processing device can determine the degree of influence of different word fragments on the meaning of the source language text, and the association parameters can reflect the translation mapping relationship between word fragments. Therefore, the processing device can train the initial translation model based on the association parameters, so that the translation results output by the initial translation model are more in line with the text meaning of the source language text.

[0064] The processing device can determine, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text, respectively. The word loss parameters are used to adjust the learning intensity of the initial translation model. Thus, the processing device can use the word loss parameters to learn word segments with different degrees of influence with different intensities.

[0065] Among them, if the translation mapping relationship reflected by the corresponding associated parameters is relatively complex, it means that there may be multiple word fragments with translation mapping relationships in the source language for the word fragment, or the word fragment is one of the multiple word fragments that can be obtained after the translation of the word fragment included in the first text. Since the translation mapping relationship is relatively complex, there may be multiple word fragments that can be used as the translation result of the word fragment included in the first text. At this time, if the word fragment included in the second text is different from the corresponding word fragment in the model translation text, the impact on the meaning of the first text is usually low. For example, "happy" can correspond to "happy" in the second text and "happy" in the model translation text. This difference has a low impact on the meaning. Therefore, the processing device can set a smaller learning intensity for such word fragments through the word loss parameter, that is, tell the initial translation model that even if the learning intensity for how to determine such word fragments is small, the impact on the accuracy of the final output result is also low, thereby reducing the time and energy required to train the initial translation model.

[0066] If the translation mapping relationship reflected by the corresponding associated parameters is relatively simple, it means that the word segment has a relatively simple word segment corresponding to it in the source language, that is, under normal circumstances, when translating the word segment of the source language, the corresponding word segment in the second text will be obtained. Therefore, if the word segment in the second text does not appear in the model translation text, it means that there is a high probability that a translation error has occurred. For example, the word segment "bearing" is usually translated as "Bearing" in English. If the first text contains the word segment "bearing", but the corresponding model translation text does not contain the word segment "Bearing", it is highly likely that the initial translation model has produced an incorrect translation result. At this time, the processing device can set a greater learning intensity for the word segments in this type of second text through the word loss parameter, so that the initial translation model can learn how to translate this type of word segment with greater intensity, thereby improving the translation accuracy of the translation model for this type of word segment.

[0067] S205: Train the initial translation model according to the word loss parameter to obtain a translation model.

[0068] By using the word loss parameters determined through the above steps, the processing device can enable the initial translation model to learn word segments with different degrees of influence with different intensities, thereby improving the learning speed of some word segments with lower influence, and improving the learning accuracy of some word segments with higher influence. In this way, the obtained translation model can maximize the accuracy of expressing the meaning of the source language text while ensuring translation efficiency.

[0069] S206: Translate the text to be processed in the source language into a translated text in the target language using a translation model.

[0070] Since the translation model is trained based on a translation text training set consisting of a first text in the source language and a second text in the target language, after obtaining the translation model, in practical applications, the text to be processed in the source language can be used as the model input of the translation model to more accurately obtain the translated text in the target language. The text to be processed can be any text that includes word fragments in the source language.

[0071] It can be seen from the above technical solution that in order to improve the translation quality, the association parameters of the word segments included in the second text in the text sample pair to which it belongs can be determined, and the association parameters are used to reflect the translation mapping relationship between the target word segments in the second text of the target text sample pair and the word segments in the first text of the target text sample pair. When performing model training, the model translation text in the target language can be determined by the initial translation model based on the first text in the target text sample pair, and the difference between the initial translation model when translating can be reflected by the model translation text and the second text in the target text sample pair. Based on the corresponding association parameters, the word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text can be determined. Since the accuracy of the translation of word segments between two languages can be analyzed through the translation mapping relationship, the word loss parameter can reflect the degree of influence of the word segments included in the second text on the translation accuracy based on the combination of the translation mapping relationship. The initial translation model can be trained based on the word loss parameter, so that the initial translation model can adopt different learning intensities to learn word segments with different degrees of influence on translation accuracy. Then, through more accurate word translation, the translated text can be made to fit the corresponding meaning of the text to be processed in the source language, thereby improving translation accuracy.

[0072] In related technologies, when training a translation model, the training weights corresponding to the word segments are usually determined based on the token frequencies (token frequencies) of the word segments included in the target language, thereby solving the problem of uneven distribution of word segments in the translation results. However, this method does not take into account the linguistic characteristics of the source language. On the other hand, word segments with similar token frequencies may have completely different translation mapping relationships in the source language. If the same training weights are assigned to word segments with similar token frequencies, it may lead to poor training results and make it difficult to accurately reflect the textual meaning of the source language text. Figure 3 As shown, Figure 3A graph of experimental results provided in an embodiment of the present application shows the Mutual Information (Mutual Information) value on the horizontal axis. This Mutual Information value can reflect the translation mapping relationship between target language word segments and source language word segments. The higher the Mutual Information value, the more uniform the translation mapping relationship. As can be seen from the graph, word segments with the same word frequency may correspond to a variety of Mutual Information values. Therefore, if the training weight is determined only based on word frequency, the translation mapping relationship cannot be effectively reflected, and the translation result cannot be accurately mapped to the source language text, resulting in poor translation effect.

[0073] As mentioned above, through the word loss parameters, the processing device can learn word segments with different translation mapping relationships with different intensities. Specifically, during the training process, the processing device can use the word segments included in the second text of the target text sample pair as the granularity, and respectively determine the word differences between the word segments included in the second text of the target text sample pair and the model translation text, and then determine the loss weight based on the associated parameters corresponding to the word segments included in the second text of the target text sample pair. The loss weight is used to adjust the learning intensity of the model when learning each word segment. The larger the value of the loss weight, the greater the learning intensity of the model when learning the word segment, that is, to improve the accuracy of the translation of the word segment.

[0074] As can be seen from the above, the more complex the translation mapping relationship corresponding to a word segment, the less impact the translation error will have on the meaning of the source text. Furthermore, the more complex the translation mapping relationship, the more diverse the mapping relationship between the word segments included in the second text and the word segments included in the first text. For example, the word segment included in the first text may have translation results for multiple word segments, including the word segment included in the second text. This makes it more difficult for the model to learn whether the word segment is translated accurately.

[0075] like Figure 4 As shown, Figure 4An experimental chart is provided for an embodiment of the present application, which uses the average bilingual mutual information (Bilingual Mutual Information, referred to as BMI) value as the horizontal axis, the text lexical diversity measure (Measure of Textual Lexical Diversity, referred to as MTLD) value and the bilingual evaluation under study (Bilingual Evaluation Understudy, referred to as BLEU) value as the vertical axis. The BMI value can be used to reflect the translation mapping relationship between word segments. The higher the BMI value, the simpler the translation mapping relationship between word segments. The average BMI value refers to the average value of the BMI values corresponding to the word segments included in the second text in the text sample pair. The average BMI value can reflect the translation mapping relationship between the second text as a whole and the first text in the text sample pair to which it belongs. The solid line represents the BLEU value. The higher the BLEU value, the more accurate the translation result, that is, the text sample pair used for translation training is less difficult for the translation model to learn; the dotted line represents the MTLD value. The higher the MTLD value, the higher the lexical diversity in the translation result. The experimental results shown in the chart show that when the average BMI value of the second text is higher, that is, the translation mapping relationship between the second text and the first text in the corresponding text sample pair is more uniform, the lexical diversity in the translation result is lower, the translation result is more accurate, and the translation model has an easier time learning this text sample pair. This shows that the corresponding association parameters can, to a certain extent, reflect the difficulty of the translation model learning word fragments.

[0076] Based on this, in order to improve the learning effect of the initial translation model while reducing the overall learning difficulty of the initial translation model and improving learning efficiency, when determining the loss weight based on the associated parameters, the value of the loss weight can be inversely correlated with the complexity of the identified translation mapping relationship.

[0077] The processing device can determine the word loss parameter based on the word difference and the corresponding loss weight, so that when the model is trained based on the word loss parameter, the word segment with a relatively simple translation mapping relationship can be studied with greater intensity, and the word segment with a relatively complex translation mapping relationship can be studied with less intensity. Since the word segment with a single translation mapping relationship has a greater impact on the meaning of the source language text when a translation error occurs, and the difficulty of learning the word segment is relatively low, a higher loss weight can be set to set a lower tolerance for the translation error of such word segment, thereby improving the accuracy of the translation result to the meaning of the source language text; since the word segment with a complex translation mapping relationship has a relatively small impact on the meaning of the source language text when a translation error occurs, and the difficulty of learning the word segment is relatively high, a lower loss weight can be set to set a higher tolerance for the translation error of such word segment, thereby reducing the learning difficulty of the model to a certain extent while ensuring the accuracy of the translation result to the meaning of the source language text, thereby achieving a relatively good improvement effect in both learning accuracy and learning difficulty.

[0078] In order to more accurately determine the loss weight, the processing device can also introduce multiple hyperparameters to adjust the associated parameters, and determine the loss weight based on the adjusted associated parameters. In one possible implementation, when determining the loss weight based on the associated parameters, the processing device can determine the loss weight based on a first hyperparameter, a second hyperparameter, and the associated parameters, the first hyperparameter being used to scale the associated parameters, and the second hyperparameter being used to determine the lower limit of the loss weight. Thus, through the first hyperparameter and the second hyperparameter, the processing device can more accurately adjust the value of the loss weight, thereby enabling the initial translation model to learn the word fragment more reasonably.

[0079] For example, the following formula is a formula for determining loss weights:

[0080] w(y j )=S·BMI(X,y j )+B

[0081] Among them, w(y j ) is the word fragment y j The corresponding loss weight, BMI(X,y j ) is the word fragment y j The associated parameters in the text sample pair are: X is the first text in the text sample pair to which the word segment belongs; S is the first hyperparameter used to scale the BMI value; B is the second hyperparameter used to determine w(y j ) is the lower limit value of .

[0082] For word segments with larger BMI values, the initial translation model can assume that the translation mapping relationship of these word segments is relatively simple, and amplify the loss of these word segments with a larger loss weight, so as to conduct more intensive learning. For word segments with smaller BMI values, the initial translation model can assume that the mapping relationship of these word segments is relatively complex and the learning difficulty is higher, and a smaller loss weight can be used to reduce the loss of these word segments, thereby avoiding falling into a local optimum due to over-learning. The processing device can determine the loss parameter using the following formula:

[0083]

[0084] in, is the loss parameter corresponding to the second text in a text sample pair, the second text includes m word segments, w(y j )·logp(y j |Y<j,X) represents the jth word segment y j The corresponding word loss parameter, logp(y j |Y<j,X) is the probability of accurate translation of the jth word segment, determined by the processing device based on the translation results corresponding to the word segments between the jth word segment. This probability reflects the difference between the jth word segment and the corresponding word in the model translation text. Using this loss parameter, the initial translation model can determine the learning intensity of each word segment in the second text, and then comprehensively learn the translation relationship between the second text and the first text, thereby improving the translation accuracy of the first text.

[0085] The above content mainly introduces in detail how to determine the word loss parameter. Next, we will focus on how to determine the association parameters corresponding to the word fragments. As mentioned above, the association parameters can be used to reflect the translation mapping relationship between the target word fragment in the second text of the target text sample pair and the word fragment in the first text of the target text sample pair. Therefore, the more accurate the association parameters are, the more accurate the translation mapping relationship reflected is, and the more reasonable the loss weight and other related parameters determined based on the association parameters are, so that a more accurate translation model can be trained. Based on this, in order to improve the accuracy of model training, when determining the association parameters, the processing device can combine the co-occurrence frequency parameters of the target word fragment and the word fragment in the first text and the word frequency parameters corresponding to each word fragment. The co-occurrence frequency is used to reflect the frequency of the two word fragments appearing in the same text sample pair, and the word frequency parameter is used to reflect the frequency of the word fragment in the translation text training set. Therefore, the combination of the co-occurrence frequency parameter and the word frequency parameter corresponding to each word fragment can reflect the difference between the frequency of the word fragment appearing alone or together and the frequency of the word fragment appearing together, thereby reflecting the translation mapping relationship between the two word fragments.

[0086] In a possible implementation, the first text of the target text sample pair may include n word segments, and the second text may include m word segments. The target word segment may be the j-th word segment among the m word segments. For the j-th word segment in the target text sample pair, when determining the association parameters of the word segments included in the second text in the text sample pair to which it belongs, the processing device may determine the co-occurrence frequency parameters of the segment pairs consisting of the j-th word segment and the n word segments in multiple text sample pairs, and the co-occurrence frequency parameters are used to reflect the occurrence frequency of the segment pairs in multiple text sample pairs. At the same time, the processing device may also determine the first word frequency parameters of the n word segments in multiple text sample pairs, and the first word frequency parameters are used to reflect the occurrence frequency of the n word segments in the multiple text sample pairs.

[0087] Based on the co-occurrence frequency parameter and the first word frequency parameter, the processing device can determine the associated parameters of the j-th word segment in the target text sample pair. It can be understood that if the first word frequency parameter is relatively close to the co-occurrence frequency parameter, it means that among the n word segments included in the first text, there is a word segment that has a relatively simple translation mapping relationship with the j-th word segment, that is, when the word segment appears in the first text included in the text sample pair, there is a high probability that the j-th word segment will also appear in the second text included in the text sample pair, and the j-th word segment is the translation result mainly corresponding to the word segment. If the first word frequency parameter is significantly different from the co-occurrence frequency parameter, it means that the n word segments included in the first text have a relatively complex translation mapping relationship with the j-th word segment, that is, the j-th word segment is very likely to be only one of the multiple translation results corresponding to a certain word segment among the n word segments included in the first text, so the first word frequency parameter will be greater than the co-occurrence frequency parameter. It can be seen that the translation mapping relationship between the j-th word segment and the word segment included in the first text in the target text sample pair can be determined through the co-occurrence frequency parameter and the first word frequency parameter.

[0088] As can be seen from the above, the first word frequency parameter and the co-occurrence frequency parameter can accurately reflect whether the j-th word segment is one of the multiple translation results of the word segment in the first text. In order to reflect the translation mapping relationship from a richer dimension and further improve the accuracy of the translation mapping relationship, in one possible implementation, the processing device can also determine whether there are multiple word segments in the source language that can use the j-th word segment as a translation result, thereby analyzing whether the j-th word segment has a complex translation mapping relationship from another dimension.

[0089] In one possible implementation, the processing device may determine a second term frequency parameter for the jth term segment in multiple text sample pairs, where the second term frequency parameter is used to reflect the frequency of occurrence of the jth term segment in the multiple text sample pairs. The processing device may determine an association parameter for the jth term segment in the target text sample pair based on the co-occurrence frequency parameter, the first term frequency parameter, and the second term frequency parameter.

[0090] Among them, after combining the second word frequency parameter, if the difference between the second word frequency parameter and the co-occurrence frequency parameter is small, it can be explained to a certain extent that there is a word segment among the n word segments that is the main word segment in the source language for which the j-th word segment is used as the translation result, that is, the j-th word segment and the word segment among the n word segments have a relatively simple translation mapping relationship; if the difference between the second word frequency parameter and the co-occurrence frequency parameter is large, it means that in addition to the word segments among the n word segments in the source language, there are other word segments that can use the j-th word segment as the translation result, that is, the j-th word segment and the word segment among the n word segments have a relatively complex translation mapping relationship. It can be seen that by combining the first word frequency parameter, the second word frequency parameter and the co-occurrence frequency parameter, it can not only reflect whether the n word segments have multiple translation results in the target language, but also reflect whether there are multiple word segments in the source language that can use the j-th word segment as a translation result, thereby reflecting the translation mapping relationship of the j-th word segment in the target text sample pair from two dimensions, further improving the accuracy of the association parameter, and ultimately improving the rationality of the model training, and obtaining a more accurate translation model.

[0091] It is understandable that when the j-th word segment and the word segment in the n word segments are not a one-to-one translation mapping relationship, and are not the only translation results of each other, the j-th word segment may have different association parameters in different text sample pairs. For example, in a certain text sample pair, the word segment included in the first text may have multiple translation results in the target language, and the j-th word segment included in the second text is only one of them. When determining the association parameters of the j-th word segment corresponding to the text sample pair, the co-occurrence frequency parameter corresponding to the segment pair composed of the j-th word segment and the word segment will be much smaller than the first word frequency parameter; in another text sample pair, the j-th word segment may be the only translation result of a word segment in the first text in the target language. When determining the association parameters corresponding to the j-th word segment in the text sample pair, the co-occurrence frequency parameter corresponding to the segment pair composed of the j-th word segment and the word segment will be closer to the first word frequency parameter corresponding to the word segment. It can be seen from this that the same j-th word segment may have different association parameters in different text sample pairs. Based on this, by training the model on the associated parameters of the text sample pairs, the initial translation model can perform targeted learning based on the translation mapping of the same j-th word segment and different first text word segments, so that the translation text determined by the final translation model can be more consistent with the text meaning of the source language text.

[0092] As shown in the following formula, this formula is a formula for determining an association parameter, and the association parameter may be a mutual information parameter BMI:

[0093]

[0094] Among them, BMI(X,y j ) is the association parameter of the jth word segment in the text sample pair to which it belongs, n is the number of word segments included in the first text in the text sample pair, f(x i ,y j ) is the word fragment y j and word fragment x i The co-occurrence frequency parameter of the composed segment pair, f(x i ) is the word fragment x i The corresponding first word frequency parameter, f(y j ) is the word fragment y jThe corresponding second word frequency parameter, K, is the total number of text sample pairs in the translation text training set. In addition to the BMI value, other parameters that can reflect the translation mapping relationship between word segments can also be used as association parameters. For example, the association parameter can be determined based on the confidence level between the first text word segment and the second text word segment. This confidence level can be used to indicate the probability of obtaining the second text word segment when translating the first text word segment.

[0095] In addition, there may be multiple ways to reflect the frequency of occurrence of fragment pairs and word fragments through co-occurrence frequency parameters and word frequency parameters. Since the determination method includes multiple parameters, in order to improve the rationality of the associated parameters, the processing device can set multiple parameters appearing in the same method as parameters under the same measurement standard. In one possible implementation method, the co-occurrence frequency parameter can be used to identify the number of text sample pairs in which fragment pairs co-occur in multiple text sample pairs. For the i-th word fragment in n word fragments, the first word frequency parameter can be used to identify the number of texts in which the i-th word fragment appears in multiple text pairs. For the j-th word fragment, the second word frequency parameter can be used to identify the number of texts in which the j-th word fragment appears in multiple text pairs. This enables the above three parameters to all be able to determine the word frequency parameters based on the number of texts as the measurement standard, thereby improving the rationality of the associated parameters.

[0096] In another possible implementation, the co-occurrence frequency parameter can also be used to identify the number of times a segment pair co-occurs in multiple text sample pairs. For the i-th word segment in n word segments, the first word frequency parameter can be used to identify the number of times the i-th word segment appears in multiple text pairs. For the j-th word segment, the second word frequency parameter can be used to identify the number of times the j-th word segment appears in multiple text pairs. In this way, more detailed statistics can be made on word segments that appear repeatedly in the same text pair, so that the obtained association parameters can more accurately and comprehensively reflect the translation mapping relationship. At the same time, the above parameters are all determined based on the number of occurrences of word segments as a measurement standard, so that multiple parameters can be maintained in the same dimension, ensuring the rationality of the determined association parameters. At the same time, based on different parameter determination methods, the processing device can also adaptively adjust the loss weight determined based on the association parameter, so that the determined loss weight is more reasonable.

[0097] It is understandable that there may be some word segments in the translation text training set that have overly complex translation mapping relationships, that is, a word segment may have a large number of corresponding word segments in another language. At this time, for the initial translation model, such word segments may be too difficult to learn. If the initial translation model is made to excessively learn such word segments, it may lead to poor learning efficiency and difficulty in obtaining good learning results. As mentioned above, the more complex the translation mapping relationship, the lower the impact of the word segments on the accuracy of the translation results. Therefore, the word segments with overly complex translation mapping relationships have a lower impact on the translation results. Based on this, in one possible implementation method, in order to remove the adverse effects of these word segments on model training and improve the efficiency and accuracy of model training, the processing device can screen the word segments based on the associated parameters.

[0098] If the associated parameters include a target associated parameter whose value is less than a threshold, in the process of training the initial translation model according to the word loss parameter, the word loss parameter determined based on the target associated parameter can be ignored. For example, the word loss parameter determined by the target associated parameter can be set to 0, thereby avoiding the initial translation model from over-learning this type of word fragment and affecting the learning efficiency, thereby improving the rationality of learning and training.

[0099] For example, in the specific model training process, such as Figure 5 As shown, Figure 5 A schematic diagram of an initial translation model is shown. The initial translation model includes an encoder (ENCODERS) and a decoder (DECODERS). The processing device can input the French text in the text sample pair as the first text into the encoder, and then obtain the translated English text through the decoder as the model translation text. First, to improve the training efficiency of the model, the processing device can train the model for a certain number of steps by minimizing the cross-entropy loss function, for example, 100,000 steps. The cross-entropy loss function is as follows:

[0100]

[0101] Where m is the number of word segments in the second text corresponding to the first text, logp(y j|Y<j,X) represents the difference in words between the jth word segment of the second text and the corresponding word segment of the model translation text. By minimizing the cross entropy loss function, the processing device can train the initial translation model based on the difference between the word segments, so that the initial translation model can learn how to make the determined translation result close to the second text corresponding to the input first text. Subsequently, in order to improve the training accuracy, the processing device can determine the word loss parameter based on the associated parameters corresponding to the word segments included in the second text, and train the initial translation model for 100,000 steps based on the word loss parameter. During the second training process, the processing device can set the loss weight corresponding to the word segments with associated parameters lower than 0.4 to 0, thereby avoiding the initial translation model from spending a lot of time learning this part of the word segments with overly complex translation mapping relationships, and further improving the efficiency of model training.

[0102] Based on the text translation method provided in the above embodiment, the present application also provides a text translation device, see Figure 6 , Figure 6 This is a structural block diagram of a text translation device 600 provided in an embodiment of the present application. The device 600 includes an acquisition unit 601, a first determination unit 602, a second determination unit 603, a third determination unit 604, a training unit 605, and a translation unit 606:

[0103] An acquisition unit 601 is configured to acquire a translation text training set, wherein the translation text training set includes a plurality of text sample pairs, each of which includes a first text in a source language and a second text in a target language, wherein the second text is a translation of the first text in the target language;

[0104] A first determining unit 602 is configured to determine an association parameter of a word segment included in the second text in a corresponding text sample pair, wherein the target text sample pair is any one of the plurality of text sample pairs, and the association parameter is configured to reflect a translation mapping relationship between a target word segment in the second text of the target text sample pair and a word segment in the first text of the target text sample pair;

[0105] A second determining unit 603 is configured to determine a model translation text in the target language using an initial translation model based on the first text in the target text sample pair;

[0106] A third determining unit 604 is configured to determine, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively;

[0107] A training unit 605 is configured to train the initial translation model according to the word loss parameter to obtain a translation model;

[0108] The translation unit 606 is configured to translate the text to be processed in the source language into a translated text in the target language using the translation model.

[0109] In a possible implementation, the third determining unit 604 is specifically configured to:

[0110] Taking the word segments included in the second text of the target text sample pair as granularity, respectively determining the word differences between the word segments included in the second text of the target text sample pair and the word segments corresponding to the model translation text;

[0111] Determining a loss weight according to association parameters corresponding to the word segments included in the second text of the target text sample pair;

[0112] The word loss parameter is determined according to the word difference and the corresponding loss weight, wherein the value of the loss weight is inversely correlated with the complexity of the identified translation mapping relationship.

[0113] In a possible implementation, the third determining unit 604 is specifically configured to:

[0114] The loss weight is determined according to a first hyperparameter, a second hyperparameter and the associated parameter, wherein the first hyperparameter is used to scale the associated parameter, and the second hyperparameter is used to determine a lower limit value of the loss weight.

[0115] In a possible implementation, the first text of the target text sample pair includes n word segments, the second text includes m word segments, and the target word segment is the jth word segment among the m word segments;

[0116] For the j-th word segment in the target text sample pair, the first determining unit 602 is specifically configured to:

[0117] Determining co-occurrence frequency parameters of the segment pairs consisting of the j-th word segment and the n word segments in the plurality of text sample pairs;

[0118] Determining first word frequency parameters of the n word segments in the plurality of text sample pairs respectively;

[0119] The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter and the first word frequency parameter.

[0120] In a possible implementation, the apparatus 600 further includes a fourth determining unit:

[0121] A fourth determining unit, configured to determine a second word frequency parameter of the j-th word segment in the plurality of text sample pairs;

[0122] The first determining unit 602 is specifically configured to:

[0123] The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter, the first word frequency parameter, and the second word frequency parameter.

[0124] In a possible implementation, the co-occurrence frequency parameter is used to identify the number of text sample pairs in which the segment pair co-occurs among the multiple text sample pairs;

[0125] For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of texts in which the i-th word segment appears in the multiple text pairs;

[0126] For the j-th word segment, the second word frequency parameter is used to identify the number of texts in which the j-th word segment appears in the multiple text pairs.

[0127] In a possible implementation, the co-occurrence frequency parameter is used to identify the number of times the segment pair co-occurs in the plurality of text sample pairs;

[0128] For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of times the i-th word segment appears in the multiple text pairs;

[0129] For the j-th word segment, the second word frequency parameter is used to identify the number of times the j-th word segment appears in the multiple text pairs.

[0130] In a possible implementation, the training unit 605 is specifically configured to:

[0131] If the association parameters include a target association parameter whose value is less than a threshold, in the process of training the initial translation model according to the word loss parameter, the word loss parameter determined based on the target association parameter is ignored.

[0132] The present application also provides a computer device, which is described below with reference to the accompanying drawings. Figure 7 As shown, the embodiment of the present application provides a device, which may also be a terminal device. The terminal device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), an in-vehicle computer, etc., taking a mobile phone as an example:

[0133] Figure 7The block diagram shows a partial structure of a mobile phone related to the terminal device provided in the embodiment of the present application. Figure 7 The mobile phone includes components such as a radio frequency (RF) circuit 710, a memory 720, an input unit 730, a display unit 740, a sensor 750, an audio circuit 760, a wireless fidelity (WiFi) module 770, a processor 780, and a power supply 790. It will be understood by those skilled in the art that Figure 7 The mobile phone structure shown in the figure does not constitute a limitation to the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0134] The following combination Figure 7 A detailed introduction to the various components of a mobile phone:

[0135] The RF circuit 710 can be used to receive and send signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor 780 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 710 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 710 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0136] The memory 720 can be used to store software programs and modules. The processor 780 executes the various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 720. The memory 720 can mainly include a program storage area and a data storage area. The program storage area can store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory 720 can include high-speed random access memory and non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0137] The input unit 730 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 731) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 731 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 780. It can also receive commands sent by the processor 780 and execute them. In addition, the touch panel 731 can be implemented using various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch panel 731, the input unit 730 may further include other input devices 732. Specifically, the other input devices 732 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick.

[0138] The display unit 740 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 740 may include a display panel 741. Optionally, the display panel 741 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 731 may cover the display panel 741. When the touch panel 731 detects a touch operation on or near it, it is transmitted to the processor 780 to determine the type of touch event. Subsequently, the processor 780 provides corresponding visual output on the display panel 741 according to the type of touch event. Although in Figure 7 In the embodiment, the touch panel 731 and the display panel 741 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 731 and the display panel 741 can be integrated to realize the input and output functions of the mobile phone.

[0139] The mobile phone may also include at least one sensor 750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 741 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 741 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that the mobile phone can also be configured with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.

[0140] Audio circuit 760, speaker 761, and microphone 762 provide an audio interface between the user and the phone. Audio circuit 760 converts received audio data into electrical signals and transmits them to speaker 761, which then converts them into sound signals for output. Microphone 762, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 760 and converted into audio data. The audio data is then processed by processor 780 and transmitted to, for example, another phone via RF circuit 710, or stored in memory 720 for further processing.

[0141] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse the web and access streaming media through the WiFi module 770. It provides users with wireless broadband Internet access. Figure 7A WiFi module 770 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.

[0142] Processor 780 is the control center of the mobile phone, connecting all parts of the mobile phone using various interfaces and circuits. It executes software programs and / or modules stored in memory 720 and accesses data stored in memory 720 to perform various functions and process data. Optionally, processor 780 may include one or more processing units. Preferably, processor 780 integrates an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 780.

[0143] The mobile phone also includes a power supply 790 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 780 through a power management system, thereby managing charging, discharging, and power consumption management functions through the power management system.

[0144] Although not shown, the mobile phone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0145] In this embodiment, the processor 780 included in the terminal device further has the following functions:

[0146] Obtaining a translation text training set, the translation text training set comprising a plurality of text sample pairs, the text sample pairs comprising a first text in a source language and a second text in a target language, the second text being a translation of the first text in the target language;

[0147] Determining association parameters of the word segments included in the second text in the text sample pair to which they belong, wherein the target text sample pair is any one of the multiple text sample pairs, and the association parameters are used to reflect a translation mapping relationship between the target word segment in the second text of the target text sample pair and the word segment in the first text of the target text sample pair;

[0148] Determining a model translation text in the target language using an initial translation model based on the first text in the target text sample pair;

[0149] Determining, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively;

[0150] Training the initial translation model according to the word loss parameter to obtain a translation model;

[0151] The text to be processed in the source language is translated into a translated text in the target language by using the translation model.

[0152] This application embodiment also provides a server, see Figure 8 As shown, Figure 8 The structural diagram of the server 800 provided in the embodiment of the present application, the server 800 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 822 (for example, one or more processors) and memories 832, and one or more storage media 830 (for example, one or more mass storage devices) for storing application programs 842 or data 844. Among them, the memories 832 and the storage media 830 can be temporary storage or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 822 can be configured to communicate with the storage medium 830 to execute a series of instruction operations in the storage medium 830 on the server 800.

[0153] The server 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input and output interfaces 858, and / or one or more operating systems 841, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0154] The steps performed by the server in the above embodiment can be based on Figure 8 The server structure shown.

[0155] An embodiment of the present application further provides a computer-readable storage medium for storing a computer program, wherein the computer program is used to execute any one of the implementations of the text translation method described in the aforementioned embodiments.

[0156] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the above-mentioned storage medium can be at least one of the following media: read-only memory (English: read-only memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0157] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0158] The above is merely one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A text translation method, characterized in that: Obtaining a translation text training set, the translation text training set comprising a plurality of text sample pairs, the text sample pairs comprising a first text in a source language and a second text in a target language, the second text being a translation of the first text in the target language; Determining association parameters of the word segments included in the second text in the text sample pair to which they belong, wherein the target text sample pair is any one of the multiple text sample pairs, and the association parameters are used to reflect the complexity of the translation mapping relationship between the target word segment in the second text of the target text sample pair and the word segment in the first text of the target text sample pair; the method comprising: Determining a model translation text in the target language using an initial translation model based on the first text in the target text sample pair; Determining, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively; The initial translation model is trained according to the word loss parameter to obtain a translation model; the word loss parameter is used to adjust the learning strength of the initial translation model; the complexity of the translation mapping relationship is inversely correlated with the learning strength; The text to be processed in the source language is translated into a translated text in the target language by using the translation model.

2. The method according to claim 1, characterized in that The determining, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively includes: Taking the word segments included in the second text of the target text sample pair as granularity, respectively determining the word differences between the word segments included in the second text of the target text sample pair and the word segments corresponding to the model translation text; Determining a loss weight according to association parameters corresponding to the word segments included in the second text of the target text sample pair; The word loss parameter is determined according to the word difference and the corresponding loss weight, wherein the value of the loss weight is inversely correlated with the complexity of the identified translation mapping relationship.

3. The method according to claim 2, characterized in that The determining of the loss weight according to the associated parameters corresponding to the word segments included in the second text of the target text sample pair includes: The loss weight is determined according to a first hyperparameter, a second hyperparameter and the associated parameter, wherein the first hyperparameter is used to scale the associated parameter, and the second hyperparameter is used to determine a lower limit value of the loss weight.

4. The method according to claim 1, wherein The first text of the target text sample pair includes n word segments, the second text includes m word segments, and the target word segment is the jth word segment among the m word segments; For the j-th word segment in the target text sample pair, determining the associated parameters of the word segment included in the second text in the text sample pair to which it belongs includes: Determining co-occurrence frequency parameters of the segment pairs consisting of the j-th word segment and the n word segments in the plurality of text sample pairs; Determining first word frequency parameters of the n word segments in the plurality of text sample pairs respectively; The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter and the first word frequency parameter.

5. The method according to claim 4, characterized in that The method further comprises: Determining a second word frequency parameter of the j-th word segment in the plurality of text sample pairs; The determining the association parameter of the j-th word segment in the target text sample pair according to the co-occurrence frequency parameter and the first word frequency parameter includes: The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter, the first word frequency parameter, and the second word frequency parameter.

6. The method according to claim 5, characterized in that The co-occurrence frequency parameter is used to identify the number of text sample pairs in which the segment pair co-occurs among the multiple text sample pairs; For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of texts in which the i-th word segment appears in the multiple text pairs; For the j-th word segment, the second word frequency parameter is used to identify the number of texts in which the j-th word segment appears in the multiple text pairs.

7. The method according to claim 5, characterized in that The co-occurrence frequency parameter is used to identify the number of times the segment pair co-occurs in the multiple text sample pairs; For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of times the i-th word segment appears in the multiple text pairs; For the j-th word segment, the second word frequency parameter is used to identify the number of times the j-th word segment appears in the multiple text pairs.

8. The method according to any one of claims 1 to 7, characterized in that The training of the initial translation model according to the word loss parameter includes: If the association parameters include a target association parameter whose value is less than a threshold, in the process of training the initial translation model according to the word loss parameter, the word loss parameter determined based on the target association parameter is ignored.

9. A text translation device, characterized in that: The apparatus includes an acquisition unit, a first determination unit, a second determination unit, a third determination unit, a training unit, and a translation unit: The acquisition unit is configured to acquire a translation text training set, wherein the translation text training set includes a plurality of text sample pairs, each of which includes a first text in a source language and a second text in a target language, wherein the second text is a translation of the first text in the target language; The first determining unit is configured to determine an association parameter of a word segment included in the second text in a corresponding text sample pair, wherein the target text sample pair is any one of the plurality of text sample pairs, and the association parameter is configured to reflect a complexity of a translation mapping relationship between a target word segment in the second text of the target text sample pair and a word segment in the first text of the target text sample pair; The second determining unit is configured to determine a model translation text in the target language using an initial translation model based on the first text in the target text sample pair; The third determining unit is configured to determine, based on the corresponding association parameters, word loss parameters corresponding to the word segments included in the second text of the target text sample pair and the model translation text respectively; The training unit is used to train the initial translation model according to the word loss parameter to obtain a translation model; the word loss parameter is used to adjust the learning strength of the initial translation model; the complexity of the translation mapping relationship is inversely correlated with the learning strength; The translation unit is configured to translate the to-be-processed text in the source language into a translated text in the target language using the translation model.

10. The device according to claim 9, characterized in that The third determining unit is specifically configured to: Taking the word segments included in the second text of the target text sample pair as granularity, respectively determining the word differences between the word segments included in the second text of the target text sample pair and the word segments corresponding to the model translation text; Determining a loss weight according to association parameters corresponding to the word segments included in the second text of the target text sample pair; The word loss parameter is determined according to the word difference and the corresponding loss weight, wherein the value of the loss weight is inversely correlated with the complexity of the identified translation mapping relationship.

11. The device according to claim 10, characterized in that The third determining unit is specifically configured to: The loss weight is determined according to a first hyperparameter, a second hyperparameter and the associated parameter, wherein the first hyperparameter is used to scale the associated parameter, and the second hyperparameter is used to determine a lower limit value of the loss weight.

12. The device according to claim 9, characterized in that The first text of the target text sample pair includes n word segments, the second text includes m word segments, and the target word segment is the jth word segment among the m word segments; For the j-th word segment in the target text sample pair, the first determining unit is specifically configured to: Determining co-occurrence frequency parameters of the segment pairs consisting of the j-th word segment and the n word segments in the plurality of text sample pairs; Determining first word frequency parameters of the n word segments in the plurality of text sample pairs respectively; The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter and the first word frequency parameter.

13. The device according to claim 12, characterized in that The apparatus further includes a fourth determining unit: The fourth determining unit is configured to determine a second word frequency parameter of the j-th word segment in the plurality of text sample pairs; The first determining unit is specifically configured to: The association parameter of the j-th word segment in the target text sample pair is determined according to the co-occurrence frequency parameter, the first word frequency parameter, and the second word frequency parameter.

14. The device according to claim 13, characterized in that The co-occurrence frequency parameter is used to identify the number of text sample pairs in which the segment pair co-occurs among the multiple text sample pairs; For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of texts in which the i-th word segment appears in the multiple text pairs; For the j-th word segment, the second word frequency parameter is used to identify the number of texts in which the j-th word segment appears in the multiple text pairs.

15. The device according to claim 13, characterized in that The co-occurrence frequency parameter is used to identify the number of times the segment pair co-occurs in the multiple text sample pairs; For the i-th word segment among the n word segments, the first word frequency parameter is used to identify the number of times the i-th word segment appears in the multiple text pairs; For the j-th word segment, the second word frequency parameter is used to identify the number of times the j-th word segment appears in the multiple text pairs.

16. The device according to any one of claims 9 to 15, characterized in that The training unit is specifically used to: If the association parameters include a target association parameter whose value is less than a threshold, in the process of training the initial translation model according to the word loss parameter, the word loss parameter determined based on the target association parameter is ignored.

17. A computer device, characterized in that: The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the text translation method according to any one of claims 1 to 8 according to instructions in the program code.

18. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the text translation method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Translated sentence corresponding method and device therefor

    JP1997160918A