Method, apparatus and device for constructing entity recognition and sentiment analysis models
By constructing entity recognition and sentiment analysis models, and using pre-trained language models to fine-tune training, the problem of difficult to identify relevant entities and their sentiment analysis in the Internet network information in the prior art is solved, and high-precision entity recognition and sentiment analysis, as well as emotion prediction functions are realized.
Patent Information
- Application Number
- CN202510227813.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-02-28
AI Technical Summary
The prior art is difficult to effectively identify relevant entities and their sentiment analysis in Internet network information, resulting in low recognition accuracy and weak generalization ability, and the inability to capture deep emotional dimensions and intensity.
By obtaining multi-source network information of different topics, processing is carried out for different stages of each topic, determining entity names, types and emotions, and constructing sample data sets, fine-tuning training is used for pre-training language models to obtain entity recognition and sentiment analysis models.
Accurate identification of entities in network information and multi-dimensional fine-grained sentiment analysis can predict emotional changes in entities in the next stage, improving the accuracy and generalization ability of sentiment analysis.
Smart Images

Figure CN119721041B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of Internet data processing, and particularly to a technology for constructing an entity recognition and sentiment analysis model. Background Art
[0002] In the era of Internet information explosion, a vast amount of network information contains rich user sentiment data, which has important reference value for governments, enterprises, media, etc. to understand public sentiment, policy effects, market trends, etc.
[0003] In the prior art, traditional sentiment analysis methods based on rules, dictionaries, or shallow machine learning often face problems such as low recognition accuracy, weak generalization ability, and inability to capture deep sentiment dimensions and intensities when dealing with complex and unstructured network information. In particular, network information on the same topic (such as an event / topic / phenomenon) usually involves multiple entities, while traditional methods often do not distinguish entities and can only perform overall analysis on network information, resulting in analysis results that cannot distinguish the sentiment states of different entities and are also difficult to meet actual needs in terms of quantification, accuracy, and granularity of entity sentiment analysis.
[0004] Therefore, how to identify relevant entities based on network information obtained from the Internet and analyze entity sentiment has become an urgent problem to be solved. Summary of the Invention
[0005] The purpose of this application is to provide a method, device, and equipment for constructing an entity recognition and sentiment analysis model to at least partially solve the technical problem in the prior art that it is difficult to identify relevant entities and their sentiment analysis based on network information.
[0006] According to one aspect of this application, a method for constructing an entity recognition and sentiment analysis model is provided, wherein the method includes:
[0007] Obtain multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine the first network information corresponding to different stages of the topic;
[0008] Based on the first network information corresponding to different stages of each topic, determine the entity names and types involved, and the sentiment of the entity, and form a sample data by combining the first network information with the entity names and types and the sentiment of the entity. Traverse each stage of each topic, and use the obtained several sample data as the first data set;
[0009] Based on the first data set and a first preset prompt template, train a pre-trained language model, and verify the trained pre-trained language model to obtain an entity recognition and sentiment analysis model.
[0010] Optionally, the method further includes:
[0011] Determine the corresponding key progress type based on the first network information corresponding to different stages of each theme;
[0012] Input the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model to obtain the entity recognition and sentiment analysis results of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis results as the second network information corresponding to the stage where the theme is located;
[0013] Form a sample data with the second network information, the stage where it is located, and the key progress type, traverse each stage of each theme, and use the obtained several sample data as the second data set;
[0014] Train the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model.
[0015] Optionally, wherein the training of the pre-trained language model based on the first data set and the first preset prompt template, and the verification of the trained pre-trained language model to obtain an entity recognition and sentiment analysis model includes:
[0016] Train the pre-trained language model based on the first data set and the first preset prompt template, and verify the trained pre-trained language model to obtain multiple entity recognition and sentiment analysis models;
[0017] Wherein, the inputting the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model to obtain the entity recognition and sentiment analysis results of the first network information, and using the first network information and its corresponding entity recognition and sentiment analysis results as the second network information corresponding to the stage where the theme is located includes:
[0018] Input the first network information corresponding to different stages of each theme into each entity recognition and sentiment analysis model respectively to obtain entity recognition and sentiment analysis results of multiple pieces of the first network information;
[0019] Determine the final entity recognition and sentiment analysis results of the first network information based on the entity recognition and sentiment analysis results of multiple pieces of the first network information;
[0020] Use the first network information and its corresponding final entity recognition and sentiment analysis results as the second network information corresponding to the stage where the theme is located;
[0021] Among them, training the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verifying the trained entity recognition and sentiment analysis model to obtain the entity sentiment prediction model includes:
[0022] Based on the second data set and the second preset prompt template, training one entity recognition and sentiment analysis model among the multiple entity recognition and sentiment analysis models, and verifying the trained entity recognition and sentiment analysis model to obtain the entity sentiment prediction model.
[0023] Optionally, among them, determining the final entity recognition and sentiment analysis result of the first network information includes:
[0024] Processing the entity recognition and sentiment analysis results of the multiple first network information by using a voting mechanism to determine the final entity recognition and sentiment analysis result of the first network information.
[0025] Optionally, the method further includes:
[0026] Inputting the obtained network information to be predicted into the entity sentiment prediction model to output the entity corresponding to the network information to be predicted, the stage where it is located, the type of key progress, as well as the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
[0027] Optionally, the method further includes:
[0028] Performing data structuring processing on the output of the entity sentiment prediction model to save and / or visually display the output after data structuring.
[0029] According to another aspect of the present application, there is provided an apparatus for constructing an entity recognition and sentiment analysis model, where the apparatus includes:
[0030] A first module, configured to obtain multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine the first network information corresponding to different stages of the topic;
[0031] A second module, configured to determine the entity names and types involved and the sentiment of the entity based on the first network information corresponding to different stages of each topic, and form a sample data by combining the first network information with the entity names and types and the sentiment of the entity. Traverse each stage of each topic and use the obtained several sample data as the first data set;
[0032] A third module, configured to train a pre-trained language model based on the first data set and the first preset prompt template, and verify the trained pre-trained language model to obtain the entity recognition and sentiment analysis model.
[0033] Optionally, the device further includes:
[0034] A fourth module, configured to determine a corresponding key progress type based on the first network information corresponding to different stages of each theme;
[0035] A fifth module, configured to input the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model, obtain the entity recognition and sentiment analysis result of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis result as the second network information corresponding to the stage where the theme is located;
[0036] A sixth module, configured to form a sample data by combining the second network information, the stage where it is located, and the key progress type, traverse each stage of each theme, and use the obtained several sample data as a second data set;
[0037] A seventh module, configured to train the entity recognition and sentiment analysis model based on the second data set and a second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model.
[0038] Optionally, the device further includes:
[0039] An eighth module, configured to input the obtained network information to be predicted into the entity sentiment prediction model to output the entity corresponding to the network information to be predicted that is recognized, the stage where it is located, the key progress type, as well as the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
[0040] Optionally, the device further includes:
[0041] A ninth module, configured to perform data structuring processing on the output of the entity sentiment prediction model to save and / or visually display the output after data structuring.
[0042] Compared with the prior art, the present application provides a method, apparatus, and device for constructing an entity recognition and sentiment analysis model. The method includes: obtaining multi-source network information of different topics, and for each topic, processing the multi-source network information according to different stages of the topic to determine first network information corresponding to different stages of the topic; based on the first network information corresponding to different stages of each topic, determining the entity names and types involved, and the sentiment of the entity, and combining the first network information with the entity names and types and the sentiment of the entity to form a sample data, traversing each stage of each topic, and using the obtained several sample data as a first data set; training a pre-trained language model based on the first data set and a first preset prompt template, and validating the trained pre-trained language model to obtain an entity recognition and sentiment analysis model. Further, the method further includes: determining a corresponding key progress type based on the first network information corresponding to different stages of each topic; inputting the first network information corresponding to different stages of each topic into the entity recognition and sentiment analysis model to obtain the entity recognition and sentiment analysis result of the first network information, and using the first network information and its corresponding entity recognition and sentiment analysis result as the second network information corresponding to the stage where the topic is located; combining the second network information, the stage where it is located, and the key progress type to form a sample data, traversing each stage of each topic, and using the obtained several sample data as a second data set; training the entity recognition and sentiment analysis model based on the second data set and a second preset prompt template, and validating the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model. Through this method, a model can be constructed to identify different entities involved in the network information of a certain topic and perform multi-dimensional and fine-grained analysis of the entity sentiment at the current stage. A model can also be constructed to predict the entity sentiment in the next stage in combination with relevant key progress types. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Other features, objects, and advantages of the present invention will become more apparent by reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0044] Figure 1 FIG. shows a schematic flowchart of a method for constructing an entity recognition and sentiment analysis model according to an aspect of the present application;
[0045] Figure 2 FIG. shows a schematic diagram of an apparatus for constructing an entity recognition and sentiment analysis model according to another aspect of the present application;
[0046] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] The present invention will be further described in detail below with reference to the accompanying drawings.
[0048] In a typical configuration of each embodiment of the present application, each trusted party of the device, system, and / or each module of the device may include one or more processors (CPUs), input / output interfaces, network interfaces, and memories.
[0049] The memory may include non - permanent memory in the computer - readable medium, in the form of random access memory (RAM) and / or non - volatile memory, such as read - only memory (ROM) or flash RAM. The memory is an example of a computer - readable medium.
[0050] Computer - readable media includes permanent and non - permanent, removable and non - removable media, and information storage can be implemented by any method or technology. The information can be computer - readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase - change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read - only memory (ROM), electrically erasable programmable read - only memory (EEPROM), flash memory or other memory technologies, compact disc read - only memory (CD - ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non - transitory medium that can be used to store information accessible by a computing device. As defined herein, computer - readable media does not include transitory media, such as modulated data signals and carrier waves.
[0051] The present application provides a method, device, and equipment for constructing an entity recognition and sentiment analysis model. A first data set and a preset first prompt template are constructed, and the existing pre - trained large - language model is fine - tuned to obtain an entity recognition and sentiment analysis model for entity recognition and sentiment analysis tasks of network information, identifying the entity recognition corresponding to the network information and multi - dimensional fine - grained sentiment analysis. A second data set can also be constructed according to the first data set and the entity recognition and sentiment analysis model, and the entity recognition and sentiment analysis model is fine - tuned according to the constructed second data set and a preset second prompt template to obtain an entity sentiment prediction model, which can be used for multi - dimensional fine - grained sentiment prediction of the sentiment of the entity corresponding to real - time network information in the next stage. The output sentiment analysis results and sentiment prediction results can also be visually displayed.
[0052] To further elaborate on the technical means adopted in this application and the achieved effects, the following clearly and completely describes the technical solutions of this application in combination with the accompanying drawings and preferred embodiments.
[0053] Figure 1 A schematic flowchart of a method for constructing an entity recognition and sentiment analysis model according to an aspect of this application is shown. Among them, the method of one embodiment includes:
[0054] S101 Obtain multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine the first network information corresponding to different stages of the topic;
[0055] S102 Based on the first network information corresponding to different stages of each topic, determine the entity names and types involved, and the sentiment of the entity, and form a sample data by combining the first network information with the entity names and types and the sentiment of the entity. Traverse each stage of each topic, and use the obtained several sample data as the first data set;
[0056] S103 Train a pre-trained language model based on the first data set and a first preset prompt template, and verify the trained pre-trained language model to obtain an entity recognition and sentiment analysis model.
[0057] In this application, each method embodiment / optional embodiment can be implemented or executed by device 100. Among them, device 100 is a computer device with corresponding software and hardware environments. Among them, the computer device includes but is not limited to personal computers, laptop computers, industrial computers, servers, network hosts, single network servers or network server clusters. Here, the computer device is only an example, and other existing or future possible devices and / or resource platforms applicable to this application should also be included in the protection scope of this application. Here, it is included by reference.
[0058] In this embodiment, in step S101, device 100 can obtain multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine the first network information corresponding to different stages of the topic.
[0059] Among them, for historical themes, multi-source network information on different themes can be collected from the Internet. Among them, different themes can include representative events, topics or social phenomena in different fields / industries, so as to cover entity types such as enterprises, social institutions, brands, figures, industries, public policies, laws and regulations, and social phenomena. Multi-source network information related to relevant themes can be collected from the Internet based on methods such as combined keywords. For example, multi-source network information related to themes such as enterprise mergers and acquisitions, brand new product launches, public policy releases, and social hot events. Among them, the sources of network information can cover search engines, news websites, social media platforms, forums, blogs, etc. The network information collected from different sources on the Internet includes text information, and can also include multimedia information such as pictures and videos. If it is multimedia information, it needs to be converted into text information first before it can be used for subsequent screening. For each theme, according to different stages of the theme, the first network information corresponding to different stages of the theme is screened out from the collected multi-source network information. Among them, the first network information is text information that has been vectorized. In the Internet, the life cycle of a theme can usually be divided into multiple different stages, which can include the latency period, the rising period, the outbreak period, the decline period, and some themes may also include the rebound period. Among them, each stage corresponds to a piece of first network information, and each piece of first network information can include the basic information and the main comment information of a stage related to the theme. Among them, the basic information can include: the theme name, the content mainly reported by the media in this stage, etc. Among the content mainly reported by the media, information such as the name of the key progress related to the theme and the content of the key progress is included, and the type of key progress can be determined according to the basic information.
[0060] Continuing in this embodiment, in step S102, the device 100 can determine the entity names and types involved, and the sentiment of the entity based on the first network information corresponding to different stages of each theme, and form a sample data by combining the first network information with the entity names and types and the sentiment of the entity. Traverse each stage of each theme, and use the obtained several sample data as the first data set.
[0061] Among them, through device 100, based on the first network information corresponding to different stages of each theme, several entity names and types involved in the first network information can be determined, as well as the multi-dimensional fine-grained sentiment of each entity, which may include the sentiment polarity, sentiment dimension, and sentiment intensity of the entity. Among them, the sentiment polarity can be divided into three categories: positive, neutral, and negative; the sentiment dimension can be divided into seven categories: joy, surprise, fear, sadness, disgust, anger, and neutral; the sentiment intensity can be divided using a five-level scale (strong, relatively strong, medium, relatively weak, weak). And the determined several entity names and types, as well as the multi-dimensional sentiment of each entity, are combined with the first network information to form a sample data. Traverse each network information corresponding to each stage of each theme determined in step S101, and use the obtained several sample data as the first data set.
[0062] Continuing in this embodiment, in step S103, device 100 can train a pre-trained language model based on the first data set and a first preset prompt template, and verify the trained pre-trained language model to obtain an entity recognition and sentiment analysis model.
[0063] Among them, considering that the language model pre-trained through large-scale unsupervised learning has context understanding ability, entity recognition ability, and sentiment analysis ability, it can be fine-tuned according to specific tasks in the actual application scenario. In this application, based on the pre-trained language model, for the entity recognition and sentiment analysis task of this application, a prompt template is designed according to the fine-tuning strategy, and the selected pre-trained language model is supervised trained to further improve the performance of the model on specific tasks.
[0064] Among them, an existing pre-trained language model can be selected as the model to be fine-tuned. For example, existing pre-trained language models such as Wenxin Yiyan, Tongyi Qianwen, T5, and Shusheng·Puyu can be selected. According to the task requirements of entity recognition and sentiment analysis in this application, a first preset prompt template can be designed to guide the selected pre-trained language model to complete the entity recognition and sentiment analysis task by inserting prompt words and / or constructing specific sentence patterns. An exemplary first preset prompt template is as follows:
[0065] Prompt:
[0066] "Task background: As a public opinion analyst, conduct in-depth analysis of the online public opinion related to an event. It is necessary to identify the main entities involved in the theme, judge the entity types, and describe the sentiment polarity, dimension, and intensity of each entity included therein based on the basic information of the provided theme and relevant comments.
[0067] Task description: Sentiment polarity is divided into three categories: positive, negative, and neutral. The sentiment dimension is divided into seven categories: joy, surprise, fear, sadness, disgust, anger, and neutral. The sentiment intensity is analyzed according to a five-level scale.
[0068] Input information: The topic name and its network information (basic information and comments), identify the main entities in the network information at the current stage and analyze the corresponding sentiment.
[0069] Output result: In the form of "Entity 1 name (entity type) - sentiment polarity, sentiment dimension, sentiment intensity; Entity 2 name (entity type) - sentiment polarity, sentiment dimension, sentiment intensity; Entity 3 name (entity type) - sentiment polarity, sentiment dimension, sentiment intensity..."
[0070] Among them, the first dataset can be divided into a first training dataset and a first validation dataset. Using the first training dataset and the first preset prompt template, fine-tuning training is performed on the selected model to be fine-tuned.
[0071] Before performing fine-tuning training, first, a cross-entropy loss function can be selected to measure the training effect. Among them, the calculation of the cross-entropy loss function can adopt the following formula (1),
[0072]
[0073] Among them, P is the model input, and X is the model output. represents the probability distribution of obtaining output X and X being the true value when the input P is given, and can be obtained according to formula (2),
[0074] (2)
[0075] Among them, i represents the i-th output in X. is the previous output.
[0076] Secondly, in the fine-tuning training of the pre-trained language model, hyperparameters such as the training batch size, the number of training iterations, the longest sequence length, and the learning rate have a direct impact on the training effect and efficiency of the model. Reasonable hyperparameters such as the batch size, the number of iterations, the longest sequence length, the learning rate, and the early stopping condition can be set, and a suitable optimizer can be selected, such as the AdamW optimizer based on weight decay. An exemplary partial hyperparameter configuration is shown in Table 1 below.
[0077] Table 1
[0078]
[0079] Among them, after each fine-tuning training of the selected model to be fine-tuned, the trained model to be fine-tuned can be verified using the first validation dataset. At least one of the metrics such as accuracy, precision, recall, and F1 score can be used to evaluate in combination with the requirements of the actual application scenario. If the metric value of the trained model to be fine-tuned for the first validation dataset meets the preset threshold, the trained model to be fine-tuned meets the requirements and can be used as the entity recognition and sentiment analysis model of this application. If the metric value of the trained model to be fine-tuned for the first validation dataset does not meet the preset threshold, the relevant hyperparameters, fine-tuning strategies (i.e., modifying the first preset indication template), and / or the training process can be adjusted in combination with the verification results (for example, adding DPO (Direct Preference Optimization) learning, interactive learning, etc.). Continuously iterate training and verification until the verification result of the trained model to be fine-tuned meets the requirements, thereby obtaining the entity recognition and sentiment analysis model of this application.
[0080] Optionally, the method for constructing an entity recognition and sentiment analysis model further includes:
[0081] S104 Determine the corresponding key progress type based on the first network information corresponding to different stages of each theme;
[0082] S105 Input the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model to obtain the entity recognition and sentiment analysis result of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis result as the second network information corresponding to the stage where the theme is located;
[0083] S106 Combine the second network information, the stage where it is located, and the key progress type into a sample data, traverse each stage of each theme, and use the obtained several sample data as the second dataset;
[0084] S107 Train the entity recognition and sentiment analysis model based on the second dataset and the second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model.
[0085] Among them, in step S104, the device 100 can also determine the key progress type corresponding to the first network information according to the first network information corresponding to different stages of each theme. Among them, the key progress type can be preset and can include exposure, news release, official statement, in-depth investigation, liability determination, legal litigation and judgment, handling and accountability, victim compensation, policy change, comprehensive rectification, etc.
[0086] Among them, a historical theme different from that in the foregoing step S101 may be reselected, multi-source network information of each theme is collected from the Internet, and then for each theme, according to different stages of the theme, first network information corresponding to different stages of the theme is filtered out from the collected multi-source network information. Then, the key progress type corresponding to the first network information is determined.
[0087] Continuing with this alternative embodiment, in step S105, the device 100 may input the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model obtained through step S103, obtain the entity recognition and sentiment analysis result of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis result as the second network information corresponding to the stage where the theme is located.
[0088] Among them, the device 100 may input the first network information corresponding to different stages of each theme into the entity recognition and sentiment analysis model obtained in the foregoing step S103, and output the entity recognition and sentiment analysis result related to the first network information in the format of the first preset prompt template, that is, the main entity and its type, as well as the sentiment polarity, sentiment dimension, and sentiment intensity of each entity.
[0089] Among them, the entity recognition and sentiment analysis model may output the entity recognition and sentiment analysis result according to a preset structure and store it in a data-structured form. For example, it is stored in the form of CSV, JSON, or a database for subsequent use. Among them, the data-structured form may be that each row of data represents the analysis result of an entity corresponding to a stage where a theme is located, and may include data corresponding to fields such as entity name, entity type, sentiment polarity, sentiment dimension, and sentiment intensity.
[0090] Among them, the first network information and its corresponding entity recognition and sentiment analysis result are also used as the second network information corresponding to the stage where the theme is located. Among them, the second network information may include basic information related to the theme, main comment information, several entity names and their types corresponding to the stage where the theme is located, and the sentiment (polarity, dimension, and intensity) of each entity.
[0091] Continuing with this alternative embodiment, in step S106, the device 100 may form a sample data from the second network information, the stage where it is located, and the key progress type, traverse each stage of each theme, and use the obtained several sample data as the second data set.
[0092] Among them, through the device 100, the second network information corresponding to the stage where each theme is located, the stage where it is located, and the key progress type can also be combined into a sample data. Traverse each stage of each theme, and operate according to steps S104 to S106 to obtain a number of sample data, and use these obtained sample data as the second data set.
[0093] Continuing in this alternative embodiment, in step S107, the device 100 can train the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model.
[0094] Among them, the entity recognition and sentiment analysis model obtained in step S103 can be used as a basic model. For the sentiment prediction task of this application, according to the second preset prompt template designed according to the fine-tuning strategy, the basic model is supervised-trained to improve the performance of the model in the sentiment prediction task.
[0095] Among them, according to the task requirements of the sentiment prediction of this application, a second preset prompt template can be designed to guide the model to focus on the feature recognition of sentiment changes and the analysis of triggering factors when generating or completing the text, so that the trained basic model can complete the entity recognition, sentiment analysis, and prediction tasks. An exemplary second preset prompt template is as follows:
[0096] Prompt:
[0097] "Task background: As a public opinion analyst, conduct in-depth analysis and prediction on the online public opinion related to the theme. It is necessary to judge the current stage of the public opinion based on the basic information and comments of the given theme, and predict the main entities and their types, sentiment polarities, sentiment dimensions, and sentiment intensities involved in the online information after a certain key progress appears in the next stage.
[0098] Task description: Based on the given theme name and its online information (basic information and comments), analyze the current stage and current progress, and identify the main entities and their types involved in the theme. Considering the impact of the development of public opinion and possible progress on sentiment, analyze the factors that may trigger sentiment changes. Predict the possible progress that may occur in the next stage of the given theme, and further predict the sentiment polarities, dimensions, and intensities of the relevant entities.
[0099] Input information: Theme name and its online information (basic information and comments). Predict the main entities in the online information after a certain key progress appears in the next stage and analyze the corresponding sentiment.
[0100] Output result: Prediction result format: "In the next stage, if ** progress appears, the sentiment polarity, dimension, and intensity of entity 1, the sentiment polarity, dimension, and intensity of entity 2, the sentiment polarity, dimension, and intensity of entity 3."
[0101] Among them, the second data set can be divided into a second training data set and a second validation data set, and the basic model is fine-tuned using the second training data set and the second preset prompt template.
[0102] Among them, the same cross-entropy loss function as described above can be selected to measure the training effect. In the fine-tuning training of the basic model, relevant hyperparameters, optimizers, etc. can be set and selected according to the requirements of the actual application scenario, or the relevant settings and selections in step S103 above can be referred to.
[0103] Among them, after each fine-tuning training of the basic model, the second validation data set can be used to validate the trained basic model, and at least one of the indicators such as accuracy, precision, recall rate, and F1 score can be used to evaluate according to the requirements of the actual application scenario. If the indicator value of the trained basic model for the second validation data set meets the preset threshold, the trained basic model meets the requirements and can be used as the entity sentiment prediction model of this application. If the indicator value of the trained basic model for the second validation data set does not meet the preset threshold, the relevant hyperparameters, fine-tuning strategies (i.e., modifying the second preset indication template), and / or improving the training process (such as adding DPO learning, interactive learning, etc.) can be adjusted in combination with the verification results, and continuous iterative training and verification are carried out until the verification result of the trained basic model meets the requirements, so as to obtain the entity sentiment prediction model of this application.
[0104] The entity sentiment prediction model can be deployed according to the requirements of the actual application scenario. For example, it can be deployed to an opinion monitoring system or a social media analysis platform, and real-time network information related to popular topics can be collected from the Internet, and the entity names and their types corresponding to the current stage of the topic can be output, as well as the sentiment analysis results of each entity, including the sentiment polarity, sentiment dimension, and sentiment intensity of each entity, and the sentiment of each entity at the corresponding stage after entering a certain key progress can be predicted. Among them, the actual network information corresponding to the stage of the topic can also be collected regularly, the corresponding actual entities and their types, as well as the sentiment, can be determined, and compared with the model output results to regularly evaluate the prediction effect of the model. And new sample data can be sorted out according to the actual network information and added to the data set to maintain and update the model to further improve the performance of the model.
[0105] To improve the accuracy of the sentiment analysis results of entities, multiple entity recognition and sentiment analysis models can be trained. The same first network information is input into each entity recognition and sentiment analysis model, and multiple sentiment analysis results are output. Then, based on the multiple sentiment analysis results, the final sentiment analysis result corresponding to the network information is determined, so as to obtain the corresponding final entity recognition and sentiment analysis result. Then, the first network information and its corresponding final entity recognition and sentiment analysis result are used as the second network information corresponding to the stage where the theme is located, and a second data set is constructed.
[0106] Optionally, the step S103 includes:
[0107] Based on the first data set and the first preset prompt template, a pre-trained language model is trained, and the trained pre-trained language model is verified to obtain multiple entity recognition and sentiment analysis models;
[0108] The step S105 includes:
[0109] The first network information corresponding to different stages of each theme is respectively input into each entity recognition and sentiment analysis model to obtain the entity recognition and sentiment analysis results of the first network information;
[0110] Based on the entity recognition and sentiment analysis results of the first network information, the final entity recognition and sentiment analysis result of the first network information is determined;
[0111] The first network information and its corresponding final entity recognition and sentiment analysis result are used as the second network information corresponding to the stage where the theme is located;
[0112] The step S107 includes:
[0113] Based on the second data set and the second preset prompt template, one entity recognition and sentiment analysis model in the multiple entity recognition and sentiment analysis models is trained, and the trained entity recognition and sentiment analysis model is verified to obtain an entity sentiment prediction model.
[0114] Among them, in step S103, the device 100 can also divide the first data set into a number of training data sets and corresponding validation data sets according to the entity type, combine the first preset prompt template, train the selected pre-trained language model, and verify the trained pre-trained language model to obtain multiple entity recognition and sentiment analysis models. Among them, the same pre-trained language model can be selected and trained and verified using different training data sets and their corresponding validation data sets. Alternatively, pre-trained language models based on different algorithms or architectures can be selected. For example, BERT models, RoBERTa models, etc. based on Transformer. The training data sets and corresponding validation data sets for different entity types are used to train and verify different pre-trained language models. In this way, the obtained entity recognition and sentiment analysis models will focus on or be better at analyzing the sentiment of a certain type of entity. To obtain multiple entity recognition and sentiment analysis models with differences but complementarity, such as entity recognition and sentiment analysis models that focus on different entity types such as enterprises and institutions, or entity recognition and sentiment analysis models that are good at capturing syntactic features, semantic features or context dependencies.
[0115] Among them, for each pre-trained language model, the same cross-entropy loss function as described above can be selected to measure the training effect. In the fine-tuning training of each pre-trained language model, relevant hyperparameters, optimizers, etc. can be set and selected in combination with the requirements of the actual application scenario, or the relevant settings and selections in the aforementioned step S103 can be referred to.
[0116] Among them, several entity recognition and sentiment analysis models with complementary characteristics can be selected. In step S105, device 100 can first input the first network information corresponding to different stages of each topic into each entity recognition and sentiment analysis model respectively. Each entity recognition and sentiment analysis model outputs with reference to the format in the first preset prompt template, so as to obtain the entity recognition and sentiment analysis results of the first network information. Each entity recognition and sentiment analysis result includes the main entities related to the first network information and their types, as well as the sentiment polarity, sentiment dimension and sentiment intensity of each entity, which can be stored in a data-structured manner. For example, it can be stored in the form of CSV, JSON or database. Among them, the data-structured form can be that each row of data represents the analysis result of an entity corresponding to a stage of a topic, and can include data corresponding to fields such as entity name, entity type, sentiment polarity, sentiment dimension, sentiment intensity, etc. Then, the sentiment analysis results (sentiment polarity, sentiment dimension and sentiment intensity) of the same entity in the different entity recognition and sentiment analysis results corresponding to the first network information of the same topic at a certain stage can be summarized and processed to determine the final sentiment analysis result of the entity. By traversing each entity corresponding to the first network information of the topic at this stage, the final entity recognition and sentiment analysis result corresponding to the first network information of the topic at this stage can be determined. Finally, the first network information and its corresponding final entity recognition and sentiment analysis result are used as the second network information corresponding to the stage of the topic to construct a second data set. Among them, the second network information includes basic information, main comment information, relevant entity names and their types, and the sentiment analysis results (sentiment polarity, sentiment dimension and sentiment intensity) corresponding to each entity.
[0117] Among them, one that best meets the requirements of the actual application scenario can be selected from multiple entity recognition and sentiment analysis models as the base model for subsequent further fine-tuning training. In step S107, device 100 can train the base model according to the second data set and the second preset prompt template, and verify the trained base model to obtain an entity sentiment prediction model. Among them, the second data set can be divided into a second training data set and a second validation data set, and the base model can be fine-tuned and trained using the second training data set and the second preset prompt template. Among them, the same cross-entropy loss function as described above can be selected to measure the training effect. In the fine-tuning training of the base model, relevant hyperparameters, optimizers, etc. can be set and selected in combination with the requirements of the actual application scenario, or the relevant settings and selections in step S103 above can be referred to. Among them, after each fine-tuning training of the base model, the second validation data set can be used to verify the trained base model, and at least one of the indicators such as accuracy, precision, recall, and F1 score can be used to evaluate in combination with the requirements of the actual application scenario. If the indicator value of the trained base model for the second validation data set meets the preset threshold, the trained base model meets the requirements and can be used as the entity sentiment prediction model of this application. If the indicator value of the trained base model for the second validation data set does not meet the preset threshold, the relevant hyperparameters, fine-tuning strategies (i.e., modifying the second preset indication template), and / or training processes (such as adding DPO learning, interactive learning, etc.) can be adjusted in combination with the verification results, and continuous iterative training and verification can be performed until the verification result of the trained base model meets the requirements to obtain an entity sentiment prediction model. This entity sentiment prediction model can be deployed according to the requirements of the actual application scenario, such as being deployed to a public opinion monitoring system or a social media analysis platform.
[0118] Optionally, among them, determining the final entity recognition and sentiment analysis result of the first network information based on the entity recognition and sentiment analysis results of the multiple first network information includes:
[0119] Processing the entity recognition and sentiment analysis results of the multiple first network information using a voting mechanism to determine the final entity recognition and sentiment analysis result of the first network information.
[0120] Among them, a voting mechanism can be adopted to summarize and process the sentiment analysis results (sentiment polarity, sentiment dimension, and sentiment intensity) of the same entity in the recognition and sentiment analysis results of different entities corresponding to the first network information of the same theme at a certain stage. If the sentiment polarities of a certain entity output by more than a preset quantity or ratio (for example, more than half) of the models are the same, assuming positive, it can be considered that the sentiment polarity of the entity at the stage of the theme is positive, and it can be determined that the final sentiment polarity of the entity at the stage of the theme is positive. The final sentiment dimension and final sentiment intensity of the entity at the stage of the theme can be determined in the same way, so as to determine the final sentiment analysis result of the entity at the stage of the theme. By traversing each entity corresponding to the first network information of the theme at this stage, the final entity recognition and sentiment analysis result corresponding to the first network information of the theme at this stage can be determined, including each relevant entity and its type identified, as well as the sentiment analysis result (sentiment polarity, sentiment dimension, and sentiment intensity) of each entity.
[0121] Optionally, the method for constructing an entity recognition and sentiment analysis model further includes:
[0122] S108 Input the obtained network information to be predicted into the entity sentiment prediction model to output the entity, the stage, the type of key progress corresponding to the network information to be predicted identified, as well as the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
[0123] Among them, device 100 can collect real-time multi-source network information of relevant themes from the network, determine the network information to be predicted of the theme, input it into the deployed entity sentiment prediction model, output the entity names and their types, the stages, and the sentiment analysis results (sentiment polarity, sentiment dimension, and sentiment intensity) of each entity corresponding to the network information to be predicted, and can also input the key progress information into the deployed entity sentiment prediction model to output the sentiment (sentiment polarity, sentiment dimension, and sentiment intensity) of each entity in the theme predicted by the entity sentiment prediction model after the occurrence of the key progress.
[0124] Optionally, the method for constructing an entity recognition and sentiment analysis model further includes:
[0125] S109 Perform data structuring processing on the output of the entity sentiment prediction model to save and / or visually display the output after data structuring.
[0126] Among them, in order to facilitate the subsequent use of the output of the entity sentiment prediction model, the output of the entity sentiment prediction model can be subjected to data structuring processing for storage to improve data storage efficiency, and / or visually display the output to enhance data readability. It can also facilitate the users of the output to take targeted measures based on the output.
[0127] Among them, network information related to relevant topics can also be regularly collected to determine the corresponding actual entities, their types, and sentiment, and compare them with the model output results corresponding to the network information to regularly evaluate the prediction effect of the model. It can be sorted and marked and then supplemented into the dataset as new sample data to maintain and update the model, so as to further improve the entity recognition, sentiment analysis, and prediction performance of the model.
[0128] Figure 2 The schematic diagram of a device for constructing an entity recognition and sentiment analysis model according to another aspect of the present application is shown. Among them, the device in one embodiment includes:
[0129] The first module 210 is configured to obtain multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine the first network information corresponding to different stages of the topic.
[0130] The second module 220 is configured to determine the entity names and types involved, and the sentiment of the entity based on the first network information corresponding to different stages of each topic, and form a sample data by combining the first network information with the entity names and types, and the sentiment of the entity. Traverse each stage of each topic, and use the obtained several sample data as the first dataset.
[0131] The third module 230 is configured to train a pre-trained language model based on the first dataset and a first preset prompt template, and verify the trained pre-trained language model to obtain an entity recognition and sentiment analysis model.
[0132] In this embodiment, the device is deployed or integrated in the device 100 in the foregoing method embodiment and / or optional embodiment.
[0133] In this embodiment, through the first module 210 of the device, multi-source network information of different topics can be collected from the Internet for historical topics, and for each topic, the collected multi-source network information can be processed according to different stages of the topic, and the first network information corresponding to different stages of the topic can be screened out therefrom.
[0134] Continuing in this embodiment, through the second module 220 of the device, based on the first network information corresponding to different stages of each topic, several entity names and types involved in the first network information can be determined, as well as the multi-dimensional fine-grained sentiment of each entity, which may include the sentiment polarity, sentiment dimension, and sentiment intensity of the entity. And the determined several entity names and types, as well as the multi-dimensional sentiment of each entity, together with the first network information, form a sample data. Traverse each network information corresponding to each stage of each topic determined by the first module 210, and use the obtained several sample data as the first data set.
[0135] Continuing in this embodiment, through the third module 230 of the device, based on the first data set and the first preset prompt template, a pre-trained language model is trained, and the trained pre-trained language model is verified to obtain an entity recognition and sentiment analysis model. Among them, an existing pre-trained language model can be selected as the model to be fine-tuned, and the cross-entropy loss function is selected to measure the training effect. Among them, the first data set can be divided into a first training data set and a first verification data set. The selected model to be fine-tuned is fine-tuned using the first training data set and the first preset prompt template. After each fine-tuning training of the selected model to be fine-tuned, the first verification data set can be used to verify the trained model to be fine-tuned. If the metric value of the trained model to be fine-tuned for the first verification data set meets the preset threshold, the trained model to be fine-tuned meets the requirements and can be used as the entity recognition and sentiment analysis model of this application.
[0136] Optionally, the device for constructing an entity recognition and sentiment analysis model further includes:
[0137] A fourth module 240, configured to determine the corresponding key progress type based on the first network information corresponding to different stages of each topic;
[0138] A fifth module 250, configured to input the first network information corresponding to different stages of each topic into the entity recognition and sentiment analysis model, obtain the entity recognition and sentiment analysis result of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis result as the second network information corresponding to the stage where the topic is located;
[0139] A sixth module 260, configured to form a sample data by combining the second network information, the stage where it is located, and the key progress type, traverse each stage of each topic, and use the obtained several sample data as the second data set;
[0140] A seventh module 270, configured to train the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model.
[0141] In this alternative embodiment, through the fourth module 240 of the device, the key progress type corresponding to the first network information can also be determined according to the first network information corresponding to different stages of each theme. Among them, different historical themes different from those in the foregoing first module 210 can also be reselected, multi-source network information of each theme can be collected from the Internet, and then for each theme, according to different stages of the theme, the first network information corresponding to different stages of the theme can be screened out from the collected multi-source network information, and then the key progress type corresponding to the first network information can be determined.
[0142] Continuing in this alternative embodiment, through the fifth module 250 of the device, the first network information corresponding to different stages of each theme can be input into the entity recognition and sentiment analysis model obtained through the above-mentioned third module 230, and the entity recognition and sentiment analysis results related to the first network information can be output with reference to the format in the first preset prompt template, that is, the main entities and their types, as well as the sentiment polarity, sentiment dimension and sentiment intensity of each entity, and the first network information and its corresponding entity recognition and sentiment analysis results are used as the second network information corresponding to the stage where the theme is located.
[0143] Continuing in this alternative embodiment, through the sixth module 260 of the device, the second network information corresponding to the stage where each theme is located can be combined with the stage where the theme is located and the key progress type corresponding to the theme to form a sample data. Traverse each stage of each theme, and through the fourth module 240, the fifth module 250 and the sixth module 260, a number of sample data are obtained, and the obtained number of sample data is used as the second data set.
[0144] Continuing with this alternative embodiment, the entity recognition and sentiment analysis model obtained through the third module 230 can be used as a base model. Through the seventh module 270 of this device, based on the second data set and the second preset prompt template, the entity recognition and sentiment analysis model can be trained and the trained entity recognition and sentiment analysis model can be verified to obtain an entity sentiment prediction model. Among them, the second data set can be divided into a second training data set and a second validation data set, and the base model can be fine-tuned using the second training data set and the second preset prompt template. Among them, the same cross-entropy loss function as described above can be selected to measure the training effect. In the fine-tuning training of the base model, relevant hyperparameters, optimizers, etc. can be set and selected according to the requirements of the actual application scenario, or the relevant settings and selections in the third module 230 can be referred to. Among them, after each fine-tuning training of the base model, the second validation data set can be used to verify the trained base model, and at least one of the indicators such as accuracy, precision, recall rate, F1 score, etc. can be used to evaluate according to the requirements of the actual application scenario. If the indicator value of the trained base model for the second validation data set meets the preset threshold, the trained base model meets the requirements and can be used as the entity sentiment prediction model of this application.
[0145] Optionally, the device for constructing an entity recognition and sentiment analysis model further includes:
[0146] An eighth module 280, configured to input the obtained network information to be predicted into the entity sentiment prediction model, so as to output the entity corresponding to the network information to be predicted, the stage it is in, the type of key progress, as well as the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
[0147] In this alternative embodiment, through the eighth module 280 of this device, real-time multi-source network information related to the relevant topic can also be collected from the network, the network information to be predicted for this topic can be determined, input into the deployed entity sentiment prediction model, and the entity names and their types, the stages they are in, the sentiment analysis results (sentiment polarity, sentiment dimension, and sentiment intensity) of each entity corresponding to the network information to be predicted can be output. Additionally, the key progress information can be input into the deployed entity sentiment prediction model, and the entity sentiments (sentiment polarity, sentiment dimension, and sentiment intensity) predicted by the entity sentiment prediction model for each entity in this topic after the occurrence of this key progress can be output.
[0148] Optionally, the device for constructing an entity recognition and sentiment analysis model further includes:
[0149] A ninth module 290, configured to perform data structuring processing on the output of the entity sentiment prediction model, so as to save and / or visually display the output after data structuring.
[0150] In this alternative embodiment, to facilitate the subsequent use of the output of the entity sentiment prediction model, through the ninth module 290 of the device, the output of the entity sentiment prediction model can be processed to structure the data for storage, so as to improve the data storage efficiency, and / or visually display the output to enhance the data readability. It can also facilitate the users of the output to take targeted measures based on the output.
[0151] In each of the above-described embodiments and / or alternative embodiments of the device, the parts not mentioned in the method steps executed by each module are the same as those in the foregoing relevant method embodiments and / or alternative embodiments, and will not be elaborated herein.
[0152] According to another aspect of the present application, there is also provided a computer-readable medium storing computer-readable instructions that can be executed by a processor to implement the foregoing method embodiments.
[0153] It should be noted that in the method embodiments and / or alternative embodiments of the present application, the order of execution of each step may not be strictly limited. As long as the method embodiments and / or alternative embodiments can solve the defects existing in the prior art, achieve the invention purpose of the present application, and obtain beneficial effects. The method embodiments and / or alternative embodiments of the present application can be implemented in software and / or a combination of software and hardware. The software programs involved in the present application can be executed by a processor to implement the steps or functions of the foregoing embodiments. Similarly, the software programs (including related data structures) of the present application can be stored in a computer-readable recording medium.
[0154] In addition, a part or all of the present application can be applied as a computer program product. For example, computer program instructions, when executed by a computer, can call or provide the methods and / or technical solutions according to the present application through the operation of the computer. The program instructions for calling the methods of the present application may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in the working memory of a computer device running according to the program instructions.
[0155] According to yet another aspect of the present application, there is also provided a device for constructing an entity recognition and sentiment analysis model. The device includes: a memory storing computer program instructions and one or more processors for executing the program instructions. When the computer program instructions are executed by the processor, the device is triggered to run the methods and / or technical solutions of the foregoing embodiments.
[0156] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-described exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be construed as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices recited in the apparatus claims can also be implemented by one unit or device through software and / or hardware. The words such as "first" and "second" are used to denote names and do not represent any particular order.
Claims
1. A method for constructing an entity sentiment prediction model, characterized in that: The method comprises: Acquire multi-source network information of different topics, and for each topic, process the multi-source network information according to different stages of the topic to determine first network information corresponding to the different stages of the topic; Based on the first network information corresponding to different stages of each topic, determine the entity name and type involved, and the sentiment of the entity, and combine the first network information with the entity name and type, and the sentiment of the entity to form a sample data, traverse each stage of each topic, and use the obtained sample data as the first data set; Based on the first data set and the first preset prompt template, a pre-trained language model is trained, and the trained pre-trained language model is verified to obtain an entity recognition and sentiment analysis model; Based on the first network information corresponding to the different stages of each topic, determine the corresponding key progress type; Inputting the first network information corresponding to different stages of each topic into the entity recognition and sentiment analysis model to obtain entity recognition and sentiment analysis results of the first network information, and using the first network information and its corresponding entity recognition and sentiment analysis results as the second network information corresponding to the stage of the topic; The second network information, the stage, and the key progress type are combined into a sample data, and each stage of each topic is traversed to obtain a plurality of sample data as a second data set; Based on the second data set and the second preset prompt template, the entity recognition and sentiment analysis model is trained, and the trained entity recognition and sentiment analysis model is verified to obtain an entity sentiment prediction model, wherein the entity sentiment prediction model outputs the corresponding entity, the stage it is in, the key progress type, the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
2. The method according to claim 1, characterized in that The method of training a pre-trained language model based on the first data set and the first preset prompt template, and verifying the trained pre-trained language model to obtain an entity recognition and sentiment analysis model includes: Based on the first data set and the first preset prompt template, a pre-trained language model is trained, and the trained pre-trained language model is verified to obtain multiple entity recognition and sentiment analysis models; The step of inputting the first network information corresponding to different stages of each topic into the entity recognition and sentiment analysis model to obtain entity recognition and sentiment analysis results of the first network information, and using the first network information and its corresponding entity recognition and sentiment analysis results as the second network information corresponding to the stage of the topic includes: Inputting the first network information corresponding to different stages of each topic into each entity recognition and sentiment analysis model respectively, to obtain a plurality of entity recognition and sentiment analysis results of the first network information; Determine a final entity recognition and sentiment analysis result of the first network information based on the plurality of entity recognition and sentiment analysis results of the first network information; The first network information and the final entity recognition and sentiment analysis results corresponding thereto are used as the second network information corresponding to the stage of the topic; The method of training the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verifying the trained entity recognition and sentiment analysis model to obtain the entity sentiment prediction model includes: Based on the second data set and the second preset prompt template, one entity recognition and sentiment analysis model among the multiple entity recognition and sentiment analysis models is trained, and the trained entity recognition and sentiment analysis model is verified to obtain an entity sentiment prediction model.
3. The method according to claim 2, characterized in that Determining the final entity recognition and sentiment analysis result of the first network information includes: The entity recognition and sentiment analysis results of the plurality of the first network information are processed by using a voting mechanism to determine a final entity recognition and sentiment analysis result of the first network information.
4. The method according to claim 2, characterized in that The method further comprises: The acquired network information to be predicted is input into the entity sentiment prediction model to output the entity, the stage, the key progress type, the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage corresponding to the identified network information to be predicted.
5. The method according to claim 4, characterized in that The method further comprises: The output of the entity sentiment prediction model is processed into data structure to save and / or visually display the output after data structure.
6. A device for constructing an entity sentiment prediction model, characterized in that: The device comprises: The first module is used to obtain multi-source network information of different topics, and for each topic, according to different stages of the topic, process the multi-source network information to determine the first network information corresponding to the different stages of the topic; The second module is used to determine the entity name and type involved and the emotion of the entity based on the first network information corresponding to the different stages of each topic, and to form a sample data with the first network information, the entity name and type, and the emotion of the entity, and traverse each stage of each topic to obtain a plurality of sample data as the first data set; The third module is used to train a pre-trained language model based on the first data set and the first preset prompt template, and verify the trained pre-trained language model to obtain an entity recognition and sentiment analysis model; The fourth module is used to determine the corresponding key progress type based on the first network information corresponding to the different stages of each topic; A fifth module is used to input the first network information corresponding to different stages of each topic into the entity recognition and sentiment analysis model, obtain the entity recognition and sentiment analysis results of the first network information, and use the first network information and its corresponding entity recognition and sentiment analysis results as the second network information corresponding to the stage of the topic; A sixth module is used to combine the second network information, the stage, and the key progress type into a sample data, traverse each stage of each topic, and use the obtained sample data as a second data set; The seventh module is used to train the entity recognition and sentiment analysis model based on the second data set and the second preset prompt template, and verify the trained entity recognition and sentiment analysis model to obtain an entity sentiment prediction model, wherein the entity sentiment prediction model outputs the corresponding entity, the stage it is in, the key progress type, the sentiment analysis result of the entity and the sentiment prediction result of the entity in the next stage.
7. The device according to claim 6, characterized in that The device also includes: The eighth module is used to input the acquired network information to be predicted into the entity sentiment prediction model to output the entity, stage, key progress type, sentiment analysis result of the entity and sentiment prediction result of the entity in the next stage corresponding to the identified network information to be predicted.
8. The device according to claim 7, characterized in that The device also includes: The ninth module is used to process the output of the entity emotion prediction model into data structure so as to save and / or visually display the output after data structure.
9. A computer-readable medium, characterized in that Computer readable instructions are stored thereon, and the computer readable instructions are executed by a processor to implement the method according to any one of claims 1 to 5.
10. A device for constructing an entity sentiment prediction model, characterized in that: The device comprises: one or more processors; and A memory storing computer readable instructions which, when executed, cause the processor to perform the operations of the method as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
Task processing method and server
CN117171325A
Chemical network public opinion sentiment analysis method
CN119446341A