Aspect sentiment analysis method, training method of generative model, and device thereof

CN117763141BActive Publication Date: 2026-09-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211137227.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-19
Publication Date
2026-09-22
Estimated Expiration
2042-09-19

AI Technical Summary

Technical Problem

然而,这种直接对评论进行直接分析的方式,容易出现方面情感分析结果不准确的情况

Benefits of technology

[0014]在对原始评论文本进行方面情感分析时,对原始评论文本进行转换,以将原始评论文本中与方面情感分析无关的冗余信息删除得到转换文本,并对转换文本进行方面情感分析,从而可避免冗余信息中的其他情感对方面情感分析的影响,提高了方面情感分析结果的准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117763141B_ABST
    Figure CN117763141B_ABST
Patent Text Reader

Abstract

The application provides an aspect sentiment analysis method, a training method of a generative model and a device thereof, and relates to the technical field of computers, wherein the method comprises the following steps: when performing aspect sentiment analysis on an original comment text, converting the original comment text to delete redundant information irrelevant to the aspect sentiment analysis in the original comment text to obtain a converted text, and performing aspect sentiment analysis on the converted text, so that the influence of other sentiments in the redundant information on the aspect sentiment analysis can be avoided, and the accuracy of the aspect sentiment analysis result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a sentiment analysis method, a method for training generative models, and an apparatus thereof. Background Technology

[0002] Aspect sentiment analysis is an emerging fine-grained sentiment analysis task that aims to extract aspects from comments, the corresponding sentiment polarity of each aspect, and to identify viewpoints as the cause of emotions.

[0003] Current technologies typically perform aspect sentiment analysis directly on comments. However, this direct analysis method is prone to inaccurate results. Therefore, developing a method for performing aspect sentiment analysis on comments is a pressing technical challenge. Summary of the Invention

[0004] This application aims to address, at least to some extent, the technical problems in the related art.

[0005] This application provides an aspect sentiment analysis method, a generative model training method, and an apparatus thereof.

[0006] The first aspect of this application proposes an aspect sentiment analysis method, the method comprising: acquiring original comment text; converting the original comment text to obtain converted text of the original comment text, wherein the converted text includes only the text segments required for aspect sentiment analysis of the original comment text; and performing aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis result of the converted text.

[0007] A second aspect of this application proposes a method for training a generative model. The method includes: acquiring aspect sentiment analysis sample results and corresponding original text; inputting the aspect sentiment analysis sample results and preset initial control keywords into an initial generative model, such that the model parameters of the initial generative model are reconstructed using first initial values ​​to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; inputting the original text and preset first control keywords into the initial generative model, such that the model parameters of the initial generative model are set to second initial values, and transforming the original text to obtain transformed predicted text, wherein the second initial value corresponds to the first control keyword; inputting the reconstructed text and preset second control keywords into the initial generative model, such that the model parameters of the initial generative model are set to third initial values, and performing aspect sentiment analysis on the reconstructed text to obtain aspect sentiment analysis prediction results; and adjusting the first initial value, the second initial value, and the third initial value according to the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results to achieve training.

[0008] A third aspect of this application provides an aspect sentiment analysis apparatus for comment text. The apparatus includes: an acquisition module for acquiring original comment text; a conversion module for converting the original comment text to obtain converted text, wherein the converted text includes only the text segments required for aspect sentiment analysis of the original comment text; and an aspect sentiment analysis module for performing aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis result of the converted text.

[0009] A fourth aspect of this application provides a training apparatus for a generative model. The apparatus includes: an acquisition module for acquiring aspect sentiment analysis sample results and corresponding original text; a reconstruction module for inputting the aspect sentiment analysis sample results and preset initial control keywords into an initial generative model, such that the model parameters of the initial generative model adopt a first initial value, and reconstructing the aspect sentiment analysis sample results to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; and a conversion module for inputting the original text and preset first control keywords into the initial generative model, such that the model parameters of the initial generative model adopt a second initial value. An initial value is set, and the original text is transformed to obtain transformed predicted text, wherein the second initial value corresponds to the first control keyword; an aspect sentiment analysis module is used to input the reconstructed text and the preset second control keyword into the initial generative model, so that the model parameters of the initial generative model adopt a third initial value, and to perform aspect sentiment analysis on the reconstructed text to obtain aspect sentiment analysis prediction results, wherein the third initial value corresponds to the second control keyword; a model parameter adjustment module is used to adjust the first initial value, the second initial value and the third initial value according to the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results to achieve training.

