Public opinion report generation method and system based on large language model

Through an automated method based on the large language model, the problem of time-consuming and labor-intensive writing process of traditional public opinion report and difficulty in responding to emergencies is solved, and the rapid, accurate and comprehensive generation of public opinion reports is achieved.

CN119848309APending Publication Date: 2025-04-18WUHAN FIBERHOME PUTIAN INFORMATION TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411959679.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The process of writing traditional public opinion reports is time-consuming and labor-intensive, expensive, difficult to respond to emergencies quickly, and ignores the multi-dimensional importance of information.

Method used

An automated method based on a large language model is adopted to extract public opinion event descriptions through pattern matching, and keyword extraction and semantic expansion are used for large language model, relevant information is retrieved and sorted, multi-dimensional feature quantification and information reordering are performed, and public opinion reports are generated.

Benefits of technology

It realizes the rapid generation of public opinion reports, improves analysis efficiency and response speed, ensures the accuracy and comprehensiveness of reports, and can better reflect the relevance and importance of public opinion events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848309A_ABST
    Figure CN119848309A_ABST
Patent Text Reader

Abstract

The invention discloses a public opinion report generation method based on a large language model. The public opinion report generation method comprises the following steps: S1, extracting description information of a public opinion event from user input by adopting a pattern matching method; s2, performing keyword extraction and semantic expansion on the description information by utilizing a large language model (LLM); s3, using the processed keywords to retrieve information related to the public opinion event, and sorting the retrieved information; s4, performing multi-dimensional feature quantification processing on the public opinion information, reordering the public opinion information, and screening a specified number of information from the reordered public opinion information by adopting a down-sampling function to serve as background data of the public opinion report; s5, inputting the screened background data into a large language model, and generating a final public opinion report through iterative analysis; according to the method, the public opinion report is automatically generated, and a multi-dimensional feature quantification processing and information reordering mechanism is adopted, so that the selected public opinion information is highly related to the event and is important, and the public opinion report is more accurate and comprehensive.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a method and system for generating a public opinion report based on a large language model. Background Art

[0002] As a document that summarizes, analyzes and provides feedback on public opinions and emotions under specific public opinion events, public opinion reports play an important role in decision support, public relations management, brand building and other fields. The traditional process of writing public opinion reports usually relies on public opinion monitoring personnel to manually collect relevant information from multiple channels, and then professional public opinion analysts conduct detailed summaries, research and analysis of these massive amounts of information to extract key information from various dimensions and ultimately form a public opinion report for reference by the company's decision-making. This process is not only time-consuming and labor-intensive, resulting in high costs, but also often difficult to respond quickly when faced with emergencies, which affects the company or service unit's timely formulation and implementation of effective public opinion response strategies to mitigate the adverse effects that negative public opinion may bring.

[0003] In recent years, with the rapid development of generative artificial intelligence technology, large language models (hereinafter referred to as LLMs) have become the main development direction in this field. Large language models not only master a wide range of world knowledge, but also demonstrate excellent general capabilities and performance. In the pre-training stage, large language models absorb massive amounts of Internet data (tokens in the order of B) and accumulate rich public opinion expertise. Through instruction fine-tuning, these models have further acquired the ability to perform various complex tasks. With just the careful design of appropriate prompts, they can generate text content that meets specific business needs, demonstrating their flexibility and practicality in the field of text generation.

[0004] Traditional public opinion analysis methods often only focus on the literal similarity of information, while ignoring the importance of multiple dimensions such as the number of readings, comments, likes, and the authority of the information source. Therefore, how to construct a quantitative processing method that can comprehensively consider multiple dimensions of label information to more comprehensively reflect the relevance and importance of public opinion events is an urgent problem to be solved. Summary of the invention

[0005] The purpose of the present invention is to address the problems existing in the prior art and to provide a method and system for generating public opinion reports based on a large language model, which automatically generates public opinion reports and adopts multi-dimensional feature quantification processing and information reordering mechanism to ensure that the selected public opinion information is highly relevant and important to the event, making the public opinion report more accurate and comprehensive.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] A method for generating a public opinion report based on a large language model comprises the following steps:

