Text translation method and device, equipment and storage medium

By obtaining matching translation corpus that matches the grammatical structure of the text to be translated and generating prompt text to indicate the translation model, the problem of insufficient translation accuracy of text in the prior art is solved, and a higher quality translation result is achieved.

CN119514562APending Publication Date: 2025-02-25IFLYTEK CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411424535.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing text translation methods are not highly accurate enough when dealing with text with complex syntax structures.

Method used

By obtaining a matching translation corpus that matches the grammatical structure of the text to be translated, a prompt text containing the text to be translated and the matching translation corpus is generated, and the prompt text is input into the translation model to instruct the translation model to refer to the matching translation corpus to output the translation result corresponding to the text to be translated.

Benefits of technology

Improves the accuracy of translation, especially when dealing with text with complex syntactic structures, making the translation quality of generated translated texts better.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514562A_ABST
    Figure CN119514562A_ABST
Patent Text Reader

Abstract

The invention discloses a text translation method and device, equipment and a storage medium. The method comprises the steps of obtaining a matched translation corpus matched with a grammatical structure of a to-be-translated text; generating a prompt text containing the to-be-translated text and the matched translation corpus; and inputting the prompt text into a translation model to indicate the translation model to output a translation result corresponding to the to-be-translated text by referring to the matched translation corpus. Through the method, the translation accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing, and in particular to a text translation method, apparatus, device and storage medium. Background Art

[0002] Text translation can convert the input text into a translation text in the language specified by the user. However, although general text translation methods can generate translation texts, they are still insufficient in handling the translation of texts with complex grammatical structures. This process is often limited to the generation of simple text to translation text, ignoring the complex grammatical structure contained in the text input by the user, making the translation accuracy not high enough. Summary of the invention

[0003] The main technical problem solved by the present application is to provide a text translation method, device, equipment and storage medium, which can improve the accuracy of translation.

[0004] In order to solve the above technical problems, a technical solution adopted by the present application is: to provide a text translation method, the method comprising: obtaining a matching translation corpus that matches the grammatical structure of the text to be translated; generating a prompt text containing the text to be translated and the matching translation corpus; inputting the prompt text into a translation model to instruct the translation model to output a translation result corresponding to the text to be translated with reference to the matching translation corpus.

[0005] In order to solve the above technical problems, another technical solution adopted by the present application is: to provide an interactive device, including: a translation corpus acquisition module, used to acquire a matching translation corpus that matches the grammatical structure of the text to be translated; a prompt text generation module, used to generate a prompt text containing the text to be translated and the matching translation corpus; a translation text generation module, used to input the prompt text into a translation model to instruct the translation model to refer to the matching translation corpus to output a translation result corresponding to the text to be translated.

[0006] In order to solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, including a memory and a processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the above text translation method.

[0007] In order to solve the above technical problems, another technical solution adopted by the present application is: providing a computer-readable storage medium, which is used to store program instructions, and the program instructions can be executed to implement the above text translation method.

[0008] The above scheme generates a translation text corresponding to the matching translation corpus and a prompt text of the matching translation corpus by obtaining a matching translation corpus that matches the grammatical structure of the translation text. The prompt text is input into the translation model to instruct the translation model to output the translation result corresponding to the text to be translated with reference to the matching translation corpus. This process enables the translation model to refer to the matching translation corpus, so that when translating the text, it can more accurately process the complex grammatical structure, so that the translation quality of the generated translation text is better, thereby improving the accuracy of the translation. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 It is a flowchart of an embodiment of a text translation method provided by the present application;

[0010] Figure 2 is a schematic diagram of a set of sample texts input into a translation model provided by the present application;

[0011] Figure 3 It is a flowchart of another embodiment of the text translation method provided by the present application;

[0012] Figure 4 This is a schematic diagram of a prompt text generation process provided by this application;

[0013] Figure 5 It is a schematic diagram of the prompt text display provided by this application;

[0014] Figure 6 It is a schematic diagram of the framework of an embodiment of the text translation device of the present application;

[0015] Figure 7 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;

[0016] Figure 8 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and effect of the present application clearer and more specific, the present application is further described in detail below with reference to the accompanying drawings and examples.

