Method and device for sentiment analysis of mixed language reviews, electronic equipment and medium

By combining a multilingual pre-trained model and attention mechanism with a target language dictionary and low-rank adaptive technology, the problem of sentiment polarity misjudgment in mixed-language comments is solved, achieving highly accurate sentiment analysis, which is applicable to scenarios such as cross-border e-commerce and social media.

CN121168422BActive Publication Date: 2026-02-03SHENZHEN MINGXIN DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511726141.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-03
Estimated Expiration
2045-11-24

AI Technical Summary

Technical Problem

Existing sentiment analysis techniques cannot resolve the logical connections between different language segments when processing mixed-language comments, leading to misjudgments of sentiment polarity. Furthermore, they are unable to cover high-frequency regional slang, affecting the accuracy of the analysis results.

Method used

A multilingual pre-trained model is used to identify multilingual segments, cross-language alignment is performed through an attention mechanism, and sentiment polarity is corrected using a target language dictionary. The model is optimized by combining low-rank adaptive technology and contrastive learning algorithm, and sentiment weights are dynamically adjusted.

Benefits of technology

It improves the accuracy of sentiment recognition in mixed-language comments, reduces the false positive rate, and provides a highly accurate and adaptable sentiment analysis solution, thereby enhancing the precision of business decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121168422B_ABST
    Figure CN121168422B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of sentiment analysis of mixed language reviews, and discloses a sentiment analysis method and device for mixed language reviews, electronic equipment and a medium, wherein the method comprises the following steps: through a multilingual pre-training model and an attention mechanism, accurate analysis of mixed language reviews is realized, different language segments are fused and understood in a preset semantic space, the sentiment recognition accuracy of mixed sentences is improved, and further through dynamic calling of a target language dictionary based on a language label, the sentiment weight of slang is corrected in a targeted manner, the sentiment polarity reversal is effectively avoided, and the misjudgment rate of regional market reviews is reduced.The application has the beneficial effects that while maintaining the processing efficiency, a high-accuracy and high-adaptability sentiment analysis solution is provided for application scenarios such as cross-border e-commerce and social media monitoring, and the accuracy and automation level of business decision-making are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of sentiment analysis of mixed language reviews, and in particular to a sentiment analysis method and device for mixed language reviews, an electronic device and a medium. BACKGROUND

[0002] In the global e-commerce and social media platforms, user reviews commonly exist in the phenomenon of mixed use of multiple languages, especially in some regions, there are often mixed texts of local language and English. Traditional sentiment analysis technology has significant limitations. First, these tools are usually designed for a single language. When processing mixed language reviews, the model cannot parse the logical association between different language segments, resulting in misjudgment of the overall sentiment polarity. Second, the general model based on standardized dictionaries is difficult to cover regional high-frequency slang, often misclassifying these emotionally colored words as neutral, causing the sentiment polarity to reverse, which seriously affects the accuracy of the review analysis results.

[0003] The existing solutions lack deep semantic understanding of mixed language structures and adaptation ability to localized expressions, which greatly reduces their performance in actual application scenarios with multiple cultural interweaving. SUMMARY

[0004] Therefore, it is necessary to propose a sentiment analysis method, device, electronic device and medium for mixed language reviews to solve the existing problems of sentiment analysis of mixed language reviews.

[0005] A sentiment analysis method for mixed language reviews, the method comprising:

[0006] receiving a mixed language review text containing at least two languages;

[0007] extracting multilingual segments in the mixed language review text;

[0008] using a multilingual pre-training model to identify each of the multilingual segments to obtain a word sequence and a corresponding language label for each of the multilingual segments;

[0009] projecting different language word tokens in the word sequence into a unified semantic space and performing weighted fusion through an attention mechanism to generate an initial cross-language aligned semantic vector;

[0010] obtaining a target language dictionary based on the language label, and performing sentiment polarity correction on the semantic vector according to the target language dictionary to obtain a corrected target semantic vector; wherein the target language dictionary contains slang and its sentiment weight corresponding to the language label;

[0011] analyzing the target semantic vector to obtain a sentiment analysis result of the mixed language review text.

[0012] Further, the step of using a multilingual pre-trained model to identify each of the multilingual segments to obtain the lexical sequences and corresponding language labels of each of the multilingual segments includes:

[0013] Each of the aforementioned multilingual segments is segmented into sub-words to obtain multiple language lexical units;

[0014] The multilingual fragments and their corresponding lexical units are input into a multilingual pre-trained model. Based on multilingual contextual understanding, a language identity identifier is assigned to each generated lexical unit, thereby forming a lexical sequence with language labels.

[0015] Further, the step of obtaining the corresponding target language dictionary based on the language tag, and performing sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector includes:

[0016] The corresponding target language dictionary is obtained based on the language tags;

[0017] Detect whether the lexical units in the lexical sequence match the slang in the target language dictionary;

[0018] When a lexical element in the lexical sequence matches a slang term in the target language dictionary, the sentiment weight corresponding to that slang term is obtained.

[0019] The sentiment weight is used as a bias term and applied to the vector representation of the corresponding word in the initial semantic vector to generate the corrected target semantic vector.

[0020] Furthermore, the step of projecting different language lexical units in the lexical sequence onto a unified semantic space and performing weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages ​​includes:

[0021] Based on the language tags, the lexical units in the lexical unit sequence are classified according to their source languages ​​to obtain the target language category of each lexical unit;

[0022] Obtain the language-specific word library of the target language category from the preset word library, and obtain the source language word vectors corresponding to the word elements from the language-specific word library respectively;

[0023] By mapping the word vectors of each source language to a preset semantic space through a preset cross-language projection matrix, cross-language aligned lexical units are obtained;

[0024] Calculate the attention weight of each word in the word sequence; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence in the preset semantic space;

[0025] Based on the attention weights of each lexical unit, the cross-linguistic aligned lexical units of all lexical units in the lexical unit sequence are weighted and summed to generate the initial semantic vector.

[0026] Furthermore, after the step of analyzing the target semantic vector to obtain the sentiment analysis result of the mixed language comment text, the method further includes:

