Matching method, device, equipment and medium for machine translation engine

By aggregating documents to be translated into multiple clusters and matching the sentence vector and target language vector with the training corpus vector of the machine translation engine, the problem of not being able to select a suitable machine translation engine in the prior art is solved, and the translation quality is improved.

CN116050435BActive Publication Date: 2025-08-19IOL WUHAN INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111265282.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-08-19
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The prior art cannot effectively select a suitable machine translation engine for specific industry documents translation, resulting in poor translation results.

Method used

By aggregating the documents to be translated into multiple clusters, and matching the sentence vector and the target language vector with the training corpus vector of the machine translation engine, the most matching machine translation engine is selected for translation.

Benefits of technology

Improve the translation quality, make full use of the advantages of vertical machine translation engine, and ensure that each sentence is translated using the most matching engine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116050435B_ABST
    Figure CN116050435B_ABST
Patent Text Reader

Abstract

The present invention provides a matching method, apparatus, device, and medium for machine translation engines, relating to the field of computer-assisted translation. The matching method comprises: aggregating the documents to be translated into multiple clusters based on the sentence vector of each sentence in the documents to be translated; and selecting the machine translation engine that best matches each cluster from the multiple machine translation engines based on the sentence vector and target language vector of each sentence in the multiple clusters, as well as the original sentence vector and target language sentence vector of each training corpus in multiple machine translation engines. This method enables each sentence in the document to be translated to be translated using the machine translation engine that best matches it, thereby fully utilizing vertical machine translation engines and significantly improving translation quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer-assisted translation, and in particular to a matching method, device, equipment and medium for a machine translation engine. Background Art

[0002] In the translation field, machine translation engines (MT) have become essential infrastructure. However, in many industries, the abundance of industry terminology and fixed translations makes general-purpose MT engines unsatisfactory for translating documents in specific sectors. Therefore, using industry-specific corpora to train MT engines for specific sectors has become the best way to improve their translation performance within specific sectors.

[0003] However, after training several machine translation engines for vertical industries, how to choose the corresponding machine translation engine for a given document to be translated becomes an important part of making good use of vertical machine translation engines. Summary of the Invention

[0004] The purpose of the present invention is to provide a method, device, equipment and medium for matching machine translation engines to solve the technical problem in the prior art that it is impossible to select a suitable machine translation engine according to the document to be translated.

[0005] In a first aspect, an embodiment of the present application provides a matching method of a machine translation engine, the matching method comprising:

[0006] According to the sentence vector of each sentence in the document to be translated, the document to be translated is aggregated and divided into multiple clusters;

[0007] According to the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines, the machine translation engine that best matches each cluster is selected from the multiple machine translation engines.

[0008] In one embodiment, the documents to be translated are aggregated and divided into multiple clusters based on the sentence vector of each sentence in the documents to be translated, including:

[0009] Taking the sentence vector of each sentence in the document to be translated as an object, and constructing a set including a plurality of the objects;

[0010] Calculating the similarity between any two objects in the set;

[0011] According to the similarity and a preset clustering threshold, the plurality of objects in the set are respectively divided into the plurality of clusters, each of the clusters including at least one of the objects.

[0012] In one embodiment, dividing the plurality of objects in the set into the plurality of clusters according to the similarity and a preset clustering threshold comprises:

[0013] The first step is to select an object from the set and classify it into a cluster as an initial element;

[0014] Step 2: Select the object with the highest average similarity to all elements in the cluster from the remaining objects in the set as the pending element;

[0015] Step 3: If the mean similarity between the undetermined element and all elements in the cluster is greater than or equal to the preset clustering threshold, the undetermined element is divided into the cluster and the undetermined element is deleted from the set;

[0016] Step 4: Repeat the above steps 2 and 3 until the average similarity between the element to be determined and all elements in the cluster is less than the preset clustering threshold, thus completing the construction of the cluster;

[0017] Step 5: Following the process from Step 1 to Step 4, construct the next cluster among the remaining objects in the set until the multiple clusters are constructed and each object in the set is assigned to one cluster.