[0018] It should be noted that the term "several" in this article means at least one, and the terms "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. The term "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of types. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0019] See also Figure 1 , Figure 1 1 is a flowchart of an embodiment of a text translation method provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not use Figure 1 The method of this embodiment is executed by a text translation device, which can be any device with processing capabilities, such as a computer, a mobile phone, a server, etc. Figure 1 As shown, this embodiment includes:

[0020] Step S11: Acquire a matching translation corpus that matches the grammatical structure of the text to be translated.

[0021] The text to be translated may be provided by the target user or determined by the text translation device itself. Specifically, the text translation device may be provided with a human-computer interaction interface, and the text to be translated input by the user may be obtained through the human-computer interaction interface. Of course, in other embodiments, the text translation device has a communication module, and the text translation device receives the text to be translated sent by the terminal device through the communication module. The terminal device has a human-computer interaction function, and the user uses the human-computer interaction function to input the text to be translated to be sent to the speech synthesis device on the terminal device.

[0022] The matching translation corpus herein may be the corresponding reference translation corpus stored in the reference corpus pool. In one embodiment, the reference translation corpus may include an academic translation text for a reference academic text, or a translation text of a reference text.

[0023] In the process of grammatical structure matching, grammatical structure matching can be performed between texts of the same or different languages ​​to analyze the similarities and differences of grammatical structures. In one embodiment, grammatical structure matching is performed using texts of the same language, that is, the matching translation corpus can include a reference text of the same language as the text to be translated and a corresponding translation text of the specified language of the reference text. The specified language can be English, German, etc., which is not limited here. Grammatical structure matching is performed using the reference text of the same language as the text to be translated in the matching translation corpus.

[0024] In a specific embodiment, the matching translation corpus is the corresponding reference translation corpus stored in the reference corpus pool. The corresponding matching translation corpus can be determined by obtaining a reference text that matches the grammatical structure of the text to be translated. Specifically, this step S11 includes: obtaining the first grammatical structure feature of the text to be translated. Obtain the similarity between the first grammatical structure feature and the second grammatical structure feature of each reference text in the reference corpus pool, wherein the reference corpus pool includes a number of reference translation corpora, and each reference translation corpus can include a reference text and a corresponding translation text. The reference text whose similarity meets the matching requirements is used as the matching text, and the reference translation corpus containing the matching text is used as the matching translation corpus. Among them, the first grammatical structure feature of the text to be translated and the second grammatical structure feature of the reference text can be obtained by the same or different methods. The matching translation corpus that matches the grammatical structure of the text to be translated can be one or more.

[0025] The first grammatical structure feature represents the grammatical structure information in the text to be translated, and the second grammatical structure feature represents the grammatical structure information of the reference text in the matching translation corpus. In a specific implementation, the grammatical structure information can be processed using at least one of dependency syntax analysis, phrase structure analysis, feature engineering, distributed representation learning, and neural network to obtain the first grammatical structure feature or the second grammatical structure feature.

[0026] In another specific implementation, the grammatical structure information corresponding to the first grammatical structure feature and the grammatical structure information corresponding to the second grammatical structure feature are obtained in the same manner. For example, at least one of word segmentation analysis, part-of-speech tagging, dependency syntax analysis, and syntax tree construction can be used to extract the grammatical structure information in the text to be translated or match the translation corpus.

[0027] In another specific embodiment, a similarity matching standard can be set to determine the matching translation corpus. Specifically, the similarity meeting the matching requirement can be defined as the similarity being higher than a preset threshold, which can be set according to actual needs and the characteristics of the reference corpus pool to ensure that the selected reference text has sufficient similarity with the text to be translated in terms of grammatical structure, or directly select the reference translation corpus corresponding to the reference text with the highest similarity as the most matching translation corpus.