[0027] Collect labeled data from users to correct the sentiment analysis results, forming a training sample set;

[0028] Based on the training sample set, a low-rank adaptive technique is used to perform lightweight fine-tuning on the large language model, which serves as the multilingual pre-training model, to obtain the fine-tuned model parameters.

[0029] The fine-tuned model parameters are integrated into the multilingual pre-trained model to obtain the optimized multilingual pre-trained model.

[0030] Furthermore, before the step of projecting different language lexical units in the lexical sequence onto a unified semantic space and performing weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages, the method further includes:

[0031] Obtain manually annotated region feature statements;

[0032] Training triples for contrastive learning are constructed based on regional feature sentences; wherein, the triples include anchor samples, positive samples with the same cultural context emotional polarity as the anchor samples, and negative samples with different cultural context emotional polarity as the anchor samples, and the anchor samples are text fragments containing emoticons or ironic sentences with specific cultural features.

[0033] The model is trained by a contrastive learning algorithm to reduce the distance between the anchor sample and the positive sample in the semantic space, and to increase the distance between the anchor sample and the negative sample in the semantic space, thereby obtaining the target model.

[0034] The cultural context understanding capability of the target model is injected into the mapping process of the semantic space, so that the sentiment weight of the word sequence is adjusted when generating the initial semantic vector.

[0035] Furthermore, this occurs before the step of receiving mixed-language comment text containing at least two languages;

[0036] Extract the initial text of the mixed-language comments from a pre-defined comment database;

[0037] The initial text of the mixed-language comment is anonymized to obtain the mixed-language comment text.

[0038] A sentiment analysis device for mixed-language comments, the device comprising:

[0039] A receiving module is used to receive mixed-language comment text containing at least two languages;

[0040] The extraction module is used to extract multilingual fragments from the mixed-language comment text;

[0041] The recognition module is used to recognize each of the multilingual segments using a multilingual pre-trained model, so as to obtain the word sequence of each of the multilingual segments and the corresponding language labels;

[0042] The generation module is used to project different language lexical units in the lexical sequence onto a unified semantic space and perform weighted fusion through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0043] The correction module is used to obtain the corresponding target language dictionary based on the language tag, and to perform sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tag and its sentiment weight;

[0044] The analysis module is used to analyze the target semantic vector to obtain the sentiment analysis results of the mixed language comment text.

[0045] An electronic device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:

[0046] Receive mixed-language comment text containing at least two languages;

[0047] Extract multilingual segments from the mixed-language comment text;

[0048] A multilingual pre-trained model is used to identify each of the multilingual segments in order to obtain the word sequence of each multilingual segment and the corresponding language label.

[0049] Different language lexical units in the lexical sequence are projected into a unified semantic space and weighted and fused through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0050] Based on the language tags, the corresponding target language dictionary is obtained, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tags and their sentiment weights;

[0051] The target semantic vector is analyzed to obtain the sentiment analysis results of the mixed language comment text.

[0052] A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps:

[0053] Receive mixed-language comment text containing at least two languages;

[0054] Extract multilingual segments from the mixed-language comment text;

[0055] A multilingual pre-trained model is used to identify each of the multilingual segments in order to obtain the word sequence of each multilingual segment and the corresponding language label.

[0056] Different language lexical units in the lexical sequence are projected into a unified semantic space and weighted and fused through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0057] Based on the language tags, the corresponding target language dictionary is obtained, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tags and their sentiment weights;

[0058] The target semantic vector is analyzed to obtain the sentiment analysis results of the mixed language comment text.

[0059] The beneficial effects of this invention are as follows: By employing a multilingual pre-trained model and attention mechanism, it achieves accurate parsing of mixed-language comments, fusing and understanding different language fragments within a pre-defined semantic space. This improves the accuracy of sentiment recognition for mixed sentences. Furthermore, by dynamically invoking the target language dictionary based on language tags, it specifically corrects the sentiment weights of slang, effectively avoiding sentiment polarity reversal and reducing the misjudgment rate of regional market comments. Ultimately, while maintaining processing efficiency, this system provides a highly accurate and adaptable sentiment analysis solution for applications such as cross-border e-commerce and social media monitoring, enhancing the accuracy and automation of business decisions. Attached Figure Description

[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0061] in:

[0062] Figure 1 This is a diagram illustrating the application environment of a sentiment analysis method for mixed-language comments in one embodiment.

[0063] Figure 2 This is a flowchart of a sentiment analysis method for mixed-language comments in one embodiment;

[0064] Figure 3 This is a structural block diagram of a sentiment analysis device for mixed-language comments in one embodiment;

[0065] Figure 4 This is a structural block diagram of an electronic device in one embodiment. Detailed Implementation

[0066] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0067] Figure 1 This is a diagram illustrating the application environment of sentiment analysis for mixed-language comments in one embodiment. (Refer to...) Figure 1 This sentiment analysis method for mixed-language comments is applied to a sentiment analysis system for mixed-language comments. The system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be a standalone server or a server cluster consisting of multiple servers. The terminal 110 receives the mixed-language comment text, and the server 120 outputs the sentiment analysis results of the mixed-language comment text.

[0068] like Figure 2 As shown, in one embodiment, a sentiment analysis method for mixed-language comments is provided. This method can be applied to both terminals and servers; this embodiment illustrates its application to terminals. The sentiment analysis method for mixed-language comments specifically includes the following steps:

[0069] S1: Receive mixed-language comment text containing at least two languages;

[0070] S2: Extract multilingual segments from the mixed-language comment text;

[0071] S3: Use a multilingual pre-trained model to identify each of the multilingual segments, so as to obtain the word sequence of each of the multilingual segments and the corresponding language labels;

[0072] S4: Project the different language lexical units in the lexical unit sequence onto a unified semantic space, and perform weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages;

[0073] S5: Obtain the corresponding target language dictionary based on the language tag, and perform sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tag and its sentiment weight;

[0074] S6: Analyze the target semantic vector to obtain the sentiment analysis results of the mixed language comment text.