[0018] In one embodiment, selecting the machine translation engine that best matches each cluster from the multiple machine translation engines based on the sentence vector and target language vector of each sentence in the multiple clusters and the source sentence vector and target sentence vector of each training corpus in the multiple machine translation engines includes:

[0019] respectively calculating a first dot product between the sentence vector of each sentence in the plurality of clusters and the original sentence vector of each training corpus in the plurality of machine translation engines;

[0020] respectively calculating a second dot product between the target language vector of each sentence in the plurality of clusters and the translation sentence vector of each training corpus in the plurality of machine translation engines;

[0021] Determining final matching values between the plurality of clusters and the plurality of machine translation engines respectively according to the first dot product and the second dot product;

[0022] The machine translation engine that best matches each cluster is determined according to the final matching value.

[0023] In one embodiment, determining final matching values of the plurality of clusters and the plurality of machine translation engines respectively according to the first dot product and the second dot product includes:

[0024] Obtaining a first matching value between each cluster and each machine translation engine original text according to the maximum value of the first dot product corresponding to the sentence vector of each sentence in each cluster and the number of sentence vectors in each cluster;

[0025] Obtaining a second matching value between each cluster and each machine translation engine translation according to the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster and the number of sentence vectors in each cluster;

[0026] According to the first matching value, the second matching value, and a preset original text matching threshold and translation matching threshold, a final matching value between each cluster and each machine translation engine is obtained.

[0027] In one embodiment, obtaining a final matching value between each cluster and each machine translation engine based on the first matching value, the second matching value, and a preset original text matching threshold and a preset translation matching threshold includes:

[0028] Calculate the product of the first matching value and the original text matching threshold, and record it as a first product;

[0029] Calculating the product of the second matching value and the translation matching threshold, recorded as a second product;

[0030] The sum of the first product and the second product is calculated and recorded as the final matching value between the cluster and the machine translation engine.

[0031] In one embodiment, the sum of the original text matching threshold and the translation matching threshold is 1, and the original text matching threshold is greater than the translation matching threshold.

[0032] In a second aspect, an embodiment of the present application provides a matching device for a machine translation engine, the matching device comprising:

[0033] A clustering module, configured to aggregate the documents to be translated into multiple clusters based on the sentence vector of each sentence in the documents to be translated;

[0034] A matching module is configured to select, from the multiple machine translation engines, the machine translation engine that best matches each of the clusters based on the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines.

[0035] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing a computer program, wherein the processor implements the steps of the matching method described in the first aspect when executing the computer program.

[0036] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements the steps of the matching method described in the first aspect when executed by a processor.

[0037] The embodiments of the present application provide a matching method, apparatus, device, and medium for a machine translation engine. The method groups documents to be translated into multiple clusters, and then selects the machine translation engine that best matches each cluster from multiple machine translation engines based on the sentence vector and target language vector of each sentence in the cluster, as well as the original sentence vector and translated sentence vector of each training corpus in multiple machine translation engines. This allows each sentence in the document to be translated to be translated using the machine translation engine that best matches it, thereby fully utilizing vertical machine translation engines and significantly improving translation quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is one of the flow charts of a matching method of a machine translation engine provided in an embodiment of the present application;

[0039] Figure 2 This is the second flow chart of a matching method of a machine translation engine provided in an embodiment of the present application;

[0040] Figure 3 This is the third flow chart of a matching method of a machine translation engine provided in an embodiment of the present application;

[0041] Figure 4 This is a structural diagram of a matching device for a machine translation engine provided in an embodiment of the present application;

[0042] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.

[0044] The terms "first", "second", "third", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", "third", etc. are generally of the same type, and do not limit the number of objects. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0045] Figure 1 This is a flow chart of a matching method of a machine translation engine provided in an embodiment of the present application. Figure 1 As shown, a matching method of a machine translation engine provided in an embodiment of the present application may include:

[0046] Step 100: Aggregate the documents to be translated according to the sentence vector of each sentence in the documents to be translated and divide them into multiple clusters.