[0028] Take the acquisition of matching translation corpus as an example. For example, the text to be translated is "With the in-depth study of the pathological mechanism of sepsis, sepsis is defined as a life-threatening organ dysfunction caused by the host's dysregulated immune response to infection", and the reference text corresponding to the reference translation corpus is "With the in-depth study of uremia, uremia is defined as a syndrome of a series of clinical symptoms and metabolic disorders caused by chronic renal failure" and "Uremia is a very serious disease characterized by the accumulation of excessive urea and other waste substances in the body". The similarity between the first grammatical structure feature of the text to be translated and the second grammatical structure text feature of the reference text corresponding to each reference translation corpus is calculated. When the second grammatical structure feature corresponding to "With the in-depth study of uremia, uremia is defined as a syndrome of a series of clinical symptoms and metabolic disorders caused by chronic renal failure" has the greatest similarity with the first grammatical structure feature, "With the in-depth study of uremia, uremia is defined as a syndrome of a series of clinical symptoms and metabolic disorders caused by chronic renal failure" and the translation text corresponding to the reference text are used as matching translation corpus.

[0029] Step S12: Generate a prompt text including the text to be translated and the matching translation corpus.

[0030] The prompt text in this article can be generated by concatenating or associating the text to be translated and the matching translation corpus. The concatenation or association here does not mean directly merging the two into an inseparable text unit, but rather linking the text to be translated and the matching translation corpus together in some way so that the target user can see the text to be translated and the matching translation corpus at the same time.

[0031] The reference text and the corresponding translation text in the matching translation corpus herein generally refer to sentences or chapters. In one embodiment, the translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated. Before generating the prompt text, the translation pair matching the text to be translated can also be obtained in the constructed academic dictionary, that is, the translation result with higher translation quality can be generated by matching the combination of the translation corpus and the translation pair. Specifically, before step S12, it also includes: finding out the academic translation word matching at least one word in the text to be translated from the academic dictionary, wherein the word and the corresponding academic translation word constitute the academic translation pair.

[0032] In a specific implementation, the academic translation words matching the text to be translated can be obtained by performing word segmentation analysis or part-of-speech tagging on the text to be translated. For example, the step of obtaining the academic translation words includes: performing word segmentation on the text to be translated to obtain a number of words; for each word, searching for an academic word matching the word from an academic dictionary, and in response to finding an academic word matching the word, obtaining an academic translation word corresponding to the matching academic word from the academic dictionary as the academic translation word matching the word.

[0033] For example, the text to be translated is segmented in the form of subject, predicate and object. The segmentation results are analyzed to identify and extract those words with specific field knowledge or high professionalism. Academic words with similar or identical semantics to the word are searched in the dictionary. The word and the academic translation word corresponding to the academic word form a translation pair. For example, the text to be translated is "With the in-depth study of the pathological mechanism of sepsis, sepsis is defined as a life-threatening organ dysfunction caused by the host's dysregulated immune response to infection." The text to be translated is segmented, and the words obtained are "sepsis, pathological mechanism, immune response, organ dysfunction", etc. The academic word with the same semantics as the word "sepsis" is found in the dictionary, and the corresponding academic translation word is "sepsis". Then the reference translation pair consisting of sepsis and sepsis is used as a translation pair.

[0034] In another specific embodiment, the translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated. When matching translation words and matching translation corpus are found, this step S12 includes: generating a prompt text containing the text to be translated, the matching translation corpus, and each translation pair. Wherein, the prompt text in this article can be generated by splicing or associating the text to be translated, the matching translation corpus, and each translation pair. Wherein, the translation pair includes the academic words matched with the text to be translated and the academic translation words corresponding to the academic words.

[0035] Step S13: inputting the prompt text into the translation model to instruct the translation model to refer to the matching translation corpus and output the translation result corresponding to the text to be translated.

[0036] In one embodiment, the matching translation corpus includes a reference text in the same language as the text to be translated and a corresponding translation text in a specified language of the reference text. The translation model can refer to the translation text in the matching translation corpus to translate the text to be translated and obtain a corresponding translation result.

[0037] In another embodiment, the translation result corresponding to the text to be translated is an academic translation result corresponding to the text to be translated. When the corresponding academic translation words and matching translation corpus are found, this step S13 includes: inputting the prompt text into the translation model to instruct the translation model to output the academic translation result corresponding to the text to be translated with reference to the matching translation corpus and each translation pair.