[0075] As described in step S1 above, receive mixed-language comment text containing at least two languages. In the context of globalization, users communicate in different contexts and cultures, often using multiple languages ​​to express themselves. General analysis methods for such mixed-language comments are insufficient to grasp their true emotional meaning. Therefore, this application targets mixed-language comment text containing at least two languages. Receiving such text can be achieved in various ways, including but not limited to text input boxes, speech-to-text conversion, and social media crawlers.

[0076] As described in step S2 above, multilingual segments are extracted from the mixed-language comment text. Due to the nature of mixed languages, simple sentiment analysis methods may be ineffective. Therefore, the system needs to be able to distinguish between different language segments in the text. To achieve this goal, rule-based word segmentation, part-of-speech tagging, and other techniques can be used, or machine learning and deep learning models can be employed to automatically identify language boundaries. For example, the system can use known language models to identify the linguistic features of various language texts and divide them into appropriate substrings.

[0077] As described in step S3 above, a multilingual pre-trained model is used to identify each of the multilingual segments to obtain the token sequences and corresponding language labels for each segment. Common multilingual pre-trained models include BERT and XLM-RoBERTa, which have powerful language understanding capabilities and can handle features of multiple languages. These models are trained on large-scale language data and can capture semantic relationships and contextual information between different languages. When each multilingual segment is input into the pre-trained model, the model generates a series of tokens for each segment. Simultaneously, the model assigns a corresponding language label to each token according to its internal algorithm. This label helps in subsequent processing, enabling the system to understand the semantic attributes of each word. In this way, the system not only obtains the token sequence but also clearly knows the language to which each token belongs, providing an information foundation for subsequent sentiment analysis.

[0078] As described in step S4 above, different language lexical units in the lexical sequence are projected onto a unified semantic space and weighted fusion is performed through an attention mechanism to generate an initial semantic vector aligned across languages. Based on the extracted lexical sequence, the corresponding word vector is queried for each lexical unit. These word vectors are typically derived from pre-trained lexical models in various languages, specifically multilingual lexical models (such as FastText or multilingual BERT). To map these different language lexical units into a unified semantic space, the system calculates the contextual relevance of each lexical unit by applying an attention mechanism, assigning importance weights to different semantics. Through weighted fusion, an initial semantic vector aligned across languages ​​is generated. This vector effectively integrates the semantic features of various language segments and forms the basis for subsequent sentiment polarity analysis. By ensuring that lexical units of different languages ​​are in the same semantic space, the accuracy of sentiment analysis for mixed-language comments can be significantly improved, overcoming the limitations of traditional sentiment analysis methods when dealing with mixed languages.

[0079] As described in step S5 above, the corresponding target language dictionary is obtained based on the language tag, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector. The target language dictionary contains slang corresponding to the language tag and its sentiment weight. Based on manually annotated regional feature sentences and slang database, a target language dictionary containing sentiment weight is constructed. That is, the dictionary is a pre-constructed collection of regional slang and its sentiment weight, which has been appropriately adjusted and supplemented for the expression methods of different languages ​​and cultural backgrounds. After the target language dictionary is determined, information matching the word units in the initial semantic vector is retrieved. The sentiment polarity is modified according to the sentiment weight of these slang and a corresponding negative sentiment weight is assigned. The system will then adjust the sentiment label of the semantic vector accordingly.

[0080] As described in step S6 above, the target semantic vector is analyzed to obtain the sentiment analysis results of the mixed-language comment text. Deep analysis is performed on the corrected target semantic vector to extract the sentiment analysis results of the comment. Fully connected layers and a Softmax classifier can be used to classify the sentiment polarity of the target semantic vector, specifically including categorization analysis, sentiment polarity determination, and sentiment intensity assessment. Classification algorithms and sentiment recognition models are used to calculate the final sentiment result from the target semantic vector. The sentiment analysis result can be not only positive, negative, or neutral, but can also encompass the quantification of sentiment intensity. For example, after analysis, the system may determine that the sentiment polarity of a given comment is "negative" and attach a corresponding intensity value. If the input mixed-language comment text contains multiple sentiments, the system can continuously optimize the accuracy of sentiment assessment through multi-task learning, thereby providing a more comprehensive analytical perspective and real-time sentiment feedback to users, facilitating further data-driven decision-making and optimization. Through this holistic approach, the system can accurately identify the diversity of comments containing multiple languages, enabling it to perform well in practical applications in e-commerce, social media, and other fields, while significantly improving user satisfaction and analysis quality.

[0081] In one embodiment, step S3, which involves using a multilingual pre-trained model to identify each of the multilingual segments to obtain the lexical sequences and corresponding language labels for each of the multilingual segments, includes:

[0082] S301: Perform word segmentation on each of the multilingual segments to obtain multiple language lexical units;

[0083] S302: Input the multilingual fragments and each corresponding language lexical unit into the multilingual pre-trained model, and assign a language identity identifier to each generated lexical unit based on multilingual context understanding, thereby forming a lexical unit sequence with language labels.

[0084] As described in step S301 above, each of the multilingual segments is segmented into sub-words to obtain multiple language units. Sub-word segmentation is a commonly used text preprocessing technique that allows the system to split the text at a finer granularity, thereby generating a large number of units that can be used for subsequent analysis. Specifically, algorithms such as Byte-Pair Encoding (BPE), Unigram, and WordPiece can be used to decompose each input language segment.

[0085] As described in step S302 above, the multilingual fragments and their corresponding language units are input into a multilingual pre-trained model. Based on multilingual contextual understanding, each generated unit is assigned a language identity identifier, thus forming a sequence of units with language labels. Specifically, the multilingual fragments after sub-word segmentation and their corresponding language units are input into the multilingual pre-trained model. This model, based on the Transformer architecture and trained on large-scale multilingual texts, is capable of capturing the context and semantic relationships of multiple languages. When multilingual fragments and units are input into the model, it utilizes its built-in contextual understanding capabilities to analyze surrounding language features, thereby assigning a specific language identity identifier to each generated unit. By combining each unit with its language affiliation, the system significantly enhances its ability to process multilingual comment texts, providing an important foundation for subsequent sentiment polarity correction and analysis.