[0047] Specifically, word embeddings, also known as word vectors, are part of natural language processing. Words or phrases are mapped to real vectors in a multidimensional space. Similarly, sentence embeddings are real vectors mapped to a multidimensional space. They can be derived from word embeddings or generated independently.

[0048] In the embodiment of the present disclosure, aggregation is to group together sentences with a certain degree of similarity in the documents to be translated.

[0049] Step 200: Select a machine translation engine that best matches each cluster from the multiple machine translation engines based on the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines.

[0050] By aggregating the documents to be translated into multiple clusters, and then selecting the machine translation engine that best matches each cluster from multiple machine translation engines based on the sentence vector and target language vector of each sentence in the cluster, as well as the original sentence vector and translated sentence vector of each training corpus in multiple machine translation engines, each sentence in the document to be translated can be translated using the machine translation engine that best matches it, thereby making full use of vertical machine translation engines and significantly improving translation quality.

[0051] In an embodiment of the present application, the document to be translated can be input into a specific pre-trained model, such as the BERT (Bidirectional Encoder Representations from Transformer) model, to generate a sentence vector for each sentence. The target language into which the document to be translated is selected, and the target language vector for each sentence is generated. For example, if all the sentences in the document to be translated are in Chinese and Chinese needs to be translated into English, then the target language for each sentence is English.

[0052] Similarly, the original text and translation of each training corpus in the machine translation engine can be input into the BERT model to obtain the original sentence vector and translation sentence vector of each training corpus in the machine translation engine. This is a conventional technique and will not be described in detail in this application.

[0053] It should be noted that the machine translation engine described in this application is consistent with the translation direction of the document to be translated.

[0054] Figure 2 This is a second flow chart of a matching method of a machine translation engine provided in an embodiment of the present application. Figure 2 As shown, based on the above embodiment, step 100 may include:

[0055] Step 110: Treat the sentence vector of each sentence in the document to be translated as an object and construct a set including multiple objects.

[0056] For example, the document to be translated includes n sentences, and the sentence vector of each sentence is represented by s. The constructed set is S = {s1, ...si, ...sn}, where s1, ...si, ...sn represent the sentence vectors of n sentences respectively, where si represents the sentence vector of the i-th sentence among the n sentences, and 1≤i≤n.

[0057] Step 120: Calculate the similarity between any two objects in the collection.

[0058] In the embodiment of the present application, a cosine similarity algorithm may be used to calculate the similarity between any two objects in the set S.

[0059] Step 130: Divide the multiple objects in the set into multiple clusters according to the similarity and a preset clustering threshold, where each cluster includes at least one object.

[0060] The clustering threshold is a threshold selected from the range of 0 to 1, and is generally set to 0.6.

[0061] By using the above method, each object in each cluster obtained by aggregation can have a certain degree of similarity, thereby facilitating subsequent translation of each cluster using the same machine translation engine.

[0062] Based on the above embodiment, step 130 may include:

[0063] The first step is to select an object from the set and divide it into a cluster as the initial element;

[0064] The second step is to select the object with the highest average similarity with all elements in the cluster from the remaining objects in the set as the pending element;

[0065] The mean similarity is the average of the sum of the similarities between the selected object and each element in the cluster. The object with the highest mean similarity is the object with the highest average of the sum of the similarities between the selected object and each element in the cluster when there are multiple selected objects.

[0066] Step 3: If the mean similarity between the undetermined element and all elements in the cluster is greater than or equal to the preset clustering threshold, the undetermined element is divided into the cluster and deleted from the set;

[0067] Step 4: Repeat the above steps 2 and 3 until the average similarity between the element to be determined and all elements in the cluster is less than the preset clustering threshold, completing the construction of a cluster;

[0068] Step 5: Following the process from Step 1 to Step 4 above, the next cluster is constructed among the remaining objects in the set until multiple clusters are constructed and each object in the set is assigned to a cluster.

[0069] To better understand this application, the following example illustrates the specific process of clustering in this application. Assuming that the set S contains four objects, namely s1, s2, s3 and s4, the clustering process is as follows:

[0070] (1) Select object s1 from set S (generally the first object in set S is preferred) and divide it into a cluster C1 as the initial element.