[0010] A fifth aspect of this application provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform an aspect sentiment analysis method as proposed in a first aspect of this application, or to perform a generative model training method as proposed in a second aspect of this application.

[0011] A sixth aspect of this application provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform an aspect sentiment analysis method as proposed in a first aspect of this application, or to perform a generative model training method as proposed in a second aspect of this application.

[0012] A seventh aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the aspect sentiment analysis method proposed in the first aspect of this application, or executes the generative model training method proposed in the second aspect of this application.

[0013] One embodiment of the above invention has the following advantages or beneficial effects:

[0014] When performing aspect sentiment analysis on the original comment text, the original comment text is transformed to remove redundant information that is irrelevant to aspect sentiment analysis, resulting in a transformed text. Aspect sentiment analysis is then performed on the transformed text, which avoids the influence of other sentiments in the redundant information on aspect sentiment analysis and improves the accuracy of aspect sentiment analysis results.

[0015] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0016] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0017] Figure 1 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 1 of this application;

[0018] Figure 2 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 2 of this application;

[0019] Figure 3 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 3 of this application;

[0020] Figure 4 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 4 of this application;

[0021] Figure 5 This is a schematic diagram of the aspect-based emotion analysis device provided in Embodiment 5 of this application;

[0022] Figure 6 This is a schematic diagram of the structure of the training device for the generative model provided in Embodiment Six of this application;

[0023] Figure 7 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present application is shown. Detailed Implementation

[0024] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0025] The following description, with reference to the accompanying drawings, outlines aspects of the sentiment analysis method, generative model training method, and apparatus of this application.

[0026] Figure 1 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 1 of this application.

[0027] like Figure 1 As shown, the sentiment analysis method in this regard may include the following steps 101-103.

[0028] Step 101: Obtain the original comment text.

[0029] It should be noted that the aspect sentiment analysis method provided in this application embodiment can be executed by an aspect sentiment analysis device. This aspect sentiment analysis device can be an electronic device or can be configured within an electronic device to avoid the influence of other emotions in redundant information on the aspect sentiment analysis, thereby improving the accuracy of the aspect sentiment analysis results. The electronic device may include terminal devices, servers, etc., and this embodiment does not specifically limit the type of electronic device.

[0030] In this application, the embodiment of the emotion analysis device is used as an electronic device for illustration.

[0031] Step 102: Convert the original comment text to obtain the converted text of the original comment text.

[0032] The converted text only includes the text segments needed for aspect sentiment analysis of the original comment text. In other words, the original comment text contains not only the text segments needed for aspect sentiment analysis but also redundant information unrelated to it, while the converted text does not contain this redundant information and only includes the text segments needed for aspect sentiment analysis.

[0033] In one embodiment of this application, a possible implementation of converting the original comment text to obtain the converted text is as follows: the original comment text is input into a pre-trained text conversion model, and the original comment text is converted by the text conversion model to obtain the converted text. Thus, based on the text conversion model, the converted text of the original comment text can be obtained quickly and accurately.

[0034] The text conversion model mentioned above was pre-trained.

[0035] One possible way to train a text conversion model is to acquire training data, which includes sample comment text and corresponding sample converted text. The sample comment text can be used as the input to the text conversion model, and the sample converted text can be used as the output of the text conversion model to train the text conversion model and obtain a trained text conversion model.

[0036] Other possible implementations of converting the original comment text to obtain the converted text will be described in subsequent embodiments.

[0037] In one embodiment of this disclosure, in order to facilitate users in sorting out the opinions in the comments, the converted text can also be used as a summary of the original comment text, so that manual review no longer needs to read a large amount of invalid text, directly improving the efficiency of manual sorting.

[0038] In one embodiment of this disclosure, to ensure that the converted text contains keywords from the original comment text, the decoder of the text conversion model in this example embodiment includes a pointer network decoder. Correspondingly, after the original comment text is input into the text conversion model, the encoder in the text conversion model encodes the word representations in the original comment text. Based on the pointer network decoder, keywords in the original comment text are determined from each word according to its encoding representation. Based on these keywords, text fragments required for aspect sentiment analysis of the original comment text are generated.

[0039] For example, the original comment text is "What bad luck, I got off work so late today. Luckily, the rice cooker cooks rice quickly, otherwise I wouldn't have had dinner." After inputting this original comment text into a text conversion model, assuming that the pointer network decoder in the text conversion model determines the keywords "rice cooker" and "cooks quickly" based on the encoded representation of each word in the original comment text, the corresponding converted text output by the text conversion model could be "The rice cooker cooks quickly, that's great."

