Chapter machine translation method, device, and storage medium

By replacing entity words with placeholders in the chapter and translating the replacement statements and entity words separately, the problem of insufficient consistency in the translation of chapters in the prior art is solved, and higher consistency and user experience are achieved.

CN112149432BActive Publication Date: 2025-02-18BEIJING XIAOMI PINECONE ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011031037.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-27
Publication Date
2025-02-18
Estimated Expiration
2040-09-27

AI Technical Summary

Technical Problem

When existing machine translation techniques translate chapters, the same word may produce different translations in different sentences, resulting in the consistency of the translation being affected.

Method used

By identifying the entity words in the chapter, replacing them with placeholders, inputting the replacement statement and entity words into the translation model, obtaining the first translation result and the second translation result, and combining them to obtain the translation result of the original statement.

Benefits of technology

Improve the translation consistency of entity words in the chapter and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112149432B_ABST
    Figure CN112149432B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and device for machine translation of a text, and a storage medium. The method includes: identifying entity words in a text; replacing the original sentence in the text with a placeholder for the entity word to obtain a replacement sentence containing the placeholder, wherein the placeholders for different entity words are different; inputting the replacement sentence and the entity word extracted from the original sentence into a translation model respectively to obtain a first translation result of the replacement sentence and a second translation result of the entity word; combining the first translation result and the second translation result to obtain a translation result of the original sentence. Through this method, the consistency of entity word translation in a text can be improved, and the user experience can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of electronic devices, and in particular to a method and device for machine translation of a text, and a storage medium. Background Art

[0002] Neural machine translation is a technology that uses neural networks to translate text from one language to another. In recent years, neural machine translation has achieved good results and is comparable to human translation in fields and languages ​​with large-scale training data.

[0003] However, when translating a passage, most people split the passage into individual sentences for translation. Therefore, the same word may have different translations in different sentences, affecting the consistency of the translation. Summary of the invention

[0004] The present invention provides a method and device for machine translation of a text, and a storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, a method for machine translation of a text is provided, comprising:

[0006] Identify entity words within a text;

[0007] The entity words are replaced with placeholders for original sentences in the passage to obtain replacement sentences containing the placeholders, wherein the placeholders for different entity words are different;

[0008] Inputting the replacement sentence and the entity word extracted from the original sentence into a translation model respectively to obtain a first translation result of the replacement sentence and a second translation result of the entity word;

[0009] The first translation result and the second translation result are combined to obtain a translation result of the original sentence.

[0010] Optionally, the method further includes:

[0011] Comparing the replacement statement with the first translation result to determine the missing placeholder in the first translation result;

[0012] Inputting the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation;

[0013] Inserting a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, and updating the first translation result;

[0014] The combining the first translation result and the second translation result to obtain the translation result of the original sentence includes:

[0015] The updated first translation result and the second translation result are combined to obtain a translation result of the original sentence.

[0016] Optionally, the method further includes:

[0017] Replace the entity words in the first sentence used for training and the entity words in the second sentence translated from the first sentence with the same placeholder; wherein the placeholders of different entity words in the first sentence or the second sentence are different, and the placeholders of the entity words with the same meaning in the first sentence or the second sentence are the same;

[0018] The first sentence and the first sentence replaced with the placeholder are input into a neural network model, and the parameters in the neural network model are adjusted according to the second sentence used to represent the training label and the second sentence replaced with the placeholder to obtain the translation model.

[0019] Optionally, replacing the entity words in the first sentence for training and the entity words in the second sentence after translation corresponding to the first sentence with the same placeholders includes:

[0020] Inputting the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other;

[0021] If the word alignment result indicates that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholder.

[0022] Optionally, replacing the original sentence in the passage with the placeholder for the entity word to obtain a replacement sentence containing the placeholder includes:

[0023] The entity words whose word frequency among the entity words is greater than a preset frequency are replaced with the placeholders for the original sentences in the passage to obtain the replacement sentences containing the placeholders.

[0024] Optionally, the method further includes:

[0025] If the passage does not include entity words with a frequency greater than a preset frequency, the original sentence is input into the translation model to obtain a translation result of the original sentence.

[0026] According to a second aspect of an embodiment of the present disclosure, there is provided a paragraph machine translation device, comprising:

[0027] A recognition module configured to recognize entity words within a text;

[0028] A first replacement module is configured to replace the original sentence in the passage with the placeholder of the entity word to obtain a replacement sentence containing the placeholder, wherein the placeholders of different entity words are different;

[0029] A first translation module is configured to input the replacement sentence and the entity word extracted from the original sentence into a translation model respectively, to obtain a first translation result of the replacement sentence and a second translation result of the entity word;

[0030] The combining module is configured to combine the first translation result and the second translation result to obtain a translation result of the original sentence.

[0031] Optionally, the device further comprises:

[0032] a determination module configured to compare the replacement statement with the first translation result to determine a missing placeholder in the first translation result;

[0033] An obtaining module is configured to input the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation;

[0034] An updating module, configured to insert a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, so as to update the first translation result;

[0035] The combining module is configured to combine the updated first translation result and the second translation result to obtain a translation result of the original sentence.

[0036] Optionally, the device further comprises:

[0037] A second replacement module is configured to replace the entity words in the first sentence used for training and the entity words in the second sentence translated from the first sentence with the same placeholder; wherein the placeholders of different entity words in the first sentence or the second sentence are different, and the placeholders of the entity words with the same meaning in the first sentence or the second sentence are the same;

[0038] The training module is configured to input the first sentence and the first sentence replaced by the placeholder into a neural network model, adjust the parameters in the neural network model according to the second sentence used to represent the training label and the second sentence replaced by the placeholder, and obtain the translation model.

[0039] Optionally, the second replacement module is specifically configured to input the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other; if the word alignment result represents that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, then the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholders.

[0040] Optionally, the first replacement module is specifically configured to replace the original sentence in the passage with the placeholder for the entity words whose frequency among the entity words is greater than a preset frequency, so as to obtain the replacement sentence containing the placeholder.

[0041] Optionally, the device further comprises:

[0042] The second translation module is configured to input the original sentence into the translation model to obtain a translation result of the original sentence if the passage does not include entity words with a frequency greater than a preset frequency.

[0043] According to a third aspect of an embodiment of the present disclosure, there is provided a paragraph machine translation device, comprising:

[0044] processor;

[0045] a memory for storing processor-executable instructions;

[0046] The processor is configured to execute the text machine translation method as described in the first aspect above.

[0047] According to a fourth aspect of an embodiment of the present disclosure, there is provided a storage medium, including:

[0048] When the instructions in the storage medium are executed by a processor of a computer, the computer is enabled to execute the text machine translation method as described in the first aspect above.

[0049] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0050] It can be understood that in the embodiments of the present disclosure, the entity words of each original sentence in the chapter are replaced with placeholders, and the replacement sentences and entity words are translated respectively. Since the entity words are translated separately, they will not be affected by the context of the previous and next sentences, so the second translation result of the same entity word is unique. And when processing each sentence in the chapter, because the placeholders of different entity words in the sentence are different, the placeholders of the same entity words are the same, that is, in each sentence, the placeholders belonging to the same entity word are unique, so after the replacement sentence is translated to obtain the first translation result, when the placeholder in the first translation result is replaced with the second translation result corresponding to the entity word, the same entity words in different original sentences in the original chapter can have the same translation result, so this method can improve the consistency of the translation of entity words in the chapter and improve the user experience.

[0051] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0053] Figure 1 It is a flow chart of a method for machine translation of a passage shown in an embodiment of the present disclosure.

[0054] Figure 2 It is an example flow chart of a method for machine translation of a passage shown in an embodiment of the present disclosure.

[0055] Figure 3 The figure is a diagram of a machine translation device for a text according to an exemplary embodiment.

[0056] Figure 4 It is a block diagram of a device for machine translation of a text according to an exemplary embodiment.

[0057] Figure 5 It is a block diagram of another apparatus for text machine translation according to an exemplary embodiment. DETAILED DESCRIPTION

[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0059] Figure 1This is a process of a machine translation method for a passage shown in an embodiment of the present disclosure. Figure 1 ,like Figure 1 As shown, the text machine translation method applied in an electronic device includes the following steps:

[0060] S11, identify entity words in the text;