[0071] (2) Select the object with the highest mean similarity to element s1 in cluster C1 from the remaining objects s2, s3 and s4 in set S as the undetermined element.

[0072] At this point, since cluster C1 contains only one initial element, s1, we can directly select the object with the highest similarity to element s1 as the pending element. Since the similarity between any two objects in the set has already been calculated in step 120, we can determine the object with the highest mean similarity to element s1 based on the calculation results of step 120. For example, this is s2. In this case, s2 is selected as the pending element.

[0073] (3) Compare the similarity between the undetermined element s2 and the initial element s1 to see whether it is greater than or equal to the preset clustering threshold.

[0074] Assuming that the clustering threshold is 0.6, the similarity between the undetermined element s2 and the initial element s1 is 0.8, and 0.6<0.8, the undetermined element s2 is divided into cluster C1 and step (4) is continued.

[0075] In another case, if the similarity between the undetermined element s2 and the initial element s1 is 0.5, and 0.6>0.5, then the undetermined element s2 cannot be classified into cluster C1. In this case, the construction of cluster C1 is completed, that is, there is only one element s1 in cluster C1, and no subsequent steps are required.

[0076] (4) Select the object with the highest mean similarity to elements s1 and s2 in cluster C1 from the remaining objects s3 and s4 in set S as the undetermined element.

[0077] Assuming that the similarities between object s3 and elements s1 and s2 are 0.6 and 0.5, respectively, and the similarities between object s4 and elements s1 and s2 are 0.5 and 0.4, respectively, we can calculate that the average similarity between object s3 and elements s1 and s2 is (0.6 + 0.5) / 2 = 0.55, and the average similarity between object s4 and elements s1 and s2 is (0.6 + 0.4) / 2 = 0.5. In this case, object s3 can be selected as the element to be determined.

[0078] (5) Compare the similarity average (i.e., 0.55) between the undetermined element s3 and elements s1 and s2 to see whether it is greater than or equal to the preset clustering threshold.

[0079] Since the average similarity between the undetermined element s3 and elements s1 and s2 is 0.55, which is less than 0.6, the undetermined element s3 cannot be classified into cluster C1. This completes the construction of cluster C1, which contains elements s1 and s2.

[0080] (6) Select object s4 from the set S and divide it into a cluster C2 as the initial element.

[0081] At this time, since there are no other objects in the set S, cluster C2 only contains element s4.

[0082] If there are more objects in the set S, then you can continue to follow the methods in steps (1) to (5) above to select more elements from other objects into cluster C2, and complete the construction of clusters C2, C3, ..., Ck.

[0083] Figure 3 This is a flow chart of a matching method of a machine translation engine provided in an embodiment of the present application. Figure 3As shown, based on the above embodiment, step 200 may include:

[0084] Step 210: Calculate the first dot product between the sentence vector of each sentence in the multiple clusters and the original sentence vector of each training corpus in the multiple machine translation engines.

[0085] For example, the present embodiment includes two clusters C1 and C2, where C1 includes sentence vectors m11 and m12 for two sentences, and C2 includes sentence vectors m21 and m22 for two sentences. Furthermore, the present embodiment includes two machine translation engines K1 and K2, where K1 includes sentence vectors n11 and n12 for the original text of two training corpora, and K2 includes sentence vectors n21 and n22 for the original text of two training corpora.

[0086] In step 210, the first dot products between m11 and n11, between m11 and n12, between m11 and n21, and between m11 and n22 need to be calculated, respectively. The first dot products between m12 and n11, between m12 and n12, between m12 and n21, and between m12 and n22 also need to be calculated. At the same time, the first dot products between m21 and n11, between m21 and n12, between m21 and n21, and between m21 and n22 are also calculated, as well as the first dot products between m22 and n11, between m22 and n12, between m22 and n21, and between m22 and n22.

[0087] Step 220 : Calculate the second dot product between the target language vector of each sentence in the multiple clusters and the translation sentence vector of each training corpus in the multiple machine translation engines.