[0040] Step 103: Perform aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis results of the converted text.

[0041] The aspect sentiment analysis results include aspect words, opinion words, and sentiment polarity.

[0042] Aspects are different information axes along which additional information about an entity can be obtained. For example, for the entity "Hawaii," possible aspects could include "beach," "hotel," and "weather." Similarly, for the entity "electronic product," possible aspects could include "screen," "screen material," "flashlight," and "charger."

[0043] The term "aspect term" refers to the text that names an aspect.

[0044] "Entity" refers to text that names or identifies something.

[0045] Emotional polarity can be positive, negative, or neutral.

[0046] Among them, opinion words are texts expressing opinions about the opposing viewpoint. For example, in the phrase "the screen is too bright," "too bright" is an opinion about the "screen."

[0047] In one embodiment of this application, after obtaining the converted text of the original comment text, the converted text can be input into a pre-trained aspect sentiment analysis model to perform aspect sentiment analysis on the converted text and obtain the sentiment analysis result of the converted text.

[0048] In summary, the aspect sentiment analysis method provided in this application transforms the original comment text to remove redundant information unrelated to aspect sentiment analysis, and then performs aspect sentiment analysis on the transformed text. This avoids the influence of other emotions in the redundant information on aspect sentiment analysis and improves the accuracy of aspect sentiment analysis results.

[0049] Figure 2 This is a flowchart illustrating the aspect sentiment analysis method provided in Embodiment 2 of this application. It should be noted that this embodiment uses the same generative model for both text conversion and aspect sentiment analysis. The following section will combine... Figure 2 The aspect-based sentiment analysis method implemented here is further described.

[0050] like Figure 2 As shown, aspect-based sentiment analysis methods may include:

[0051] Step 201: Obtain the original comment text.

[0052] Step 202: Obtain the preset first control keyword.

[0053] The first control keyword is used to instruct the generative model to perform text transformation on the input original comment text. In other words, the text transformation function of the generative model is determined based on the first control keyword.

[0054] It should be noted that the generative model in this embodiment has two functions: text-to-text conversion and aspect sentiment analysis. Although the model parameters used in the generative model are the same for both functions, the values ​​of the model parameters used for the two functions are different. In some embodiments, the values ​​of the model parameters of the generative model can be determined based on the first control keyword.

[0055] The first control keyword is preset. In practical applications, the first control keyword can be set according to actual needs. For example, the first control keyword can be... <string>to <string>.

[0056] Step 203: Concatenate the original comment text and the first control keyword to obtain the first concatenated text.

[0057] Step 204: Input the first concatenated text into the pre-trained generative model so that the model parameters of the generative model adopt the first value, and transform the original comment text in the first concatenated text to obtain the transformed text of the original comment text, wherein the first value corresponds to the first control keyword.

[0058] For example, the original comment text is "What bad luck, I got off work really late today. Luckily, the rice cooker cooks rice quickly, otherwise I wouldn't have had any dinner." Let's assume the first control keyword is " <string>to <string>The concatenated text obtained by combining the original comment text and the first control keyword is "". <string>to <string>"What bad luck, I got off work really late today. Luckily, the rice cooker cooks rice quickly, otherwise I wouldn't have had any dinner." After inputting the concatenated text into a pre-trained generative model, the model detected that the concatenated text contained the first control keyword. <string>to <string>At this point, it can be determined that the transformation function of the generative model should be used. Correspondingly, based on the first control keyword, the first value of the model parameter of the generative model can be determined, and the value of the model parameter of the generative model can be adjusted to the first value, thereby enabling the generative model to have a text transformation function. Correspondingly, the generative model performs text transformation on the original comment text "What bad luck, I got off work so late today. Luckily, the rice cooker cooks rice quickly, otherwise I wouldn't have had dinner" in the concatenated text, in order to delete redundant information in the original comment text that is irrelevant to the aspect sentiment analysis, so as to obtain a transformed text with a more obvious sentiment expression style. Among them, the transformed text output by the generative model is "The rice cooker cooks rice quickly, very good."

[0059] In the example embodiment, the generative model is an end-to-end machine learning model. For example, the generative model described above could be a text-to-text transformer (T5) model. The T5 model includes an encoder and a decoder, where the decoder is a pointer network decoder used to constrain the decoding process to ensure that the decoded transformed text includes keywords from the original comment text.