[0038] It should be noted that the translation pair provides professional vocabulary translation prompts for the large model, reducing the impact of the solidified memory of the pre-training stage on the translation results of the large model during translation, and improving the translation accuracy of professional vocabulary. That is, through the prompts of the academic dictionary, the model generates translations based on the prompts, rather than translating only based on the training data during the fine-tuning of the translation model.

[0039] In another embodiment, the translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated, and the translation model is a large model. Wherein, the large model can be fine-tuned by supervised learning or unsupervised learning. Before step S13, it is necessary to fine-tune the translation model. The fine-tuning process of the translation model includes: using several groups of sample texts to fine-tune the translation model, wherein each group of sample texts includes a sample academic text and a corresponding academic translation result, wherein the academic translation result is marked as the expected output of the corresponding sample academic text.

[0040] In a specific implementation, the sample academic text includes text at at least one of the following levels: word level, sentence level, and paragraph level.

[0041] In another specific implementation, the sample academic text translation results include academic translation results and general translation results, and the translation model is fine-tuned using several sample text sets, including: each group of the sample texts also includes a general translation result corresponding to the sample academic text, and the general translation result is marked as the general output of the corresponding sample academic text.

[0042] Combination Figure 2 Give an example. Figure 2It is a schematic diagram of a group of sample texts input to a translation model provided by the present application. Among them, a sample academic text set 20 includes a sample academic text 21 and a corresponding sample academic text translation result 22. The sample academic text translation result 22 includes an academic translation result 220 and a general translation result 221. The academic translation result 220 is marked as the expected output, and the general translation result 221 is marked as the general output. Through a loss function that can distinguish between the expected output and the general output. For example, using weighted loss, a higher weight is given to the prediction of the expected output, while a lower weight is given to the prediction of the general output. In this way, the model will learn to tend to output the expected output rather than the general output during the training process. In the fine-tuning process, by iteratively showing the input and the corresponding output (expected output and general output) to the model, and using the designed loss function to perform gradient descent optimization. By continuously adjusting the parameters of the model, the model can tend to output the expected output, that is, through the fine-tuning of the translation model, the model has the ability to tend to output academic translation results rather than general translation results.

[0043] The present embodiment mode generates a translation text corresponding to the matching translation corpus and a prompt text of the matching translation corpus by obtaining a matching translation corpus that matches the grammatical structure of the text to be translated. The prompt text is input into a translation model to indicate that the translation model outputs a translation result corresponding to the text to be translated with reference to the matching translation corpus. This process enables the translation model to refer to the matching translation corpus, so that when translating the text, it can more accurately process the complex grammatical structure, so that the translation quality of the generated translation text is better, thereby improving the accuracy of the translation.

[0044] See also Figure 3 , Figure 3 It is a flowchart of another embodiment of the text translation method provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not take Figure 3 The process sequence shown is limited. In this embodiment, the grammatical structure information of the text to be translated or the reference text corresponding to the matching translation corpus is obtained by constructing a grammar tree. Figure 3 As shown, this embodiment includes:

[0045] Step S31: Acquire a first grammatical structure of the text to be translated.

[0046] For a detailed description of obtaining the text to be translated, please refer to the relevant description of step S11.

[0047] In one embodiment, the method for obtaining the first grammatical structure feature includes: obtaining grammatical structure information of the text to be translated. Encoding the grammatical structure information of the text to be translated using a neural network to obtain the first grammatical structure feature. The neural network may be a graph convolutional neural network. The grammatical structure information of the text to be translated is obtained by constructing a grammatical tree.

[0048] In a specific embodiment, the text to be translated is processed using a natural language processing model to construct a grammar tree. For example, the text to be translated is converted into corresponding grammar structure information using an LTP tool. The step of converting the text to be translated into corresponding grammar structure information may include: using the LTP tool to construct a grammar tree of the text to be translated as the grammar structure information of the text to be translated, wherein the grammar tree includes a plurality of nodes.