[0088] For example, the present embodiment includes two clusters C1 and C2, where C1 includes target language vectors m11' and m12' for two sentences, and C2 includes target language vectors m21' and m22' for two sentences. Furthermore, the present embodiment includes two machine translation engines K1 and K2, where K1 includes target sentence vectors n11' and n12' for two training corpora, and K2 includes target sentence vectors n21' and n22' for two training corpora.

[0089] In step 210, the first dot products between m11' and n11', between m11' and n12', between m11' and n21', and between m11' and n22' need to be calculated, respectively. The first dot products between m12' and n11', between m12' and n12', between m12' and n21', and between m12' and n22' also need to be calculated. At the same time, the first dot products between m21' and n11', between m21' and n12', between m21' and n21', and between m21' and n22' also need to be calculated, respectively. The first dot products between m22' and n11', between m22' and n12', between m22' and n21', and between m22' and n22' also need to be calculated, respectively.

[0090] Step 230: Determine final matching values between the plurality of clusters and the plurality of machine translation engines according to the first dot product and the second dot product.

[0091] In the embodiment of the present application, step 230 may include:

[0092] The first step is to obtain the first matching value between each cluster and each machine translation engine original text based on the maximum value of the first dot product corresponding to the sentence vector of each sentence in each cluster and the number of sentence vectors in each cluster.

[0093] In an embodiment of the present application, the maximum value of the first dot product corresponding to the sentence vector of each sentence in each cluster can be added and divided by the number of sentence vectors in each cluster to obtain the first matching value of each cluster and each machine translation engine original text.

[0094] For example, assuming that for machine translation engine K1 in the above example, the first dot product W11 between the sentence vectors m11 and n11 in cluster C1 is the largest, and the first dot product W12 between m12 and n12 is the largest, then the first matching value Q11 between cluster C1 and the original text of machine translation engine K1 is (W11 + W22) / 2. If the first dot product W13 between the sentence vectors m21 and n11 in cluster C2 is the largest, and the first dot product W14 between m22 and n12 is the largest, then the first matching value Q21 between cluster C2 and the original text of machine translation engine K1 is (W13 + W14) / 2.

[0095] Similarly, using the above method, the first matching value Q12 between cluster C1 and the original text of the machine translation engine K2 and the first matching value Q22 between cluster C2 and the original text of the machine translation engine K2 can be obtained.

[0096] In the second step, the second matching value between each cluster and each machine translation engine translation is obtained based on the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster and the number of sentence vectors in each cluster.

[0097] In an embodiment of the present application, the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster can be added and divided by the number of sentence vectors in each cluster to obtain the second matching value of each cluster and each machine translation engine translation.

[0098] For example, assuming that, for machine translation engine K1, the second dot product W11' between sentence vectors m11' and n11' in cluster C1 is the largest, and the second dot product W12' between m12' and n12' is the largest, then the second matching value Q11' between the translation cluster C1 and machine translation engine K1 is (W11' + W22') / 2. If the second dot product W13' between sentence vectors m21' and n11' in cluster C2 is the largest, and the second dot product W14' between m22' and n12' is the largest, then the second matching value Q21' between cluster C2 and the translation of machine translation engine K1 is (W13' + W14') / 2.

[0099] Similarly, using the above method, a second matching value Q12' between cluster C1 and the translation of the machine translation engine K2 and a second matching value Q22' between cluster C2 and the translation of the machine translation engine K2 can be obtained.

[0100] Step 3: According to the first matching value, the second matching value, and the preset original text matching threshold and translation matching threshold, the final matching value of each cluster and each machine translation engine is obtained.

[0101] The original text matching threshold and the translation matching threshold can be pre-set. The sum of the original text matching threshold a and the translation matching threshold b is 1, and the original text matching threshold a is greater than the translation matching threshold b. For example, in the embodiment of the present application, a=0.7 and b=0.3 can be set.

[0102] Optionally, the third step may include:

[0103] Calculate the product of the first matching value and the original text matching threshold, and record it as a first product;

[0104] Calculating the product of the second matching value and the translation matching threshold, recorded as a second product;