[0008] S1. Use pattern matching method to extract description information of public opinion events from user input;

[0009] S2, using a large language model LLM to perform keyword extraction and semantic expansion on the description information;

[0010] S3, using the processed keywords to retrieve information related to the public opinion event, and sorting the retrieved information;

[0011] S4, quantifying and re-ranking the public opinion information in multiple dimensions, and then using a down-sampling function to select a specified amount of information from the re-ranked public opinion information as background information for the public opinion report;

[0012] S5. Input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

[0013] Step S1 includes:

[0014] When the user input is a news link, a regular expression is used to match and identify the news link as the description information of the public opinion event;

[0015] When the user input is a phrase or short sentence describing a public opinion event, a regular expression is used to match and capture the public opinion event topic in the user request as the description information of the public opinion event.

[0016] Step S1 also includes:

[0017] When a news link is identified, web crawler technology is used to capture the news report content pointed to by the news link as the description information of the public opinion event.

[0018] Step S2 includes:

[0019] S2.1. Input the description information of the public opinion event into LLM, use the Few-Shot learning method to extract keywords, and obtain the initial keyword set;

[0020] S2.2. Provide a specific Prompt expression to LLM to semantically expand the initial keyword set and generate other keywords that are semantically similar to the initial keywords.

[0021] Step S3 includes:

[0022] S3.1. Using the extracted event keywords as search factors, collect information closely related to the public opinion event from the real-time public opinion information database or by directly calling the information search API;

[0023] S3.2, receiving and processing the returned search results, sorting the results according to the literal similarity with the event keyword set, and obtaining a public opinion information set D = {d1, d2, ..., d m}, where d m It is the public opinion information most relevant to the event keywords, and d1 is the information with lower relevance.

[0024] Step S4 includes:

[0025] S4.1. Quantify the multi-dimensional features of each public opinion event, including posting time, media category, text length, number of keyword hits, and interaction indicators, and construct a feature vector for the public opinion event;

[0026] S4.2. Use the LSTM model to learn the relationship between the feature differences and relative importance of public opinion events based on training samples, and train the model;

[0027] S4.3. Using the trained LSTM model, the retrieved public opinion events are compared pairwise, and a directed graph is constructed based on the comparison results. The public opinion event set D arranged from high to low importance is obtained through topological sorting. sorted ;

[0028] S4.4. Calculate the sampling value n using the downsampling function. The calculation expression is:

[0029]

[0030] Among them, x is the total number of public opinion information, L is the saturation upper limit of the function, indicating the maximum sampling value, x0 is the inflection point of the function, controlling the inflection point of the sampling number; k is the parameter of the growth rate, and e is the base of the natural logarithm;

[0031] S4.5. Take the public opinion event set D sorted The first n public opinion information is used as the background information for generating the public opinion report.

[0032] Step S5 includes:

[0033] S5.1. Divide the filtered public opinion information set into several small batch subsets;

[0034] S5.2. For the first subset of public opinion information, build Prompt and call the big model for the first analysis to generate preliminary public opinion report content;

[0035] S5.3. Combine the subsequent batches of public opinion information subsets with the content of the public opinion report generated last time, build a new prompt, and call the large model for iterative analysis to gradually update and improve the public opinion report;

[0036] S5.4. Repeat the above iterative analysis process until the last batch of public opinion information is analyzed to obtain the final public opinion report content.

[0037] A public opinion report generation system based on a large language model, comprising:

[0038] The description information extraction module is used to extract the description information of the public opinion event from the user input by using the pattern matching method;

[0039] The keyword processing module is used to extract keywords and expand the semantics of the extracted description information using the large language model LLM;

[0040] The information retrieval and sorting module is used to use the processed keywords to retrieve information related to the public opinion event and sort the retrieved information;

[0041] The information screening module is used to quantify and re-sort the public opinion information in multiple dimensions, and then use the downsampling function to filter a specified amount of information from the re-sorted public opinion information as the background information for the public opinion report;

