A machine translation method, apparatus and terminal device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-12
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]本发明的主要目的在于提出一种机器翻译方法、装置及终端设备,解决传统的机器翻译不能使译文样式与原文样式一致,影响翻译效果的问题
Smart Images

Figure CN116205243B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine translation technology, and in particular to a machine translation method, apparatus, and terminal device. Background Technology
[0002] Compared to human translation, machine translation has the advantages of high efficiency, wide language support, and no restrictions on file formats. However, current machine translation still cannot meet all users' translation needs.
[0003] The general process of machine translation is: file parsing, translation, style adjustment, and file restoration. Style adjustment is to ensure that the style of the translated text is consistent with that of the original text. For example, if a word in the original text is bolded, then the word in the translated text should also be bolded. If the above style adjustment is not made, on the one hand, the key marks in the translated text will be lost, and on the other hand, it will affect the comparative reading of the original text and the translated text. Summary of the Invention
[0004] The main objective of this invention is to propose a machine translation method, apparatus, and terminal device to solve the problem that traditional machine translation cannot make the translated text style consistent with the original text style, thus affecting the translation effect.
[0005] To achieve the above objectives, the first embodiment of the present invention provides a machine translation method, comprising: The original text to be translated is translated using a syntax parser to obtain the translated text. Identify text portions with unique styles in the original text to be translated; The text portion is translated, and the same translated words are searched in the translated text based on the translation results. When searching for the same translated words in the translated text, function words are combined forward and backward to obtain expanded words. The extended words are translated and then sequentially replaced into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text portion, the original extended words replaced into the original text to be translated are the target replacement words. Replace the translated words contained in the target replacement words into the translation, and make them have the same individual style as the text portion.
[0006] In conjunction with the first aspect of the present invention, in the first embodiment of the present invention, translating the original text to be translated using a syntax parser includes: Identify the target language of the original text to be translated; Obtain a syntax parser suitable for the target language to translate the original text.
[0007] In conjunction with the first aspect of the present invention, in the second embodiment of the present invention, translating the text portion includes: Obtain multiple types of translation results based on the text portion using translation tools; The types include at least tense types and common word types.
[0008] In conjunction with the first aspect of the present invention, in the third embodiment of the present invention, searching for identical translated words in the translated text based on the translation results includes: The translation result and the translated text have the same semantic meaning.
[0009] In conjunction with the first aspect of the present invention, in the fourth embodiment of the present invention, matching the translated extended words of the original text to be translated with the text portion includes: Content word matching and function word matching.
[0010] In conjunction with the first aspect of the present invention, in the fifth embodiment of the present invention, replacing the translated words contained in the target replacement word into the translated text, and making them have the same individual style as the text portion, includes: The displacement of the text portion within the original text to be translated is obtained by index positioning; The position information of the translated words contained in the target replacement word in the translation is located based on the displacement amount; Based on the location information, the translated words contained in the target replacement word are replaced in the translation, and the format of the translated words contained in the target replacement word is converted into a separate style that is the same as that of the text portion.
[0011] In conjunction with the fifth embodiment of the first aspect of the present invention, in the sixth embodiment of the present invention, converting the format of the translated words contained in the target replacement word into a separate style that is the same as the text portion includes: Add position tags to the translated text; Edit the mapping relationship between the location information and the location label on the location label; Based on the mapping relationship, the target replacement words in the translation are added with the same individual style as the text portion.
[0012] A second aspect of the present invention provides a machine translation apparatus, comprising: The first translation module is used to translate the original text to be translated using a syntax parser to obtain the translated text. The style recognition module is used to identify text portions in the original text to be translated that have unique styles; The second translation module is used to translate the text portion and search for identical translated words in the translated text based on the translation results. When searching for identical translated words in the translated text, the module combines function words forward and backward to obtain expanded words. The matching module is used to translate the extended words and replace them sequentially into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text part, the original extended words replaced into the original text to be translated are the target replacement words. The style adjustment module is used to replace the translated words contained in the target replacement words into the translation and make them have the same individual style as the text part.
[0013] A third aspect of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method provided in the first aspect above.
[0014] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method provided in the first aspect above.
[0015] This invention employs a positive and negative matching method. Positive matching locates text portions with unique styles in the original text to be translated and translates them, finding all matching texts in the translation results. Negative matching iterates through the results obtained in the positive matching, and upon successful matching, identifies words or sentences in the translation that should have the same unique style as the text portion, thereby completing style adjustments to ensure that the style of the translation matches the style of the original text, guaranteeing that the translation and the original text have the same reading effect. Attached Figure Description
[0016] Figure 1 A schematic diagram illustrating the implementation process of the machine translation method provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the composition of the machine translation device provided in an embodiment of the present invention.
[0017] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0019] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0020] In this document, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and do not have any specific meaning in themselves. Therefore, "module" and "part" can be used interchangeably.
[0021] like Figure 1 As shown, embodiments of the present invention provide a machine translation method, including but not limited to the following steps: S101. The original text to be translated is translated using a syntax parser to obtain the translation.
[0022] In step S101 above, the syntax parser is a syntax repository implemented using big data and machine learning. The syntax parser can identify various grammatical components in the output word string based on the provided word stream and the grammatical rules of the programming language. Different languages have different grammars. Therefore, during translation, it is necessary to obtain the corresponding syntax parser for each language and translate the input content according to the grammar of the corresponding language.
[0023] In one embodiment, one implementation of step S101 includes: Identify the target language of the original text to be translated; Obtain a syntax parser suitable for the target language to translate the original text.
[0024] S102. Identify text portions with unique styles in the original text to be translated.
[0025] In step S102 above, the identification of text parts with unique styles can be achieved through image recognition or by parsing file formats. This embodiment of the invention does not limit the specific methods used.
[0026] In practical applications, a passage or word in the original text to be translated may appear repeatedly. When the passage or word is a text part with a unique style, it may only appear in one place, while it appears in the regular style elsewhere.
[0027] For example: using Iteration The iterative relaxation method serves as the core algorithm for achieving structure coverage. Test cases Automatic generation.
[0028] In the above text, the word "iteration" appears twice, but only once with a single style. In this embodiment of the invention, after translation, only the iteration in "iterative relaxation method" has a single style.
[0029] S103. Translate the text portion and search for identical translated words in the translated text based on the translation results. When searching for identical translated words in the translated text, combine function words forward and backward to obtain extended words. In step S103 above, translating the text portion includes: Obtain multiple types of translation results based on the text portion using translation tools; The types include at least tense types and common word types.
[0030] In this embodiment of the invention, a translation tool is used to translate the text to obtain more translation results and avoid situations where the same translated words cannot be found in the translated text.
[0031] As illustrated in the example above, "utilization" Iteration The iterative relaxation method serves as the core algorithm for achieving structure coverage. test use cases "Automatic generation" The iterations and test cases are textual components, and translation tools can provide at least the following translation results: Iteration: iterative -> The iterative; Test cases: test cases -> test cases; According to its translation: "The iteration of iterative relaxation method is used as the core algorithm to realize the automatic generation of structural coveragetest cases" When searching for identical words in the translation for "iterative," combining function words both before and after the target word yields the following expanded vocabulary: The first iterative -> The iteration of; The second iterative relaxation method is; In one embodiment, function words are combined forward and backward until a non-content word is encountered.
[0032] S104. The extended words are translated and then sequentially replaced into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text portion, the original extended words replaced into the original text to be translated are the target replacement words.
[0033] In step S104 above, the translated extended words that replace the original text to be translated are matched with the text portion, including: Content word matching and function word matching.
[0034] For example, the expanded words, after translation, are: The iteration of ->; The iterative relaxation method is... When we replace these words in the original text to be translated, the former matches the second “iteration” and the latter matches the first “iteration”, meaning the latter matches the text portion. Therefore, “of iterative relaxation method is” is the target replacement word.
[0035] S105. Replace the translated words contained in the target replacement words into the translation, and make them have the same individual style as the text part.
[0036] In this embodiment of the invention, the target replacement word includes the translated word "iterative" in "of iterative relaxation method is".
[0037] Steps S101 to S105 above include two processes: positive matching and negative matching. Positive matching, as steps S101 to S103, locates source text with specific patterns, translates as much text as possible using machine translation software, and finds all matching text in the translated text. Negative matching, as steps S014 and S015, iterates through the results obtained in positive matching, matching the context as far forward and backward as possible (until non-content words are encountered), then uses machine translation software to translate the obtained results and finds matching text in the source text.
[0038] This embodiment of the invention adds individual styles to the text in the translation by index positioning. Specifically, in step S105 above, the translated words contained in the target replacement word are replaced into the translation, and they are made to have the same individual style as the text portion. This includes: The displacement of the text portion within the original text to be translated is obtained by index positioning; The position information of the translated words contained in the target replacement word in the translation is located based on the displacement amount; Based on the location information, the translated words contained in the target replacement word are replaced in the translation, and the format of the translated words contained in the target replacement word is converted into a separate style that is the same as that of the text portion.
[0039] The process of converting the format of the translated words contained in the target replacement words into a separate style identical to the text portion includes: Add position tags to the translated text; Edit the mapping relationship between the location information and the location label on the location label; Based on the mapping relationship, add the same individual style as the text portion to the translated words contained in the target replacement word in the translated text.
[0040] like Figure 2 As shown, this embodiment of the invention also provides a machine translation device 20, comprising: The first translation module 21 is used to translate the original text to be translated using a syntax parser to obtain the translation; The style recognition module 22 is used to identify text portions with unique styles in the original text to be translated; The second translation module 23 is used to translate the text portion and search for identical translated words in the translated text based on the translation results. When searching for identical translated words in the translated text, function words are combined forward and backward to obtain extended words. The matching module 24 is used to translate the extended words and replace them sequentially into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text part, the original extended words replaced into the original text to be translated are the target replacement words. The style adjustment module 25 is used to replace the translated words contained in the target replacement words into the translation and make them have the same individual style as the text part.
[0041] This invention also provides a terminal device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the machine translation method described in the above embodiments.
[0042] This invention also provides a storage medium, which is a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the various steps of the machine translation method described in the above embodiments.
[0043] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the foregoing embodiments have described the present invention in detail, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A machine translation method, characterized in that, include: S101. The original text to be translated is translated using a syntax parser to obtain the translation. S102. Identify text portions with unique styles in the original text to be translated; S103. Translate the text portion and search for identical translated words in the translated text based on the translation results. When searching for identical translated words in the translated text, combine function words forward and backward to obtain extended words. S104. The extended words are translated and then sequentially replaced into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text part, the original extended words replaced into the original text to be translated are the target replacement words. S105. Replace the translated words contained in the target replacement words into the translation, and make them have the same individual style as the text part; Steps S101 to S105 include two processes: positive matching and negative matching. Positive matching corresponds to steps S101 to S103, where the source text with a special style is located, and the translation of the text is completed using machine translation software. All matching texts are then found in the translated text. Negative matching corresponds to steps S104 to S105, where the results obtained in positive matching are traversed, and the context is matched forward and backward until a non-content word is encountered. The obtained results are then translated using machine translation software, and matching texts are found in the source text.
2. The machine translation method as described in claim 1, characterized in that, The original text to be translated is translated using a syntax parser, including: Identify the target language of the original text to be translated; Obtain a syntax parser suitable for the target language to translate the original text.
3. The machine translation method as described in claim 1, characterized in that, Translating the aforementioned text includes: Obtain multiple types of translation results based on the text portion using translation tools; The types include at least tense types and common word types.
4. The machine translation method as described in claim 1, characterized in that, Based on the translation results, find identical translated words in the translated text, including: The translation result and the translated text have the same semantic meaning.
5. The machine translation method as described in claim 1, characterized in that, The translated expanded words that replace the original text to be translated are matched with the text portion, including: Content word matching and function word matching.
6. The machine translation method as described in claim 1, characterized in that, The translation words contained in the target replacement words are replaced into the translation, and they are made to have the same individual style as the text portion, including: The displacement of the text portion within the original text to be translated is obtained by index positioning; The position information of the translated words contained in the target replacement word in the translation is located based on the displacement amount; Based on the location information, the translated words contained in the target replacement word are replaced in the translation, and the format of the translated words contained in the target replacement word is converted into a separate style that is the same as that of the text portion.
7. The machine translation method as described in claim 6, characterized in that, Converting the format of the translated words contained in the target replacement words to the same separate style as the text portion includes: Add position tags to the translated text; Edit the mapping relationship between the location information and the location label on the location label; Based on the mapping relationship, add the same individual style as the text portion to the translated words contained in the target replacement word in the translated text.
8. A machine translation apparatus for implementing the machine translation method of claim 1, characterized in that, include: The first translation module is used to translate the original text to be translated using a syntax parser to obtain the translated text. The style recognition module is used to identify text portions in the original text to be translated that have unique styles; The second translation module is used to translate the text portion and search for identical translated words in the translated text based on the translation results. When searching for identical translated words in the translated text, the module combines function words forward and backward to obtain expanded words. The matching module is used to translate the extended words and replace them sequentially into the original text to be translated. When the translated extended words replaced into the original text to be translated match the text part, the original extended words replaced into the original text to be translated are the target replacement words. The style adjustment module is used to replace the translated words contained in the target replacement words into the translation and make them have the same individual style as the text part.
9. A terminal device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the steps of the machine translation method as described in any one of claims 1 to 7.
10. A storage medium, said storage medium being a computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements each step of the machine translation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Translation error identification method and device, computer equipment and readable storage medium
CN112667208A
Techniques for translating documents including tags
US8825469B1