[0061] S12, replacing the original sentence in the passage with the placeholder of the entity word to obtain a replacement sentence containing the placeholder, wherein the placeholders of different entity words are different;

[0062] S13, inputting the replacement sentence and the entity word extracted from the original sentence into a translation model respectively, to obtain a first translation result of the replacement sentence and a second translation result of the entity word;

[0063] S14. Combining the first translation result and the second translation result to obtain a translation result of the original sentence.

[0064] In the embodiments of the present disclosure, the paragraph machine translation method can be applied to electronic devices, including mobile devices and fixed devices; the mobile devices include mobile phones, tablet computers, etc. The fixed devices include but are not limited to personal computers (PCs).

[0065] When translating a text, in some embodiments, some improvements are made to the grammar and tense consistency of the text translation, but there is little work on improving the consistency of entity words appearing in the text. Entity words include at least: nouns and / or pronouns.

[0066] For example, if the text is in English and the translated language is Chinese, for example, a sentence in the text "AI technology serves humanity." may be translated as "Artificial intelligence technology serves humanity." When the context of the entity word "AI" changes, such as "Many people benefit from AI technology.", it may be translated as "Many people benefit from AI technology." or "Many people benefit from artificial intelligence technology."

[0067] It can be seen that the same entity word "AI" has been translated into "artificial intelligence" and "AI" successively, which increases the reading difficulty for readers.

[0068] In this regard, the present disclosure identifies entity words in a passage in step S11, and further replaces the entity words in the original sentences containing the entity words in the passage with placeholders in step S12 to obtain replacement sentences containing the placeholders.

[0069] It should be noted that when identifying entity words in a passage, a named entity recognition tool can be used to automatically identify entity words in each original sentence. The named entity recognition tool can be trained based on sentences including words of different parts of speech, and the named entity recognition tool can at least identify the part of the input sentence whose part of speech is entity words. And when replacing entity words with placeholders, in the same sentence, the placeholders of different entity words are different, and the placeholders of the same entity words are the same. It can be understood that the placeholder of the same entity word is unique, and the same entity word has a unique corresponding relationship with the placeholder.

[0070] For example, the placeholder is set to<ner[number]> , where [number] can be any number from 0 to 9. Similarly, the number value is the same in entity words, but different entity words have different numbers.

[0071] For another example, the placeholder may be set to characters other than numbers, such as a special character string "shift" or "ctrl".

[0072] It should be noted that in the embodiments of the present disclosure, entity words with the same meaning may have different specific forms. In this case, the entity word dictionary can be searched to replace nouns and / or pronouns and other entity words with the same meaning in different forms with the same words, and then the placeholders can be replaced on this basis.

[0073] After identifying the entity words in the passage and obtaining a replacement sentence replaced with the placeholder, the electronic device inputs the replacement sentence and the entity words extracted from the original sentence into the translation model in step S13, thereby obtaining a first translation result of the replacement sentence and a second translation result of the entity words.

[0074] It should be noted that the translation model can be trained using a large number of training samples using a neural network method, wherein the training samples include a large number of original sentences without placeholders and replacement sentences after replacing entity words with placeholders. Through this translation model, translation results can be obtained for input sentences without entity words, and translation results can also be obtained for input sentences with placeholders, but after the replacement sentences with placeholders are translated by the translation model, the placeholders are still retained in the translation results.

[0075] After obtaining the first translation result of the replacement sentence and the second translation result of the entity word, the electronic device can combine the first translation result and the second translation result in step S14 to obtain the translation result of the original sentence. Specifically, when combining, the placeholder part in the first translation result is replaced with the second translation result of the entity word corresponding to the placeholder, thereby obtaining the translation result of the original sentence.

[0076] In one embodiment, when combining the first translation result and the second translation result to obtain the translation result of the original sentence, the placeholder in the first translation result can be directly replaced with the entity word corresponding to the placeholder to obtain an intermediate result, and the intermediate result and the second translation result of each entity word are compared, and the entity word in the intermediate result is replaced with the second translation result to obtain the translation result of the original sentence.