[0042] The report generation module is used to input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

[0043] A computer-readable storage medium stores a computer program, wherein the computer program implements the above method steps when executed by a processor.

[0044] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the above method steps are implemented when the processor executes the computer program.

[0045] Compared with the prior art, the present invention has the following beneficial effects:

[0046] 1. Through automation, large language models are used for keyword extraction, information retrieval, and report generation, which reduces manual participation, improves the efficiency and response speed of public opinion analysis, and enables rapid response to emergencies;

[0047] 2. Use pattern matching methods to accurately extract description information of public opinion events from user input, and perform semantic expansion through a large language model, thereby improving the recall rate and accuracy of information retrieval;

[0048] 3. Multi-dimensional feature quantification processing and information re-sorting mechanism ensure that the selected public opinion information is highly relevant and important to the event, making the public opinion report more accurate and comprehensive. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 This is a schematic diagram of the overall process of the method for generating a public opinion report in an embodiment of the present application;

[0051] Figure 2 This is a schematic diagram of the expression of extracting prompts for event keywords in an embodiment of the present application;

[0052] Figure 3 This is a schematic diagram of the expression of the prompt for generating the initial public opinion report in the embodiment of the present application;

[0053] Figure 4 This is a schematic diagram of the expression of generating prompts for iterating public opinion reports in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0056] In the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish descriptions and cannot be understood as indicating or suggesting relative importance. It should also be understood that although the terms "first", "second", etc. are used to describe various elements in some embodiments of the present application in the text, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, the first table can be named as the second table, and similarly, the second table can be named as the first table without departing from the scope of the various described embodiments. The first table and the second table are both tables, but they are not the same table.

[0057] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0058] In recent years, with the rapid development of generative artificial intelligence technology, large language models (hereinafter referred to as LLMs) have become the main development direction in this field. Large language models not only master a wide range of world knowledge, but also demonstrate excellent general capabilities and performance. In the pre-training stage, large language models absorb massive amounts of Internet data (tokens in the order of B) and accumulate rich public opinion expertise. Through instruction fine-tuning, these models have further acquired the ability to perform various complex tasks. With just the careful design of appropriate prompts, they can generate text content that meets specific business needs, demonstrating their flexibility and practicality in the field of text generation.

[0059] Traditional public opinion analysis methods often only focus on the literal similarity of information, while ignoring the importance of multiple dimensions such as the number of readings, comments, likes, and the authority of the information source. Therefore, how to construct a quantitative processing method that can comprehensively consider multiple dimensions of label information to more comprehensively reflect the relevance and importance of public opinion events is an urgent problem to be solved.

[0060] In view of the above technical problems, the embodiment of the present application provides a method for generating a public opinion report based on a large language model, comprising the following steps:

[0061] S1. Use pattern matching method to extract description information of public opinion events from user input;

[0062] S2, using a large language model LLM to perform keyword extraction and semantic expansion on the description information;

[0063] S3, using the processed keywords to retrieve information related to the public opinion event, and sorting the retrieved information;

[0064] S4, quantifying and re-ranking the public opinion information in multiple dimensions, and then using a down-sampling function to select a specified amount of information from the re-ranked public opinion information as background information for the public opinion report;

[0065] S5. Input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

[0066] In the above implementation, keyword extraction, information retrieval and report generation are performed using a large language model in an automated manner, which reduces manual participation, improves the efficiency and response speed of public opinion analysis, and enables rapid response to emergencies.

[0067] The pattern matching method is used to accurately extract description information of public opinion events from user input, and semantic expansion is performed through a large language model, which improves the recall rate and accuracy of information retrieval.

[0068] The multi-dimensional label quantification processing and information re-sorting mechanism ensures that the selected public opinion information is highly relevant and important to the event, making the public opinion report more accurate and comprehensive.