[0086] In one embodiment, step S5, which involves obtaining the corresponding target language dictionary based on the language tags and performing sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector, includes:

[0087] S501: Obtain the corresponding target language dictionary based on the language tags;

[0088] S502: Detect whether the lexical units in the lexical sequence match the slang in the target language dictionary;

[0089] S503: When a lexical element in the lexical sequence matches a slang term in the target language dictionary, obtain the sentiment weight corresponding to that slang term.

[0090] S504: The sentiment weight is used as a bias term and applied to the vector representation of the corresponding word in the initial semantic vector to generate the corrected target semantic vector.

[0091] As described in step S501 above, the corresponding target language dictionary is obtained based on the language tags. The target language dictionary is a database containing multilingual slang and their sentiment weights, aiming to provide culturally specific expressions and sentiment comparisons for the corresponding language. This dictionary not only covers common sentiment words but also includes slang and common expressions based on specific regions, ensuring that sentiment expression methods in multiple cultural contexts are fully considered. The system first determines the required target language dictionary based on the language tags in the word sequence.

[0092] As described in step S502 above, it is detected whether the lexical units in the lexical sequence match slang in the target language dictionary. The lexical sequence is traversed, and each lexical unit is compared sequentially with the acquired target language dictionary. The matching process can use simple string matching or more complex natural language processing techniques, such as fuzzy matching or contextual analysis, to ensure that synonyms or variations are identified. For example, the word "mahal" may appear in multiple contexts, and accurate sentiment analysis depends on whether it is clearly labeled with the negative sentiment of "expensive" in the dictionary.

[0093] As described in step S503 above, when a lexical in the lexical sequence matches a slang term in the target language dictionary, the sentiment weight corresponding to that slang term is obtained. The sentiment weight is a numerical value representing the intensity of the positive or negative sentiment conveyed by the expression. Regional slang often has very specific sentimental connotations and may differ significantly from the sentiment scores in standardized dictionaries. During implementation, the system will extract the sentiment weight of the matched slang term from the target language dictionary and provide accurate reference data for subsequent sentiment correction. For example, if "mahal" is specified as having a "negative" sentiment in the dictionary, its weight can be set to -1, indicating that the word has a strong negative meaning in the context.

[0094] As described in step S504 above, the sentiment weight is used as a bias term to adjust the sentiment polarity of the lexical vector, acting on the vector representation of the corresponding lexical in the initial semantic vector to generate the corrected target semantic vector. The extracted sentiment weight is calculated against the vector representation corresponding to the lexical in the initial semantic vector. If the sentiment weight is negative, the system adjusts the vector value by subtraction; otherwise, it adjusts it by addition. This method corrects the sentiment polarity of the lexical, thereby affecting the overall sentiment tendency of the target semantic vector. The implementation of this strategy effectively reduces sentiment misjudgments caused by neglecting cultural specificity in traditional analysis methods, making the analysis results of user comments more authentic and effective.

[0095] In one embodiment, step S4, which projects different language lexical units in the lexical sequence onto a unified semantic space and performs weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages, includes:

[0096] S401: Based on the language tags, classify the lexical units in the lexical unit sequence according to their source languages ​​to obtain the target language category of each lexical unit;

[0097] S402: Obtain the language-specific word library of the target language category from the preset word library, and obtain the source language word vector corresponding to the word from the language-specific word library respectively;

[0098] S403: Map each source language word vector to a preset semantic space using a preset cross-language projection matrix to obtain cross-language aligned lexical units;

[0099] S404: Calculate the attention weight of each word in the word sequence; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence in the preset semantic space;

[0100] S405: Based on the attention weights of each lexical unit, the cross-language aligned lexical units of all lexical units in the lexical unit sequence are weighted and summed to generate the initial semantic vector.

[0101] As described in step S401 above, based on the language tags, the lexical units in the lexical sequence are classified according to their source languages ​​to obtain the target language category of each lexical unit. The classification process typically involves traversing the lexical sequence and matching each lexical unit with its language tag. This operation may utilize a simple mapping algorithm to assign each lexical unit to a corresponding language category. After classification, the system obtains a mapping relationship, i.e., each lexical unit and its corresponding source language. This allows subsequent acquisition of corresponding language-specific lexical units for each lexical unit based on the characteristics of each language. By determining the target language category of each lexical unit, the system can also selectively apply language-specific semantic features when processing mixed sentences, thereby improving the overall accuracy of sentiment analysis.

[0102] As described in step S402 above, a language-specific word vector library for the target language category is obtained from a preset word vector database, and the source language word vectors corresponding to the word vectors are obtained from the language-specific word vector libraries. The preset word vector database typically contains word vectors from multiple languages. These word vectors are trained using deep learning algorithms and can effectively reflect the context and semantic relationships between languages. After identifying the target language category, the source language word vectors for each corresponding word vector are obtained from the relevant language-specific word vector libraries. It should be noted that all source language word vectors must have the same dimension to maintain consistency during subsequent mathematical operations.

[0103] As described in step S403 above, each source language word vector is mapped to a preset semantic space using a preset cross-linguistic projection matrix to obtain cross-linguistic aligned lexical units. This cross-linguistic projection matrix is ​​obtained through prior training. By learning the correspondence between languages, it ensures that lexical units from different languages ​​can be effectively aligned to a shared semantic space. Specifically, a cross-linguistic parallel corpus can be used, and the projection matrix is ​​learned through singular value decomposition (SVD). In practice, the system performs matrix multiplication between each source language word vector and the cross-linguistic projection matrix, thereby converting each source language word vector into a unified semantic representation. The goal of this mapping is to eliminate differences between languages, enabling words from different languages ​​to be compared and connected in the same space, thus enhancing semantic consistency for subsequent analysis and processing.