[0077] It can be understood that in the embodiments of the present disclosure, the entity words of each original sentence in the chapter are replaced with placeholders, and the replacement sentences and entity words are translated respectively. Since the entity words are translated separately, they will not be affected by the context of the previous and next sentences, so the second translation result of the same entity word is unique. And when processing each sentence in the chapter, because the placeholders of different entity words in the sentence are different, the placeholders of the same entity words are the same, that is, in each sentence, the placeholders belonging to the same entity word are unique, so after the replacement sentence is translated to obtain the first translation result, when the placeholder in the first translation result is replaced with the second translation result corresponding to the entity word, the same entity words in different original sentences in the original chapter can have the same translation result, so this method can improve the consistency of the translation of entity words in the chapter and improve the user experience.

[0078] In one embodiment, the method further comprises:

[0079] Comparing the replacement statement with the first translation result to determine the missing placeholder in the first translation result;

[0080] Inputting the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation;

[0081] Inserting a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, and updating the first translation result;

[0082] Step S14 includes:

[0083] The updated first translation result and the second translation result are combined to obtain a translation result of the original sentence.

[0084] In this embodiment, due to the uncertainty of translation, some placeholders in the replacement sentence may be lost after translation, and errors may exist in the first translation result of the replacement sentence. In this regard, the present disclosure compares the first translation result with the replacement sentence to determine the missing part of the placeholders in the first translation result. The entity words corresponding to the missing placeholders are input into the translation model to obtain the second translation result.

[0085] As described above, the same entity words and placeholders have a unique correspondence relationship, so the missing placeholder uniquely corresponds to an entity word. The present disclosure inputs the replacement statement and the first translation result into the first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result. Among them, the first word alignment model is a word alignment model that aligns the words in the sentence before translation to the words in the sentence after translation, and this first word alignment model is a unidirectional word alignment model.

[0086] For example, the sentence corresponding to the language before translation is: The weather is really good today. The sentence corresponding to the language after translation is: theweather is very good today. The word correspondence relationship in the first word alignment model is: 0-5 1-0 1-1 2-3 3-4 4-6. Among them, 0-5 means that after being processed by the model, the 0th word "today" in Chinese is aligned with the 5th word "today" in English; the 1st word "weather" in Chinese is aligned with the 0th word "the" and the 1st word "weather" in English, and the remaining alignment relationships will not be elaborated.

[0087] After obtaining the corresponding position of the missing placeholder in the first translation result based on this word alignment model, the third translation result of the entity word corresponding to the missing placeholder can be inserted into the corresponding position in the first translation result to obtain the updated first translation result, and further combine the updated first translation result and the second translation result to obtain the translation result of the original sentence.

[0088] It can be understood that since entity words are generally more important in a sentence, if they are missing, it is very likely to cause problems such as the sentence being meaningless. In the embodiments of the present disclosure, considering the situation where placeholders are lost in the first translation result after translation, the word alignment model is used to insert the missing part in the first translation result, and then the first translation result and the second translation result are combined, so the phenomenon of entity word loss in the translation result of the original sentence can be reduced, and the translation accuracy can be improved.

[0089] In one embodiment, the method further includes:

[0090] Replacing the entity words in the first sentence for training and the entity words in the second sentence corresponding to the translated first sentence with the same placeholders; wherein, the placeholders for different entity words in the first sentence or the second sentence are different, and the placeholders for the entity words with the same meaning in the first sentence or the second sentence are the same;

[0091] Inputting the first sentence and the first sentence replaced with the placeholder into the neural network model, and adjusting the parameters in the neural network model according to the second sentence for representing the training label and the second sentence replaced with the placeholder to obtain the translation model.

[0092] In this embodiment, when training to obtain a translation model, a neural network model is used, and the first sentence without a placeholder and the first sentence replaced with a placeholder are used as training samples of the input model, and the translated second sentence corresponding to the first sentence and the second sentence replaced with the placeholder are used as training labels to adjust the training parameters of the model so that the model converges, thereby obtaining a translation model. Among them, the neural network model can be a convolutional neural network model (CNN), a recurrent neural network model (RNN) or a long short-term memory system (LSTM), etc., and the embodiments of the present disclosure do not limit this.

