Knowledge base based machine translation method and system

By transforming binary pairs in the knowledge base into index vectors and utilizing similarity scores and probability distribution calculation methods, the problem of machine translation systems struggling to incorporate domain knowledge and exhibiting poor cross-domain translation performance is solved, thereby improving the translation quality of specific domains and long-tail phrases.

CN114638239BActive Publication Date: 2025-11-04SICHUAN LAN-BRIDGE INFORMATION TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210305377.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2025-11-04
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

Existing machine translation systems struggle to incorporate domain knowledge, resulting in poor cross-domain translation performance, and are ineffective at translating long-tail phrases and words.

Method used

By converting the tuples in the knowledge base into index vectors, using the query vectors to calculate similarity scores to select candidate tuples, and calculating candidate translation words based on probability distributions, the process continues until a preset length is reached.

Benefits of technology

It enables the integration of domain knowledge into specific fields, improves cross-domain translation effectiveness, and enhances the translation quality of long-tail phrases and words.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114638239B_ABST
    Figure CN114638239B_ABST
Patent Text Reader

Abstract

The application provides a knowledge base-based machine translation method and system, which comprises the following steps: converting all first binary tuples in a knowledge base into second binary tuples containing index vectors; converting a current translation state into a query vector; calculating the similarity scores of the query vector and all index vectors in the knowledge base respectively, and selecting the first binary tuples corresponding to the index vectors with the similarity scores higher than a preset threshold as candidate binary tuples; calculating the probability distribution of candidate translation words according to a sentence to be translated, the candidate binary tuples and the current translation state, and taking the candidate translation word with the maximum probability distribution as a target translation word; and repeating the above steps until the target translation reaches a preset length. The application can well integrate specific domain knowledge, realize cross-domain translation, and improve the translation effect of long-tail phrases.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular, relates to a machine translation method and system based on a knowledge base, a computer device and a storage medium. BACKGROUND

[0002] Machine translation system mainly solves the problem of converting the input of a given source language into the output of a target language without changing the semantic expression. To solve this problem, the existing machine translation system usually adopts an end-to-end neural network, inputs the pre-processed input sentence into the trained neural network, and then displays the output of the neural network to the user after post-processing.

[0003] However, the machine translation system based on the end-to-end neural network usually has the following shortcomings:

[0004] (1) It is difficult to intervene in the inference process of the end-to-end neural network. The trained model is a black box, which can only give the input to get the output, and the inference process based on matrix operation inside is difficult to understand.

[0005] (2) It is difficult to integrate domain knowledge. The target use domain, such as law, medicine, finance, etc., usually has fixed translation of terms, names, organizations, place names, etc. These domain knowledge is usually difficult to reliably integrate into the end-to-end neural network.

[0006] (3) The cross-domain effect is poor. The neural network trained in a certain domain usually becomes poor after switching domains. The existing technical means is to collect parallel corpus for each domain and train the corresponding neural network model separately, but the end-to-end neural network usually needs a large amount of parallel corpus for training, which leads to high cost of new domain business.

[0007] (4) The translation effect of long tail phrases and words is poor.

[0008] Therefore, there is an urgent need for a machine translation method and device that can integrate domain knowledge, realize cross-domain translation, and have good translation effect on long tail phrases and words. SUMMARY

[0009] The embodiments of the present application provide a machine translation method and system based on a knowledge base, a computer device and a storage medium, to solve the problems that the existing machine translation system adopts an end-to-end neural network, which is difficult to integrate specific domain knowledge, switching domains will lead to poor translation effect and high translation cost in new domains, and poor translation effect on long tail phrases and words.

[0010] In order to achieve the above purpose, the first aspect of the embodiments of the present application provides a machine translation method based on a knowledge base, comprising:

[0011] S1, transforming all first binary tuples in the knowledge base into second binary tuples containing index vectors;

[0012] S2, transforming the current translation state into a query vector, the current translation state being the generated translation;