[0049] The grammatical structure feature in this embodiment can represent the grammatical structure information corresponding to the text to be translated, that is, it can represent the grammatical tree corresponding to the text to be translated. In another specific implementation, the grammatical structure information of the text to be translated is encoded using a neural network to obtain a first grammatical structure feature. Specifically, the grammatical structure information is encoded using a graph convolutional neural network. The step of obtaining the first grammatical structure corresponding to the grammatical structure information using a graph convolutional neural network includes: for each node of the grammatical tree, obtaining the product between the adjacency matrix of the grammatical tree, the weight of the graph convolutional neural network, and the representation matrix of the node, and using an activation function to perform nonlinear processing on the product to obtain the encoding feature corresponding to the node; obtaining the central tendency representation value of the encoding feature of several nodes as the first grammatical structure feature. Among them, the central tendency representation value represents the information density, importance represented by certain nodes or subtrees in the grammatical tree, or the overall structural information carried by the grammatical tree. Specifically, for example, the multiple encoding features corresponding to multiple nodes in the grammatical tree are de-extreme averaged, averaged, or median is taken to obtain the first grammatical structure feature.

[0050] Take the step of obtaining the first grammatical structure as an example to illustrate. For example, the LTP tool is used to convert the text to be translated into a grammatical tree. The grammatical tree is used as the grammatical structure information corresponding to the text to be translated. The data containing the grammatical structure information in the grammatical tree is encoded using a pre-trained graph convolutional neural network, wherein each node in the grammatical tree represents each data containing grammatical structure information. The specific calculation method is, X1 = ReLU (AXW), wherein A is the adjacency matrix of the grammatical tree, W is the weight of the graph convolutional neural network, X is the representation matrix of a node, and X1 is the encoding feature corresponding to a node of the grammatical tree. The encoding features corresponding to all nodes in the grammatical tree are averaged to obtain the first grammatical structure feature, wherein the first grammatical structure feature represents the grammatical tree corresponding to the text to be translated. The specific calculation method is, x1 = Mean (X1), wherein x1 is the first grammatical structure feature corresponding to the text to be translated.

[0051] Step S32: obtaining the similarity between the first grammatical structure feature and the second grammatical structure feature of each reference text in the reference corpus.

[0052] The reference translation corpora in the reference corpus pool in this article can be obtained from at least one of a corpus, a cloud database, and an open source database. The reference translation corpus may include a reference text and a corresponding translation text. For example, the reference translation corpora in the reference corpus pool are obtained from a professional academic translation parallel corpus.

[0053] In one implementation, each text in the professional academic translation parallel corpus may be obtained from a sentence or chapter in an academic paper.

[0054] The reference text in this embodiment refers to a reference text in the reference corpus that is consistent with the language of the text to be translated, and the corresponding translation text represents the translation text of the reference text corresponding to the translation language specified by the target user. In one embodiment, the specific description of obtaining the second grammatical structure feature of the reference text can refer to the relevant description of step S21, which is not repeated here.

[0055] In one implementation, a similarity calculation formula may be used to calculate the similarities between the first grammatical structure feature and the second grammatical structure feature of each reference text in the reference corpus.

[0056] Step S33: taking the reference text whose similarity meets the matching requirement as the matching text, and taking the reference translation corpus containing the matching text as the matching translation corpus.

[0057] In this embodiment, there is one matching translation corpus that matches the grammatical structure of the text to be translated. In one implementation, the reference text with the highest similarity is selected as the matching text whose similarity meets the matching requirement.

[0058] Take the process of using similarity to determine the matching translation corpus as an example for illustration. For example, the similarity between the first grammatical structure feature and the second grammatical structure feature of each reference text in the reference corpus pool is calculated by score = Sim (x1, x2), where x1 is the first grammatical structure feature and x2 is the second grammatical structure feature. When the score value is the largest, the reference translation corpus corresponding to the second grammatical structure feature is used as the matching translation corpus.