[0093] In one embodiment, when assigning placeholders to different entity words, the placeholders can be determined according to the allocation order of the placeholders. For example, the placeholder contains two parts, the first part is a fixed part, and the second part is the number of the allocation order. In this way, the placeholder allocation is simple and convenient, and it can ensure that the placeholder uniquely identifies an entity word. The first part is: "#¥#¥", and the second part can be the number of the allocation order, from 0 to 9. The number of the allocation order here can be restarted from 0 for different sentences. Of course, this is just an example of placeholder allocation, and the specific implementation is not limited to this.

[0094] In one embodiment, when training a translation model, on the one hand, it is necessary to rely on the dictionary provided by the user to translate the proprietary entity words. Because it is difficult for the user to add all the entity words to the user dictionary, this method of manually adding entity words cannot solve the problem of consistency in entity translation of large amounts of text, especially passages.

[0095] On the other hand, if a sentence contains multiple words that need to be replaced with placeholders, a serial number is added to each placeholder that appears in the sentence: the first placeholder that appears is $userdict1, and the second is $userdict2; the third and more word pairs in the user dictionary that appear in the same sentence are no longer added with distinguishing serial numbers, and are replaced by $userdict, that is, the placeholder number is limited and does not uniquely represent an entity word. It can be seen that this will result in more $userdict in the data and relatively fewer other placeholders. Therefore, the number of iterations when training each label is too different, which may lead to different success rates for different placeholders. If there are multiple placeholders $userdict in a piece of data, the above method may still fail to recognize. For example, if there are multiple different names in a sentence that are replaced by the placeholder $userdict, there is a possibility that different names will be recognized as the same name.

[0096] In contrast, in the training method of the present application, first, when obtaining entity words in the training samples, the named entity recognition tool can be used to automatically identify the entity words in the first sentence, so it has the characteristics of intelligence. Secondly, when constructing training data, the present disclosure has no restrictions on the number of placeholders and the specific placeholder numbers can be random. Each placeholder does not distinguish the order in which the entity words appear, and the meaning of the entity word corresponding to the placeholder is unique, so each placeholder can be trained more fully. And because the number of placeholders is not restricted, it can also support the situation where there are multiple entity words in a sentence. When there are many entity words, the translation model trained by the present disclosure can also obtain a translation result with higher accuracy.

[0097] It should be noted that, in this embodiment, since the training sentences also include the first sentence that is not replaced by the placeholder, when the sentence that is not replaced by the placeholder is input, the translation result can also be output through the trained translation model.

[0098] In one embodiment, replacing the entity words in the first sentence used for training and the entity words in the second sentence translated from the first sentence with the same placeholders includes:

[0099] Inputting the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other;

[0100] If the word alignment result indicates that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholder.

[0101] In this embodiment, the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholder using the second word alignment model.

[0102] The second word alignment model is an alignment model in which words in a language before translation and words in a language after translation are aligned with each other. The second word alignment model is a bidirectional word alignment model.

[0103] It can be understood that in this embodiment, when constructing training data, the method of using the word alignment results of entity words between the language before translation (source language) and the language after translation (target language) to mark both ends is simpler and more time-saving. In addition, because the entity words in the first sentence and the second sentence are replaced with the same placeholder, the model can also learn the consistent characteristics of the placeholders in the source language and the target language during the training process.

[0104] In one embodiment, step S12 includes:

[0105] The entity words whose word frequency among the entity words is greater than a preset frequency are replaced with the placeholders for the original sentences in the passage to obtain the replacement sentences containing the placeholders.

[0106] In this embodiment, entity words with a frequency greater than a preset frequency are replaced with placeholders in the original sentence in the passage, thereby obtaining a replacement sentence containing the placeholder. Because only when the frequency of entity words is high will the translation results of the same entity word in the passage be inconsistent, the present disclosure replaces entity words with a frequency greater than a preset frequency by setting a preset frequency, which can reduce the processing process and improve efficiency.

[0107] In one embodiment, the method further comprises:

[0108] If the passage does not include entity words with a frequency greater than a preset frequency, the original sentence is input into the translation model to obtain a translation result of the original sentence.

[0109] As mentioned above, when a sentence without placeholder replacement is input, the translation model can also output a translation result. Therefore, in this embodiment, when the passage does not include entity words with a frequency greater than a preset frequency, the original sentence is input into the translation model to obtain a translation result of the original sentence.