[0013] S3, respectively calculating similarity scores of the query vector and all index vectors in the knowledge base, and selecting first binary tuples corresponding to index vectors with similarity scores higher than a preset threshold as candidate binary tuples;

[0014] S4, according to the sentence to be translated, the candidate binary tuples and the current translation state, calculating probability distribution of candidate translation words, and taking the candidate translation word with the maximum probability distribution as the target translation word.

[0015] Optionally, in a possible implementation manner of the first aspect, the method further includes:

[0016] detecting the length of the target translation;

[0017] if the length of the target translation does not reach a preset length, repeating steps S1-S4 until the target translation reaches the preset length.

[0018] Optionally, in a possible implementation manner of the first aspect, the similarity score is calculated by the following formula, including:

[0019] s ti (q t ,k i )

[0020] wherein q t is the query vector, and k i is the index vector of the second binary tuple.

[0021] Optionally, in a possible implementation manner of the first aspect, the knowledge base is automatically constructed, and different construction manners are adopted according to different phrase descriptions in the first binary tuples, including:

[0022] if the phrase description is a dictionary definition of the phrase, the various forms of words in the phrase are removed first, and then the dictionary definition of the phrase is queried according to an existing dictionary or a search engine;

[0023] if the phrase description is a context scenario of the phrase, monolingual corpus of the target language in the same field is obtained, and context information within a preset range of the position of the phrase is intercepted.

[0024] Optionally, in a possible implementation manner of the first aspect, the method further includes:

[0025] The phrase descriptions of all first binary tuples in the knowledge base are converted into index vectors based on a knowledge embedding model;

[0026] The query vector is obtained based on the current translation state and the sentence to be translated based on a query embedding model.

[0027] Optionally, in a possible implementation manner of the first aspect, according to different inputs of the knowledge embedding model and the query embedding model, the training of the knowledge embedding model and the query embedding model is divided into heuristic training and end-to-end translation training, and the training includes the following steps.

[0028] The heuristic training is to construct a supervision signal according to semantic correlation between the current translation state of the knowledge embedding model and the query embedding model and the phrase description.

[0029] The end-to-end translation training is to update the knowledge embedding model and the query embedding model by using a gradient generated by a translation target function, wherein the query embedding model uses model parameters obtained by the heuristic training.

[0030] Optionally, in a possible implementation manner of the first aspect, in S4, the following steps are included.

[0031] The target phrase in the candidate binary tuple is combined with the sentence to be translated respectively, and the combined result is input into the translation model, wherein the combination manner includes but is not limited to front-back splicing of text, feature fusion based on a neural network, and output of a preliminary probability distribution of a candidate word.

[0032] The preliminary probability distribution of the candidate word is weighted and summed according to the similarity score of the corresponding index vector to obtain a final probability distribution of a candidate translation word, and the candidate translation word with the maximum probability distribution is taken as a target translation word.

[0033] The second aspect of the embodiment of the application provides a machine translation system based on a knowledge base, which includes the following steps.

[0034] The first conversion module is configured to convert all first binary tuples in the knowledge base into second binary tuples containing index vectors.

[0035] The second conversion module is configured to convert the current translation state into a query vector, wherein the current translation state is a generated translation.

[0036] The candidate binary tuple selection module is configured to calculate similarity scores of the query vector and all index vectors in the knowledge base respectively, and select first binary tuples corresponding to index vectors with similarity scores higher than a preset threshold as candidate binary tuples.

[0037] The probability distribution calculation module is configured to calculate a probability distribution of the candidate translation word according to the sentence to be translated, the candidate bigram and the current translation state, and take the candidate translation word with the maximum probability distribution as the target translation word.

[0038] Optionally, in a possible implementation of the second aspect, the candidate bigram selection module calculates the similarity score by the following formula, which comprises:

[0039] s ti =s(q t ,k i )

[0040] wherein q t is the query vector, and k i is the index vector of the second bigram.