[0069] like Figure 1 As shown, it is a schematic diagram of the method flow of an embodiment of the present application, which shows in detail the entire process of generating a public opinion report. First, the user needs to input a request for a description of an event or an article link to start the mechanism of public opinion reporting. Then, it enters the event information extraction stage, which checks whether the input information contains a specific event description. If it does, event keywords are extracted and news clues are retrieved; if it does not contain an event description but contains a news link, article information is crawled. Then, the process enters the processing stage, including further processing of event news clues, sampling of case sets, and preliminary generation of public opinion reports based on this information. Finally, a complete public opinion report is output.

[0070] Step S1 includes:

[0071] User input may take various forms, and may be a simple phrase or sentence describing a specific public opinion event, or may be a news link pointing to a news report related to the public opinion event.

[0072] The embodiment of the present application adopts a pattern matching method, especially a regular expression, to extract descriptive information of a public opinion event from user input.

[0073] When the user input is a news link, regular expressions are used to match and identify the news link, and web crawler technology is used to crawl the news report content pointed to by the news link as the descriptive information source of the public opinion event;

[0074] Among them, web crawler technologies such as Python's BeautifulSoup and Scrapy libraries.

[0075] For example, for news links, the optional regular expression is:

[0076] "(https?: / / )?(http: / / www.\)?[a-zA-Z0-9-]+(\.[a-zA-Z]{2,})( / [^\s]*)?".

[0077] The above regular expression includes the domain name and an optional path portion, and can match most standard URL formats.

[0078] When the user input is a phrase or short sentence describing a public opinion event, a regular expression is used to match and capture the public opinion event topic in the user request as the description information of the public opinion event.

[0079] For example, for a phrase or short sentence describing a public opinion event, the regular expression that can be used is:

[0080] "Please help me write a public opinion report about (.+?)".

[0081] Among them, "(.+?)" is a capture group, which is used to capture the specific content of the public opinion event. "

[0082] Through the specific implementation of step S1 above, the description information of the public opinion event can be automatically extracted from the user input, providing a basis for keyword extraction, information retrieval and report generation in subsequent steps.

[0083] Step S2 includes:

[0084] S2.1. When the event description information in step S1 is a phrase or a short sentence, the description information is directly input into the LLM, and the Few-Shot learning method is used for keyword extraction. Few-Shot learning is a method for training a model with a small amount of labeled data, which enables the model to quickly adapt to new tasks and accurately extract keywords related to the event.

[0085] If the information in step S1 is a news link, the web crawler technology is first used to crawl the news title and text content corresponding to the news link, and then these contents are spliced ​​together to form a complete event description information. The description information of the public opinion event is then input into the LLM, and the Few-Shot learning method is used to extract keywords to obtain the initial keyword set.

[0086] S2.2. In order to further improve the recall rate of information retrieval, it is also necessary to semantically expand the initial keywords.

[0087] A specific Prompt expression can be provided to the LLM to guide it to semantically expand the initial keyword set and generate other keywords that are semantically similar to the initial keywords.

[0088] like Figure 2The figure shows a schematic diagram of the prompt expression for event keyword extraction, which shows how to extract keywords and perform semantic expansion through specific event descriptions, such as the "rat head and duck neck incident." First, extract core keywords from the event description, such as "duck neck" and "rat head." Then, expand these keywords semantically to obtain more related words, such as "rat," "rat head," etc., and use this as an example to guide subsequent tasks. Figure 2 Below the example, the keyword extraction and expansion results of the "Xiao Yangge, Meicheng Mooncakes" event are shown.

[0089] Step S3 includes:

[0090] S3.1. Use the extracted event keywords as retrieval factors, select the BM25 algorithm as the information retrieval algorithm, and collect information closely related to public opinion events from the real-time public opinion information database.

[0091] Among them, the information retrieval algorithm BM25 can sort the search results based on the degree of match between keywords and document content, thereby ensuring that the most relevant information can be obtained first.

[0092] In order to increase the ways of obtaining information, in addition to using algorithms such as BM25, you can also directly obtain the required information through the information retrieval API.