[0110] Figure 2 is an example flow chart of a method for machine translation of a passage shown in an embodiment of the present disclosure, such as Figure 2 As shown, the paragraph machine translation method applied to the electronic device also includes the following steps:

[0111] S101. Input the chapter to be translated.

[0112] S102, performing named entity recognition on the input passage.

[0113] In this embodiment, named entity recognition is performed on the input passage, that is, the parts of speech of words in the passage are recognized, and at least the entity words in the passage are determined.

[0114] S103. Construct a chapter-level high-frequency entity dictionary.

[0115] In this embodiment, a chapter-level high-frequency entity dictionary is constructed, that is, entity words whose frequency is greater than a preset frequency are determined.

[0116] S104: Are there any high-frequency named entities? If so, execute step S105; if not, execute step S111.

[0117] In this embodiment, when there is an entity word with a frequency greater than a preset frequency, step S105 is executed, otherwise, the original sentence in the passage is directly translated and step S111 is executed.

[0118] S105. Replace different named entities in the sentence with different placeholders.

[0119] In this embodiment, when there are entity words with a frequency greater than a preset frequency, different named entities in the sentence are replaced with different placeholders, that is, entity words with a frequency greater than a preset frequency among entity words are replaced with placeholders for the original sentences in the passage, and replacement sentences containing placeholders are obtained. Among them, the placeholders of different entity words are different, and the placeholders of entity words with the same meaning in different sentences are the same.

[0120] S106, separately translate the replaced sentences and the extracted entity words and combine them.

[0121] In this embodiment, the replaced sentence and the extracted entity words are translated separately, that is, the replaced sentence and the entity words extracted from the original sentence are input into the translation model respectively to obtain a first translation result of the replaced sentence and a second translation result of the entity words.

[0122] After the replaced sentence and the extracted entity words are translated separately, the first translation result and the second translation result can be combined to obtain the translation result of the original sentence.

[0123] S107: Does the translation result of the sentence contain all replaced placeholders? If so, execute step S110; if not, execute step S108.

[0124] In this embodiment, it is further determined whether the translation result of the sentence contains all replaced placeholders, that is, whether there are missing placeholders in the first translation result. If there are missing placeholders, step S108 is executed; if there are no missing placeholders, that is, all placeholders are included, step S110 is executed.

[0125] S108: word alignment of the source language and the translation result.

[0126] In this embodiment, if the translation result of the sentence does not contain all replaced placeholders (there are missing placeholders), the source language and the translation result are word-aligned, that is, the replacement sentence and the first translation result are input into the first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result.

[0127] S109: Insert the entity word translation corresponding to the missing placeholder in front of the corresponding position.

[0128] In this embodiment, the entity word translation corresponding to the missing placeholder is inserted in front of the corresponding position, and the translation result of the sentence is updated, that is, the second translation result of the entity word corresponding to the missing placeholder is inserted into the position where the missing placeholder is located in the first translation result, and the first translation result is updated.

[0129] S110, combining the translation result of the sentence and the translation result of the extracted entity word.

[0130] In this embodiment, the translation result of the sentence and the translation result of the extracted entity word are combined, that is, the placeholder part in the first translation result is replaced with the second translation result of the entity word corresponding to the placeholder, thereby obtaining the translation result of the original sentence.

[0131] S111. Output translation results.

[0132] In this embodiment, translation results can be obtained and output for both passages with high-frequency entity words and passages without high-frequency entity words.

[0133] It can be understood that in the embodiments of the present disclosure, the high-frequency entity words in each original sentence in the chapter are replaced with placeholders, and the replacement sentences and entity words are translated respectively. Since the entity words are translated separately, they will not be affected by the context of the previous and next sentences. Therefore, by combining the translation results of the sentences and the translation results of the separate entity words, the same entity words in different original sentences in the original chapter can have the same translation results. Therefore, this method can improve the consistency of the translation of entity words in the chapter and improve the user experience.

[0134] Figure 3 FIG. 1 is a diagram showing a machine translation device for a text according to an exemplary embodiment. Figure 3 , the machine translation device of this chapter includes:

[0135] A recognition module 101 is configured to recognize entity words in a text;