[0041] In a third aspect, the embodiment of the present application provides a computer device, including a memory and a processor, the memory stores a computer program capable of running on the processor, and the processor implements the steps in each method embodiment of the present application when executing the computer program.

[0042] In a fourth aspect, the embodiment of the present application provides a readable storage medium, the readable storage medium stores a computer program, and the computer program is used for implementing the steps of the method of the first aspect and various possible designs of the first aspect when executed by a processor.

[0043] The method and system for machine translation based on a knowledge base, the computer device and the storage medium provided by the present application can convert all first bigrams in the knowledge base into second bigrams containing index vectors, convert the current translation state into a query vector, calculate the similarity scores of the query vector and all index vectors in the knowledge base respectively, select the first bigram corresponding to the index vector with a similarity score higher than a preset threshold as a candidate bigram, calculate the probability distribution of the candidate translation word according to the sentence to be translated, the candidate bigram and the current translation state, take the candidate translation word with the maximum probability distribution as the target translation word, and repeat the above steps until the target translation reaches a preset length. The present application can intervene in the generation of the model by adding specific bigrams in the translation knowledge base, and can well integrate specific domain knowledge by adding fixed translations such as terms, names, organizations, place names and the like in the translation knowledge base, realize cross-domain translation by adding parallel corpus of target domains in the translation knowledge base, and strengthen the translation effect of long-tail phrases by adding target translations of long-tail phrases in the translation knowledge base. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1Flow chart for the first embodiment of the knowledge base based machine translation method;

[0045] Figure 2 Structural flow diagram for the first embodiment of the knowledge base based machine translation method;

[0046] Figure 3 Structural diagram for the first embodiment of the knowledge base based machine translation system. DETAILED DESCRIPTION

[0047] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0048] The terms "first", "second", "third", "fourth" and the like (if any) in the description, claims and above drawings of the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0049] It should be understood that in various embodiments of the present application, the magnitude of the serial number of each process does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0050] It should be understood that in the present application, "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units need not be limited to those clearly listed steps or units, but can include other steps or units that are not clearly listed or inherent to such processes, methods, products or devices.

[0051] It should be understood that in the present application, "a plurality of" means two or more. "And / or" is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the associated objects before and after it are in an "or" relationship. "Including A, B and C", "including A, B, C" means that A, B and C are all included, "including A, B or C" means that one of A, B and C is included, and "including A, B and / or C" means that any one or any two or three of A, B and C is included.

[0052] It should be understood that in the present application, "B corresponding to A", "B corresponding to A", "A corresponding to B" or "B corresponding to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean that B is determined only according to A, but also can be determined according to A and / or other information. The matching of A and B means that the similarity of A and B is greater than or equal to a preset threshold.

[0053] Depending on the context, "if" as used herein can be interpreted as "when" or "when" or "in response to determining" or "in response to detecting".

[0054] The technical solutions of the present application will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes can not be described in some examples.

[0055] The present application provides a knowledge base-based machine translation method, as shown in the flowchart of Figure 1 , 2 , which includes:

[0056] Step S1, converting all first binary tuples in the knowledge base into second binary tuples containing index vectors.

[0057] In this step, the translation knowledge base is composed of a series of first binary tuples (d i , p i ), wherein the first binary tuple includes a phrase description d i and a phrase p i , wherein the phrase d i is a phrase in the target language of translation, and the phrase description p i may be a dictionary definition of the phrase, a source language translation, a context of the occurrence of the phrase, etc. The construction of the translation knowledge base includes automatic construction and manual construction, wherein the manual construction means that the phrase description d i and the phrase p iAutomatic construction refers to adopting different construction methods based on the different phrase descriptions in the first tuple; that is, if the phrase description d... i To define a phrase in the dictionary, first remove any variations of the words in the phrase, then look up the phrase's dictionary definition using an existing dictionary or search engine. If the phrase description d i To determine the context of the phrase, monolingual corpora of the target language within the same domain are obtained, and contextual information within a preset range of the phrase's location is extracted. If the phrase description d... i For the source language phrase corresponding to the phrase: If the phrase p is a whole sentence, then the existing parallel corpus can be used directly as the knowledge base; if p is a phrase, then a large number of language pairs (source language phrase, target language phrase) can be mined from the parallel corpus using translation alignment tools, and then the knowledge base can be obtained by filtering according to certain criteria.