[0104] As described in step S404 above, the attention weight of each word in the word sequence is calculated; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence within the preset semantic space. The degree of relevance between each word's vector and other word vectors is determined by calculating the similarity between them. Commonly used methods include dot product or cosine similarity, which can quantify the similarity between words to obtain corresponding attention weights. These weights reflect the importance of a word in the current context and its relationship with other words.

[0105] As described in step S405 above, based on the attention weights of each lexical unit, the cross-linguistic aligned lexical units of all lexical units in the lexical unit sequence are weighted and summed to generate the initial semantic vector. By weighting the cross-linguistic aligned lexical units of each lexical unit in the lexical unit sequence using the corresponding attention weights as multipliers, and summing all weighted lexical units, the system ultimately generates a new, comprehensive initial semantic vector. This vector represents the semantic features of the entire mixed-language commentary text, better capturing the overall emotional attitude of the text, effectively integrating information from different words in multilingual texts, and considering the relative importance of each word in a specific context. Through this weighted summation method, the system not only achieves the fusion of cross-linguistic information but also improves the accuracy of sentiment analysis, laying a solid foundation for subsequent sentiment polarity determination.

[0106] In one embodiment, after step S6 of analyzing the target semantic vector to obtain the sentiment analysis result of the mixed-language comment text, the method further includes:

[0107] S701: Collect labeled data from users to correct the sentiment analysis results, forming a training sample set;

[0108] S702: Based on the training sample set, a low-rank adaptive technique is used to perform lightweight fine-tuning on the large language model, which serves as the multilingual pre-training model, to obtain the fine-tuned model parameters.

[0109] S703: Integrate the fine-tuned model parameters into the multilingual pre-trained model to obtain the optimized multilingual pre-trained model.

[0110] As described in step S701 above, labeled data from user corrections to the sentiment analysis results is collected to form a training sample set. User feedback can be collected through various means, such as providing a comment annotation function on the user interface or allowing users to evaluate the consistency between the sentiment analysis generated by the model and their own judgments. The user-annotated feedback data forms a training sample set, including the original comment text, system analysis results, user corrections, and related sentiment tags.

[0111] As described in step S702 above, based on the training sample set, a low-rank adaptive technique is used to perform lightweight fine-tuning on the large language model, which serves as the multilingual pre-trained model, to obtain the fine-tuned model parameters. LoRA technology is a method proposed in recent years to effectively enhance the adaptability of a model. Its core idea is to add a small number of trainable parameters to a given model to enable it to quickly adapt to new tasks or datasets. The model is fine-tuned based on the labeled data of the training sample set by adding low-rank matrices to the query and value projection matrices of the Transformer layer. Only the newly added parameters are trained. This process does not update all parameters of the entire large language model, but only introduces new, low-rank parameter adjustments in specific layers of the model. This maintains the model's performance in the original task while effectively absorbing information from new data. In this way, the model can quickly adapt to specific sentiment analysis tasks while retaining most of its pre-training capabilities. This fine-tuning process involves multiple iterations to ensure that the model gradually approaches its optimal state.

[0112] As described in step S703 above, the fine-tuned model parameters are integrated into the multilingual pre-trained model to obtain the optimized multilingual pre-trained model. The integration process involves superimposing the fine-tuned low-rank parameters onto the corresponding layers of the existing model without retraining the entire model. This approach not only improves the model's sensitivity and adaptability in handling mixed-language comments but also maintains the general language understanding capabilities acquired during previous training. The optimized model resulting from this integration will be able to analyze emotions more accurately in multiple language environments. This model is better able to understand culture-specific expressions and can dynamically adapt to new inputs, meaning it can provide more expected results when facing different user groups or new cultural contexts.

[0113] In one embodiment, before step S4, which projects different language lexical units in the lexical sequence onto a unified semantic space and performs weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages, the method further includes:

[0114] S311: Obtain manually annotated region feature statements;

[0115] S312: Construct training triples for contrastive learning based on regional feature sentences; wherein, the triples include anchor samples, positive samples with the same cultural context emotional polarity as the anchor samples, and negative samples with different cultural context emotional polarity as the anchor samples, wherein the anchor samples are text fragments containing emoticons or ironic sentences with specific cultural features.

[0116] S313: The model is trained by contrastive learning algorithm to reduce the distance between the anchor sample and the positive sample in the semantic space, and to increase the distance between the anchor sample and the negative sample in the semantic space, so as to obtain the target model.

[0117] S314: Inject the cultural context understanding capability of the target model into the mapping process of the semantic space, so that the sentiment weight of the word sequence is adjusted when generating the initial semantic vector.

[0118] As described in step S311 above, manually annotated regional feature sentences are obtained. The system will focus on obtaining manually annotated feature sentences from specific regions. These sentences are usually text fragments labeled by relevant personnel based on specific cultural backgrounds, regional characteristics, and emotional expressions. Manually annotated regional feature sentences are of great significance in sentiment analysis because they can represent users' emotional tendencies and expressions in a specific cultural context. Specifically, the system can use questionnaires or social media monitoring tools to collect text data containing specific cultural features (such as slang, ironic sentences, emoticons, etc.) and invite relevant experts to conduct detailed analysis and annotation. During this process, experts carefully interpret the original text to confirm its emotional polarity (such as positive, negative, or neutral) and its cultural connotations.

[0119] As described in step S312 above, training triplets for contrastive learning are constructed based on region-feature sentences. The core objective of this step is to construct training triplets for contrastive learning based on the acquired region-feature sentences. Specifically, an anchor sample refers to a region-feature sentence containing specific cultural elements and emotional expressions, serving as the base sample for contrastive learning. The positive samples corresponding to the anchor samples are typically text fragments with the same emotional polarity and similar cultural background. For example, if the anchor sample is a sentence mentioning the "very good" emoji, then its positive samples might be sentences describing similar emotions, such as "really good." These samples share the same emotional tendency and cultural context. Conversely, negative samples are texts that contrast with the anchor samples in their cultural and emotional context. They may express opposite or different emotions, such as sentences containing irony or negative emotions. Through carefully constructed contrastive learning training triplets, the system can more effectively learn the influence of cultural characteristics on emotional expression, thereby improving the sensitivity of subsequent models to different emotional expressions.

