A method and system for optimizing translation accuracy based on artificial intelligence
Through emotional classification and content word extraction technology based on artificial intelligence, emotional and information omission problems in traditional translation methods are optimized, and emotional consistency and information integrity of translation results are achieved, improving the accuracy and quality of translation.
Patent Information
- Application Number
- CN202510324369.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-03-19
AI Technical Summary
Traditional translation methods are difficult to maintain the tone and emotional consistency of the translation results in the case of emotional color and context differences, and ignore key information in the source language, resulting in the missed core concepts or important details of the translation results.
Using an AI-based translation accuracy optimization method, the source language and target language sentences are emotionally classified through a pre-trained emotion classification model, and the similarity of the emotion label is calculated. If the similarity is low, the enhanced characteristics of the content word collection are adjusted to optimize the translation accuracy.
Ensure that translation results are emotionally consistent, increase attention to important information, and improve the accuracy and quality of translation, especially when dealing with texts with strong emotional colors.
Smart Images

Figure CN119849514B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of language translation, and in particular to a translation accuracy optimization method and system based on artificial intelligence. Background Art
[0002] Traditional translation methods often focus only on the literal conversion of language, ignoring the differences in emotional color and context. Therefore, when there are differences in the emotional tone or context of the source language and the target language, the translation results may have emotional deviations. This emotional mismatch usually leads to the tone and emotion of the translated text being inconsistent with the original text, especially for texts with strong emotional colors (such as advertisements, poems, marketing copy, etc.). Traditional methods do not have a sentiment analysis mechanism, and it is difficult to ensure the emotional consistency between the source language and the target language. Even if the content of the text has been accurately translated, the communication of emotions may still be biased. For example, a paragraph of positive emotional content in the source language may not be translated into the target language. A cold or negative tone may be translated into a sentence, thus affecting the overall emotional expression of the original text; and traditional methods are usually based on statistical learning or rule matching for translation, mainly relying on context and grammatical rules, and are prone to ignoring some key content words or information in the source language, which may cause the translation results to miss the core concepts or important details in the original text, especially in information-intensive texts such as technical literature and academic articles; and traditional methods usually rely on fixed translation rules and cannot be dynamically adjusted according to the emotion or context of the text. Once the emotional tone and context change, the translation system cannot adaptively adjust the translation strategy, resulting in inconsistent or incorrect translation. Summary of the invention
[0003] The technical problem to be solved by the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a translation accuracy optimization method and system based on artificial intelligence.
[0004] The technical solution adopted to solve the above technical problems is: a translation accuracy optimization method based on artificial intelligence, including:
[0005] Acquire a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source language text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence;
[0006] Performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence;
[0007] Extracting content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set for each source language sentence in the source language sentence sequence;
[0008] Inputting a content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and outputting a target language sentence sequence corresponding to the source language sentence sequence based on the translation model;
[0009] Performing sentiment classification on each target language sentence in the target language sentence sequence based on a pre-trained second sentiment classification model to obtain a second sentiment label for each target language sentence in the target language sentence sequence;
[0010] The similarity between the first emotion tag and the second emotion tag is calculated. If the similarity is less than a preset similarity threshold, the enhanced features of the content word set of the sentence corresponding to the similarity are adjusted to optimize the translation accuracy.
[0011] Preferably, performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence comprises:
[0012] Inputting the source language sentence into a BER model, and converting the source language sentence into a target word vector through the BER model;
[0013] The target word vector is input into a bidirectional gated recurrent unit and a long short-term memory network respectively, the inter-sentence semantic features of the target word vector are obtained through the bidirectional gated recurrent unit, and the inter-sentence semantic features are converted into an inter-sentence semantic feature vector;
[0014] The intra-sentence semantic features of the target word vector are obtained through a long short-term memory network, and the intra-sentence semantic features are converted into an intra-sentence semantic feature vector.
[0015] Preferably, performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence further includes:
[0016] fusing the inter-sentence semantic feature vector and the intra-sentence semantic feature vector through a hybrid attention mechanism to obtain a first fused vector;
[0017] fusing the inter-sentence semantic feature vector, the intra-sentence semantic feature vector, and the first fusion vector to obtain a second fusion vector;
[0018] The second fusion vector is input into the emotion decoder, and the second fusion vector is mapped to the emotion category through the emotion decoder to obtain the first emotion label corresponding to the source language sentence.
[0019] Preferably, performing content word extraction on the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence includes:
[0020] Each word embedding vector in the word embedding vector set of the source language sentence is mapped into a low-dimensional hidden layer vector through two fully connected layer networks, wherein the expression of the hidden layer vector is as follows:
[0021] ;
[0022] in, Represents the word embedding vector set The hidden layer vector corresponding to the word embedding vector, and represents the weight matrix, and represents the bias term, represents the activation function, Represents the word embedding vector set word embedding vectors;
[0023] Calculate the weight of each hidden layer vector, wherein the calculation formula of the weight of the hidden layer vector is as follows:
[0024] ;
[0025] in, Represents the word embedding vector set The weight of the hidden layer vector corresponding to the word embedding vector, Represents the total number of word embedding vectors in the word embedding vector set.
[0026] Preferably, performing content word extraction on the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence further includes:
[0027] The weight of each hidden layer vector is weighted and summed with the corresponding hidden layer vector to obtain a content word feature set of the source language sentence, wherein the calculation formula of the content word feature is as follows:
[0028] ;
[0029] in, Indicates the content word features corresponding to the source language sentence
[0030] The content word feature set of the source language sentence is classified based on Softmax to obtain the content word set of the source language sentence.
[0031] Preferably, the content word set of each source language sentence in the source language sentence sequence is input as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and the target language sentence sequence corresponding to the source language sentence sequence is output based on the translation model, including:
[0032] Performing word embedding on the source language sentence to obtain a word embedding vector of the source language sentence, and performing word embedding on a content word set of the source language sentence to obtain a word embedding vector set of the content word set of the source language sentence;
[0033] The word embedding vector set of the content word set is weighted based on the gating mechanism to obtain a weight vector set of the word embedding vectors of the content word set, wherein the weight calculation formula of the word embedding vector of the content word set is as follows:
[0034] ;
[0035] in, represents the weight of the word embedding vector of the content word, and Represents the parameters of the model to be trained, represents the Sigmoid activation function, Word embedding vectors representing content words;
[0036] Adding the word embedding vector of the content word set to the corresponding position in the word embedding vector of the source language sentence according to the weight vector set to obtain an enhanced word embedding vector of the source language sentence;
[0037] Encoding the enhanced word embedding vector of the source language sentence based on a translation encoder to obtain an output vector of each sublayer in the translation encoder, wherein the translation encoder adopts an XLNet model;
[0038] The output vector of each sub-layer in the translation encoder is decoded based on a translation decoder to obtain a generation probability distribution of each word, and a target language sentence sequence corresponding to the source language sentence sequence is output based on the generation probability distribution of each word, wherein the translation decoder adopts a Transformer decoder.
[0039] Preferably, calculating the similarity between the first emotion label and the second emotion label includes:
[0040] Performing a word segmentation operation on the first emotion tag and the second emotion tag to obtain a first word sequence and a second word sequence;
[0041] Encoding the first word sequence and the second word sequence based on a Word2vec model to obtain a first word vector matrix for the first word sequence and a second word vector matrix for the second word sequence;
[0042] Interacting the first word vector matrix with the second word vector matrix to obtain a first interactive attention matrix corresponding to the first word vector matrix and a second interactive attention matrix corresponding to the second word vector matrix;
[0043] The first word vector matrix and the first interaction attention matrix are matrix-concatenated to obtain a first concatenated matrix, and the second word vector matrix and the second interaction attention matrix are matrix-concatenated to obtain a second concatenated matrix.
[0044] Preferably, calculating the similarity between the first emotion label and the second emotion label further includes:
[0045] Inputting the first splicing matrix and the second splicing matrix into a Transformer model respectively, and outputting a first text feature of the first splicing matrix and a second text feature of the second splicing matrix based on the Transformer model;
[0046] One-dimensionalizing the first text feature and the second text feature based on a fully connected layer to obtain a first semantic feature and a second semantic feature;
[0047] Calculating a difference and a product of the first semantic feature and the second semantic feature, and concatenating the difference and the product to obtain a fusion feature;
[0048] The fusion features are processed based on a two-layer fully connected network to obtain the similarity between the first emotion label and the second emotion label, wherein the first layer of the fully connected network adopts a ReLU activation function and the second layer of the fully connected network adopts a Softmax normalization function.
[0049] The technical solution adopted to solve the above technical problems is: a translation accuracy optimization system based on artificial intelligence, which is applicable to the translation accuracy optimization method based on artificial intelligence, including:
[0050] a text segmentation unit, the text segmentation unit being used to obtain a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence;
[0051] A first classification unit, wherein the first classification unit is used to perform sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence;
[0052] a content extraction unit, the content extraction unit being used to extract content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence;
[0053] A language translation unit, the language translation unit is used to input the content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and output a target language sentence sequence corresponding to the source language sentence sequence based on the translation model;
[0054] a second classification unit, the second classification unit being used to perform sentiment classification on each target language sentence in the target language sentence sequence based on a pre-trained second sentiment classification model to obtain a second sentiment label for each target language sentence in the target language sentence sequence;
[0055] The precision optimization unit is used to calculate the similarity between the first emotion tag and the second emotion tag. If the similarity is less than a preset similarity threshold, the enhanced features of the content word set of the sentence corresponding to the similarity are adjusted to optimize the translation accuracy.
[0056] The beneficial effects of the present invention are as follows: (1) The present invention classifies the source language sentences and the target language sentences respectively based on the first sentiment classification model and the second sentiment classification model, and calculates the similarity between them, thereby ensuring that the translated sentences are consistent in sentiment. This helps to avoid the problem of sentiment bias in the machine translation process, especially for some texts with strong emotional colors, ensuring that the translated emotional information can be conveyed correctly. By extracting a set of content words, the key information in the words is input into the translation model as an enhanced feature, thereby improving the model's attention to important information, which helps the translation system better understand and convey the core concepts in the source language and improves the accuracy of translation. (2) The present invention calculates the similarity of the sentiment labels of the source language and the target language sentences. If it is found that the sentiment is inconsistent (that is, the similarity is low), the weight of the content word set can be adjusted in a targeted manner. This adaptive optimization method ensures that the translation system can dynamically adjust the translation process according to changes in emotions, avoiding distortion of translation results due to inconsistent emotions. By combining enhanced features (such as content word sets) with sentiment analysis, the translation model can be more flexible and accurate when facing different types of texts. This method is not only suitable for ordinary texts, but also can show better translation effects in texts with complex emotional colors (such as literary works, marketing copy, etc.); (3) The present invention reduces the translation errors caused by emotional differences by introducing sentiment classification and performing similarity calculation. By adjusting the similarity of emotional tags, the translated content is optimized, making the translation results more consistent with the emotional tone and context of the original text. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic flow chart of the steps of an overall method in an embodiment of the present invention;
[0058] Figure 2 A schematic diagram of the system architecture of an overall system in an embodiment of the present invention.
[0059] Figure numerals: 1. text segmentation unit; 2. first classification unit; 3. content extraction unit; 4. language translation unit; 5. second classification unit; 6. precision optimization unit. DETAILED DESCRIPTION
[0060] Embodiment 1, as Figure 1 As shown, the present invention proposes a translation accuracy optimization method based on artificial intelligence, comprising:
[0061] S1. Obtain a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source language text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence;
[0062] S2. Performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence;
[0063] S3, extracting content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set for each source language sentence in the source language sentence sequence;
[0064] S4, inputting the content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and outputting a target language sentence sequence corresponding to the source language sentence sequence based on the translation model;
[0065] S5. Performing sentiment classification on each target language sentence in the target language sentence sequence based on the pre-trained second sentiment classification model to obtain a second sentiment label for each target language sentence in the target language sentence sequence;
[0066] S6. Calculate the similarity between the first emotion tag and the second emotion tag. If the similarity is less than a preset similarity threshold, adjust the enhanced features of the content word set of the sentence corresponding to the similarity to optimize the translation accuracy.
[0067] In the present invention, sentence segmentation refers to dividing the source language text (such as Chinese or English, etc.) into separate sentences, which is usually accomplished by a sentence segmenter (syntactic analysis tool) with the goal of splitting a long paragraph of text into a sequence of sentences that are easier to process; word segmentation refers to splitting a sentence into separate "words". In language processing, word segmentation is a very important step, especially for languages without clear separators such as Chinese. The word segmentation tool completes the segmentation by looking up words in the dictionary; the sentiment classification model is a natural language processing (NLP) model that determines the sentiment tendency of the text (such as positive, negative, neutral, etc.) based on the content of the text. The model outputs the sentiment label of the text by analyzing the sentiment features of the input text; the first sentiment classification model performs sentiment classification on the source language sentences and marks what kind of sentiment category each sentence belongs to; the second sentiment classification model performs sentiment classification on the translated target language sentences and marks what kind of sentiment category each target language sentence belongs to. The second sentiment classification model commonly used includes support vector machines, naive Bayes and deep learning models, etc.; content words refer to words that carry the core meaning in a sentence, generally including nouns, verbs, adjectives, etc., as opposed to grammatical function words (such as articles, auxiliary words, etc.); weight adjustment of the content word set refers to adjusting the importance or weight of the content words in the sentence during the translation process based on the results of the similarity of sentiment labels, which can help optimize the translation model so that the sentiment of the target language sentence is more consistent with the original sentence, thereby improving the accuracy and quality of the translation; enhanced feature adjustment can optimize the output of the translation model by increasing or decreasing the attention paid to certain words, especially when there are differences in the source language and the target language in terms of sentiment expression.
[0068] In the present invention, the adjustment goal of the enhanced features is to improve the accuracy of the translation model, especially in dealing with the consistency of emotions and content. If the similarity of the emotion labels between the source language sentence and the target language sentence is low, it may mean that errors occurred in the translation process, especially inaccurate communication of emotions. At this time, the adjustment of the enhanced features aims to improve the accurate mapping of emotions and content words, thereby improving the accuracy of translation and the consistency of emotions. If the emotion similarity is low, the enhanced features can be adjusted by the following methods: mapping adjustment is performed between the content words of the source language sentence and the target language sentence to ensure the accurate translation of the emotion words. For example, the emotion words in the source language (such as "happy" and "angry") need to ensure that they are also properly expressed in the target language. If there are translation differences, the content words may need to be replaced or strengthened to better fit the emotion expression of the target language. The weight of the emotion words in the enhanced features is adjusted to enhance the importance of emotion-related words in the translation, so as to ensure that the translation model pays more attention to the accuracy of emotion expression when outputting the target language sentence.
[0069] Embodiment 2, a translation accuracy optimization method based on artificial intelligence proposed by the present invention, compared with embodiment 1, this embodiment also includes: sentiment classification of each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label of each source language sentence in the source language sentence sequence, including:
[0070] A1. Input the source language sentence into the BER model and convert the source language sentence into the target word vector through the BER model;
[0071] A2. Input the target word vector into the bidirectional gated recurrent unit and the long short-term memory network respectively, obtain the inter-sentence semantic features of the target word vector through the bidirectional gated recurrent unit, and convert the inter-sentence semantic features into an inter-sentence semantic feature vector;
[0072] A3. Obtain the intra-sentence semantic features of the target word vector through the long short-term memory network, and convert the intra-sentence semantic features into an intra-sentence semantic feature vector.
[0073] In this embodiment, BERT is a pre-trained language representation model based on the Transformer architecture. Its uniqueness lies in the use of a bidirectional encoder, which means that when encoding a word, BERT will consider the context on the left and right of the word at the same time. Unlike the traditional unidirectional model, BERT can better understand the context of the word; the word vector is a vector in a high-dimensional space that represents the semantics of a word. The word vector generated by training data captures the grammatical and semantic features of the word, so the model can understand the relationship between different words through these vectors; GRU is a recurrent neural network (RNN) variant for sequence modeling. It controls the transmission of information through a "gating mechanism" and solves the gradient vanishing problem that may occur in traditional RNNs in long sequences. GRU can decide which information should be retained and which should be discarded; the bidirectional gated recurrent unit means that on the basis of GRU, the forward and reverse information of the input sequence are considered simultaneously to obtain more comprehensive context information. Through this bidirectional structure, the model can better understand the relationship between words and capture more inter-sentence semantic features; LSTM It is a special RNN variant that aims to solve the gradient vanishing problem of traditional RNN in long-term dependent tasks. LSTM introduces "memory units" to maintain information in long time series and can selectively update and forget information at each time step.
[0074] In an optional embodiment, sentiment classification is performed on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence, further comprising:
[0075] A4, fusing the inter-sentence semantic feature vector and the intra-sentence semantic feature vector through a hybrid attention mechanism to obtain a first fused vector;
[0076] A5, fusing the inter-sentence semantic feature vector, the intra-sentence semantic feature vector, and the first fusion vector to obtain a second fusion vector;
[0077] A6. Input the second fusion vector into the emotion decoder, and map the second fusion vector to the emotion category through the emotion decoder to obtain the first emotion label corresponding to the source language sentence.
[0078] It should be noted that the hybrid attention mechanism is an important technology in deep learning, especially in the sequence-to-sequence (Seq2Seq) model. Its basic idea is to determine which parts of the input sequence the model should focus on when processing each word by calculating weights (or "attention"), so that the model can dynamically focus on different parts of the input data according to current needs; the sentiment decoder is part of the sentiment analysis model, which is used to output sentiment labels based on the input feature vectors. It is usually a neural network module that maps the fused feature vectors to the final sentiment categories (such as positive, negative, neutral, etc.). The sentiment decoder determines the sentiment tendency of the sentence based on the input semantic information; the sentiment decoder uses a fully connected layer. The decoder usually contains several fully connected layers, and the output dimension of the last layer is the same as the number of sentiment categories (for example, sentiment categories may be "positive", "negative" and "neutral"); the sentiment decoder processes the input second fused vector through a series of fully connected layers, and finally maps the feature vector to the probability distribution of the sentiment category through the Softmax activation function.
[0079] In an optional embodiment, content words are extracted from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence, including:
[0080] B1. Map each word embedding vector in the word embedding vector set of the source language sentence into a low-dimensional hidden layer vector through two fully connected layer networks, where the expression of the hidden layer vector is as follows:
[0081] ;
[0082] in, Represents the word embedding vector set The hidden layer vector corresponding to the word embedding vector, and represents the weight matrix, and represents the bias term, represents the activation function, Represents the word embedding vector set word embedding vectors;
[0083] B2. Calculate the weight of each hidden layer vector, where the calculation formula of the weight of the hidden layer vector is as follows:
[0084] ;
[0085] in, Represents the word embedding vector set The weight of the hidden layer vector corresponding to the word embedding vector, Represents the total number of word embedding vectors in the word embedding vector set.
[0086] It should be noted that the fully connected layer is a common layer in neural networks, in which each input unit is connected to the output unit. Assuming that the input is a vector, this layer linearly transforms each input through the weight matrix and bias term, and then generates the output through the activation function. Through multiple fully connected layers, the network can learn more complex feature representations; the hidden layer is the middle layer of the neural network, and its function is to process the input data and extract features that are useful for the final task; the weight matrix is the core part of the neural network, which determines the connection strength between each input and output unit.
[0087] In an optional embodiment, content words are extracted from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence, further comprising:
[0088] B3. Perform a weighted summation of the weight of each hidden layer vector and the corresponding hidden layer vector to obtain a content word feature set of the source language sentence, wherein the calculation formula of the content word feature is as follows:
[0089] ;
[0090] in, Indicates the content word features corresponding to the source language sentence
[0091] B4. Classify the content word feature set of the source language sentence based on Softmax to obtain the content word set of the source language sentence.
[0092] It should be noted that Softmax is a common mathematical function, usually used in the output layer of classification tasks. It maps a set of arbitrary real numbers into a probability distribution.
[0093] In an optional embodiment, a content word set of each source language sentence in a source language sentence sequence is input as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and a target language sentence sequence corresponding to the source language sentence sequence is output based on the translation model, including:
[0094] C1. Perform word embedding on the source language sentence to obtain a word embedding vector of the source language sentence, and perform word embedding on the content word set of the source language sentence to obtain a word embedding vector set of the content word set of the source language sentence;
[0095] C2. Based on the gating mechanism, weight calculation is performed on the word embedding vector set of the content word set to obtain a weight vector set of the word embedding vector of the content word set, wherein the calculation formula of the weight of the word embedding vector of the content word set is as follows:
[0096] ;
[0097] in, represents the weight of the word embedding vector of the content word, and Represents the parameters of the model to be trained, represents the Sigmoid activation function, Word embedding vectors representing content words;
[0098] C3, adding the word embedding vector of the content word set to the corresponding position in the word embedding vector of the source language sentence according to the weight vector set to obtain the enhanced word embedding vector of the source language sentence;
[0099] C4, encoding the enhanced word embedding vector of the source language sentence based on the translation encoder to obtain the output vector of each sublayer in the translation encoder, wherein the translation encoder adopts the XLNet model;
[0100] C5. Based on the translation decoder, the output vector of each sub-layer in the translation encoder is decoded to obtain the generation probability distribution of each word, and the target language sentence sequence corresponding to the source language sentence sequence is output based on the generation probability distribution of each word, wherein the translation decoder adopts the Transformer decoder.
[0101] It should be noted that the gating mechanism is a mechanism for controlling the flow of information in a neural network. It determines which information can pass through by calculating a "gate" value; Sigmoid is a commonly used activation function with an output range of 0 to 1. It is usually used in binary classification problems to map input values between 0 and 1 to represent probability; the enhanced word embedding vector is a vector obtained by expanding and adjusting the original word embedding vector of the source language sentence. Through weight-based adjustment, the enhanced word embedding vector will be richer in capturing the content information of the source language sentence; the translation encoder is the part of the neural machine translation model that processes the source language input. It encodes the enhanced word embedding vector of the source language into a set of high-dimensional vector representations through multiple levels of processing (such as self-attention mechanism, feedforward network, etc.) for subsequent decoding. The role of the translation encoder is to convert the source language information into an internal representation that is useful for target language translation; XLNet is a pre-trained language model, a variant of the autoregressive model, mainly used to handle language understanding and generation tasks. It is an improved version of the BERT model, which improves the effect of language modeling by simultaneously considering contextual information; the translation decoder is the part of the neural machine translation model responsible for generating the target language output. It gradually generates the vocabulary of the target language based on the vector representation output by the translation encoder. The decoder generates each word in an autoregressive manner and predicts the next word based on the previously generated words; in the Transformer architecture, each decoder layer usually includes two attention sub-layers, the first is the self-attention mechanism, and the second is the cross-attention mechanism. The second attention sub-layer is mainly responsible for using the encoded information of the source language to generate the vocabulary of the target language.
[0102] In an optional embodiment, calculating the similarity between the first emotion tag and the second emotion tag includes:
[0103] D1, performing a word segmentation operation on the first sentiment label and the second sentiment label to obtain a first word sequence and a second word sequence;
[0104] D2. Encode the first word sequence and the second word sequence based on the Word2vec model to obtain a first word vector matrix for the first word sequence and a second word vector matrix for the second word sequence;
[0105] D3, interacting the first word vector matrix with the second word vector matrix to obtain a first interactive attention matrix corresponding to the first word vector matrix and a second interactive attention matrix corresponding to the second word vector matrix;
[0106] D4. Concatenate the first word vector matrix and the first interaction attention matrix to obtain a first concatenated matrix, and concatenate the second word vector matrix and the second interaction attention matrix to obtain a second concatenated matrix.
[0107] It should be noted that Word2Vec is a word vectorization model, through which words can be converted into vectors of fixed length, which can capture the semantic information of words; interaction usually refers to the attention mechanism, which calculates the attention weights between the first word vector matrix and the second word vector matrix. This process helps the model understand the relationship between two sentiment labels; the attention mechanism is used to capture the interactive relationship between the two sets of word vector matrices, and the second word vector matrix is used as the query (Query), and the first word vector matrix is used as the key (Key) and value (Value) for calculation. The attention distribution of each word in the first word vector matrix to each word in the second word vector matrix can be obtained, that is, the first interactive attention matrix is obtained; the first word vector matrix is used as the query (Query), and the second word vector matrix is used as the key (Key) and value (Value) for calculation. The attention distribution of each word in the second word vector matrix to each word in the first word vector matrix can be obtained, that is, the second interactive attention matrix is obtained.
[0108] In an optional embodiment, calculating the similarity between the first emotion tag and the second emotion tag further includes:
[0109] D5, inputting the first splicing matrix and the second splicing matrix into the Transformer model respectively, and outputting the first text feature of the first splicing matrix and the second text feature of the second splicing matrix based on the Transformer model;
[0110] D6. One-dimensionalize the first text feature and the second text feature based on the fully connected layer to obtain a first semantic feature and a second semantic feature;
[0111] D7, calculating the difference and product of the first semantic feature and the second semantic feature, and concatenating the difference and the product to obtain a fusion feature;
[0112] The fusion features are processed based on a two-layer fully connected network to obtain the similarity between the first emotion label and the second emotion label, wherein the first layer of the fully connected network adopts the ReLU activation function and the second layer of the fully connected network adopts the Softmax normalization function.
[0113] Embodiment three, as Figure 2 As shown, the present invention proposes a translation accuracy optimization system based on artificial intelligence, which is applicable to the translation accuracy optimization method based on artificial intelligence, including:
[0114] The text segmentation unit 1 is used to obtain a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence;
[0115] A first classification unit 2, the first classification unit 2 is used to perform sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence;
[0116] The content extraction unit 3 is used to extract content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set of each source language sentence in the source language sentence sequence;
[0117] The language translation unit 4 is used to input the content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and output a target language sentence sequence corresponding to the source language sentence sequence based on the translation model;
[0118] A second classification unit 5, the second classification unit 5 is used to perform sentiment classification on each target language sentence in the target language sentence sequence based on a pre-trained second sentiment classification model to obtain a second sentiment label for each target language sentence in the target language sentence sequence;
[0119] The precision optimization unit 6 is used to calculate the similarity between the first emotion tag and the second emotion tag. If the similarity is less than a preset similarity threshold, the enhanced features of the content word set of the sentence corresponding to the similarity are adjusted to optimize the translation accuracy.
[0120] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited thereto, and various changes can be made within the knowledge scope of technicians in the relevant technical field without departing from the purpose of the present invention.
Claims
1. A translation accuracy optimization method based on artificial intelligence, characterized in that: include: Acquire a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source language text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence; Performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence; Extracting content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set for each source language sentence in the source language sentence sequence; Inputting a content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and outputting a target language sentence sequence corresponding to the source language sentence sequence based on the translation model; Performing sentiment classification on each target language sentence in the target language sentence sequence based on a pre-trained second sentiment classification model to obtain a second sentiment label for each target language sentence in the target language sentence sequence; The similarity between the first emotion tag and the second emotion tag is calculated. If the similarity is less than a preset similarity threshold, the enhanced features of the content word set of the sentence corresponding to the similarity are adjusted to optimize the translation accuracy.
2. The method for optimizing translation accuracy based on artificial intelligence according to claim 1, characterized in that: Performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence includes: Inputting the source language sentence into a BER model, and converting the source language sentence into a target word vector through the BER model; The target word vector is input into a bidirectional gated recurrent unit and a long short-term memory network respectively, the inter-sentence semantic features of the target word vector are obtained through the bidirectional gated recurrent unit, and the inter-sentence semantic features are converted into an inter-sentence semantic feature vector; The intra-sentence semantic features of the target word vector are obtained through a long short-term memory network, and the intra-sentence semantic features are converted into an intra-sentence semantic feature vector.
3. The method for optimizing translation accuracy based on artificial intelligence according to claim 2, characterized in that: Performing sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model to obtain a first sentiment label for each source language sentence in the source language sentence sequence, further comprising: fusing the inter-sentence semantic feature vector and the intra-sentence semantic feature vector through a hybrid attention mechanism to obtain a first fused vector; fusing the inter-sentence semantic feature vector, the intra-sentence semantic feature vector, and the first fusion vector to obtain a second fusion vector; The second fusion vector is input into the emotion decoder, and the second fusion vector is mapped to the emotion category through the emotion decoder to obtain the first emotion label corresponding to the source language sentence.
4. The method for optimizing translation accuracy based on artificial intelligence according to claim 3, characterized in that: Extracting content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set for each source language sentence in the source language sentence sequence includes: Each word embedding vector in the word embedding vector set of the source language sentence is mapped into a low-dimensional hidden layer vector through two fully connected layer networks, wherein the expression of the hidden layer vector is as follows: ; in, Represents the word embedding vector set The hidden layer vector corresponding to the word embedding vector, and represents the weight matrix, and represents the bias term, represents the activation function, Represents the word embedding vector set word embedding vectors; Calculate the weight of each hidden layer vector, wherein the calculation formula of the weight of the hidden layer vector is as follows: ; in, Represents the word embedding vector set The weight of the hidden layer vector corresponding to the word embedding vector, Represents the total number of word embedding vectors in the word embedding vector set.
5. The method for optimizing translation accuracy based on artificial intelligence according to claim 4, characterized in that: Extracting content words from the word sequence of each source language sentence in the source language sentence sequence to obtain a content word set for each source language sentence in the source language sentence sequence, further comprising: The weight of each hidden layer vector is weighted and summed with the corresponding hidden layer vector to obtain a content word feature set of the source language sentence, wherein the calculation formula of the content word feature is as follows: ; in, Indicates the content word features corresponding to the source language sentence; The content word feature set of the source language sentence is classified based on Softmax to obtain the content word set of the source language sentence.
6. The method for optimizing translation accuracy based on artificial intelligence according to claim 5, characterized in that: Inputting the content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and outputting a target language sentence sequence corresponding to the source language sentence sequence based on the translation model, including: Performing word embedding on the source language sentence to obtain a word embedding vector of the source language sentence, and performing word embedding on a content word set of the source language sentence to obtain a word embedding vector set of the content word set of the source language sentence; The word embedding vector set of the content word set is weighted based on the gating mechanism to obtain a weight vector set of the word embedding vector of the content word set, wherein the weight calculation formula of the word embedding vector of the content word set is as follows: ; in, represents the weight of the word embedding vector of the content word, and Represents the parameters of the model to be trained, represents the Sigmoid activation function, Word embedding vectors representing content words; Adding the word embedding vectors of the content word set to corresponding positions of the word embedding vectors of the source language sentence according to the weight vector set to obtain an enhanced word embedding vector of the source language sentence; Encoding the enhanced word embedding vector of the source language sentence based on a translation encoder to obtain an output vector of each sublayer in the translation encoder, wherein the translation encoder adopts an XLNet model; The output vector of each sub-layer in the translation encoder is decoded based on a translation decoder to obtain a generation probability distribution of each word, and a target language sentence sequence corresponding to the source language sentence sequence is output based on the generation probability distribution of each word, wherein the translation decoder adopts a Transformer decoder.
7. The method for optimizing translation accuracy based on artificial intelligence according to claim 6, characterized in that: Calculating the similarity between the first emotion label and the second emotion label includes: Performing a word segmentation operation on the first emotion label and the second emotion label to obtain a first word sequence and a second word sequence; Encoding the first word sequence and the second word sequence based on a Word2vec model to obtain a first word vector matrix for the first word sequence and a second word vector matrix for the second word sequence; Interacting the first word vector matrix with the second word vector matrix to obtain a first interactive attention matrix corresponding to the first word vector matrix and a second interactive attention matrix corresponding to the second word vector matrix; The first word vector matrix and the first interaction attention matrix are matrix-concatenated to obtain a first concatenated matrix, and the second word vector matrix and the second interaction attention matrix are matrix-concatenated to obtain a second concatenated matrix.
8. The method for optimizing translation accuracy based on artificial intelligence according to claim 7, characterized in that: Calculating the similarity between the first emotion label and the second emotion label also includes: Inputting the first splicing matrix and the second splicing matrix into a Transformer model respectively, and outputting a first text feature of the first splicing matrix and a second text feature of the second splicing matrix based on the Transformer model; One-dimensionalizing the first text feature and the second text feature based on a fully connected layer to obtain a first semantic feature and a second semantic feature; Calculating a difference and a product of the first semantic feature and the second semantic feature, and concatenating the difference and the product to obtain a fusion feature; The fusion features are processed based on a two-layer fully connected network to obtain the similarity between the first emotion label and the second emotion label, wherein the first layer of the fully connected network adopts a ReLU activation function and the second layer of the fully connected network adopts a Softmax normalization function.
9. A translation accuracy optimization system based on artificial intelligence, which is applicable to the translation accuracy optimization method based on artificial intelligence described in claim 8, characterized in that: include: A text segmentation unit (1), the text segmentation unit (1) being used to obtain a source language text, perform a sentence segmentation operation on the source language text to obtain a source language sentence sequence of the source language text, and perform a word segmentation operation on each source language sentence in the source language sentence sequence to obtain a word sequence of the source language sentence; A first classification unit (2), the first classification unit (2) is used to perform sentiment classification on each source language sentence in the source language sentence sequence based on a pre-trained first sentiment classification model, so as to obtain a first sentiment label for each source language sentence in the source language sentence sequence; A content extraction unit (3), the content extraction unit (3) being used to extract content words from the word sequence of each source language sentence in the source language sentence sequence, so as to obtain a content word set of each source language sentence in the source language sentence sequence; A language translation unit (4), the language translation unit (4) being used to input a content word set of each source language sentence in the source language sentence sequence as an enhanced feature and the source language sentence sequence into a pre-trained translation model, and output a target language sentence sequence corresponding to the source language sentence sequence based on the translation model; A second classification unit (5), the second classification unit (5) is used to perform sentiment classification on each target language sentence in the target language sentence sequence based on a pre-trained second sentiment classification model, so as to obtain a second sentiment label for each target language sentence in the target language sentence sequence; The precision optimization unit (6) is used to calculate the similarity between the first emotion label and the second emotion label, and if the similarity is less than a preset similarity threshold, the enhanced features of the content word set of the sentence corresponding to the similarity are adjusted to optimize the translation accuracy.
Citation Information
Patent Citations
Cross-language attribute level sentiment classification method based on translation matching
CN114238636A
Translation method and related device
WO2024055707A1
Cited By
Intelligent processing system for text translation and semantic optimization
CN121052264A