[0059] Combination Figure 4 To illustrate with an example, Figure 4 It is a schematic diagram of a prompt text generation process provided by the present application. The text to be translated 40 is converted into a corresponding syntax tree 41 by the LTP tool, and each reference translation prediction of the reference corpus 42 is converted into a corresponding syntax tree in the same way. The similarity between the syntax tree 41 and the syntax tree corresponding to each reference translation prediction is obtained. Among them, the similarity between the syntax tree 41 and the syntax tree 43 is higher than the similarity between the syntax tree 41 and the syntax tree 44. The reference translation corpus 45 corresponding to the syntax tree 43 is taken as the matching translation corpus. That is, the matching translation corpus 46 matched with the text to be translated (with the in-depth study of the pathological mechanism of sepsis, sepsis is defined as a life-threatening organ failure disorder caused by the host's immune response disorder to infection) is "With the gradual deepening of research on uremia, uremia is defined as a series of clinical symptoms and metabolic disorders caused by chronic renal failure. With the gradual deepening of research on uremia,uremia is defined as aseries of clinicalsymptoms and metabolic disorders caused by chronic renal failure.".

[0060] Step S34: searching an academic translation word that matches at least one word in the text to be translated from an academic dictionary, wherein the word and the corresponding academic translation word form an academic translation pair.

[0061] In one embodiment, the academic dictionary includes several entry translation groups and several Chinese-English translation control groups. Among them, the entry translation data of one entry translation group or one Chinese-English translation control group can be used as a reference translation pair. The entry translation data is obtained through the entry translation data of professional translation dictionaries in various fields. The Chinese-English translation control group is obtained through the abstract or text of the academic paper. In a specific embodiment, the abstract or text of the academic paper has Chinese and English comparisons. The academic term translation results can be extracted from the abstract or text in the academic paper with the help of a high-level large-scale language model to obtain the Chinese-English translation control group. Among them, the high-level large-scale language model can be GPT4 or GPT4o.

[0062] For the detailed description of step S34, please refer to the relevant description of step S12.

[0063] Continue to combine Figure 4 To illustrate with an example, Figure 4 This is a schematic diagram of the prompt text generation process provided by the present application. The text to be translated 40 (with the in-depth study of the pathological mechanism of sepsis, sepsis is defined as a life-threatening organ failure disorder caused by a disordered host immune response to infection) is segmented in the form of subject, predicate and object. The segmentation results are analyzed to extract those words 481 (sepsis) with specific field knowledge or high professionalism. Search for academic words (sepsis) that are semantically similar or identical to the word in the academic dictionary 47. The academic translation word 482 corresponding to the academic word (sepsis) is spesis, and the word 481 (sepsis) and the academic translation word 482 (spesis) corresponding to the academic word form an academic translation pair 48 (sepsis: spesis).

[0064] Step S35: Generate a prompt text including the text to be translated, the matching translation corpus, and each translation pair.

[0065] In one embodiment, this step S35 includes: taking a reference translation pair including an academic translation word matching a word in the text to be translated as a translation pair, and generating a prompt text including the text to be translated, the matching translation corpus, and each translation pair.

[0066] Combination Figure 5 To illustrate with an example, Figure 5 5 is a schematic diagram of the prompt text display provided by the present application. Among them, the prompt text 50 includes a text pair 51, a text pair 52 and a text 53, wherein the text pair 51 is a matching translation corpus, the text pair 52 is a translation pair, and the text 53 is a text to be translated.

[0067] Step S36: inputting the prompt text into the translation model to instruct the translation model to refer to the matching translation corpus and each translation pair to output the academic translation result corresponding to the text to be translated.

[0068] For the specific description of step S36, reference may be made to the relevant description in step S13.

[0069] See also Figure 6 , Figure 6 It is a schematic diagram of the framework of an embodiment of the text translation device of the present application. The text translation device 600 includes a translation corpus acquisition module 610, a prompt text generation module 620 and a translation text generation module 630. The translation corpus acquisition module 610 is used to obtain a matching translation corpus that matches the grammatical structure of the text to be translated. The prompt text generation module 620 is used to generate a prompt text containing the text to be translated and the matching translation corpus. The translation text generation module 630 is used to input the prompt text into a translation model to instruct the translation model to output a translation result corresponding to the text to be translated with reference to the matching translation corpus.

[0070] In some embodiments, the translation corpus acquisition module 610 is specifically used to obtain a first grammatical structure feature of a text to be translated; obtain the similarity between the first grammatical structure feature and a second grammatical structure feature of each reference text in a reference corpus pool, wherein the reference corpus pool includes a number of reference translation corpora, each reference translation corpus includes a reference text and a corresponding translation text; and use the reference text whose similarity meets the matching requirements as the matching text, and use the reference translation corpus containing the matching text as the matching translation corpus.

[0071] In some embodiments, the translation corpus acquisition module 610 acquires the first grammatical structure feature of the text to be translated, including: acquiring grammatical structure information of the text to be translated; and encoding the grammatical structure information of the text to be translated using a graph convolutional neural network to obtain the first grammatical structure feature.

[0072] In some embodiments, the translation corpus acquisition module 610 acquires the grammatical structure information of the text to be translated, including: constructing a grammatical tree of the text to be translated as the grammatical structure information of the text to be translated, wherein the grammatical tree includes a plurality of nodes. The translation corpus acquisition module 610 encodes the grammatical structure information of the text to be translated using a graph convolutional neural network to obtain a first grammatical structure feature, including: for each node of the grammatical tree, acquiring the product of the adjacency matrix of the grammatical tree, the weight of the graph convolutional neural network, and the representation matrix of the node, and performing nonlinear processing on the product using an activation function to obtain the encoding feature corresponding to the node; and acquiring the central tendency representation value of the encoding features of the plurality of nodes as the first grammatical structure feature.

[0073] In certain embodiments, the translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated. Before the prompt text generation module 620 performs the prompt text generation comprising the text to be translated and the matching translation corpus, the text translation device 600 also includes a translation pair acquisition module 640, and the translation pair acquisition module 640 is used to find out the academic translation words that match at least one word in the text to be translated from the academic dictionary, wherein the words and the corresponding academic translation words form an academic translation pair. The prompt text generation module 620 is also used to generate the prompt text comprising the text to be translated, the matching translation corpus, and each translation pair. The translation text generation module 630 is also used to input the prompt text into the translation model to indicate that the translation model refers to the matching translation corpus and each translation pair outputs the academic translation result corresponding to the text to be translated.

[0074] In some embodiments, the translation pair acquisition module 640 searches for academic translation words that match at least one word in the text to be translated from an academic dictionary, including: segmenting the text to be translated to obtain a number of words; for each word, searching for an academic word that matches the word from an academic dictionary, and in response to finding an academic word that matches the word, obtaining an academic translation word corresponding to the matching academic word from the academic dictionary as the academic translation word that matches the word.

[0075] In some embodiments, the translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated, and the translation model is a large model. Before the translation text generation module 630 executes inputting the prompt text into the translation model to instruct the translation model to refer to the matching translation corpus to output the translation result corresponding to the text to be translated, it also includes: using several groups of sample texts to fine-tune the translation model, wherein each group of sample texts includes a sample academic text and a corresponding academic translation result, wherein the academic translation result is marked as the expected output of the corresponding sample academic text.

[0076] In some embodiments, the sample academic text includes text at at least one of a word level, a sentence level, and a paragraph level;

[0077] In some embodiments, each group of sample texts further includes a common translation result corresponding to the sample academic text, and the common translation result is marked as a common output of the corresponding sample academic text.

[0078] See also Figure 7 , Figure 7: is a schematic diagram of a framework of an embodiment of an electronic device of the present application. The electronic device 70 includes a memory 71 and a processor 72 coupled to each other, and the processor 72 is used to execute program instructions stored in the memory 71 to implement the steps in any of the above-mentioned text translation method embodiments. In a specific implementation scenario, the electronic device 70 may include but is not limited to: a microcomputer, a server, and in addition, the electronic device 70 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0079] Specifically, the processor 72 is used to control itself and the memory 71 to implement the steps in any of the above-mentioned text translation method embodiments. The processor 72 can also be called a CPU (Central Processing Unit). The processor 72 may be an integrated circuit chip with signal processing capabilities. The processor 72 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 72 can be implemented by an integrated circuit chip.