[0120] As described in step S313 above, the model is trained using a contrastive learning algorithm to reduce the distance between the anchor sample and the positive sample in the semantic space, and to increase the distance between the anchor sample and the negative sample in the semantic space, thus obtaining the target model. During training, the system inputs anchor samples, positive samples, and negative samples into the model. During optimization, the system uses a loss function to measure the similarity between the anchor sample and the positive sample, aiming to reduce their distance in the semantic space. Simultaneously, the model also increases the distance between the anchor sample and the negative sample during training. Through this continuous optimization training, a target model is finally obtained. This model can not only more accurately understand the emotional meaning in different cultural and linguistic contexts, but also effectively enhance future analytical capabilities for mixed languages ​​and regional slang.

[0121] As described in step S314 above, the cultural context understanding capability of the target model is injected into the mapping process of the semantic space, so that the sentiment weights of the word sequence are adjusted when generating the initial semantic vector. When generating the initial semantic vector, the system refers to the cultural context information obtained from the target model to identify which words are more representative and emotionally intense in a specific cultural context. This information can be added to the generation process of the initial semantic vector as an additional bias. Furthermore, by adjusting the model output in this cultural context, the system can dynamically correct the sentiment weights, ensuring that sentiment expression not only conforms to language rules but also reflects the deeper meaning of the cultural background. The resulting initial semantic vector will better reflect the user's true emotional expression, helping to improve the accuracy and effectiveness of sentiment analysis.

[0122] In one embodiment, this occurs before step S1, which involves receiving mixed-language comment text containing at least two languages;

[0123] S001: Extract the initial text of the mixed-language comment from the preset comment database;

[0124] S002: Desensitize the initial text of the mixed language comment to obtain the mixed language comment text.

[0125] As described in step S001 above, the initial text of mixed-language comments is extracted from a pre-defined comment database. The extraction process can typically be performed through SQL queries, data mining, or API calls. The system can set conditions to filter comment text containing at least two languages, ensuring that the selected content meets the multilingual standard. Furthermore, this step may involve certain preprocessing operations, such as removing invalid characters and cleaning up formatting, to ensure that the extracted text meets data quality standards.

[0126] As described in step S002 above, the initial text of the mixed-language comment is anonymized to obtain the mixed-language comment text. The purpose of anonymization is to ensure user privacy and prevent the leakage of personal information during data analysis. With increasingly stringent data protection laws and regulations, anonymization has become a crucial step in data processing, especially in scenarios involving user-generated content (UGC). Anonymization typically involves removing or replacing personally identifiable information in the comment text, such as user names, contact information, and account IDs. Specific implementation details may include using regular expressions to identify and replace this sensitive information, or marking it as "anonymous" or "hidden." Furthermore, it is necessary to check and process elements in the comment that can be traced back to individuals, such as geographical location and specific event names, to ensure compliance with relevant privacy protection standards.

[0127] Reference Figure 3 The present invention also provides a sentiment analysis device for mixed language comments, the device comprising:

[0128] The receiving module 902 is used to receive mixed-language comment text containing at least two languages;

[0129] Extraction module 904 is used to extract multilingual fragments from the mixed-language comment text;

[0130] The recognition module 906 is used to recognize each of the multilingual segments using a multilingual pre-trained model, so as to obtain the word sequence of each of the multilingual segments and the corresponding language labels.

[0131] The generation module 908 is used to project different language lexical units in the lexical sequence onto a unified semantic space and perform weighted fusion through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0132] The correction module 910 is used to obtain the corresponding target language dictionary based on the language tag, and to perform sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tag and its sentiment weight.

[0133] Analysis module 912 is used to analyze the target semantic vector to obtain the sentiment analysis results of the mixed language comment text.

[0134] In one embodiment, the identification module 906 includes:

[0135] The language lexical acquisition submodule is used to perform word segmentation on each of the multilingual segments to obtain multiple language lexical units;

[0136] The input submodule is used to input the multilingual fragments and each corresponding language lexical into the multilingual pre-trained model. Based on multilingual contextual understanding, a language identity identifier is assigned to each generated lexical, thereby forming a lexical sequence with language labels.

[0137] In one embodiment, the correction module 910 includes:

[0138] The target language dictionary acquisition submodule is used to acquire the corresponding target language dictionary based on the language tags;

[0139] The detection submodule is used to detect whether the lexical units in the lexical sequence match the slang in the target language dictionary;

[0140] The sentiment weight acquisition submodule is used to acquire the sentiment weight corresponding to a slang term when a lexical term in the lexical sequence matches a slang term in the target language dictionary.

[0141] The target semantic vector generation submodule is used to apply the sentiment weight as a bias term to the vector representation of the corresponding word in the initial semantic vector to generate the modified target semantic vector.

[0142] In one embodiment, the generation module 908 includes:

[0143] The classification submodule is used to classify the lexical units in the lexical unit sequence according to their source languages ​​based on the language tags, so as to obtain the target language category of each lexical unit;

[0144] The language-specific lexicon library acquisition submodule is used to acquire the language-specific lexicon library of the target language category from the preset lexicon database, and to acquire the source language word vectors corresponding to the lexicon from the language-specific lexicon library respectively;

[0145] The lexical acquisition submodule is used to map each source language word vector to a preset semantic space through a preset cross-language projection matrix to obtain cross-language aligned lexical units;

[0146] The attention weight calculation submodule is used to calculate the attention weight of each word in the word sequence; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence in the preset semantic space;

[0147] The initial semantic vector generation submodule is used to generate the initial semantic vector by weighted summation of cross-language aligned lexical units of all lexical units in the lexical sequence based on the attention weights of each lexical unit.

[0148] In one embodiment, the sentiment analysis device for mixed-language comments further includes:

[0149] The labeled data collection module is used to collect labeled data from users to correct the sentiment analysis results, forming a training sample set;

[0150] The model parameter acquisition module is used to perform lightweight fine-tuning of the large language model, which serves as the multilingual pre-training model, based on the training sample set and using low-rank adaptive technology, to obtain the fine-tuned model parameters.