[0060] It is understood that the aforementioned generative models can also be other types of machine learning models, such as BART models, bidirectional language models (Embedding from language models, ELMO), natural language regression models, and GPT-3 (Generative Pre-trained Transformer 3).

[0061] Among them, the BART model is a noise reduction autoencoder built using a sequence-to-sequence model.

[0062] Step 205: Obtain the preset second control keyword.

[0063] The second control keyword is used to instruct the generative model to perform aspect sentiment analysis on the input transformed text. In other words, the aspect sentiment analysis function of the generative model is determined based on the second control keyword.

[0064] The second control keyword is preset. In practical applications, the second control keyword can be set according to actual needs. For example, the second control keyword can be... <string>to <tag>.

[0065] Step 206: Concatenate the second control keyword and the transformed text to obtain the second concatenated text.

[0066] Step 207: Input the second concatenated text into the generative model so that the model parameters of the generative model adopt the second value, and perform aspect sentiment analysis on the transformed text in the second concatenated text to obtain the aspect sentiment analysis result of the transformed text, wherein the second value corresponds to the second control keyword.

[0067] Continuing the previous example, let's convert the text to "The rice cooker cooks food quickly, very good." Assume the second control keyword is " <string>to <tag>After concatenating the second control keyword and the transformed text, the resulting concatenated text can be " <string>to <tag>"The rice cooker cooks food quickly, which is great." Correspondingly, after inputting this second concatenated text into the generative model, the model, based on the second control keyword in the second concatenated text, determines that aspect sentiment analysis needs to be performed. Accordingly, the generative model determines the second value of its model parameters based on the second control keyword, adjusts the model parameters to the second value, and performs aspect sentiment analysis on the transformed text in the second concatenated text. Since there is no redundant information unrelated to aspect sentiment analysis in the transformed text, the generative model can accurately output the aspect sentiment analysis result of the transformed text. The aspect sentiment analysis result can be "rice cooker, cooks quickly, positive sentiment." It can be understood that "rice cooker" in the aspect sentiment analysis result is an aspect term, "cooks quickly" is an opinion term, and "positive sentiment" is the sentiment polarity.

[0068] In the embodiments of this application, by adding corresponding control keywords to the input of the generative model, the same generative model can transform the original comment text and perform aspect sentiment analysis on the transformed text, thereby reducing the amount of model usage in the entire processing process and saving model parameters.

[0069] It should be noted that the generative model described above is pre-trained.

[0070] This application also proposes a method for training generative models.

[0071] Figure 3 This is a flowchart illustrating the training method for the generative model provided in Embodiment 3 of this application.

[0072] like Figure 3 As shown, the training method for this generative model includes the following steps:

[0073] Step 301: Obtain the aspect sentiment analysis sample results and the corresponding original text.

[0074] Step 302: Input the aspect sentiment analysis sample results and the preset initial control keywords into the initial generative model so that the model parameters of the initial generative model are reconstructed using the first initial value to obtain the reconstructed text, wherein the first initial value corresponds to the initial control keyword.

[0075] The initial control keyword is used to indicate that the text should be reconstructed using a generative model. At this time, the model parameters of the generative model need to use the first initial value corresponding to the initial control keyword, reconstruct the text based on the input information, and output the reconstructed text.

[0076] The initial control keyword is preset. In practical applications, the initial control keyword can be set according to actual needs. For example, the initial control keyword can be set to " <tag>to <string>".

[0077] For example, the sentiment analysis sample result is "rice cooker, cooks quickly, positive sentiment". Assume the initial control keyword is " <tag>to <string>"Suppose that the initial control keywords and aspect sentiment analysis sample results are concatenated to obtain the concatenated text, which is: " <tag>to <string>(Rice cooker, cooks quickly, positive sentiment). Correspondingly, after inputting the concatenated text into the generative model, the model determines the first initial values ​​to be used for the model parameters based on the initial control keywords, adjusts the values ​​of the model parameters to the first initial values, and reconstructs the aspect sentiment analysis sample results in the concatenated text to obtain the reconstructed text. The reconstructed text could be: "Rice cooker cooks quickly, very good."

[0078] Step 303: Input the original text and the preset first control keyword into the initial generative model so that the model parameters of the initial generative model adopt the second initial value, and transform the original text to obtain the transformed predicted text, wherein the second initial value corresponds to the first control keyword.