[0093] S3.2, receiving and processing the returned search results, sorting the results according to the literal similarity with the event keyword set, and obtaining a public opinion information set D = {d1, d2, ..., d m}, where d m It is the public opinion information most relevant to the event keywords, and d1 is the information with lower relevance.

[0094] Step S4 includes:

[0095] S4.1. Quantify the multi-dimensional features of each public opinion event, including publication time, media category, text length, number of keyword hits, and interaction indicators, to construct a feature vector of the public opinion event.

[0096] Specifically, the publication time is quantified by calculating the time difference between the current time and the news release time, and quantifying it into a time difference value Δt i The closer the time is, the larger the quantization value is. The media category quantization method is to encode different types of media into discrete values ​​to form a media category quantization value m i The text length is quantified by calculating the number of words in the public opinion event text to obtain the text length L iThe quantification method of keyword hits is to calculate the number of keywords related to the public opinion event and obtain the number of keyword hits k i The interactive index is quantified by directly quantifying the number of likes, readings and comments. They are respectively expressed as the number of likes p i 、Reading number i and the number of comments c i .

[0097] Quantify each feature using the formula to obtain the corresponding numerical feature.

[0098]

[0099] Then all the features are quantified and constructed into the feature vector of the public opinion event.

[0100]

[0101] Among them, n is the number of selected features, and the feature vector X i It is a numerical representation of public opinion events, which has captured the information of public opinion events in multiple dimensions.

[0102] S4.2. Use the LSTM model to learn the relationship between the feature differences and relative importance of public opinion events based on training samples, and train the model.

[0103] Specifically, for every two public opinion events N i and N j Constructed as a sample, the input of the sample is the feature difference ΔX between the two public opinion events ij =X i -X j , the feature vector is obtained by normalization As the input of the LSTM model.

[0104] Among them, normalization is performed by the following formula:

[0105]

[0106] The output of the LSTM model is a binary classification result express:

[0107]

[0108] , which represents the relative importance between two public opinion events, and optimizes the model parameters by minimizing the binary cross entropy loss function.

[0109] Among them, the binary cross entropy loss function is:

[0110]

[0111] S4.3. Using the trained LSTM model, the retrieved public opinion events are compared pairwise, and a directed graph is constructed based on the comparison results. The public opinion event set D arranged from high to low importance is obtained through topological sorting. sorted .

[0112] Specifically, for each pair of events in the public opinion news set (N i , N j ), input its feature vector into the trained LSTM model, and obtain the classification result output by the model like Then it means event N i Than event N j important; otherwise, vice versa.

[0113] According to the classification results of each pair of events output by the LSTM model, a directed graph is constructed. In this directed graph, each event represents a node, and the edges between nodes represent the relative importance relationship between events. In this way, a directed graph containing all public opinion news nodes and the relative importance relationship between them can be obtained.

[0114] The constructed directed graph is topologically sorted. Topological sorting is an algorithm for sorting directed acyclic graphs, which can obtain a linear sequence. In this embodiment, by sorting the directed graph using a topological sorting algorithm, a set of public opinion news can be obtained, which is arranged from high to low in importance. The sorting results are:

[0115]

[0116] in, is the classification result of each pair of events output by the LSTM model. TopologicalSort indicates that the comparison results between each pair of events are topologically sorted to obtain the re-sorted public opinion information set D sorted This is the final re-ranking result of the public opinion news set.

[0117] S4.4. Calculate the sampling value n using the downsampling function. The calculation expression is:

[0118]

[0119] Among them, x is the total number of public opinion information, L is the saturation upper limit of the function, indicating the maximum sampling value, x0 is the inflection point of the function, controlling the inflection point of the sampling number; k is the parameter of the growth rate, and e is the base of the natural logarithm;

[0120] S4.5. Take the public opinion event set D sorted The first n public opinion information is used as the background information for generating the public opinion report.

[0121] For example, the public opinion event information set D contains 1500 pieces of public opinion information. The sampling value n is calculated using the downsampling function. L=400, x0=1000, k=0.002 and x=1500 are substituted into the function expression to obtain n≈318. From the reordered public opinion information set D sorte In d, the first 318 pieces of information will be selected as the background information for the final generation of the public opinion report.