[0151] An integration module is used to integrate the fine-tuned model parameters into the multilingual pre-trained model to obtain an optimized multilingual pre-trained model.

[0152] In one embodiment, the sentiment analysis device for mixed-language comments further includes:

[0153] The region feature statement acquisition module is used to acquire manually annotated region feature statements;

[0154] The training triple construction module is used to construct training triples for contrastive learning based on regional feature sentences; wherein, the triple includes anchor samples, positive samples with the same cultural context emotional polarity as the anchor samples, and negative samples with different cultural context emotional polarity as the anchor samples, wherein the anchor samples are text fragments containing emoticons or ironic sentences with specific cultural features.

[0155] The distance reduction module is used to train the model through a contrastive learning algorithm to reduce the distance between the anchor sample and the positive sample in the semantic space, and increase the distance between the anchor sample and the negative sample in the semantic space, so as to obtain the target model.

[0156] The sentiment weight adjustment module is used to inject the cultural context understanding ability of the target model into the mapping process of the semantic space, so that the sentiment weight of the word sequence is adjusted when generating the initial semantic vector.

[0157] In one embodiment, the sentiment analysis device for mixed-language comments further includes:

[0158] The mixed-language comment initial text extraction module is used to extract the initial text of mixed-language comments from a preset comment database;

[0159] The desensitization module is used to desensitize the initial text of the mixed-language comment to obtain the mixed-language comment text.

[0160] It should be noted that the state detection model can be obtained by training a pre-built first neural network model based on a preset sample set. Each sample data in the preset sample set includes sample motion data (including sample step count, sample speed, and sample motion pattern) and the corresponding sample state. When training the pre-built first neural network model, the sample motion data in each sample data set is used as the input to the first neural network model, and the sample state corresponding to the sample motion data in each sample data set is used as the output of the first neural network model. Through training, the first neural network model can learn the correspondence between all possible sample motion data and sample states. The trained first neural network model is then used as the state detection model.

[0161] Figure 4 An internal structural diagram of an electronic device in one embodiment is shown. This electronic device can specifically be a terminal or a server, and more specifically, a computer device. Figure 4 As shown, the electronic device includes a processor, a memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a sentiment analysis method for mixed-language comments. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to implement a sentiment analysis method for mixed-language comments. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0162] In one embodiment, an electronic device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps:

[0163] Receive mixed-language comment text containing at least two languages;

[0164] Extract multilingual segments from the mixed-language comment text;

[0165] A multilingual pre-trained model is used to identify each of the multilingual segments in order to obtain the word sequence of each multilingual segment and the corresponding language label.

[0166] Different language lexical units in the lexical sequence are projected into a unified semantic space and weighted and fused through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0167] Based on the language tags, the corresponding target language dictionary is obtained, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tags and their sentiment weights;

[0168] The target semantic vector is analyzed to obtain the sentiment analysis results of the mixed language comment text.

[0169] By employing a multilingual pre-trained model and attention mechanism, the system achieves accurate parsing of mixed-language comments. It integrates and understands different language fragments within a pre-defined semantic space, improving the accuracy of sentiment recognition for mixed sentences. Furthermore, by dynamically invoking the target language dictionary based on language tags, it specifically corrects the sentiment weights of slang, effectively preventing sentiment polarity reversal and reducing the misjudgment rate of regional market comments. Ultimately, while maintaining processing efficiency, the system provides a highly accurate and adaptable sentiment analysis solution for applications such as cross-border e-commerce and social media monitoring, enhancing the accuracy and automation of business decisions.

[0170] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following steps:

[0171] Receive mixed-language comment text containing at least two languages;

[0172] Extract multilingual segments from the mixed-language comment text;

[0173] A multilingual pre-trained model is used to identify each of the multilingual segments in order to obtain the word sequence of each multilingual segment and the corresponding language label.

[0174] Different language lexical units in the lexical sequence are projected into a unified semantic space and weighted and fused through an attention mechanism to generate an initial semantic vector that is aligned across languages.

[0175] Based on the language tags, the corresponding target language dictionary is obtained, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tags and their sentiment weights;

[0176] The target semantic vector is analyzed to obtain the sentiment analysis results of the mixed language comment text.

[0177] By employing a multilingual pre-trained model and attention mechanism, the system achieves accurate parsing of mixed-language comments. It integrates and understands different language fragments within a pre-defined semantic space, improving the accuracy of sentiment recognition for mixed sentences. Furthermore, by dynamically invoking the target language dictionary based on language tags, it specifically corrects the sentiment weights of slang, effectively preventing sentiment polarity reversal and reducing the misjudgment rate of regional market comments. Ultimately, while maintaining processing efficiency, the system provides a highly accurate and adaptable sentiment analysis solution for applications such as cross-border e-commerce and social media monitoring, enhancing the accuracy and automation of business decisions.

[0178] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0179] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0180] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A sentiment analysis method for mixed-language comments, characterized in that, The method includes: Receive mixed-language comment text containing at least two languages; Extract multilingual segments from the mixed-language comment text; A multilingual pre-trained model is used to identify each of the multilingual segments in order to obtain the word sequence of each multilingual segment and the corresponding language label. Different language lexical units in the lexical sequence are projected into a unified semantic space and weighted and fused through an attention mechanism to generate an initial semantic vector that is aligned across languages. Based on the language tags, the corresponding target language dictionary is obtained, and the semantic vector is modified for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tags and their sentiment weights; The target semantic vector is analyzed to obtain the sentiment analysis results of the mixed language comment text; The step of obtaining the corresponding target language dictionary based on the language tags, and modifying the semantic vector for sentiment polarity according to the target language dictionary to obtain the modified target semantic vector includes: The corresponding target language dictionary is obtained based on the language tags; Detect whether the lexical units in the lexical sequence match the slang in the target language dictionary; When a lexical element in the lexical sequence matches a slang term in the target language dictionary, the sentiment weight corresponding to that slang term is obtained. The sentiment weight is used as a bias term and applied to the vector representation of the corresponding word in the initial semantic vector to generate the corrected target semantic vector. The step of projecting different language lexical units in the lexical sequence onto a unified semantic space and performing weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages ​​includes: Based on the language tags, the lexical units in the lexical unit sequence are classified according to their source languages ​​to obtain the target language category of each lexical unit; Obtain the language-specific word library of the target language category from the preset word library, and obtain the source language word vectors corresponding to the word elements from the language-specific word library respectively; By mapping the word vectors of each source language to a preset semantic space through a preset cross-language projection matrix, cross-language aligned lexical units are obtained; Calculate the attention weight of each word in the word sequence; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence in the preset semantic space; Based on the attention weights of each lexical unit, the cross-linguistic aligned lexical units of all lexical units in the lexical unit sequence are weighted and summed to generate the initial semantic vector.