[0079] In some embodiments, the model parameters of the initial generative model can be adjusted to second initial values ​​corresponding to the transformation phase based on the difference information between the transformed predicted text and the reconstructed text.

[0080] For a description of the first control keyword, please refer to the relevant description in the above embodiments, which will not be repeated here.

[0081] Step 304: Input the reconstructed text and the preset second control keyword into the initial generative model so that the model parameters of the initial generative model adopt the third initial value, and perform aspect sentiment analysis on the reconstructed text to obtain the aspect sentiment analysis prediction result, wherein the third initial value corresponds to the second control keyword.

[0082] The description of the second control keyword can be found in the relevant description of the above embodiments, and will not be repeated here.

[0083] Step 305: Based on the aspect sentiment analysis prediction results and aspect sentiment analysis sample results, adjust the first initial value, the second initial value, and the third initial value to achieve training.

[0084] In the example embodiment of this application, the aspect sentiment analysis sample results are reconstructed using a generative model to obtain reconstructed text. Based on the reconstructed text and the aspect sentiment analysis sample results, the model parameters corresponding to the three stages of the generative model are trained to obtain a trained generative model. Thus, a generative model with multiple functions is trained, facilitating subsequent text conversion and aspect sentiment analysis based on the same generative model.

[0085] The three stages mentioned above include the reconstruction stage, the transformation stage, and the aspect sentiment analysis stage.

[0086] The reconstruction phase involves the generative model reconstructing the aspect sentiment analysis sample results to obtain the reconstructed text.

[0087] The transformation stage refers to the stage in which the generative model transforms the input text to obtain the transformed text.

[0088] The aspect sentiment analysis stage is the stage in which the generative model performs aspect sentiment analysis on the input transformed text.

[0089] To ensure a clear understanding of this application, the following will be combined with... Figure 4 The training method for the generative model in this embodiment is described exemplarily. In this example embodiment, the generative model is described using the T5 model.

[0090] like Figure 4 As shown, it may include:

[0091] Step ① Reconstruct the text based on the training data labels to obtain the reconstructed text.

[0092] During the reconstruction phase, the T5 model reconstructs the corresponding reconstructed text based on the training data labels. Since the training data labels (e.g., only containing aspect words, aspect opinion words, and sentiment polarity) cannot completely restore the original text of the model, information unrelated to aspect sentiment will be discarded. It is this feature that enables the removal of all irrelevant information in the original text.

[0093] Since all three stages in this example are processed using the same model, some control keywords need to be added to the model input to guide the model in handling different scenarios. To guide the model in text reconstruction, initial control keywords can also be added to the input along with the training data labels, for example: the initial control keyword is " <tag>to <string>In other words, during the reconstruction phase, the input to the T5 model consists of two parts: training data labels and initial control keywords.

[0094] For example, the training data labels are "rice cooker, cooks quickly, positive sentiment", and the control keywords are " <tag>to <string>"In the context of " <tag>to <string>When the phrase "(rice cooker, cooks quickly, positive sentiment)" is input into the T5 model, the reconstructed text output by the T5 model can be "The rice cooker cooks food quickly, very good."

[0095] It should be noted that the training data labels in this example can also be referred to as aspect sentiment analysis sample results.

[0096] In step ②, the original text corresponding to the training data labels is style-transformed to obtain the transformed text.

[0097] During this stage, while inputting the original text into the T5 model, it is also necessary to input the first control keyword required for the transformation stage. For example, the first control keyword could be " <string>to <string>In other words, during the conversion phase, the input to the T5 model consists of two parts: the original text and the first control keyword.

[0098] In step ③, the T5 model is used to perform aspect sentiment analysis on the reconstructed text to obtain the aspect sentiment analysis prediction results.

[0099] During the sentiment analysis phase, while inputting the reconstructed text into the T5 model, it is also necessary to input the second control keyword required for this phase. For example, the second control keyword could be " <string>to <tag>In other words, during the sentiment analysis phase, the input to the T5 model consists of two parts: the reconstructed text and the second control keyword.

[0100] Then, based on the difference between the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results (i.e., training data labels), the generative model is trained to obtain the trained generative model.

[0101] Figure 5 This is a schematic diagram of the aspect-based emotion analysis device provided in Embodiment 5 of this application.

[0102] like Figure 5 As shown, the aspect sentiment analysis device 500 may include: an acquisition module 501, a conversion module 502, and an aspect sentiment analysis module 503, wherein:

[0103] Module 501 is used to retrieve the original comment text.

[0104] The conversion module 502 is used to convert the original comment text to obtain the converted text of the original comment text. The converted text only includes the text fragments needed for aspect sentiment analysis of the original comment text.

[0105] The aspect sentiment analysis module 503 is used to perform aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis results of the converted text.

[0106] In one embodiment of this application, the conversion module 502 is specifically used for: obtaining a preset first control keyword; concatenating the original comment text and the first control keyword to obtain a first concatenated text; inputting the first concatenated text into a pre-trained generative model, so that the model parameters of the generative model adopt a first value, and converting the original comment text in the first concatenated text to obtain the converted text of the original comment text, wherein the first value corresponds to the first control keyword.

[0107] In one embodiment of this application, the aspect sentiment analysis module 503 is specifically used for: obtaining a preset second control keyword; concatenating the second control keyword and the transformed text to obtain a second concatenated text; inputting the second concatenated text into a generative model so that the model parameters of the generative model adopt a second value; performing aspect sentiment analysis on the transformed text in the second concatenated text to obtain the aspect sentiment analysis result of the transformed text, wherein the second value corresponds to the second control keyword.

[0108] In one embodiment of this application, the conversion module 502 is specifically used to: input the original comment text into a pre-trained text conversion model, so as to convert the original comment text through the text conversion model to obtain the converted text of the original comment text.

[0109] In one embodiment of this application, the aspect sentiment analysis module 503 is specifically used to: input the converted text into a pre-trained aspect sentiment analysis model, so as to perform aspect sentiment analysis on the converted text through the aspect sentiment analysis model and obtain the aspect sentiment analysis result of the converted text.

[0110] It should be noted that the explanations and descriptions in the aforementioned aspect sentiment analysis method embodiments also apply to the aspect sentiment analysis device of this embodiment, and will not be repeated here.

[0111] The aspect sentiment analysis device of this application performs aspect sentiment analysis on the original comment text by converting the original comment text to remove redundant information unrelated to aspect sentiment analysis, and then performs aspect sentiment analysis on the converted text. This avoids the influence of other emotions in the redundant information on aspect sentiment analysis and improves the accuracy of aspect sentiment analysis results.

[0112] Figure 6 This is a schematic diagram of the structure of the training device for the generative model provided in Embodiment Six of this application.

[0113] like Figure 6 As shown, the training device 600 for the generative model may include an acquisition module 601, a reconstruction module 602, a transformation module 603, an aspect sentiment analysis module 604, and a model parameter adjustment module 605, wherein:

[0114] The acquisition module 601 is used to acquire the aspect sentiment analysis sample results and the corresponding original text.

[0115] The reconstruction module 602 is used to input the aspect sentiment analysis sample results and the preset initial control keywords into the initial generative model, so that the model parameters of the initial generative model are reconstructed using the first initial value to obtain the reconstructed text, wherein the first initial value corresponds to the initial control keyword.

[0116] The conversion module 603 is used to input the original text and the preset first control keyword into the initial generative model so that the model parameters of the initial generative model adopt the second initial value, and to convert the original text to obtain the converted predicted text, wherein the second initial value corresponds to the first control keyword.

[0117] The aspect sentiment analysis module 604 is used to input the reconstructed text and the preset second control keyword into the initial generative model so that the model parameters of the initial generative model adopt the third initial value, and to perform aspect sentiment analysis on the reconstructed text to obtain the aspect sentiment analysis prediction result, wherein the third initial value corresponds to the second control keyword.

[0118] The model parameter adjustment module 605 is used to adjust the first initial value, the second initial value, and the third initial value based on the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results to achieve training.

[0119] It should be noted that the explanations in the aforementioned examples of the generative model training method also apply to the training apparatus of the generative model in this example, and will not be repeated here.

[0120] The generative model training method proposed in this application reconstructs aspect sentiment analysis sample results using a generative model to obtain reconstructed text. Based on the reconstructed text and aspect sentiment analysis sample results, the model parameters corresponding to the three stages of the generative model are trained to obtain a trained generative model. Thus, a multi-functional generative model is trained, facilitating subsequent text conversion and aspect sentiment analysis based on the same generative model.

[0121] To implement the above embodiments, this application also proposes an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the aspect sentiment analysis method proposed in any of the foregoing embodiments of this application, or the generative model training method proposed in any of the foregoing embodiments of this application.