[0080] See also Figure 8 , Figure 8 The computer-readable storage medium 80 stores program instructions 81 that can be executed by a processor, and the program instructions 81 are used to implement the steps in any of the above text translation method embodiments.

[0081] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0082] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0083] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0084] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0085] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A text translation method, characterized in that: The method comprises: Obtaining a matching translation corpus that matches the grammatical structure of the text to be translated; Generating a prompt text including the text to be translated and the matching translation corpus; The prompt text is input into the translation model to instruct the translation model to output a translation result corresponding to the text to be translated with reference to the matching translation corpus.

2. The method according to claim 1, characterized in that The step of obtaining a matching translation corpus that matches the grammatical structure of the text to be translated includes: Acquire a first grammatical structure feature of the text to be translated; Obtaining similarities between the first grammatical structure feature and the second grammatical structure feature of each reference text in a reference corpus pool, wherein the reference corpus pool includes a plurality of reference translation corpora, and each of the reference translation corpora includes a reference text and a corresponding translation text; The reference text whose similarity meets the matching requirement is used as the matching text, and the reference translation corpus containing the matching text is used as the matching translation corpus.

3. The method according to claim 2, characterized in that The step of obtaining the first grammatical structure feature of the text to be translated includes: Acquiring grammatical structure information of the text to be translated; The grammatical structure information of the text to be translated is encoded using a graph convolutional neural network to obtain the first grammatical structure feature.