[0122] Step S5 includes:

[0123] S5.1. Divide the filtered public opinion information set into several small batch subsets, denoted as D batchs ={Db1,Db2,...,Db j}.

[0124] Each subset contains a certain amount of public opinion information, and the specific amount can be adjusted according to the actual situation and computing resources. Batch processing can ensure that the amount of data analyzed each time is moderate and avoid excessive consumption of computing resources.

[0125] S5.2. For the first subset of public opinion information Db1, construct Prompt and call the large model for the first analysis to generate the preliminary public opinion report content Rep1.

[0126] Figure 3 A schematic diagram of the prompt for generating the initial public opinion report, which lists in detail the key elements and format requirements for generating the public opinion analysis report.

[0127] Specific content includes:

[0128] Role: Set the expert identity to public opinion analysis expert.

[0129] Task: Generate a public opinion analysis report based on a news collection.

[0130] Background information: The report must cover six items, including an overview of public opinion and the parties involved, and each item has specific explanations and requirements.

[0131] Input data: public opinion news collection.

[0132] Output format requirements: The output format of the report is specified, including each item starting on a new line and ending with "End of public opinion analysis".

[0133] S5.3. Combine the subsequent batches of public opinion information subsets with the content of the public opinion report generated last time, build a new prompt, and call the large model for iterative analysis to gradually update and improve the public opinion report;

[0134] S5.4. Repeat the above iterative analysis process until the last batch of public opinion information is analyzed and the final public opinion report content Rep is obtained. j .

[0135] In each iteration, the big model will analyze and summarize the new public opinion information and the previous report content, extract the key public opinion points, and supplement and revise the report. In this way, the accuracy, reliability and comprehensiveness of the public opinion report can be ensured, while avoiding the problems caused by processing a large amount of data at one time.

[0136] Figure 4 The expression diagram of the iterative public opinion report generation prompt in the embodiment of the present application is shown, and the key information required to generate the public opinion report is listed in the interface, including role positioning, task requirements, background information, input data and output format, etc. The role positioning is set as a public opinion analysis expert who is good at objectively analyzing the news collection monitored by the public opinion monitoring system. The task is set to make incremental updates on the existing structured public opinion report based on the provided public opinion news collection. The background information section explains the six major items that the report content must include. The input data is set to include public opinion news collection and existing structured public opinion reports, and the output requirements are set to include seven contents such as event introduction, public opinion overview, involved subjects, risk scenarios, public opinion reaction, official response and liaison departments.

[0137] In another aspect, an embodiment of the present application provides a system for generating a public opinion report based on a large language model, including:

[0138] The description information extraction module is used to extract the description information of the public opinion event from the user input by using the pattern matching method;

[0139] The keyword processing module is used to extract keywords and expand the semantics of the extracted description information using the large language model LLM;

[0140] The information retrieval and sorting module is used to use the processed keywords to retrieve information related to the public opinion event and sort the retrieved information;

[0141] The information screening module performs multi-dimensional feature quantification processing on public opinion information and re-sorts it, and then uses a downsampling function to select a specified amount of information from the re-sorted public opinion information as background information for the public opinion report;

[0142] The report generation module is used to input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

[0143] In another aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program implements the above-mentioned method steps when executed by a processor.

[0144] On the other hand, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method steps when executing the computer program.

[0145] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for generating a public opinion report based on a large language model, characterized in that: The following steps are involved: S1. Use pattern matching method to extract description information of public opinion events from user input; S2, using a large language model LLM to perform keyword extraction and semantic expansion on the description information; S3, using the processed keywords to retrieve information related to the public opinion event, and sorting the retrieved information; S4, quantifying and re-ranking the public opinion information in multiple dimensions, and then using a down-sampling function to select a specified amount of information from the re-ranked public opinion information as background information for the public opinion report; S5. Input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