[0122] Among them, the electronic device can be a personal computer (PC), cloud device, mobile device, server, etc. The mobile device can be any hardware device such as mobile phone, tablet computer, personal digital assistant, wearable device, vehicle device, etc. This application does not limit it.

[0123] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the aspect sentiment analysis method proposed in any of the foregoing embodiments of this application, or the generative model training method proposed in any of the foregoing embodiments of this application.

[0124] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the aspect sentiment analysis method proposed in any of the foregoing embodiments of this application, or the generative model training method proposed in any of the foregoing embodiments of this application.

[0125] Figure 7 A schematic block diagram of an example electronic device 1000 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0126] like Figure 7 As shown, the electronic device 1000 may include a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. The RAM 1003 may also store various programs and data required for the operation of the device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0127] Multiple components in device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of monitors, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0128] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as aspect sentiment analysis methods. For example, in some embodiments, the aspect sentiment analysis method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the aspect sentiment analysis method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform aspect-based sentiment analysis methods by any other suitable means (e.g., by means of firmware).

[0129] In other exemplary embodiments, computing unit 1001 performs the various methods and processes described above, such as generative model training methods. For example, in some embodiments, the generative model training method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by computing unit 1001, one or more steps of the generative model training method described above may be performed. Alternatively, in other embodiments, computing unit 1001 may be configured to perform generative model training methods by any other suitable means (e.g., by means of firmware).

[0130] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0131] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0132] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0133] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0134] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0135] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. A server can be a cloud server, a server in a distributed system, or a server incorporating blockchain technology.

[0136] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0137] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.< / tag> < / string> < / string> < / string> < / string> < / tag> < / string> < / tag> < / string> < / tag> < / string> < / tag> < / string> < / tag> < / string> < / tag> < / tag> < / string> < / tag> < / string> < / tag> < / string> < / string> < / string> < / string> < / string> < / string> < / string> < / string> < / string>

Claims

1. A method for aspect sentiment analysis of comment text, characterized in that, The method includes: Get the original comment text; The original comment text is transformed to obtain the transformed text of the original comment text, wherein the transformed text only includes the text fragments required for aspect sentiment analysis of the original comment text; Aspect sentiment analysis is performed on the converted text to obtain the aspect sentiment analysis results of the converted text; The process of converting the original comment text to obtain the converted text includes: Retrieve the preset first control keyword; The original comment text and the first control keyword are concatenated to obtain the first concatenated text; The first concatenated text is input into a pre-trained generative model so that the model parameters of the generative model take a first value, and the original comment text in the first concatenated text is transformed to obtain the transformed text of the original comment text, wherein the first value corresponds to the first control keyword; The generative model is obtained by acquiring aspect sentiment analysis sample results and the corresponding original text. The aspect sentiment analysis sample results and preset initial control keywords are input into the initial generative model so that the model parameters of the initial generative model adopt the first initial value, and the aspect sentiment analysis sample results are reconstructed to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; The original text and the preset first control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the second initial value, and the original text is transformed to obtain the transformed predicted text, wherein the second initial value corresponds to the first control keyword; The reconstructed text and the preset second control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the third initial value, and aspect sentiment analysis is performed on the reconstructed text to obtain the aspect sentiment analysis prediction result, wherein the third initial value corresponds to the second control keyword; Based on the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results, the first initial value, the second initial value, and the third initial value are adjusted to achieve training.

2. The method as described in claim 1, characterized in that, The step of performing aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis results of the converted text includes: Retrieve the preset second control keyword; The second control keyword and the converted text are concatenated to obtain the second concatenated text; The second concatenated text is input into the generative model so that the model parameters of the generative model adopt the second value. Aspect sentiment analysis is performed on the transformed text in the second concatenated text to obtain the aspect sentiment analysis result of the transformed text, wherein the second value corresponds to the second control keyword.

3. The method as described in claim 1, characterized in that, The process of converting the original comment text to obtain the converted text includes: The original comment text is input into a pre-trained text conversion model to convert the original comment text into the converted text.

4. The method as described in claim 1, characterized in that, The step of performing aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis results of the converted text includes: The converted text is input into a pre-trained aspect sentiment analysis model to perform aspect sentiment analysis on the converted text, thereby obtaining the aspect sentiment analysis results of the converted text.