[0136] A first replacement module 102 is configured to replace the original sentence in the passage with the placeholder of the entity word to obtain a replacement sentence containing the placeholder, wherein the placeholders of different entity words are different;

[0137] A first translation module 103 is configured to input the replacement sentence and the entity word extracted from the original sentence into a translation model respectively, to obtain a first translation result of the replacement sentence and a second translation result of the entity word;

[0138] The combining module 104 is configured to combine the first translation result and the second translation result to obtain a translation result of the original sentence.

[0139] Optionally, the device further comprises:

[0140] A determination module 105, configured to compare the replacement statement with the first translation result to determine a missing placeholder in the first translation result;

[0141] The obtaining module 106 is configured to input the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation;

[0142] An updating module 107, configured to insert a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, so as to update the first translation result;

[0143] The combining module 104 is configured to combine the updated first translation result and the second translation result to obtain a translation result of the original sentence.

[0144] Optionally, the device further comprises:

[0145] A second replacement module 108 is configured to replace the entity words in the first sentence used for training and the entity words in the second sentence after translation corresponding to the first sentence with the same placeholder; wherein the placeholders of different entity words in the first sentence or the second sentence are different, and the placeholders of the entity words with the same meaning in the first sentence or the second sentence are the same;

[0146] The training module 109 is configured to input the first sentence and the first sentence replaced with the placeholder into the neural network model, adjust the parameters in the neural network model according to the second sentence used to represent the training label and the second sentence replaced with the placeholder, and obtain the translation model.

[0147] Optionally, the second replacement module 108 is specifically configured to input the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other; if the word alignment result represents that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, then the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholders.

[0148] Optionally, the first replacement module 102 is specifically configured to replace the original sentence in the passage with the placeholder for the entity words whose frequency among the entity words is greater than a preset frequency, so as to obtain the replacement sentence containing the placeholder.

[0149] Optionally, the device further comprises:

[0150] The second translation module 110 is configured to input the original sentence into the translation model to obtain a translation result of the original sentence if the passage does not include entity words with a frequency greater than a preset frequency.

[0151] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0152] Figure 4 8 is a block diagram of a device 800 for machine translation of a text according to an exemplary embodiment. For example, the device 800 may be a mobile phone or the like.

[0153] Reference Figure 4 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0154] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0155] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0156] The power component 806 provides power to the various components of the device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0157] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0158] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0159] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0160] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0161] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0162] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0163] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0164] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a terminal, enables a computer to perform a text machine translation method, the method comprising:

[0165] Identify entity words within a text;

[0166] The entity words are replaced with placeholders for original sentences in the passage to obtain replacement sentences containing the placeholders, wherein the placeholders for different entity words are different;

[0167] Inputting the replacement sentence and the entity word extracted from the original sentence into a translation model respectively to obtain a first translation result of the replacement sentence and a second translation result of the entity word;

[0168] The first translation result and the second translation result are combined to obtain a translation result of the original sentence.

[0169] Figure 5 2 is a block diagram of another apparatus 900 for machine translation of a text according to an exemplary embodiment. For example, the apparatus 900 may be a server or the like.

[0170] Reference Figure 5 The apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions, such as an application, that can be executed by the processing component 922. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute instructions to perform the above-mentioned information processing method.

[0171] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0172] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0173] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for machine translation of a text, characterized in that: The method comprises: Identify entity words within a text; The entity words are replaced with placeholders for original sentences in the passage to obtain replacement sentences containing the placeholders, wherein different entity words have different placeholders, the same entity words have a unique corresponding relationship with the placeholders, and the placeholders allocated to different entity words are determined according to the allocation order of the placeholders; Inputting the replacement sentence and the entity word extracted from the original sentence into a translation model respectively to obtain a first translation result of the replacement sentence and a second translation result of the entity word; The first translation result and the second translation result are combined to obtain a translation result of the original sentence.