2. According to the method for generating a public opinion report based on a large language model according to claim 1, it is characterized in that: Step S1 includes: When the user input is a news link, regular expressions are used to match and identify the news link, and web crawler technology is used to crawl the news report content pointed to by the news link as the description information of the public opinion event; When the user input is a phrase or short sentence describing a public opinion event, a regular expression is used to match and capture the public opinion event topic in the user request as the description information of the public opinion event.

3. According to claim 1, a method for generating a public opinion report based on a large language model is characterized in that: Step S2 includes: S2.

1. Input the description information of the public opinion event into LLM, use the Few-Shot learning method to extract keywords, and obtain the initial keyword set; S2.

2. Provide a specific Prompt expression to LLM to semantically expand the initial keyword set and generate other keywords that are semantically similar to the initial keywords.

4. According to the method for generating a public opinion report based on a large language model according to claim 1, it is characterized in that: Step S3 includes: S3.

1. Using the extracted event keywords as search factors, collect information closely related to the public opinion event from the real-time public opinion information database or by directly calling the information search API; S3.2, receiving and processing the returned search results, sorting the results according to the literal similarity with the event keyword set, and obtaining a public opinion information set D = {d1, d2, ..., d m }, where d m It is the public opinion information most relevant to the event keywords, and d1 is the information with lower relevance.

5. According to the method for generating a public opinion report based on a large language model according to claim 1, it is characterized in that: In step S4, the public opinion information is subjected to multi-dimensional feature quantification processing and re-ranking, including: S4.

1. Quantify the multi-dimensional features of each public opinion event, including posting time, media category, text length, number of keyword hits, and interaction indicators, and construct a feature vector for the public opinion event; S4.

2. Use the LSTM model to learn the relationship between the feature differences and relative importance of public opinion events based on training samples, and train the model; S4.

3. Using the trained LSTM model, the retrieved public opinion events are compared pairwise, and a directed graph is constructed based on the comparison results. The public opinion event set D arranged from high to low importance is obtained through topological sorting. sorted .

6. According to the method for generating a public opinion report based on a large language model according to claim 5, it is characterized in that: In step S4, a downsampling function is then used to filter a specified amount of information from the reordered public opinion information as background information for the public opinion report, including: S4.

4. Calculate the sampling value n using the downsampling function. The calculation expression is: Among them, x is the total number of public opinion information, L is the saturation upper limit of the function, indicating the maximum sampling value, x0 is the inflection point of the function, controlling the inflection point of the sampling number; k is the parameter of the growth rate, and e is the base of the natural logarithm; S4.

5. Take the public opinion event set D sorted The first n public opinion information is used as the background information for generating the public opinion report.

7. According to claim 1, a method for generating a public opinion report based on a large language model is characterized in that: Step S5 includes: S5.

1. Divide the filtered public opinion information set into several small batch subsets; S5.

2. For the first subset of public opinion information, build Prompt and call the big model for the first analysis to generate preliminary public opinion report content; S5.

3. Combine the subsequent batches of public opinion information subsets with the content of the public opinion report generated last time, build a new prompt, and call the large model for iterative analysis to gradually update and improve the public opinion report; S5.

4. Repeat the above iterative analysis process until the last batch of public opinion information is analyzed to obtain the final public opinion report content.

8. A public opinion report generation system based on a large language model, characterized in that: include: The description information extraction module is used to extract the description information of the public opinion event from the user input by using the pattern matching method; The keyword processing module is used to extract keywords and expand the semantics of the extracted description information using the large language model LLM; The information retrieval and sorting module is used to use the processed keywords to retrieve information related to the public opinion event and sort the retrieved information; The information screening module performs multi-dimensional feature quantification processing on public opinion information and re-sorts it, and then uses a downsampling function to select a specified amount of information from the re-sorted public opinion information as background information for the public opinion report; The report generation module is used to input the screened background information into the large language model and generate the final public opinion report through iterative analysis.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the method steps of any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method steps of any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Earthquake event emergency response method

    CN120744199A

  • Earthquake event emergency response method

    CN120744199B

  • Public opinion analysis system and method based on large model, electronic equipment and storage medium

    CN120804183A