[0058] After establishing the translation knowledge base, the phrase descriptions in the first tuple are transformed into index vectors k using the knowledge embedding model K. i This forms the second tuple (k) i ,p i )=(K(d i ),p i (Where, the knowledge embedding model K is a sequence encoding model, such as using the standard self-attention model Transformer, or a recurrent neural network LSTM, and averaging the encoded vectors of each word to obtain d.) i Corresponding vector k i Given a source language sentence as input x, output a target language sentence y = [y1, y2, ..., y]. t For example, the input of the knowledge embedding model K is the phrase p in the parallel knowledge base. i The corresponding source language sentence.

[0059] Step S2: Convert the current translation state into a query vector, where the current translation state is the generated translation.

[0060] In step S2, the embedding model Q is queried, based on the current translation state h. t The query vector q is obtained by inputting either the original text to be translated or a sentence from the original text to be translated. t Among them, the current translation status h t The translation that has already been generated, i.e., the word h that has been generated in the previous t-1 steps. t =y 1:t-1 =[y1,y2,...,y t-1]. The query embedding model Q is a sequence encoding model, and the knowledge embedding model K has the same model structure but does not share parameters, to input the source language sentence x, output the target language sentence y = [y1, y2,..., y t ..., for example, the input of the query embedding model Q is the source language sentence x that needs to be predicted at present, at this time all q t Take the common value q = Q(x). In addition, when the first word of the original text is translated, the input original text and a special start symbol <bos>Translation is performed using translation model T.

[0061] Step S3: Calculate the similarity score between the query vector and all index vectors in the knowledge base, and select the first tuple corresponding to the index vector with a similarity score higher than a preset threshold as a candidate tuple.

[0062] In this step, the similarity score between the query vector input using the query embedding model Q and all index vectors in the translation knowledge base is calculated, and the first tuple (d) corresponding to the n index vectors with the highest similarity scores is selected. i p i ) are considered as candidate pairs. The similarity score is calculated using the following formula: s ti =s(q t ,k i )=q T k i ; where q t Let k be the query vector. i is the index vector of the second tuple.

[0063] Step S4: Based on the sentence to be translated, candidate pairs, and the current translation state, calculate the probability distribution of candidate translation words, and select the candidate translation word with the highest probability distribution as the target translation word.

[0064] In step S4, the sentence to be translated, i.e., the input source language sentence X, is compared with the retrieved candidate tuples [(d1,p1),...,(d...]. n ,p n The combination process is performed to obtain [x, p] i The combined result is input into the translation model T to obtain the preliminary probability distribution of the next word. The combination method includes, but is not limited to, splicing the source language sentence x with the target phrase p in the retrieved bigram. i The first and last phrases are concatenated to obtain [x,pi]), and features are fused based on neural networks. Then, the probability distribution of the preliminary candidate words obtained by combining different phrases is weighted and summed according to the similarity scores of the corresponding index vectors to obtain the final probability distribution of the candidate translation words, i.e., P(y). t )∝∑ i s(q,k i )P i (y t Then, a greedy search algorithm selects the translation word with the highest final probability distribution as the target translation word. The translation model T uses autoregressive generation, a standard sequence-to-sequence model, such as Transformer; the final probability distribution of the candidate translation word is P(y...). t )∝∑ i s(q,k i )P i (y t ) needs to be applied to all y t Normalization, such as softmax, is performed to ensure that the output conforms to the probability distribution. Additionally, when the translation model T generates a target translation word, the current translation state h needs to be adjusted. t Perform a status update. This status update involves updating the generated translation, for example, the current translation status h. t After generating the target translation "Xiaoming" based on translation model T for "Good morning", what is the current translation state h? t The message is "Good morning, Xiaoming".