[0105] The sum of the first product and the second product is calculated and recorded as the final matching value between the cluster and the machine translation engine.

[0106] For example, for clusters C1 and C2 and machine translation engines K1 and K2, the above embodiment has four first matching values Q11, Q12, Q21, and Q22, and four second matching values Q11', Q12', Q21', and Q22'.

[0107] Then, four first products Q11*a, Q12*a, Q21*a, and Q22*a, and four second products Q11'*b, Q12'*b, Q21'*b, and Q22'*b can be calculated.

[0108] For cluster C1 and machine translation engine K1, the final matching value Z11 = Q11*a+Q11'*b.

[0109] For cluster C1 and machine translation engine K2, the final matching value Z12 = Q12*a+Q12'*b.

[0110] For cluster C2 and machine translation engine K1, the final matching value Z21 = Q21*a+Q21'*b.

[0111] For cluster C2 and machine translation engine K2, the final matching value Z22 = Q22*a+Q22'*b.

[0112] Step 240: Determine the machine translation engine that best matches each cluster based on the final matching value.

[0113] Specifically, the machine translation engine with the largest final matching value with each cluster may be selected as the machine translation engine that best matches each cluster.

[0114] For example, in the above embodiment, four final matching values Z11, Z12, Z21, and Z22 are ultimately obtained. If Z11 < Z12, then the machine translation engine that best matches cluster C1 is determined to be K2. If Z12 < Z11, then the machine translation engine that best matches cluster C1 is determined to be K1. If Z11 = Z12, then either K1 or K2 can be selected as the machine translation engine that best matches cluster C1.

[0115] Similarly, if Z21 < Z22, then K2 is determined to be the most suitable machine translation engine for cluster C2. If Z22 < Z21, then K1 is determined to be the most suitable machine translation engine for cluster C2. If Z21 = Z22, then either K1 or K2 can be selected as the most suitable machine translation engine for cluster C2.

[0116] The final matching values between multiple clusters and the machine translation engine are calculated by dot product, which ultimately ensures the matching effect between the final machine translation engine and each sentence in the cluster, further ensuring the translation quality.

[0117] A code docking device provided in an embodiment of the present application is described below. The code docking device described below and the code docking method described above can refer to each other.

[0118] Figure 4 This is a structural diagram of a matching device for a machine translation engine provided in an embodiment of the present application. Figure 4As shown, the code docking device 400 includes a clustering module 410 and a matching module 420 .

[0119] A clustering module 410 is used to aggregate the documents to be translated into multiple clusters based on the sentence vector of each sentence in the documents to be translated;

[0120] The matching module 420 is configured to select a machine translation engine that best matches each cluster from the multiple machine translation engines based on the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines.

[0121] By aggregating the documents to be translated into multiple clusters, and then selecting the machine translation engine that best matches each cluster from multiple machine translation engines based on the sentence vector and target language vector of each sentence in the cluster, as well as the original sentence vector and translated sentence vector of each training corpus in multiple machine translation engines, each sentence in the document to be translated can be translated using the machine translation engine that best matches it, thereby making full use of vertical machine translation engines and significantly improving translation quality.

[0122] Optionally, the clustering module 410 is further configured to:

[0123] Treat the sentence vector of each sentence in the document to be translated as an object and construct a set of multiple objects;

[0124] Calculate the similarity between any two objects in the collection;

[0125] According to the similarity and a preset clustering threshold, multiple objects in the collection are divided into multiple clusters, each cluster including at least one object.

[0126] Optionally, the clustering module 410 is further configured to:

[0127] The first step is to select an object from the set and divide it into a cluster as the initial element;

[0128] The second step is to select the object with the highest average similarity with all elements in the cluster from the remaining objects in the set as the pending element;

[0129] Step 3: If the mean similarity between the undetermined element and all elements in the cluster is greater than or equal to the preset clustering threshold, the undetermined element is divided into the cluster and deleted from the set;

[0130] Step 4: Repeat the above steps 2 and 3 until the average similarity between the element to be determined and all elements in the cluster is less than the preset clustering threshold, completing the construction of a cluster;