4. The method according to claim 3, characterized in that The step of obtaining the grammatical structure information of the text to be translated includes: Constructing a syntax tree of the text to be translated as grammatical structure information of the text to be translated, wherein the syntax tree includes a plurality of nodes; The using a graph convolutional neural network to encode the grammatical structure information to obtain the first grammatical structure feature includes: For each node of the syntax tree, obtain the product of the adjacency matrix of the syntax tree, the weight of the graph convolutional neural network, and the representation matrix of the node, and perform nonlinear processing on the product using an activation function to obtain a coding feature corresponding to the node; A central tendency representation value of the encoding features of the plurality of nodes is obtained as the first grammatical structure feature.

5. The method according to claim 1, characterized in that The translation result corresponding to the text to be translated is the academic translation result corresponding to the text to be translated; Before generating the prompt text including the text to be translated and the matching translation corpus, the method further includes: Searching for an academic translation word that matches at least one word in the text to be translated from an academic dictionary, wherein the word and the corresponding academic translation word form an academic translation pair; The generating of the prompt text including the text to be translated and the matching translation corpus includes: Generate a prompt text including the text to be translated, the matching translation corpus, and each of the translation pairs; The step of inputting the prompt text into a translation model to instruct the translation model to output an academic translation result corresponding to the text to be translated with reference to the matching translation corpus comprises: The prompt text is input into the translation model to instruct the translation model to output the academic translation result corresponding to the text to be translated with reference to the matching translation corpus and each of the translation pairs.

6. The method according to claim 5, characterized in that The step of searching from an academic dictionary for an academic translation word corresponding to at least one word in the text to be translated comprises: Segmenting the text to be translated to obtain a number of words; For each of the words, an academic word matching the word is retrieved from the academic dictionary. In response to finding the academic word matching the word, an academic translation word corresponding to the matching academic word is obtained from the academic dictionary as the academic translation word matching the word.

7. The method according to claim 1, characterized in that The translation result corresponding to the text to be translated is an academic translation result corresponding to the text to be translated, and the translation model is a large model; Before inputting the prompt text into the translation model to instruct the translation model to output the academic translation result corresponding to the text to be translated with reference to the matching translation corpus, the method further includes: The translation model is fine-tuned using several groups of sample texts, wherein each group of the sample texts includes a sample academic text and a corresponding academic translation result, wherein the academic translation result is marked as the expected output of the corresponding sample academic text.

8. The method according to claim 7, characterized in that The sample academic text includes text at at least one of the word level, sentence level, and paragraph level; And / or, each group of the sample texts further includes a common translation result corresponding to the sample academic text, and the common translation result is marked as a common output of the corresponding sample academic text.

9. A text translation device, characterized in that: The device comprises: A translation corpus acquisition module is used to acquire a matching translation corpus that matches the grammatical structure of the text to be translated; A prompt text generation module, used to generate a prompt text including the text to be translated and the matching translation corpus; The translation text generation module is used to input the prompt text into the translation model to instruct the translation model to output the translation result corresponding to the text to be translated with reference to the matching translation corpus.

10. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the text translation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program instructions, and the program instructions can be executed to implement the text translation method according to any one of claims 1 to 8.