2. The method according to claim 1, characterized in that The method further comprises: Comparing the replacement statement with the first translation result to determine the missing placeholder in the first translation result; Inputting the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation; Inserting a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, and updating the first translation result; The combining the first translation result and the second translation result to obtain the translation result of the original sentence includes: The updated first translation result and the second translation result are combined to obtain a translation result of the original sentence.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Replace the entity words in the first sentence used for training and the entity words in the second sentence translated from the first sentence with the same placeholder; wherein the placeholders of different entity words in the first sentence or the second sentence are different, and the placeholders of the entity words with the same meaning in the first sentence or the second sentence are the same; The first sentence and the first sentence replaced with the placeholder are input into a neural network model, and the parameters in the neural network model are adjusted according to the second sentence used to represent the training label and the second sentence replaced with the placeholder to obtain the translation model.

4. The method according to claim 3, characterized in that The replacing the entity words in the first sentence for training and the entity words in the second sentence after translation corresponding to the first sentence with the same placeholders includes: Inputting the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other; If the word alignment result indicates that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholder.

5. The method according to claim 1, characterized in that The step of replacing the original sentence in the passage with the placeholder for the entity word to obtain a replacement sentence containing the placeholder includes: The entity words whose word frequency among the entity words is greater than a preset frequency are replaced with the placeholders for the original sentences in the passage to obtain the replacement sentences containing the placeholders.

6. The method according to claim 5, characterized in that The method further comprises: If the passage does not include entity words with a frequency greater than a preset frequency, the original sentence is input into the translation model to obtain a translation result of the original sentence.

7. A text machine translation device, characterized in that: The device comprises: A recognition module configured to recognize entity words within a text; A first replacement module is configured to replace the original sentence in the passage with the placeholder of the entity word to obtain a replacement sentence containing the placeholder, wherein the placeholders of different entity words are different, the same entity word has a unique corresponding relationship with the placeholder, and the placeholders allocated to different entity words are determined according to the allocation order of the placeholders; A first translation module is configured to input the replacement sentence and the entity word extracted from the original sentence into a translation model respectively, to obtain a first translation result of the replacement sentence and a second translation result of the entity word; The combining module is configured to combine the first translation result and the second translation result to obtain a translation result of the original sentence.

8. The device according to claim 7, characterized in that The device also includes: a determination module configured to compare the replacement statement with the first translation result to determine a missing placeholder in the first translation result; An obtaining module is configured to input the replacement sentence and the first translation result into a first word alignment model to obtain the corresponding position of the missing placeholder in the first translation result; wherein the first word alignment model is an alignment model of the words in the sentence before translation corresponding to the words in the sentence after translation; An updating module, configured to insert a second translation result of the entity word corresponding to the missing placeholder into the corresponding position in the first translation result, so as to update the first translation result; The combining module is configured to combine the updated first translation result and the second translation result to obtain a translation result of the original sentence.

9. The device according to claim 7 or 8, characterized in that The device also includes: A second replacement module is configured to replace the entity words in the first sentence used for training and the entity words in the second sentence translated from the first sentence with the same placeholder; wherein the placeholders of different entity words in the first sentence or the second sentence are different, and the placeholders of the entity words with the same meaning in the first sentence or the second sentence are the same; The training module is configured to input the first sentence and the first sentence replaced by the placeholder into a neural network model, adjust the parameters in the neural network model according to the second sentence used to represent the training label and the second sentence replaced by the placeholder, and obtain the translation model.

10. The device according to claim 9, characterized in that The second replacement module is specifically configured to input the first sentence and the second sentence into a second word alignment model to obtain a word alignment result; wherein the second word alignment model is an alignment model in which words in a sentence before translation and words in a sentence after translation are aligned with each other; if the word alignment result represents that the entity words in the first sentence and the entity words in the second sentence are aligned with each other, then the entity words in the first sentence and the entity words in the second sentence are replaced with the same placeholders.

11. The device according to claim 7, characterized in that The first replacement module is specifically configured to replace the original sentence in the passage with the placeholder for the entity words whose frequency among the entity words is greater than a preset frequency, so as to obtain the replacement sentence containing the placeholder.

12. The device according to claim 11, characterized in that The device also includes: The second translation module is configured to input the original sentence into the translation model to obtain a translation result of the original sentence if the passage does not include entity words with a frequency greater than a preset frequency.

13. A text machine translation device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the text machine translation method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of a computer, the computer is enabled to execute the text machine translation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Translation processing method and device

    CN106250375A

  • Neural machine translation model training method and neural machine translation method and device

    CN111539229A