A keyword prompting method for text translators
The importance score of words in source language sentences is calculated through the self-attention neural network encoder, which solves the problem of mistranslation and missing translation when translators deal with numbers, measurement units and punctuation marks, etc., and achieves higher translation accuracy. and work efficiency.
Patent Information
- Application Number
- CN202111409606.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-09-07
- Filing Date
- 2021-11-25
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-11-25
AI Technical Summary
Existing computer-assisted translation technology cannot effectively prevent translators from making mistakes in processing numbers, units of measurement, and punctuation marks in the source language, leading to frequent mistranslations and missed translations.
By converting the input source language words into a word vector sequence, and using a self-attention neural network encoder to calculate the importance score of each word, the maximum and minimum values are scaled to mark the importance, prompting the translator to focus on key words.
It effectively prevents missing or mistranslated keywords, improves translation accuracy, and improves the efficiency of translation and proofreading work.
Smart Images

Figure CN114328856B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a keyword prompting method for text translators, belonging to the technical field of computer application and computer-assisted translation. Background Art
[0002] Computer-assisted translation is a general term for human-computer collaboration technology for translators, which aims to use computers to improve the efficiency of translators in the translation production process. In modern translation work, text translators usually use computer-assisted translation systems. At present, the core goal of computer-assisted translation is to assist translators in handling translation work with a high rate of translation repetition, provide translation memory and translation candidates, thereby improving the translation efficiency of translators, improving translation quality, and optimizing the translation process.
[0003] Existing assisted translation technologies mainly focus on providing translation memory, prompting terminology translation, and other functions. However, some errors that are prone to occur in manual translation work are ignored. For example, some numbers, measurement units, and even punctuation marks in the source language that need to be translated are often mistranslated due to the negligence of the translator. On the other hand, some important verbs, nouns, or modifying elements may also be omitted or mistranslated due to negligence. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and creatively propose a keyword prompting method for text translators in view of the above technical problems. The method marks the importance of the input source language words in advance to prompt the translators to focus on these words, avoid mistranslation and omission, and improve the translation accuracy. At the same time, the translation proofreader can also use this method to improve the efficiency of proofreading work.
[0005] The innovation of the present invention is that: first, the input sequence is converted into a word vector sequence, and then the word vector sequence is calculated by a self-attention neural network encoder to obtain the importance score of each word in the input source language sentence. The score is scaled by the maximum and minimum values to obtain the final score. According to the final score, the importance of each word in the input source language sentence is marked to prompt the translator to focus on important vocabulary.
[0006] In order to achieve the above-mentioned purpose and technology, the technical solution adopted by the present invention is as follows:
[0007] A keyword prompting method for text translators comprises the following steps:
[0008] First, the relevant definitions are as follows:
[0009] Definition 1: Source language sentence
[0010] Refers to the source language sentence to be translated, denoted by X, X={x1,…,x i ,…,x T}, where T is the length of the source language sentence, x i Represents a word in a source language sentence.
[0011] Definition 2: Target language sentence
[0012] It refers to the target language sentence obtained after the source language is translated, denoted as Y, Y = {y1,…,y T}.
[0013] Definition 3: Parallel Sentence Pairs
[0014] It is a sentence pair consisting of a source language sentence and a corresponding target language sentence, denoted as (X, Y);
[0015] A data set consisting of parallel sentence pairs is called parallel data.
[0016] Definition 4: Vocabulary
[0017] A list of all known words, denoted by V;
[0018] The list provides a number for each word, and the length of the vocabulary is N. v , the number of word w in the vocabulary is denoted by V(w);
[0019] The vocabulary consisting of source language words is called the source language vocabulary, denoted by V x ; The vocabulary consisting of target language words is called the target language vocabulary, denoted by V y .
[0020] Definition 5: One-hot encoding
[0021] It is denoted as O and represented by an integer vector. The length of the vector is the length of the vocabulary. For the integer n that needs to be encoded, the nth bit in the one-hot encoding is 1, and the other bits are 0. The one-hot encoding of the integer n is denoted as O(n).
[0022] Definition 6: Word Embedding
[0023] Refers to the distributed real number representation corresponding to the word. It is presented in the form of a real vector, and the dimension of the word vector is d e .
[0024] Definition 7: Word Embedding Matrix
[0025] A two-dimensional real number matrix composed of word vectors arranged in the order of the vocabulary, denoted as E, with a dimension of N v ×d e ,Right now, in, is a real number field; if the unique hot encoding corresponding to word w is O w , then the word vector of w is obtained by O w ×E is calculated and abbreviated as O w E;
[0026] The source language word vector matrix is denoted as E x , the target language word vector matrix is recorded as E y .
[0027] Definition 8: Activation Function
[0028] Refers to the activation function in a neural network, denoted by σ(·).
[0029] Definition 9: Self-Attention Neural Network Encoder
[0030] Denoted as ε(·), its input is a real matrix and its output is a matrix with dimension d m Real vector of And the attention weight vector W. It is calculated as follows:
[0031] ε(e)=U o ×(W×H(e))+b o (1)
[0032] in, e represents the input real number matrix, which consists of a sequence of word vectors; L represents the number of matrix columns, which is paired with the sentence length; H(e) represents the hidden layer state matrix of the encoder;
[0033] The calculation methods of W and H(e) are as follows:
[0034] W = softmax(tanh(U w H(e))) (2)
[0035]
[0036] Among them, U o , U w , U h , U g , b o , b h , b g are the free parameter matrices in the model, Represents bitwise multiplication, and the dimension of the model is denoted by d m ,but σ represents the activation function.
[0037] Definition 10: Heatmap
[0038] It is a chart that intuitively displays the difference between values through the brightness of colors. In the present invention, the lower the brightness (the darker the color), the larger the corresponding value.
[0039] Step 1: According to Definition 1 and Definition 4, the input source language sentence X = {x1,…,x T} is converted into a sequence of word numbers V(X), V(X) = {V(x1),…,V(x T )}, where V(x t ) represents the tth word x in the source language sentence t Number.
[0040] Step 2: According to Definition 5, convert the word number sequence in step 1 into a one-hot encoding sequence O(V(X)), O(V(X)) = {O(V(x1)),…,O(V(x1)) T ))}, where O(V(x t )) represents the tth word x in the source language sentence t One-hot encoding of . We can abbreviate O(V(X)) as
[0041] Step 3: According to Definition 6 and Definition 7, convert the one-hot encoded sequence in step 2 into a word vector sequence in The tth word x in the source language sentence t The word vector of O X E x Abbreviated as E x X={E x x1,…,E x x T}.
[0042] Step 4: According to Definition 6 and Definition 9, the word vector sequence E obtained in step 3 x X is used as the input of the self-attention neural network encoder to calculate ε(E x X):
[0043]
[0044] W = softmax(tanh(U w H(E x X))) (5)
[0045] ε(E x X)=U o ×(W×H(E x X))+b o (6)
[0046] Among them, H(E xX) represents the input word vector matrix E x The hidden layer state matrix of the encoder obtained after X, ε(E x X) is the input word vector matrix E x X is used to get the sentence encoding. The dimension is d m The sentence encoding vector and a self-attention weight vector with T elements
[0047] Step 5: Scale the self-attention weight vector W obtained in step 4 to the maximum and minimum values.
[0048] Specifically, the implementation method is as follows:
[0049] First, find the maximum and minimum values in W, denoted by w max and w min ;
[0050] Then, traverse each element in W, where the i-th element is recorded as w i , w i ∈W, we have:
[0051]
[0052] in, Represents the i-th element after scaling. Thus, the scaled weight vector W is obtained. * . * The importance score of each word in the source language sentence taken as input.
[0053] Step 6: Substitute the scaled weight vector W from step 5 * , that is, the importance score of each word is displayed. Specifically, it can be displayed in the form of a heat map according to Definition 10.
[0054] Beneficial Effects
[0055] Compared with the prior art, the method of the present invention has the following beneficial effects:
[0056] 1. The method of the present invention can automatically prompt the translator of the keywords in the source language sentence to be translated before the translator performs the translation operation, so as to prompt the translator to focus on the keywords, and can effectively prevent the occurrence of problems such as omission or mistranslation of keywords.
[0057] 2. The keyword prompting function of the present invention is also applicable to target language sentences. Keywords of the source language and the target language can be prompted at the same time to facilitate the proofreading work of the translator after translation. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1It is a flow chart for realizing the method of the present invention;
[0059] Figure 2 It is a visualization result display effect diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The method of the present invention is described in detail below with reference to the accompanying drawings and embodiments. Figure 1 Flow chart of the method of the present invention.
[0061] Example
[0062] Taking the source language sentences in the NIST 2003 Chinese to English translation test data as an example, X = {'human', 'total', 'twenty-three', 'pair', 'chromosome', '. '}, the operation flow of the keyword prompt method for text translators proposed by the present invention is introduced:
[0063] Step 1: According to Definition 1 and Definition 4, the input source language sentence X = {'human', 'total', 'twenty-three', 'pair', 'chromosome', '. '} is converted into a sequence of word numbers: V(X) = {994,956,4312,25,21968,4};
[0064] Step 2: According to Definition 5, convert the word number sequence in step 1 into a one-hot encoding sequence: Since the one-hot encoding is too long, it is given in symbolic form. For example, its specific form should be:
[0065] Step 3: According to Definition 6 and Definition 7, convert the one-hot encoded sequence in step 2 into a word vector sequence: E x X={E x x1,E x x2,E x x3,E x x4,E x x5,E x x6}, where each vector has dimension d e The value of E is 512. x Take x6 as an example, its specific form is: E x x6=[0.07628387957811356,-0.030490420758724213,0.05357102304697037,…,-0.01158 3887040615082,0.013022661209106445,0.0565364733338356,-0.01634673774242401];
[0066] Step 4: According to Definition 6 and Definition 9, the word vector sequence E obtained in step 3 x X is used as the input of the self-attention neural network encoder, and ε(E x X):
[0067]
[0068] W = softmax(tanh(U w H(E x X)))
[0069] ε(E x X)=U o ×(W×H(E x X))+b o
[0070] In this embodiment, d m =512. σ(·) uses the sigmoid function:
[0071]
[0072] The self-attention weight vector W with the number of elements T=6 is obtained, W=[0.1521, 0.1370, 0.1753, 0.1089, 0.2670, 0.159].
[0073] Step 5: Scale the self-attention weight vector W obtained in step 4 to the maximum and minimum values.
[0074] Specifically, the implementation method is as follows:
[0075] First, find the maximum and minimum values in W, which are w max =0.2670 and w min =0.1089.
[0076] Then, traverse each element in W, where the i-th element is recorded as w i ∈W, let:
[0077]
[0078] Get the scaled weight vector W * , W * =[0.27639824,0.18202972,0.4210846,0.0062428913,0.9937571,0.3232182].
[0079] Step 6: According to Definition 10, the weight vector W scaled in step 5 is* It is displayed in the form of a heat map. The darker the color, the higher the value, that is, the more important the corresponding word is. The specific form is shown in Figure 2 .
[0080] So far, from step 1 to step 6, the execution flow of an embodiment of the keyword prompt operation for text translators of the present method has been completed.
[0081] The above is only a preferred embodiment of the present invention, and the present invention should not be limited to the contents disclosed in the embodiment and the drawings. Any equivalent or modification completed without departing from the spirit disclosed in the present invention shall fall within the scope of protection of the present invention.
Claims
1. A keyword prompting method for text translators, characterized in that: The following steps are involved: First, the input sequence is converted into a word vector sequence, which includes the following steps: Step 1: According to Definition 1 and Definition 4, the input source language sentence X = {x1,…,x T } is converted into a sequence of word numbers V(X), V(X) = {V(x1),…,V(x T )}, where V(x t ) represents the tth word x in the source language sentence t Serial number; Step 2: According to Definition 5, convert the word number sequence in step 1 into a one-hot encoding sequence O(V(X)), O(V(X)) = {O(V(x1)),…,O(V(x1)) T ))}, where O(V(x t )) represents the tth word x in the source language sentence t One-hot encoding of ; O(V(X)) is abbreviated as Step 3: According to Definition 6 and Definition 7, convert the one-hot encoding sequence in step 2 into a word vector sequence O X E x , in The tth word x in the source language sentence t word vector; X E x Abbreviated as E x X={E x x1,…,E x x T }; in: Definition 1: Source language sentence Refers to the source language sentence to be translated, denoted by X, X={x1,…,x i ,…,x T }, where T is the length of the source language sentence, x i Represents a word in a source language sentence; Definition 4: Vocabulary A list of all known words, denoted by V; The list provides a number for each word, and the length of the vocabulary is N. v , the number of word w in the vocabulary is denoted by V(w); The vocabulary consisting of source language words is called the source language vocabulary, denoted by V x ; The vocabulary consisting of target language words is called the target language vocabulary, denoted by V y ; Definition 5: One-hot encoding It is denoted as O and represented by an integer vector. The length of the vector is the length of the vocabulary. For the integer n to be encoded, the nth bit in the one-hot encoding is 1, and the other bits are 0. The one-hot encoding of the integer n is denoted as O(n). Definition 6: Word Embedding Refers to the distributed real number representation corresponding to the word, presented in the form of a real number vector, and the dimension of the word vector is recorded as d e ; Definition 7: Word Embedding Matrix A two-dimensional real number matrix composed of word vectors arranged in the order of the vocabulary, denoted as E, with a dimension of N v ×d e ,Right now, in, is a real number field; if the unique hot encoding corresponding to word w is O w , then the word vector of w is obtained by O w ×E is calculated and abbreviated as O w E; The source language word vector matrix is denoted as E x , the target language word vector matrix is recorded as E y ; Then, the word vector sequence is calculated through the self-attention neural network encoder to obtain the importance score of each word in the input source language sentence as follows: According to Definition 6 and Definition 9, the word vector sequence E x X is used as the input of the self-attention neural network encoder, and ε(E x X): W=softmax(tanh(U w H(E x X))) ε(E x X)=U o ×(W×H(E x X))+b o Among them, H(E x X) represents the input word vector matrix E x The hidden layer state matrix of the encoder obtained after X, ε(W x X) is the input word vector matrix E x After X, the sentence encoding is obtained; the dimension is d m The sentence encoding vector and a self-attention weight vector with T elements The obtained self-attention weight vector W is scaled to the maximum and minimum values to obtain the scaled weight vector W * , W * The importance score of each word in the source language sentence as input, and the importance score of each word is displayed; in: Definition 6: Word vector refers to the distributed real number representation corresponding to a word; it is presented in the form of a real number vector, and the dimension of the word vector is denoted by d e ; Definition 9: The self-attention neural network encoder is denoted by ε(·), whose input is a real matrix and output is a matrix with dimension d m The real vector of And the attention weight vector W, which is calculated as follows: ε(e)=U o ×(W×H(e))+b o (1) in, e represents the input real number matrix, which consists of a sequence of word vectors; L represents the number of matrix columns, which is paired with the sentence length; H(e) represents the hidden layer state matrix of the encoder; The calculation methods of W and H(e) are as follows: W=softmax(tanh(U w H(e))) (2) Among them, U o , U w , U h , U g 、b o 、b h 、b g are the free parameter matrices in the model, Represents bitwise multiplication, the dimension of the model is denoted by d m ,but σ represents the activation function; After that, the score is scaled by the maximum and minimum values to obtain the final score; Based on the final score, the importance of each word in the input source language sentence is marked to provide prompts to the translator.
2. A keyword prompting method for text translators as claimed in claim 1, characterized in that: Get the scaled weight vector W * The method is as follows: First, find the maximum and minimum values in W, denoted by w max and w min ; Then, traverse each element in W, where the i-th element is recorded as w i , w i ∈W, we have: in, Represents the i-th element after scaling, thus obtaining the scaled weight vector W * .
3. A keyword prompting method for text translators as claimed in claim 1, characterized in that: Use heat map to display the importance score of each word; Among them, the heat map is a chart that intuitively displays the size differences between values through the brightness of colors. The lower the brightness and the darker the color, the larger the corresponding score value.