5. A method for training a generative model, characterized in that, The method includes: Obtain sentiment analysis sample results and corresponding original text; The aspect sentiment analysis sample results and preset initial control keywords are input into the initial generative model so that the model parameters of the initial generative model adopt the first initial value, and the aspect sentiment analysis sample results are reconstructed to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; The original text and the preset first control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the second initial value, and the original text is transformed to obtain the transformed predicted text, wherein the second initial value corresponds to the first control keyword; The reconstructed text and the preset second control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the third initial value, and aspect sentiment analysis is performed on the reconstructed text to obtain the aspect sentiment analysis prediction result, wherein the third initial value corresponds to the second control keyword; Based on the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results, the first initial value, the second initial value, and the third initial value are adjusted to achieve training.

6. A sentiment analysis device for comment text, characterized in that, The device includes: The retrieval module is used to retrieve the original comment text; A conversion module is used to convert the original comment text to obtain a converted text of the original comment text, wherein the converted text only includes the text fragments required for aspect sentiment analysis of the original comment text; An aspect sentiment analysis module is used to perform aspect sentiment analysis on the converted text to obtain the aspect sentiment analysis results of the converted text. The conversion module is specifically used for: Retrieve the preset first control keyword; The original comment text and the first control keyword are concatenated to obtain the first concatenated text; The first concatenated text is input into a pre-trained generative model so that the model parameters of the generative model take a first value, and the original comment text in the first concatenated text is transformed to obtain the transformed text of the original comment text, wherein the first value corresponds to the first control keyword; The generative model is obtained by acquiring aspect sentiment analysis sample results and the corresponding original text. The aspect sentiment analysis sample results and preset initial control keywords are input into the initial generative model so that the model parameters of the initial generative model adopt the first initial value, and the aspect sentiment analysis sample results are reconstructed to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; The original text and the preset first control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the second initial value, and the original text is transformed to obtain the transformed predicted text, wherein the second initial value corresponds to the first control keyword; The reconstructed text and the preset second control keyword are input into the initial generative model so that the model parameters of the initial generative model adopt the third initial value, and aspect sentiment analysis is performed on the reconstructed text to obtain the aspect sentiment analysis prediction result, wherein the third initial value corresponds to the second control keyword; Based on the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results, the first initial value, the second initial value, and the third initial value are adjusted to achieve training.

7. The apparatus as claimed in claim 6, characterized in that, The aforementioned sentiment analysis module is specifically used for: Retrieve the preset second control keyword; The second control keyword and the converted text are concatenated to obtain the second concatenated text; The second concatenated text is input into the generative model so that the model parameters of the generative model adopt the second value. Aspect sentiment analysis is performed on the transformed text in the second concatenated text to obtain the aspect sentiment analysis result of the transformed text, wherein the second value corresponds to the second control keyword.

8. The apparatus as claimed in claim 6, characterized in that, The conversion module is specifically used for: The original comment text is input into a pre-trained text conversion model to convert the original comment text into the converted text.

9. The apparatus as claimed in claim 6, characterized in that, The aforementioned sentiment analysis module is specifically used for: The converted text is input into a pre-trained aspect sentiment analysis model to perform aspect sentiment analysis on the converted text, thereby obtaining the aspect sentiment analysis results of the converted text.

10. A training device for a generative model, characterized in that, The device includes: The acquisition module is used to acquire aspect sentiment analysis sample results and the corresponding original text; The reconstruction module is used to input the aspect sentiment analysis sample results and preset initial control keywords into an initial generative model, so that the model parameters of the initial generative model are reconstructed using a first initial value to obtain reconstructed text, wherein the first initial value corresponds to the initial control keyword; The conversion module is used to input the original text and the preset first control keyword into the initial generative model, so that the model parameters of the initial generative model adopt the second initial value, and to convert the original text to obtain the converted predicted text, wherein the second initial value corresponds to the first control keyword; An aspect sentiment analysis module is used to input the reconstructed text and a preset second control keyword into the initial generative model, so that the model parameters of the initial generative model adopt a third initial value, and to perform aspect sentiment analysis on the reconstructed text to obtain aspect sentiment analysis prediction results, wherein the third initial value corresponds to the second control keyword; The model parameter adjustment module is used to adjust the first initial value, the second initial value, and the third initial value based on the aspect sentiment analysis prediction results and the aspect sentiment analysis sample results, so as to achieve training.

11. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4, or the method of claim 5.

12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method of any one of claims 1-4, or the method of claim 5.

Citation Information

Patent Citations

  • Context feature fused aspect-level sentiment classification method and device

    CN111581966A