[0065] Step S5: Repeat steps S1-S4 until the target translation reaches the preset length.

[0066] In step S5, after selecting the translation result of the current word to be translated based on the final probability distribution of the candidate translation words, y1,...,y will be continuously generated according to the above steps. t ..., finally forming the target translation sentence y; then the sentence length of the target translation sentence is checked. If the sentence length reaches the preset length, or the output translation word is a terminator, then... <eos>, then it means that the original text to be translated has been completely translated; on the contrary, if the length of the sentence does not reach the preset length, or the output translation word is not a terminal symbol <eos>If not, steps S1-S4 need to be repeated until the sentence length of the target translation sentence reaches the preset length or the output terminal symbol is reached.

[0067] In one embodiment, the training of the knowledge embedding model and the query embedding model is divided into heuristic training and translation end-to-end training according to the different inputs of the knowledge embedding model and the query embedding model, comprising:

[0068] The heuristic training is to construct a supervision signal according to the semantic correlation of the current translation state of the knowledge embedding model and the query embedding model and the phrase description.

[0069] The translation end-to-end training is to update the knowledge embedding model and the query embedding model through the gradient generated by the translation objective function, wherein the query embedding model uses the model parameters obtained by the heuristic training.

[0070] In this step, the knowledge embedding model K and the query embedding model Q input differently, and are divided into heuristic training and translation end-to-end training. The model parameters obtained by the heuristic training can be used as the initialization of the translation end-to-end training, thereby further improving the performance. The specific training is as follows:

[0071] Heuristic training: The heuristic training needs to construct a supervision signal according to the semantic correlation of the current translation state h t and the phrase description d i of the inputs of the knowledge embedding model K and the query embedding model Q. When the knowledge base is after the heuristic training ends, Q and K can continue to improve the performance through the translation end-to-end training, or the parameters can be fixed and not involved in the process of the translation end-to-end training.

[0072] Translation end-to-end training: The translation end-to-end training updates the knowledge embedding model K and the query embedding model Q through the gradient generated by the translation objective function. The query embedding model Q can directly update using the gradient of the translation objective, but since the update of the query embedding model K involves the update of the translation knowledge base vector index, the calculation amount of K is extremely large each time, so K usually uses the model parameters obtained by the heuristic training or uses the parameters of other general sequence models. Therefore, a large amount of calculation amount caused by the update of the translation knowledge base vector index is avoided, and the vector index can be updated periodically, such as updating the entire translation knowledge base every 50 steps.

[0073] In one embodiment, the model training for the translation model T comprises:

[0074] The sentence to be translated X, the current translation state h t , and the candidate binary tuple [(d1, p1),..., (d n , p n ) into the translation model T to obtain a probability distribution P(y t ) of the current candidate word. The training objective of translation usually uses maximum likelihood estimation. If the parameters of the model are θ, the objective of maximum likelihood estimation is max θ ∑ t log(P θ (y t ')) where y t ' is the real target word in the training sample. Gradient descent is usually used to minimize the loss function L(θ) = -∑ t log(P θ (y t ')) to solve the above objective.

[0075] The machine translation method based on the knowledge base provided by the application comprises the following steps: converting all first binary tuples in the knowledge base into second binary tuples containing index vectors; converting a current translation state into a query vector, the current translation state being a generated translation; respectively calculating similarity scores of the query vector and all index vectors in the knowledge base, and selecting first binary tuples corresponding to index vectors with similarity scores higher than a preset threshold as candidate binary tuples; according to a sentence to be translated, the candidate binary tuples and the current translation state, calculating a probability distribution of candidate translation words, and taking a candidate translation word with the maximum probability distribution as a target translation word; repeating the above steps until the target translation reaches a preset length.

[0076] The embodiment of the application further provides a machine translation system based on the knowledge base, as shown in the accompanying drawings, comprising: Figure 3

[0077] A first conversion module is configured to convert all first binary tuples in the knowledge base into second binary tuples containing index vectors.

[0078] A second conversion module is configured to convert a current translation state into a query vector, the current translation state being a generated translation.

[0079] ​The candidate binary tuple selection module is configured to calculate similarity scores of the query vector and all index vectors in the knowledge base respectively, and select a first binary tuple corresponding to an index vector with a similarity score higher than a preset threshold as a candidate binary tuple.

[0080] The probability distribution calculation module is configured to calculate a probability distribution of a candidate translation word according to the sentence to be translated, the candidate binary tuple, and the current translation state, and take a target translation word with the maximum probability distribution as the target translation word.

[0081] The target translation output module is configured to repeat the above modules until the target translation reaches a preset length.

[0082] In an embodiment, the candidate binary tuple selection module calculates the similarity score by the following formula, which comprises:

[0083] s ti =s(q t ,k i )

[0084] wherein q t is the query vector, and k i is an index vector of a second binary tuple.

[0085] The machine translation system based on the knowledge base provided by the application converts all first binary tuples in the knowledge base into second binary tuples containing index vectors, converts the current translation state into a query vector, the current translation state being a generated translation, calculates similarity scores of the query vector and all index vectors in the knowledge base respectively, selects a first binary tuple corresponding to an index vector with a similarity score higher than a preset threshold as a candidate binary tuple, calculates a probability distribution of a candidate translation word according to the sentence to be translated, the candidate binary tuple, and the current translation state, and takes a target translation word with the maximum probability distribution as the target translation word. The above steps are repeated until the target translation reaches a preset length. The application sets a translation knowledge base containing binary tuples, and can intervene in the generation of the model by adding specific binary tuples in the translation knowledge base, and can well integrate specific domain knowledge by adding fixed translations such as terms, names, organizations, and place names in the translation knowledge base, and can realize cross-domain translation by adding parallel corpora of target domains in the translation knowledge base, and can enhance the translation effect of long-tail phrases by adding target translations of long-tail phrases in the translation knowledge base.

[0086] Wherein, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transfer of computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general or special purpose computer. For example, the readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). In addition, the ASIC can be located in the user equipment. Of course, the processor and the readable storage medium can also exist as discrete components in the communication device. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0087] The present application also provides a program product, which includes execution instructions stored in a readable storage medium. At least one processor of the device can read the execution instructions from the readable storage medium, and the at least one processor executes the execution instructions to make the device implement the method provided by the various embodiments described above.

[0088] In the above-mentioned embodiments of the terminal or the server, it should be understood that the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the present application can be directly embodied as execution completed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0089] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.< / eos> < / eos> < / bos>

Claims

1. A machine translation method based on a knowledge base, wherein the knowledge base consists of multiple first tuples, each first tuple consisting of a phrase description and a phrase, characterized in that... include: S1, transform all first tuples in the knowledge base into second tuples containing index vectors; S2, convert the current translation state and the sentence to be translated into a query vector, wherein the current translation state is the generated translation; S3, calculate the similarity score between the query vector and all index vectors in the knowledge base, and select the first tuple corresponding to the index vector with a similarity score higher than a preset threshold as a candidate tuple; S4. Based on the sentence to be translated, candidate pairs, and the current translation state, calculate the probability distribution of candidate translation words, and select the candidate translation word with the highest probability distribution as the target translation word. This includes: combining the phrases in the candidate pairs with the sentence to be translated, and inputting the combined result into the translation model. The combination methods include text concatenation and feature fusion based on neural networks, and outputting the preliminary probability distribution of candidate words; performing weighted summation of the preliminary probability distribution of candidate words based on the similarity scores of the corresponding index vectors to obtain the final probability distribution of candidate translation words, and selecting the candidate translation word with the highest probability distribution as the target translation word; updating the generated translation based on the target translation word to obtain the target translation. S5, Detect the length of the target translation. If the length of the target translation does not reach the preset length, repeat steps S1-S4 until the target translation reaches the preset length. The method also includes: based on the knowledge embedding model, converting all phrase descriptions of the first tuple in the knowledge base into index vectors; based on the query embedding model, obtaining query vectors according to the current translation status and the sentence to be translated; The training of the knowledge embedding model and the query embedding model is divided into heuristic training and translation end-to-end training, depending on the different inputs of the knowledge embedding model and the query embedding model. The heuristic training involves constructing a supervision signal based on the current translation state of the knowledge embedding model and the query embedding model and the semantic relevance of the phrase description. The translation end-to-end training involves updating the knowledge embedding model and the query embedding model through the gradient generated by the translation objective function, wherein the query embedding model uses the model parameters obtained by heuristic training. The knowledge base is automatically constructed. The automatic construction adopts different construction methods according to the different phrase descriptions in the first binary tuple, including: if the phrase description is the dictionary definition of the phrase, then the various variations of words in the phrase are removed first, and then the dictionary definition of the phrase is queried according to the existing dictionary or search engine; if the phrase description is the context of the phrase, then the monolingual corpus of the target language in the same domain is obtained, and the context information within a preset range of the phrase location is extracted.

2. The knowledge-based machine translation method according to claim 1, characterized in that, The similarity score is calculated using the following formula, including: in, For the query vector, This is the index vector of the second tuple.

3. A knowledge-based machine translation system, characterized in that, include: The first transformation module is used to transform all first tuples in the knowledge base into second tuples containing index vectors. The second conversion module is used to convert the current translation status and the sentence to be translated into a query vector, wherein the current translation status is the generated translation. The candidate binary selection module is used to calculate the similarity score between the query vector and all index vectors in the knowledge base, and select the first binary corresponding to the index vector with a similarity score higher than a preset threshold as the candidate binary. The probability distribution calculation module is used to calculate the probability distribution of candidate translation words based on the sentence to be translated, candidate pairs, and the current translation state, and select the candidate translation word with the highest probability distribution as the target translation word. This includes: combining the phrases in the candidate pairs with the sentence to be translated, and inputting the combined results into a translation model. The combination methods include text concatenation and feature fusion based on neural networks, outputting a preliminary probability distribution of candidate words; weighting and summing the preliminary probability distribution of candidate words according to the similarity scores of their corresponding index vectors to obtain the final probability distribution of candidate translation words, and selecting the candidate translation word with the highest probability distribution as the target translation word; updating the generated translation based on the target translation word to obtain the target translation. The target translation output module is used to detect the length of the target translation. If the target translation length does not reach the preset length, the steps executed by the first conversion module, the second conversion module, the candidate binary selection module, and the probability distribution calculation module are repeated until the target translation reaches the preset length. The device also uses a knowledge embedding model to convert phrase descriptions of all first-order tuples in the knowledge base into index vectors; and uses a query embedding model to obtain query vectors based on the current translation status and the sentence to be translated. The training of the knowledge embedding model and the query embedding model is divided into heuristic training and translation end-to-end training, depending on the different inputs of the knowledge embedding model and the query embedding model. The heuristic training involves constructing a supervision signal based on the current translation state of the knowledge embedding model and the query embedding model and the semantic relevance of the phrase description. The translation end-to-end training involves updating the knowledge embedding model and the query embedding model through the gradient generated by the translation objective function, wherein the query embedding model uses the model parameters obtained by heuristic training. The knowledge base is automatically constructed. The automatic construction adopts different construction methods according to the different phrase descriptions in the first binary tuple, including: if the phrase description is the dictionary definition of the phrase, then the various variations of words in the phrase are removed first, and then the dictionary definition of the phrase is queried according to the existing dictionary or search engine; if the phrase description is the context of the phrase, then the monolingual corpus of the target language in the same domain is obtained, and the context information within a preset range of the phrase location is extracted.

4. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 2.

5. 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 the steps of the method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Machine translation method and device

    CN110263353A

  • Text translation method, device and equipment and computer readable storage medium

    CN112668347A