[0131] Step 5: Following the process from Step 1 to Step 4 above, the next cluster is constructed among the remaining objects in the set until multiple clusters are constructed and each object in the set is assigned to a cluster.

[0132] Optionally, the matching module 420 is further configured to:

[0133] Calculate the first dot product between the sentence vector of each sentence in multiple clusters and the original sentence vector of each training corpus in multiple machine translation engines;

[0134] Calculating the second dot product between the target language vector of each sentence in the multiple clusters and the translation sentence vector of each training corpus in the multiple machine translation engines;

[0135] Determining final matching values between the plurality of clusters and the plurality of machine translation engines respectively according to the first dot product and the second dot product;

[0136] The machine translation engine that best matches each cluster is determined based on the final matching value.

[0137] Optionally, the matching module 420 is further configured to:

[0138] Obtaining a first matching value between each cluster and each machine translation engine original text based on the maximum value of the first dot product of the sentence vectors of each sentence in each cluster and the number of sentence vectors in each cluster;

[0139] Obtaining a second matching value between each cluster and each machine translation engine translation based on the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster and the number of sentence vectors in each cluster;

[0140] According to the first matching value, the second matching value, and the preset original text matching threshold and translation matching threshold, a final matching value between each cluster and each machine translation engine is obtained.

[0141] Optionally, the matching module 420 is further configured to:

[0142] Calculate the product of the first matching value and the original text matching threshold, and record it as the first product;

[0143] Calculate the product of the second matching value and the translation matching threshold, and record it as the second product;

[0144] Calculate the sum of the first product and the second product, and record it as the final matching value between the clustering and the machine translation engine.

[0145] Optionally, the sum of the original text matching threshold and the translation matching threshold is 1, and the original text matching threshold is greater than the translation matching threshold.

[0146] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call the computer program in the memory 530 to execute the steps of the matching method provided in the above embodiments, for example, including:

[0147] Based on the sentence vector of each sentence in the document to be translated, the documents to be translated are aggregated and divided into multiple clusters;

[0148] According to the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines, a machine translation engine that best matches each cluster is selected from the multiple machine translation engines.

[0149] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the 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 for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0150] On the other hand, embodiments of the present application further provide a computer program product, comprising a computer program. The computer program may be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the matching method provided in each of the above embodiments, for example, including:

[0151] Based on the sentence vector of each sentence in the document to be translated, the documents to be translated are aggregated and divided into multiple clusters;

[0152] According to the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines, a machine translation engine that best matches each cluster is selected from the multiple machine translation engines.

[0153] On the other hand, an embodiment of the present application further provides a processor-readable storage medium, wherein the processor-readable storage medium stores a computer program, wherein the computer program is configured to cause a processor to execute the steps of the methods provided in the above embodiments, for example, including:

[0154] Based on the sentence vector of each sentence in the document to be translated, the documents to be translated are aggregated and divided into multiple clusters;

[0155] According to the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and translated sentence vector of each training corpus in the multiple machine translation engines, a machine translation engine that best matches each cluster is selected from the multiple machine translation engines.

[0156] The processor-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROMs, EPROMs, EEPROMs, non-volatile memories (NANDFLASH), solid-state drives (SSDs)), etc.

[0157] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0158] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A matching method for a machine translation engine, characterized in that: The matching method includes: According to the sentence vector of each sentence in the document to be translated, the document to be translated is aggregated and divided into multiple clusters; The method further comprises: selecting, from the plurality of machine translation engines, the machine translation engine that best matches each cluster based on the sentence vector and the target language vector of each sentence in the plurality of clusters, and the source sentence vector and the target language vector of each training corpus in the plurality of machine translation engines. respectively calculating a first dot product between the sentence vector of each sentence in the plurality of clusters and the original sentence vector of each training corpus in the plurality of machine translation engines; respectively calculating a second dot product between the target language vector of each sentence in the plurality of clusters and the translation sentence vector of each training corpus in the plurality of machine translation engines; Determining final matching values between the plurality of clusters and the plurality of machine translation engines according to the first dot product and the second dot product respectively includes: Obtaining a first matching value between each cluster and each machine translation engine original text according to the maximum value of the first dot product corresponding to the sentence vector of each sentence in each cluster and the number of sentence vectors in each cluster; Obtaining a second matching value between each cluster and each machine translation engine translation according to the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster and the number of sentence vectors in each cluster; Obtaining a final matching value between each cluster and each machine translation engine according to the first matching value, the second matching value, and a preset original text matching threshold and a preset translation matching threshold; The machine translation engine that best matches each cluster is determined according to the final matching value.

