Implicit sentiment analysis method and device, storage medium and computer program product
By using at least two large language models to identify and analyze attributes and emotional values in implicit emotional texts, determine the emotional polarity of the text, solve the problem of poor accuracy of emotional polarity analysis of implicit emotional texts, and achieve more detailed emotions Information analysis.
Patent Information
- Application Number
- CN202411348323.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art has poor accuracy in the analysis of emotional polarity of implicit emotional texts and lacks effective solutions.
At least two large language models are used to analyze the input text. First, the attributes of the target to be analyzed are identified through the first large language model, and then the emotional values on the attributes are calculated through the second large language model, and the emotions of the text are determined based on these emotional values. Polarity, including positive, neutral or negative.
By analyzing the attributes and emotional values of the input text that reflect the subject to be analyzed, the accuracy of the emotional polarity analysis of implicit emotional text is improved, and the problem of poor accuracy of the emotional polarity analysis of implicit emotional text is solved.
Smart Images

Figure CN119248930A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to an implicit sentiment analysis method and device, a storage medium, and a computer program product. Background Art
[0002] Nowadays, more and more users like to express their opinions on various online platforms, expressing their subjective opinions on commodities, movies, news events, etc., and the amount of information contained in the comments is increasing. These comments contain a lot of positive or negative emotional information. Therefore, text sentiment analysis came into being.
[0003] Due to the diversity and complexity of languages, sentiment analysis can be divided into two categories: explicit and implicit, depending on whether the research text contains explicit sentiment words. Explicit sentiment text contains clear sentiment words, so it is relatively simple to analyze sentiment tendency; while implicit sentiment text has no obvious sentiment words, so it still faces great challenges when analyzing sentiment polarity.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide an implicit sentiment analysis method and device, a storage medium, and a computer program product to at least solve the technical problem that the related art has poor accuracy in sentiment polarity analysis of implicit sentiment texts.
[0006] According to one aspect of an embodiment of the present application, an implicit sentiment analysis method is provided, comprising: obtaining an input text containing a target to be analyzed; analyzing the input text using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; analyzing each attribute of the target to be analyzed using a second language model to obtain a sentiment value of the target to be analyzed on each attribute; determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of sentiment polarity include: positive, neutral or negative.
[0007] Optionally, obtaining input text containing the target to be analyzed includes: obtaining original text containing the target to be analyzed; preprocessing the original text to obtain input text containing the target to be analyzed, wherein the preprocessing includes at least one of the following: removing modal particles and correcting spelling.
[0008] Optionally, the input text is analyzed using the first largest language model to obtain at least one attribute of the input text that mentions the target to be analyzed, including: using the first largest language model to perform dependency syntactic analysis on the input text to obtain a corresponding syntactic dependency graph, wherein the syntactic dependency graph is used to reflect the dependency relationship between each word in the input text; using the first largest language model to analyze the syntactic dependency graph to obtain at least one associated target in the input text that has an associated relationship with the target to be analyzed, and using the at least one associated target as at least one attribute of the input text that mentions the target to be analyzed, wherein the associated target is a noun or pronoun in the input text.
[0009] Optionally, the second largest language model is used to analyze each attribute of the target to be analyzed to obtain the sentiment value of the target to be analyzed on each attribute, including: for each attribute, the second largest language model is used to analyze the syntactic dependency graph to obtain the description words of the corresponding associated target, wherein the description words are adjectives or adverbs in the input text; the similarity between the description words of the associated target and each sentiment word in a preset sentiment dictionary is calculated, wherein the sentiment dictionary includes multiple sentiment words and sentiment values used to reflect the sentiment tendency of the sentiment words; the sentiment value of the sentiment word whose similarity is greater than a preset similarity threshold is used as the target sentiment value corresponding to the description word, and the target sentiment value is used as the sentiment value of the target to be analyzed on the corresponding attribute.
[0010] Optionally, before taking the sentiment value as the sentiment value of the target to be analyzed on the corresponding attribute, the method also includes: using the second largest language model to analyze the syntactic dependency graph to obtain the degree adverbs of the descriptive words of the associated target; using the second largest language model to analyze the part of speech and degree level of the degree adverbs, and adjusting the sentiment value of the target to be analyzed on the corresponding attribute according to the part of speech and degree level of the degree adverbs.
[0011] Optionally, determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed includes: determining the weight value of each attribute, and determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value and weight value of each attribute of the target to be analyzed.
[0012] Optionally, the sentiment polarity of the input text with respect to the target to be analyzed is determined based on the sentiment value and weight value of each attribute of the target to be analyzed, including: determining the sentiment value of the input text based on the sentiment value and weight value of each attribute of the target to be analyzed; when the sentiment value of the input text is not less than a first preset threshold, determining that the sentiment polarity of the input text with respect to the target to be analyzed is positive; when the sentiment value of the input text is not greater than a second preset threshold, determining that the sentiment polarity of the input text with respect to the target to be analyzed is negative; when the sentiment value of the input text is less than the first preset threshold and greater than the second preset threshold, determining that the sentiment polarity of the input text with respect to the target to be analyzed is neutral.
[0013] According to another aspect of an embodiment of the present application, an implicit sentiment analysis device is also provided, including: an acquisition module, used to acquire input text containing a target to be analyzed; a first analysis module, used to analyze the input text using a first large language model, and obtain at least one attribute of the target to be analyzed mentioned in the input text; a second analysis module, used to analyze each attribute of the target to be analyzed using a second large language model, and obtain the sentiment value of the target to be analyzed on each attribute; a determination module, used to determine the sentiment polarity of the input text to the target to be analyzed based on the sentiment value of the target to be analyzed on each attribute, wherein the types of sentiment polarity include: positive, neutral or negative.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned implicit sentiment analysis method by running the computer program.
[0015] According to another aspect of an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein the computer program implements the above-mentioned implicit sentiment analysis method when executed by a processor.
[0016] In an embodiment of the present application, an input text containing a target to be analyzed is obtained; the input text is analyzed using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; each attribute of the target to be analyzed is analyzed using a second language model to obtain the sentiment value of the target to be analyzed on each attribute; based on the sentiment value of the target to be analyzed on each attribute, the sentiment polarity of the input text to the target to be analyzed is determined, wherein the types of sentiment polarity include: positive, neutral, or negative. By analyzing the attributes (i.e., specific aspects) of the subject to be analyzed reflected in the input text and the sentiment values of the subject to be analyzed on each attribute, the sentiment polarity of the input text to the subject to be analyzed is comprehensively obtained, thereby more carefully analyzing the sentiment information of the input text to the target to be analyzed, thereby solving the technical problem of poor accuracy of sentiment polarity analysis of implicit sentiment text in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of an optional computer terminal (or mobile device) for implementing an implicit sentiment analysis method according to an embodiment of the present application;
[0019] Figure 2 is a flow chart of an optional implicit sentiment analysis method according to an embodiment of the present application;
[0020] Figure 3 It is a flowchart of an optional implicit sentiment analysis method based on prompt words according to an embodiment of the present application;
[0021] Figure 4 is a schematic structural diagram of an optional implicit sentiment analysis device according to an embodiment of the present application;
[0022] Figure 5 An optional electronic structure diagram according to an embodiment of the present application is a schematic diagram. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0026] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:
[0027] Dependency Parsing (DP): is a natural language processing technology that reveals the grammatical structure of a sentence by analyzing the dependency relationship between components within a language unit. The core idea of this analysis method is to regard a sentence as a directed graph, in which words are nodes and dependency relationships are edges. By constructing such a graph structure, the grammatical relationship between each word in the sentence can be clearly displayed.
[0028] Large Language Models (LLMs) are deep learning models specifically designed to understand, analyze, and generate human-like text. They use large amounts of data to learn patterns, structures, and contexts in language, enabling them to perform tasks such as text classification, sentiment analysis, summarization, and translation.
[0029] Example 1
[0030] According to an embodiment of the present application, a method embodiment of an implicit sentiment analysis method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing an implicit sentiment analysis method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0032] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0033] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the implicit sentiment analysis method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the implicit sentiment analysis method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0036] In the above operating environment, Figure 2 is a flow chart of an optional implicit sentiment analysis method according to an embodiment of the present application, such as Figure 2 As shown, the method at least includes steps S202-S208, wherein:
[0037] Step S202: obtaining input text containing the target to be analyzed.
[0038] In the technical solution provided in step S202, the above input text can be understood as: text that does not explicitly contain emotional words. For example, "The screen of this computer is very clear, but the battery is average", where the screen and the battery correspond to the objects to be analyzed in this application, that is, the subjects corresponding to emotions (also known as aspects).
[0039] Step S204: Analyze the input text using the first large language model to obtain at least one attribute of the input text that mentions the object to be analyzed.
[0040] In the technical solution provided in step S204, use the first large language model to identify the text theme of the input text, and then determine at least one attribute of the input text that mentions the object to be analyzed according to the identified theme. For example, "The taste of the bread in this store is very good", where the subject corresponding to the emotion is "bread", and by analyzing this text, it is not difficult to see that this text mentions the "taste" attribute of "bread".
[0041] Step S206: Analyze each attribute of the object to be analyzed using the second large language model to obtain the emotional value of the object to be analyzed on each attribute.
[0042] In the technical solution provided in step S206, the above emotional value is used to reflect the emotional tendency of the object to be analyzed on each attribute.
[0043] Step S208: Determine the emotional polarity of the input text towards the object to be analyzed based on the emotional values of the object to be analyzed on each attribute.
[0044] In the technical solution provided in step S208, comprehensively analyze the emotional values of the object to be analyzed on each attribute to obtain the emotional polarity of the object to be analyzed in this input text, where the types of the above emotional polarity include: positive, neutral or negative.
[0045] The above method of this embodiment will be further introduced below.
[0046] As an optional implementation manner, in the technical solution provided in the above step S202, in order to ensure the accuracy of subsequent analysis, the original text containing the object to be analyzed can be obtained first; then, preprocess the original text to obtain the input text containing the object to be analyzed, where the above preprocessing includes but is not limited to: removing modal particles (such as meaningless modal particles like "de", "le", etc.), spelling correction, etc.
[0047] As an optional implementation manner, in the technical solution provided in the above step S204, the method may include:
[0048] Step S2041: Use the first language model to perform dependency syntactic analysis on the input text to obtain a corresponding syntactic dependency graph.
[0049] In the technical solution provided in the above step S2041, first, the input text is segmented and tagged with parts of speech using the first language model to convert the input text into a series of words and their part-of-speech tags; then, a syntactic dependency graph with a directed graph structure is constructed based on the dependency relationship between the words, and this graph has words as nodes and dependency relationships as edges. Therefore, the syntactic dependency graph is used to reflect the dependency relationship between each word in the input text.
[0050] Step S2042: Analyze the syntactic dependency graph using the first language model to obtain at least one associated target in the input text that has an associated relationship with the target to be analyzed, and use the at least one associated target as at least one attribute of the target to be analyzed mentioned in the input text.
[0051] In the technical solution provided in the above step S2042, the syntactic dependency graph is parsed using the first largest language model to identify the grammatical components (such as subject, predicate, object, attributive, adverbial, etc.) and parts of speech (such as noun, pronoun, adjective, adverb, etc.) of each word; then, at least one associated target that has an association relationship with the target to be analyzed is determined based on the grammatical components and parts of speech of each word, and the associated target is generally a "noun" or "pronoun" in the sentence, and the at least one associated target is used as at least one attribute of the target to be analyzed mentioned in the input text.
[0052] For example: "The bread in this store tastes great", where the subject corresponding to the emotion, that is, the target to be analyzed is "bread". Since "taste" is a noun associated with "bread", it can be used as the "taste" attribute of the text mentioning "bread".
[0053] As an optional implementation, in the technical solution provided in the above step S206, the method may include:
[0054] Step S2061: For each attribute, the syntactic dependency graph is analyzed using the second largest language model to obtain description words corresponding to the associated target.
[0055] In the technical solution provided in the above step S2061, for each attribute of the target to be analyzed mentioned in the input text, the second largest language model is used to parse the syntactic dependency graph to obtain descriptive words of the associated target corresponding to the attribute, and the descriptive words are adjectives or adverbs adjacent to the associated target in the input text.
[0056] Step S2062, calculating the similarity between the description words of the associated target and each sentiment word in the preset sentiment dictionary.
[0057] In the technical solution provided in the above step S2062, the sentiment dictionary includes multiple sentiment words with marked sentiment polarities and sentiment values (also called sentiment scores) used to reflect the sentiment tendencies of the sentiment words. If the sentiment value is a positive number, it means that the sentiment tendencies of the sentiment words tend to be positive; if the sentiment value is a negative number, it means that the sentiment tendencies of the sentiment words tend to be negative.
[0058] Step S2063: The sentiment value of the sentiment word whose similarity is greater than a preset similarity threshold is used as the target sentiment value corresponding to the description word, and the target sentiment value is used as the sentiment value of the target to be analyzed on the corresponding attribute.
[0059] In the technical solution provided in the above step S2063, the sentiment value of the sentiment word with the highest similarity to the description word of the associated target in the sentiment dictionary is used as the target sentiment value corresponding to the description word, and the target sentiment value is used as the sentiment value of the corresponding attribute of the target to be analyzed.
[0060] Optionally, considering that there are modifiers for descriptive words in some texts, such as adverbs of degree, therefore, before using the target sentiment value determined in step S2062 as the sentiment value of the target to be analyzed on the corresponding attribute, the second largest language model can be further used to analyze the syntactic dependency graph to obtain the degree adverbs of the descriptive words of the associated target; the second largest language model is used to analyze the part of speech and degree level of the degree adverbs, and the sentiment value of the target to be analyzed on the corresponding attribute is adjusted according to the part of speech and degree level of the degree adverbs.
[0061] This is because, in implicit sentiment analysis, due to the lack of obvious words to express emotions, the use of degree adverbs can be called an important clue to identify and judge emotional tendencies. Therefore, in this application, by analyzing the degree adverbs of attribute-related descriptive words such as "very", "a little", etc., the emotional information implicit in the input text to be analyzed can be accurately captured. It should be noted that if the degree adverb is a negative adverb, the sentiment word can be multiplied by "-1".
[0062] As an optional implementation, in the technical solution provided in the above step S208, the method may include: determining the weight value of each attribute, and determining the sentiment polarity of the input text to the target to be analyzed based on the sentiment value and weight value of each attribute of the target to be analyzed.
[0063] Specifically, the weight values of the above-mentioned attributes are used to reflect the contribution of the attribute's sentiment value to the final discrimination of sentiment polarity, wherein the weight value can be calculated using improved information gain and chi-square statistics. Then, the sentiment words of the input text are determined based on the sentiment value and weight value of each attribute of the target to be analyzed, wherein, when the sentiment value of the input text is not less than the first preset threshold, the sentiment polarity of the input text to the target to be analyzed is determined to be positive; when the sentiment value of the input text is not greater than the second preset threshold, the sentiment polarity of the input text to the target to be analyzed is determined to be negative; when the sentiment value of the input text is less than the first preset threshold and greater than the second preset threshold, the sentiment polarity of the input text to the target to be analyzed is determined to be neutral.
[0064] It should be noted that the large language model used in step S202 and step S204 can be the same large language model, such as Chat GPT-3, Chat GPT-4 and other recursive neural networks. The training of these large language models is obtained through training on large categories of data. Therefore, the training process of the above-mentioned first large language model and the second large language model will not be further explained.
[0065] Furthermore, when using the above implicit sentiment analysis method to solve actual sentiment analysis problems, the present application also provides a model input prompt word to realize the process of implicit sentiment analysis. The specific idea is: first, analyze the implicit aspects and viewpoints in the text by using common sense and thinking chain ability; secondly, reflect on the process of implicit sentiment analysis; finally, infer the result of sentiment polarity to ensure that the language model gives a concise answer. Among them, the input sentence is defined as X, the given target is defined as t, and the sentiment polarity is defined as y (positive, neutral or negative).
[0066] Step 1: Based on the given sentence "{context}", analyze which specific aspects of {target} it may mention. Based on common sense, analyze what the potential opinions about {target} are in these aspects and what the reasons are. Limit the word count to 200 words or less.
[0067] For example, you can use the following template: context1:[Given the sentence{context}],which specific aspect of{target}is possibly mentioned? Based on the common sense, what is the implicit opinion towards the mentioned aspect of {target}, and why? Limit to 200words.
[0068] Step 2: Based on the given sentence {context}, analyze the potential emotional meaning of {context} for {target} and determine whether it tends to be positive, neutral or negative. Please limit the word count to 200 words or less.
[0069] For example, you can use the following template: context2: Given the sentence {context}, Reflect on the potential emotional implications of the text on {target}, based on the provided context and determine if it leans towards positive, neutral, or negative sentiment. Limit to 200 words.
[0070] Among them, the above context2 serves as the prompt context of the second step, and the output of this step can be expressed as Y2=argmaxp(y|X,t), where Y2 represents the output text after reflection of the large language model.
[0071] The third step is to analyze the sentiment polarity of {target} based on the given text {context}, which consists of Y1, Y2 and the input text, and return only one of these words: positive, neutral or negative. If the analyzed latent sentiment polarity is less than 0.5, it is judged as neutral. The limit is 10 words.
[0072] For example, you can use the following template: context3: Given the context {context}, Based on the provided context, summarize the sentiment polarity towards {target}, and return only one of these words: positive, neutral, or negative. If your probability of judging the polarity of implicit emotions is less than 0.5, please judge it as neutral. Limit to 10 words.
[0073] Among them, context3 is the prompt context of the third step, and the output of this step can be expressed as Y3=argmaxp(y|Y1,Y2,X,t), where Y3 represents the output result of the final sentiment analysis of the large language model.
[0074] For example, Figure 3 is a schematic diagram of an optional model input prompt word in an embodiment of the present application, such as Figure 3 As shown. The input text is {This bread is first-rate}.
[0075] Step 1: The first input text input to the large language model is: Based on the given sentence {This bread is first-rate}, analyze which specific aspects of {bread} it may mention. Based on common sense, analyze what the potential opinions about {bread} are in these aspects and what the reasons are. Limit the number of words to 200. The result obtained by the large language model is: This bread is first-rate. The specific aspects of bread mentioned in the sentence are instructions. As the word "first-rate" indicates, the implicit opinion about the bread instruction is positive because "first-rate" is a phrase used to describe the highest quality or standard. This sentence indicates that the bread is good and of high quality. This opinion may be based on the taste, texture, and appearance of the bread, because these are the most common factors used to evaluate the quality of bread. The person who expressed the opinion may have had previous experience with bread and found that its quality was always high, or they compared it with other breads and found it to be superior.
[0076] Step 2: The second input text to the large language model is: Based on the given sentence {This bread is first-rate}, reflect on the potential emotional meaning of bread in the text and determine whether it tends to be positive, neutral or negative. Please limit the number of words to 200. The result obtained by the large language model is: {This bread is first-rate} This sentence implies a positive emotion about bread, and the word "first-rate" is often used to describe high-quality or excellent things. Therefore, it can be inferred that the bread is of good quality and the person who expressed the opinion has a positive view of it. This sentence can evoke positive emotions in the viewer, such as excitement or satisfaction, especially if they like high-quality bread. Overall, the emotions tend to be positive.
[0077] Step 3: The third input text to the large language model is: Given the sentence {This bread is first-rate. The specific aspect of the bread mentioned in the sentence is the instruction. As indicated by the word "first-rate", the implicit opinion about the bread instruction is positive, because "first-rate" is a phrase used to describe the highest quality or standard. This sentence indicates that the bread is good and of high quality. This opinion may be based on the taste, texture, and appearance of the bread, as these are the most common factors used to evaluate the quality of bread. The person who expressed the opinion may have had previous experience with bread and found it to be of consistently high quality, or they compared it with other breads and found it to be superior}, the sentence "{This bread is first-rate" implies a positive sentiment about the bread, and the word "first-rate" is often used to describe something of high quality or excellence. Therefore, it can be inferred that the bread is of good quality and the person who expressed the opinion has a positive view of it. This sentence can evoke positive emotions in the viewer, such as excitement or satisfaction, especially if they like high-quality bread. Overall, the sentiment tends to be positive}, based on the above text, summarize the sentiment polarity for {bread} and return only one of these words: positive, neutral, or negative. If the analyzed implicit sentiment polarity is less than 0.5, it is judged to be neutral. The limit is 10 words. The result obtained by the large language model is: positive.
[0078] Based on the scheme defined in the above steps S202 to S208, it can be known that in the embodiment, an input text containing a target to be analyzed is obtained; the input text is analyzed using the first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; the various attributes of the target to be analyzed are analyzed using the second language model to obtain the sentiment value of the target to be analyzed on each attribute; the sentiment polarity of the input text to the target to be analyzed is determined based on the sentiment value of the target to be analyzed on each attribute, wherein the types of sentiment polarity include: positive, neutral or negative. By analyzing the attributes (i.e., specific aspects) of the subject to be analyzed reflected in the input text and the sentiment values of the subject to be analyzed on each attribute, the sentiment polarity of the input text to the subject to be analyzed is comprehensively obtained, thereby more carefully analyzing the sentiment information of the input text to the target to be analyzed, thereby solving the technical problem of poor accuracy of sentiment polarity analysis of implicit sentiment text in related technologies.
[0079] Example 2
[0080] Based on Embodiment 1 of the present application, an embodiment of an implicit sentiment analysis device is also provided, and when the device is running, the implicit sentiment analysis method of the above embodiment is executed. Figure 4 is a schematic diagram of the structure of an optional implicit sentiment analysis device according to an embodiment of the present application, such as Figure 4 As shown, the implicit sentiment analysis device at least includes an acquisition module 42, a first analysis module 44, a second analysis module 46 and a determination module 48, wherein:
[0081] An acquisition module 42 is used to acquire input text containing a target to be analyzed;
[0082] A first analysis module 44 is used to analyze the input text using the first large language model to obtain at least one attribute of the input text that mentions the target to be analyzed;
[0083] The second analysis module 46 is used to analyze each attribute of the target to be analyzed by using the second language model to obtain the sentiment value of each attribute of the target to be analyzed;
[0084] The determination module 48 is used to determine the sentiment polarity of the input text to the target to be analyzed based on the sentiment values of the target to be analyzed on various attributes, wherein the types of sentiment polarity include: positive, neutral or negative.
[0085] It should be noted that the various modules in the above-mentioned implicit sentiment analysis device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.
[0086] Example 3
[0087] According to an embodiment of the present application, a non-volatile storage medium is also provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the implicit sentiment analysis method in Example 1.
[0088] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining an input text containing a target to be analyzed; analyzing the input text using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; analyzing each attribute of the target to be analyzed using a second language model to obtain a sentiment value of the target to be analyzed on each attribute; determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of sentiment polarity include: positive, neutral or negative.
[0089] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the implicit sentiment analysis method in Example 1 is implemented.
[0090] Optionally, the computer program executes the following steps: obtaining an input text containing a target to be analyzed; analyzing the input text using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; analyzing each attribute of the target to be analyzed using a second language model to obtain a sentiment value of the target to be analyzed on each attribute; determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of sentiment polarity include: positive, neutral or negative.
[0091] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the implicit sentiment analysis method in Example 1 is executed when the program is running.
[0092] Optionally, when the program is running, the following steps are executed: obtaining an input text containing a target to be analyzed; analyzing the input text using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; analyzing each attribute of the target to be analyzed using a second language model to obtain a sentiment value of the target to be analyzed on each attribute; determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of sentiment polarity include: positive, neutral or negative.
[0093] According to an embodiment of the present application, an electronic device is also provided, wherein: Figure 5 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the implicit sentiment analysis method in the above-mentioned embodiment 1 when running.
[0094] Optionally, the processor is configured to execute the following steps through a computer program: obtaining an input text containing a target to be analyzed; analyzing the input text using a first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; analyzing each attribute of the target to be analyzed using a second language model to obtain a sentiment value of the target to be analyzed on each attribute; determining the sentiment polarity of the input text with respect to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of sentiment polarity include: positive, neutral or negative.
[0095] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0096] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0098] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0099] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0100] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0101] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. An implicit sentiment analysis method, characterized in that: include: Get the input text containing the target to be analyzed; Analyzing the input text using the first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; Analyzing each of the attributes of the target to be analyzed by using the second largest language model to obtain the sentiment value of the target to be analyzed on each of the attributes; The sentiment polarity of the input text to the target to be analyzed is determined based on the sentiment value of each of the attributes of the target to be analyzed, wherein the types of the sentiment polarity include: positive, neutral or negative.
2. The method according to claim 1, characterized in that Get the input text containing the target to be analyzed, including: Obtaining the original text containing the target to be analyzed; The original text is preprocessed to obtain the input text containing the target to be analyzed, wherein the preprocessing includes at least one of the following: removing modal particles and correcting spelling.
3. The method according to claim 1, characterized in that The input text is analyzed using the first language model to obtain at least one attribute of the target to be analyzed mentioned in the input text, including: Using the first language model to perform dependency syntactic analysis on the input text to obtain a corresponding syntactic dependency graph, wherein the syntactic dependency graph is used to reflect the dependency relationship between each word in the input text; The syntactic dependency graph is analyzed using the first large language model to obtain at least one associated target in the input text that has an associated relationship with the target to be analyzed, and the at least one associated target is used as at least one attribute of the input text that mentions the target to be analyzed, wherein the associated target is a noun or a pronoun in the input text.
4. The method according to claim 3, characterized in that Analyze each of the attributes of the target to be analyzed using the second largest language model to obtain the sentiment value of the target to be analyzed on each of the attributes, including: For each of the attributes, the syntactic dependency graph is analyzed using the second largest language model to obtain a description word corresponding to the associated target, wherein the description word is an adjective or adverb in the input text; Calculating the similarity between the description words of the associated target and each sentiment word in a preset sentiment dictionary, wherein the sentiment dictionary includes a plurality of sentiment words and sentiment values for reflecting the sentiment tendency of the sentiment words; The sentiment value of the sentiment word whose similarity is greater than a preset similarity threshold is used as the target sentiment value corresponding to the description word, and the target sentiment value is used as the sentiment value of the target to be analyzed on the corresponding attribute.
5. The method according to claim 4, characterized in that Before using the sentiment value as the sentiment value of the target to be analyzed on the corresponding attribute, the method further includes: Analyzing the syntactic dependency graph using the second largest language model to obtain degree adverbs of the descriptive words of the associated target; The second largest language model is used to analyze the part of speech and degree level of the degree adverb, and the sentiment value of the target to be analyzed on the corresponding attribute is adjusted according to the part of speech and degree level of the degree adverb.
6. The method according to claim 1, characterized in that Determining the sentiment polarity of the input text to the target to be analyzed based on the sentiment value of each of the attributes of the target to be analyzed includes: The weight values of the respective attributes are determined, and the sentiment polarity of the input text to the target to be analyzed is determined based on the sentiment values and weight values of the respective attributes of the target to be analyzed.
7. The method according to claim 6, characterized in that Determining the sentiment polarity of the input text to the target to be analyzed based on the sentiment value and weight value of each attribute of the target to be analyzed includes: Determining the sentiment value of the input text based on the sentiment value and weight value of each attribute of the target to be analyzed; When the sentiment value of the input text is not less than a first preset threshold, determining that the sentiment polarity of the input text to the target to be analyzed is positive; When the sentiment value of the input text is not greater than a second preset threshold, determining that the sentiment polarity of the input text to the target to be analyzed is negative; When the sentiment value of the input text is less than the first preset threshold and greater than the second preset threshold, it is determined that the sentiment polarity of the input text to the target to be analyzed is neutral.
8. An implicit sentiment analysis device, characterized in that: include: An acquisition module is used to obtain input text containing the target to be analyzed; A first analysis module, configured to analyze the input text using a first large language model to obtain at least one attribute of the target to be analyzed mentioned in the input text; A second analysis module is used to analyze each of the attributes of the target to be analyzed using a second language model to obtain a sentiment value of each of the attributes of the target to be analyzed; A determination module is used to determine the sentiment polarity of the input text to the target to be analyzed based on the sentiment value of each attribute of the target to be analyzed, wherein the types of the sentiment polarity include: positive, neutral or negative.
9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the implicit sentiment analysis method described in any one of claims 1 to 7 by running the computer program.
10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, it implements the implicit sentiment analysis method described in any one of claims 1 to 7.