2. The sentiment analysis method for mixed-language comments according to claim 1, characterized in that, The step of using a multilingual pre-trained model to identify each of the multilingual segments, so as to obtain the lexical sequence of each of the multilingual segments and the corresponding language labels, includes: Each of the aforementioned multilingual segments is segmented into sub-words to obtain multiple language lexical units; The multilingual fragments and their corresponding lexical units are input into a multilingual pre-trained model. Based on multilingual contextual understanding, a language identity identifier is assigned to each generated lexical unit, thereby forming a lexical sequence with language labels.

3. The sentiment analysis method for mixed-language comments according to claim 1, characterized in that, After the step of analyzing the target semantic vector to obtain the sentiment analysis result of the mixed language comment text, the method further includes: Collect labeled data from users to correct the sentiment analysis results, forming a training sample set; Based on the training sample set, a low-rank adaptive technique is used to perform lightweight fine-tuning on the large language model, which serves as the multilingual pre-training model, to obtain the fine-tuned model parameters. The fine-tuned model parameters are integrated into the multilingual pre-trained model to obtain the optimized multilingual pre-trained model.

4. The sentiment analysis method for mixed-language comments according to claim 1, characterized in that, Before the step of projecting different language lexical units in the lexical sequence onto a unified semantic space and performing weighted fusion through an attention mechanism to generate an initial semantic vector aligned across languages, the method further includes: Obtain manually annotated region feature statements; Training triples for contrastive learning are constructed based on regional feature sentences; wherein, the triples include anchor samples, positive samples with the same cultural context emotional polarity as the anchor samples, and negative samples with different cultural context emotional polarity as the anchor samples, and the anchor samples are text fragments containing emoticons or ironic sentences with specific cultural features. The model is trained by a contrastive learning algorithm to reduce the distance between the anchor sample and the positive sample in the semantic space, and to increase the distance between the anchor sample and the negative sample in the semantic space, thereby obtaining the target model. The cultural context understanding capability of the target model is injected into the mapping process of the semantic space, so that the sentiment weight of the word sequence is adjusted when generating the initial semantic vector.

5. The sentiment analysis method for mixed-language comments according to claim 1, characterized in that, Prior to the step of receiving mixed-language comment text containing at least two languages; Extract the initial text of the mixed-language comments from a pre-defined comment database; The initial text of the mixed-language comment is anonymized to obtain the mixed-language comment text.

6. A sentiment analysis device for mixed language comments, characterized in that, The device includes: A receiving module is used to receive mixed-language comment text containing at least two languages; The extraction module is used to extract multilingual fragments from the mixed-language comment text; The recognition module is used to recognize each of the multilingual segments using a multilingual pre-trained model, so as to obtain the word sequence of each of the multilingual segments and the corresponding language labels; The generation module is used to project different language lexical units in the lexical sequence onto a unified semantic space and perform weighted fusion through an attention mechanism to generate an initial semantic vector that is aligned across languages. The correction module is used to obtain the corresponding target language dictionary based on the language tag, and to perform sentiment polarity correction on the semantic vector according to the target language dictionary to obtain the corrected target semantic vector; wherein, the target language dictionary includes slang corresponding to the language tag and its sentiment weight; The analysis module is used to analyze the target semantic vector to obtain the sentiment analysis results of the mixed language comment text; The correction module includes: The target language dictionary acquisition submodule is used to acquire the corresponding target language dictionary based on the language tags; The detection submodule is used to detect whether the lexical units in the lexical sequence match the slang in the target language dictionary; The sentiment weight acquisition submodule is used to acquire the sentiment weight corresponding to a slang term when a lexical term in the lexical sequence matches a slang term in the target language dictionary. The target semantic vector generation submodule is used to apply the sentiment weight as a bias term to the vector representation of the corresponding word in the initial semantic vector to generate the modified target semantic vector. The generation module includes: The classification submodule is used to classify the lexical units in the lexical unit sequence according to their source languages ​​based on the language tags, so as to obtain the target language category of each lexical unit; The language-specific lexicon library acquisition submodule is used to acquire the language-specific lexicon library of the target language category from the preset lexicon database, and to acquire the source language word vectors corresponding to the lexicon from the language-specific lexicon library respectively; The lexical acquisition submodule is used to map each source language word vector to a preset semantic space through a preset cross-language projection matrix to obtain cross-language aligned lexical units; The attention weight calculation submodule is used to calculate the attention weight of each word in the word sequence; wherein, the attention weight is determined based on the contextual relevance of the cross-linguistic aligned word of the word and the cross-linguistic aligned word of other words in the sequence in the preset semantic space; The initial semantic vector generation submodule is used to generate the initial semantic vector by weighted summation of cross-language aligned lexical units of all lexical units in the lexical sequence based on the attention weights of each lexical unit.

7. A computer-readable storage medium, characterized in that, The system contains a computer program that, when executed by a processor, causes the processor to perform the steps of the sentiment analysis method for mixed-language comments as described in any one of claims 1 to 5.

8. An electronic device, characterized in that, The device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the sentiment analysis method for mixed-language comments as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • A multi-language sentiment classification method, device and equipment based on a capsule network and a storage medium

    CN113792143A

  • Balanced cross-language sentiment analysis method and system

    CN118133842A