2. The matching method according to claim 1, wherein: The documents to be translated are aggregated according to the sentence vector of each sentence in the documents to be translated and divided into multiple clusters, including: Taking the sentence vector of each sentence in the document to be translated as an object, and constructing a set including a plurality of the objects; Calculating the similarity between any two objects in the set; According to the similarity and a preset clustering threshold, the plurality of objects in the set are respectively divided into the plurality of clusters, each of the clusters including at least one of the objects.

3. The matching method according to claim 2, characterized in that: The dividing the plurality of objects in the set into the plurality of clusters according to the similarity and a preset clustering threshold comprises: The first step is to select an object from the set and classify it into a cluster as an initial element; Step 2: Select the object with the highest average similarity to all elements in the cluster from the remaining objects in the set as the pending element; Step 3: If the mean similarity between the undetermined element and all elements in the cluster is greater than or equal to the preset clustering threshold, the undetermined element is divided into the cluster and the undetermined element is deleted from the set; Step 4: Repeat the above steps 2 and 3 until the average similarity between the element to be determined and all elements in the cluster is less than the preset clustering threshold, thus completing the construction of the cluster; Step 5: Following the process from Step 1 to Step 4, construct the next cluster among the remaining objects in the set until the multiple clusters are constructed and each object in the set is assigned to one cluster.

4. The matching method according to claim 1, wherein: Obtaining a final matching value between each cluster and each machine translation engine based on the first matching value, the second matching value, and a preset original text matching threshold and a preset translation matching threshold includes: Calculate the product of the first matching value and the original text matching threshold, and record it as a first product; Calculating the product of the second matching value and the translation matching threshold, recorded as a second product; The sum of the first product and the second product is calculated and recorded as the final matching value between the cluster and the machine translation engine.

5. The matching method according to claim 4, characterized in that: The sum of the original text matching threshold and the translation matching threshold is 1, and the original text matching threshold is greater than the translation matching threshold.

6. A matching device for a machine translation engine, characterized in that: The matching device comprises: A clustering module, configured to aggregate the documents to be translated into multiple clusters based on the sentence vector of each sentence in the documents to be translated; A matching module is configured to select, from the multiple machine translation engines, the machine translation engine that best matches each cluster based on the sentence vector and target language vector of each sentence in the multiple clusters, and the original sentence vector and target language vector of each training corpus in the multiple machine translation engines, including: respectively calculating a first dot product between the sentence vector of each sentence in the plurality of clusters and the original sentence vector of each training corpus in the plurality of machine translation engines; respectively calculating a second dot product between the target language vector of each sentence in the plurality of clusters and the translation sentence vector of each training corpus in the plurality of machine translation engines; Determining final matching values between the plurality of clusters and the plurality of machine translation engines according to the first dot product and the second dot product respectively includes: Obtaining a first matching value between each cluster and each machine translation engine original text according to the maximum value of the first dot product corresponding to the sentence vector of each sentence in each cluster and the number of sentence vectors in each cluster; Obtaining a second matching value between each cluster and each machine translation engine translation according to the maximum value of the second dot product corresponding to the target language vector of each sentence in each cluster and the number of sentence vectors in each cluster; Obtaining a final matching value between each cluster and each machine translation engine according to the first matching value, the second matching value, and a preset original text matching threshold and a preset translation matching threshold; The machine translation engine that best matches each cluster is determined according to the final matching value.

7. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the matching method according to any one of claims 1 to 5 are implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the matching method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Translation engine suggestion via targeted probes

    CN112463917A