Network appeal text keyword extraction and embedding method and application

By constructing a similar demand case retrieval module and using retrieval enhancement generation technology, the issues of efficiency and quality in online government responses have been resolved, achieving efficient, professional, and standardized online government responses, and improving public satisfaction and trust.

CN121597803APending Publication Date: 2026-03-03DALIAN UNIV OF TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511793286.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing online response systems rely on manual services, which are inefficient and of unstable quality when faced with massive, high-frequency, and repetitive public inquiries. They fail to meet the requirements of timeliness, professionalism, and standardization. Furthermore, existing large language models have problems generating false information or overgeneralizing when applied in specific professional fields.

Method used

By integrating a large language model, a similar appeal case retrieval module is constructed. Similar cases are retrieved from the historical case database using retrieval enhancement technology. Sub-case databases are reconstructed based on text clustering methods to generate a framework and content suitable for responding to online government inquiries. This is then filled in with policy information to ensure the coherence and accuracy of the response.

Benefits of technology

It has improved the efficiency and quality of online government responses, ensuring timely, professional, and standardized responses, enhancing public satisfaction and trust, reducing redundant work, and lowering costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597803A_ABST
    Figure CN121597803A_ABST
Patent Text Reader

Abstract

The invention discloses a network appeal text keyword extraction and embedding method and application, belongs to the field of text data processing, is used for extracting and embedding appeal text keywords in network response automatic generation, and has the technical key points that an appeal text ci after word segmentation is transmitted into a KeyBERT model to obtain first q keywords; splicing the first q keywords into a character string to obtain a keyword representation text s of the appeal text ci; converting the keyword representation text s into a keyword vector kvi; converting the appeal text ci into a sentence vector cvi; and fusing the sentence vector cvi and the keyword vector kvi by adopting a mode of first summing and then L2 norm normalization to obtain a vector ckvi after keyword embedding of the text.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the patent application filed on June 16, 2025, with application number 202510802808.X, entitled "Method for Enhancing Network Response Retrieval Generation by Integrating Large Language Models, Electronic Device and Computer-Readable Storage Medium". Technical Field

[0002] This invention belongs to the field of text data processing and relates to a method for enhancing network response retrieval generation by integrating large language models, electronic devices, and computer-readable storage media. Background Technology

[0003] In the wave of digital transformation and service development, online responses, as a core interactive channel connecting organizations and the public, have become a crucial element in improving governance effectiveness, optimizing user experience, and shaping organizational image. With the popularization of internet technology and the intelligent upgrading of various online service platforms (such as government platforms, enterprise customer service, social media, and community forums), the public's activity in consulting, providing feedback, filing complaints, and making suggestions through online channels has significantly increased, resulting in a massive influx of fragmented information onto various platforms. This high level of participation places unprecedented demands on the timeliness, professionalism, standardization, and communication effectiveness of organizational online responses. How to respond efficiently, accurately, and humanely to the massive public demands has become a core challenge in enhancing organizational credibility, service efficiency, and user satisfaction.

[0004] Online response is a core element of the entire online interaction process, and its quality directly determines the public's perception, satisfaction, and trust in an organization's services. Existing research and practice indicate that high-quality online responses must simultaneously satisfy both task-oriented and non-task-oriented values: Task-oriented values ​​emphasize the practicality and functionality of the response; accuracy of information is fundamental, ensuring the truthfulness, reliability, and unambiguity of the content conveyed is essential for building trust; relevance requires responses to closely address the user's core needs, avoiding irrelevant answers; and completeness requires providing sufficient information to resolve user doubts or guide their next steps. Non-task-oriented values ​​focus on the emotional and communicative dimensions of the response: understanding and empathizing with the user's situation or emotions (such as expressing concern or apology), clearly explaining the background of the event or the reasons for the decision, and honestly describing the organization's efforts or challenges can significantly enhance the user's sense of being valued, increase their acceptance of the response, and improve overall satisfaction, even if the final result does not fully meet their needs. Furthermore, the timeliness of the response (avoiding the accumulation of user anxiety and negative emotions), clarity of expression, and politeness are also important factors influencing user perception. However, current online response practices still heavily rely on human intervention. While human responses offer flexibility in handling complex and personalized issues, their limitations become increasingly apparent when faced with massive, high-frequency, and repetitive requests. On one hand, a large volume of inquiries is highly concentrated or repetitive, trapping customer service or operations staff in inefficient cycles of repetitive work, preventing them from focusing on more complex or valuable tasks. On the other hand, response quality heavily relies on individual staff members' knowledge, experience, communication skills, and on-the-spot performance, easily leading to inconsistent response standards, non-standard expressions, omissions of key information, and even misunderstandings, damaging the organization's image. Furthermore, with a surge in inquiries, human response speed often lags behind, failing to meet users' expectations for immediate feedback and easily causing dissatisfaction. Moreover, relying on sheer manpower to meet growing demand is costly and hinders the flexible expansion of service capabilities. In recent years, Large Language Models (LLMs) have achieved numerous breakthroughs in general tasks in fields such as Natural Language Processing (NLP), primarily covering enhanced retrieval functions, semantic understanding and reasoning, in-depth case analysis, and machine translation. They are widely used in practical applications such as text creation and intelligent assistants. The successful application of LLMs in NLP offers new possibilities for solving these problems. The semantic complexity and multi-domain nature of online response texts place stringent demands on the accuracy of semantic understanding. Large language models, with their absolute advantage in semantic understanding, offer new insights into the automated generation of online political responses. However, the semantic representation and generation capabilities of large models are significantly influenced by the training corpus, leading to "illusion" problems when directly applied to specific professional domains, such as generating false information or overly generalized responses. Therefore, relying solely on large language models to generate responses is insufficient to meet the stringent requirements of accuracy and policy compliance in online political discourse.

[0005] Furthermore, while existing research has optimized the intermediate processing stages of online responses through intelligent technologies, achieving some improvements in response efficiency and quality, it has not yet constructed a complete end-to-end closed-loop system, leaving room for further optimization in overall process efficiency and service quality. Simultaneously, current research indicates a close correlation between the effectiveness of online responses and the manner of language expression. For example, scholars such as Song Yingfa have pointed out that responders need to pay attention to the artistry of language, reflecting characteristics such as popularization, personalization, humanistic care, and vividness in their expression. However, current research largely focuses on optimizing response generation efficiency and text quality, lacking in-depth exploration of the correlation mechanism between the artistry of language and public satisfaction. It is worth noting that artificial intelligence technology can not only improve response efficiency but also enhance the affinity of response texts through anthropomorphic expression. Based on this, this invention argues that integrating historical response cases with information technology to construct an intelligent response template reference system is a feasible path to improve the quality of response services in the digital age. Summary of the Invention

[0006] To address the aforementioned problems, in a first aspect, embodiments of this application provide a method for enhancing network response retrieval generation by incorporating a large language model, including...

[0007] Input the request text and prompts into the large language model, and the large language model outputs the request and type;

[0008] Input similar cases and prompts of the appeal text into the large language model, and the large language model outputs the response paradigm of the appeal type in the similar cases;

[0009] Input prompts into the large language model, which then generalizes the response paradigm to generate a first framework suitable for responding to requests.

[0010] Among them, methods for obtaining similar cases of appeal texts include

[0011] Calculate the appeal vector after keyword embedding in the appeal text;

[0012] The target sub-case library is determined based on the cosine distance between the claim vector and the center of each sub-case library clustered based on the claim content.

[0013] Similar cases are identified based on the cosine distance between the claim vector and the claim vectors of cases in the target sub-case library.

[0014] In a second aspect, embodiments of this application also provide an electronic device, the electronic device comprising: one or more processors, a memory, and one or more programs; wherein the one or more programs are stored in the memory, and the one or more programs include instructions that, when executed by the electronic device, cause the electronic device to perform the first aspect and any possible technical solution of the first aspect.

[0015] In a third aspect, embodiments of this application also provide a computer-readable storage medium comprising a computer program that, when executed on an electronic device, causes the electronic device to perform the first aspect and any possible technical solution of the first aspect.

[0016] Beneficial effects:

[0017] In the first aspect, the present invention reconstructs a new intelligent question-and-answer method that effectively solves the problem of processing non-standard text, provides theoretical and practical reference for the automatic generation of online responses, and promotes the intelligent transformation and development of online response services, such as being applicable to online political inquiry responses.

[0018] Secondly, this invention retrieves similar complaint cases, converts the complaint text into a vector, and uses a retrieval algorithm to find several similar cases from a historical online case database. The response enhancement generation process generates prompts based on the retrieved similar cases and complaints using a pre-designed prompt template, which are then input into a large model to generate a public opinion response. The case database is reconstructed using text clustering methods into multiple sub-case databases, and can be expanded using incremental clustering methods to improve the efficiency of similar complaint case retrieval and case database expansion, thus meeting the ever-increasing demand for massive online responses in the information age, such as online public opinion responses.

[0019] Thirdly, online response texts, such as online customer service responses and online government inquiries, while exhibiting characteristics such as varying expression preferences, colloquial language, complex and diverse demands, and varying levels of cultural literacy, typically share clear issues and demands. Therefore, this invention focuses on the themes of online response texts, proposing a vector representation method that integrates text themes, and then using the text vectors after theme integration to retrieve similar demand cases. The method extracts keywords that represent the main demands, integrates them into the original demand text, and then vectorizes them to highlight the main demands. The generated integrated vectors demonstrate stronger demand identification capabilities in semantic similarity calculations, enabling more accurate matching of retrieved similar cases to concerns, thereby finding similar cases with more relevant themes and improving the targeting of generated responses. This textual characteristic is particularly prominent in government inquiry texts. In some specific embodiments, this invention implements enhanced generation of online government inquiry response retrieval, achieving good results.

[0020] Fourthly, this invention reconstructs the entire online public opinion case database into several sub-case databases. It calculates the distance between the target appeal and the center of each sub-case database to determine the target sub-case database, and finally retrieves only the target sub-case database to achieve similar case retrieval. This reduces the computational load from traversing the entire case database to traversing only the target sub-case database, thereby improving the efficiency of similar case retrieval. Specifically, this method organizes the entire case database according to themes, forming multiple sub-case databases with different themes. When performing similar case retrieval, only the similarity between the target appeal and cases in a specific sub-case database is calculated, significantly reducing the number of comparison calculations and effectively improving retrieval efficiency. Furthermore, the reconstructed case database can be expanded based on incremental clustering, ensuring efficient and dynamic expansion of the reconstructed case database.

[0021] In the fifth aspect, this invention aims for stable clustering results, meaning the sample's category remains unchanged. However, as the case library grows, the convergence speed of K-Means++ clustering slows down. When clustering nears convergence, most sample categories stabilize, with only a few marginal samples potentially changing categories, leading to minor adjustments in cluster centers. Cases at the cluster edges typically have relatively unclear themes and are few in number; therefore, changes in the categories of a few marginal samples have a relatively small impact on similar case retrieval. This invention considers both the efficiency and effectiveness of similar case retrieval, and the convergence condition for case text clustering only requires stable cluster centers.

[0022] In the sixth aspect, this invention provides a response framework generation path based on context learning. Based on the concept of context learning, it utilizes similar cases to generate a request response framework, providing framework support for subsequent response text generation. This can solve the following problems: 1) Requests often contain multiple specific issues, requiring separate analysis and responses. 2) Different types of requests have different response approaches.

[0023] In the seventh aspect, after completing the aforementioned framework generation, the next step is to fine-tune the specific content within the template. First, the main objective of this detailed integration is clarified: based on the previously generated response framework, actual policy documents, phone numbers, email addresses, and other information are filled into the corresponding positions to ensure the response is more specific, detailed, and reflects reality. Second, by integrating this information, the coherence of the response is ensured, making it appear more natural and human-centered, avoiding any traces of human-computer interaction.

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

[0025] Figure 1 It is a framework for enhancing the generation of online government response retrieval based on a large language model.

[0026] Figure 2 This is a flowchart of the process for embedding keywords in the appeal text.

[0027] Figure 3 Path diagram for generating online government inquiry response framework.

[0028] Figure 4 Refine and integrate the prompt template design.

[0029] Figure 5 Elbow plot and contour coefficients for clustering of appeal texts. Detailed Implementation

[0030] The embodiments of this application are described in detail below with reference to the accompanying drawings, examples of which are shown in the drawings. This application provides a method and an electronic device. The method and device are based on the same technical concept. Since the principles by which the method and device solve the problem are similar, the implementations of the device and method can refer to each other, and repeated details will not be repeated.

[0031] In one embodiment of the present invention, a method for extracting and embedding text keywords is provided, including...

[0032] For text c i Perform word segmentation and stop word removal;

[0033] The segmented text c i The first q keywords are obtained by passing them into the KeyBERT model.

[0034] Concatenate the q keywords into a string to obtain the text s, separated by spaces;

[0035] Transform the text s into a vector kv i ;

[0036] Text c i Convert to vector cv i ;

[0037] The vector cv i sum vector kv i The text is fused using a method of first summing and then L2 norm normalization to obtain the vector ckv after keyword embedding. i .

[0038] Among them, the vector cv i sum vector kv i The fusion method, which involves summation followed by L2 norm normalization, is expressed by the following formula:

[0039] (1)

[0040] In the formula, m represents the dimension of the vector.

[0041] In this step, the text s is transformed into a vector kv. i ,include

[0042] Perform word segmentation on text s;

[0043] The segmented text s is fed into the MacBERT model to obtain the output of the last hidden layer for each token;

[0044] The vector obtained by average pooling the output of the hidden layer of all tokens is used as the vector representation of the text s, kv. i ;

[0045] In this step, text c i Convert to vector cv i ,include

[0046] For text c i Perform word segmentation;

[0047] The segmented text c i Input the MacBERT model and get the output of the last hidden layer for each token;

[0048] The vector obtained by average pooling the output of the hidden layer of all tokens is used as the text c. i The vector representation of cv i .

[0049] In one embodiment of the present invention, a method for obtaining similar cases of text is provided, including...

[0050] Calculate the vector of the text after keyword embedding;

[0051] The target sub-case library is determined based on the cosine distance between the vector and the center of each sub-case library based on content clustering;

[0052] Similar cases are identified based on the cosine distance between the claim vector and the claim vectors of cases in the target sub-case library.

[0053] Specifically, the text vector after keyword embedding is calculated based on the above-mentioned text keyword extraction and embedding methods.

[0054] The method for constructing a sub-case library based on content clustering includes...

[0055] S1. Randomly select a sample from the case dataset as the first cluster center;

[0056] S2. For each sample in the dataset, calculate the shortest distance between it and the selected cluster centers, and calculate the probability that each sample will be selected as the next cluster center based on the shortest distance;

[0057] S3. Based on the calculated probability, randomly select a new sample as the next cluster center, and repeat steps S2-S3 until k cluster centers are selected;

[0058] S4. Calculate the distance between the sample and each cluster center, and assign the sample to the cluster center with the shortest distance to it;

[0059] S5. For each cluster center, recalculate the mean similarity among all sample points to which it belongs, and use this mean as the new cluster center;

[0060] S6. Repeat steps S4-S5 until the convergence condition is met and the iteration stops. Each cluster center has all sample points as a sub-case library, resulting in t sub-case libraries clustered from the case dataset based on the content of the claims.

[0061] The convergence condition for stopping iteration is determined by the following formula:

[0062] (2); (3)

[0063] Wherein, it is assumed that after the t-th iteration, cluster C i The cluster center vector is derived from Become If the change range of the cluster centers is as shown in formula (2), and the change range of the cluster centers of k classes satisfies formula (3), and the sum of the changes of the cluster centers of all classes is less than the preset threshold θ, the cluster centers are stable, and the iteration stops when the convergence condition is met.

[0064] One embodiment of the present invention relates to a method for enhancing and generating online responses by incorporating a large language model. This method can be used for responding to online political inquiries, including...

[0065] Input the request text and prompts into the large language model, and the large language model outputs the request and type;

[0066] Input similar cases and prompts of the appeal text into the large language model, and the large language model outputs the response paradigm of the appeal type in the similar cases;

[0067] Input prompts into the large language model, which then generalizes the response paradigm to generate a first framework suitable for responding to requests.

[0068] Among them, methods for obtaining similar cases of appeal texts include

[0069] Calculate the appeal vector after keyword embedding in the appeal text;

[0070] The target sub-case library is determined based on the cosine distance between the claim vector and the center of each sub-case library clustered based on the claim content.

[0071] Similar cases are identified based on the cosine distance between the claim vector and the claim vectors of cases in the target sub-case library.

[0072] Among them, the network response retrieval enhancement generation method that integrates a large language model also includes inputting prompts into the large language model, and having the large language model limit the textual expression form and tone of the first framework applicable to the appeal response, thereby generating a second framework applicable to the appeal response.

[0073] The enhanced generation method for network response retrieval that integrates a large language model also includes inputting fill information for a first frame or a second frame into the large language model. The fill information includes policy information and / or contact information. The large language model outputs response content including the first frame or the second frame and the fill information.

[0074] Among them, the network response retrieval enhancement generation method that integrates a large language model inputs prompts into the large language model, and the large language model outputs the response content that is fluent, coherent, and consistent in tone and style.

[0075] The step of calculating the appeal vector after keyword embedding of the appeal text includes...

[0076] Regarding the request text c i Perform word segmentation and stop word removal;

[0077] The segmented appeal text c i The first q keywords are obtained by passing them into the KeyBERT model.

[0078] Concatenate the q keywords into a string to obtain the text s, separated by spaces;

[0079] Transform the text s into a vector kv i ;

[0080] The request text c i Convert to vector cv i ;

[0081] The vector cv i sum vector kv i The appeal vector ckv is obtained by fusing the appeal text after keyword embedding using a method of first summing and then L2 norm normalization. i ;

[0082] Among them, the vector cv i sum vector kv i The fusion method, which involves summation followed by L2 norm normalization, is expressed by the following formula:

[0083] (1)

[0084] In the formula, m represents the dimension of the vector.

[0085] In this step, the text s is transformed into a vector kv. i ,include

[0086] Perform word segmentation on text s;

[0087] The segmented text s is fed into the MacBERT model to obtain the output of the last hidden layer for each token;

[0088] The vector obtained by average pooling the outputs of the hidden layers of all tokens is used as the vector representation of the appeal text s, kv. i ;

[0089] In this step, the request text c i Convert to vector cv i ,include

[0090] Regarding the request text c i Perform word segmentation;

[0091] The segmented appeal text c i Input the MacBERT model and get the output of the last hidden layer for each token;

[0092] The vector obtained by average pooling the outputs of the hidden layers of all tokens is used as the appeal text c. i The vector representation of cv i .

[0093] Among them, the method for constructing a sub-case library based on clustering of demand content includes...

[0094] S1. Randomly select a sample from the case dataset as the first cluster center;

[0095] S2. For each sample in the dataset, calculate the shortest distance between it and the selected cluster centers, and calculate the probability that each sample will be selected as the next cluster center based on the shortest distance;

[0096] S3. Based on the calculated probability, randomly select a new sample as the next cluster center, and repeat steps S2-S3 until k cluster centers are selected;

[0097] S4. Calculate the distance between the sample and each cluster center, and assign the sample to the cluster center with the shortest distance to it;

[0098] S5. For each cluster center, recalculate the mean similarity among all sample points to which it belongs, and use this mean as the new cluster center;

[0099] S6. Repeat steps S4-S5 until the convergence condition is met and the iteration stops. Each cluster center and all sample points belong to a sub-case library, resulting in t sub-case libraries clustered from the case dataset based on the content of the appeal.

[0100] (2); (3)

[0101] Wherein, it is assumed that after the t-th iteration, cluster C i If the cluster center vector changes from u to u+1, then the change range of its cluster center is as shown in formula (2). If the change range of the cluster center of k classes satisfies formula (3), and the sum of the changes of the cluster center of all classes is less than the preset threshold θ, the cluster center is stable, and the iteration stops when the convergence condition is met.

[0102] In this process, the target sub-case library is determined based on the distance between the claim vector and the centers of each sub-case library clustered based on the claim content; similar cases are determined based on the cosine distance between the claim vector and the claim vectors of cases in the target sub-case library, including t sub-case libraries clustered based on the claim content of the case dataset, the cluster center vector ui of each sub-case library, and the calculation of the claim vector ckv. i The cluster center vector u of the t sub-cases clustered based on the content of the demands i The cosine distance, and the appeal vector ckv i The sub-case library with the smallest cosine distance is selected as the target sub-case library; the target sub-case library is traversed, and the appeal vector ckv is calculated. i The cosine distance between the claim vectors of all cases in the target sub-case library and the claim vectors of all cases, wherein the case with the smallest cosine distance or the first few cases are considered similar cases.

[0103] Among them, the network response retrieval enhancement generation method that integrates a large language model also includes

[0104] For a new case to be added to the database, extract the appeal vector ckv from the appeal text in the case. i ;

[0105] Calculate the appeal vector ckv i The cluster center vector u of the t sub-cases clustered based on the content of the demands i The cosine distance;

[0106] Add new cases to be added to the cluster center vector and request vector ckv. i In the sub-case set with the smallest cosine distance, the cluster center vector of the sub-case set is u;

[0107] For the cluster centers of the sub-case library, recalculate the mean similarity among all the sample points to which they belong, and use this mean as the new cluster centers;

[0108] Calculate the offset between the new cluster center and the original cluster center. If the offset is greater than the set threshold θ1, execute the method of constructing a sub-case library based on the content of the appeal, and reassign the cluster centers to which the sample points of each case belong, so as to redistribute the sub-case library. If the offset is not greater than the set threshold θ1, keep the current cluster centers to which the sample points of each case belong.

[0109] The online response refers to an online government inquiry response, and the response content refers to the content of the government inquiry response.

[0110] The following uses online political responses as an example to illustrate the invention in detail:

[0111] 1. Terminology Explanation:

[0112] Online response: Online response refers to feedback or reaction to specific information, events, behaviors, or interactions through an internet platform.

[0113] Online government response refers to the standardized process by which government departments or public authorities publicly answer, process, and respond to public inquiries, requests for assistance, and complaints regarding government affairs through internet channels. Essentially, it represents a new governance model of two-way interaction between the government and the public in the digital age, aiming to improve government transparency, service efficiency, and public participation.

[0114] 2. Related Research

[0115] 2.1 Research on Online Government Inquiry and Response

[0116] Online governance is a prominent feature of the participatory and interactive stage of government informatization and a manifestation of e-governance. It broadens channels for public expression, promotes freedom of speech, deepens the forms and content of citizen political participation, and enhances the effectiveness of online political participation, thereby expanding orderly citizen political participation. Existing research indicates that the quality of government responses is a crucial factor influencing the effectiveness of online governance and government credibility, while public satisfaction with governance responses is an important standard for measuring the quality of responses. Factors such as response efficiency, response content, response attitude, whether the issue is resolved, the handling of the issue, and the government's image all affect public satisfaction with governance responses. Therefore, from the perspective of influencing factors, constructing responses that satisfy the public is extremely important. Regarding improving response efficiency, scholars have used empirical analysis to study how to mobilize enthusiasm and participation in governance through establishing governance assessment indicators, improving governance models, and perfecting working mechanisms. Scholars believe that the generation of online governance responses depends on efficient horizontal collaboration within hierarchical organizations. As public participation and service-oriented digital governance become key issues in my country's pursuit of social governance innovation, scholars have found that government departments can use digital technologies to develop an automated, institutionalized, and procedural process for generating responses to public inquiries, thereby achieving a complete online public inquiry handling mechanism. Zhang Xuefeng, using word segmentation and clustering techniques, discovered that similar issues are repeatedly raised at different times, and proposed knowledge service suggestions: for a new issue, recommending solutions based on similarity to existing issues to resolve the problem. Yao Lan constructed an intelligent response system for a government-media integrated public inquiry platform. This system uses a topic-based automatic public message classification model to accurately categorize messages, combined with a classification-based automatic matching model to intelligently connect with functional departments. Finally, a collaborative response framework based on subject and content generates multi-dimensional composite response solutions, forming an integrated public inquiry service measure of "intelligent classification - accurate matching - collaborative response." However, while existing research has optimized the intermediate processing links of public inquiry responses through intelligent technologies, achieving some improvement in response efficiency and quality, it has not yet constructed a complete end-to-end closed-loop system for public inquiry processing, leaving room for further optimization in overall process efficiency and service quality. Meanwhile, existing research indicates that the effectiveness of online public opinion responses is closely related to the style of language expression. For example, scholars such as Song Yingfa point out that responders need to pay attention to the artistry of language, reflecting characteristics such as popular appeal, personalization, humanistic concern, and vividness in their expression. However, current research largely focuses on optimizing response generation efficiency and text quality, lacking in-depth exploration of the correlation mechanism between the artistry of language and public satisfaction. It is worth noting that artificial intelligence technology can not only improve response efficiency but also enhance the affinity of response texts through anthropomorphic expression.Based on this, the present invention believes that building an intelligent response template reference system by integrating historical response cases with information technology is a feasible path to improve the quality of government affairs services in the digital age.

[0117] In the wave of digital government construction and the digital transformation of public services, online government consultation, as a new interactive channel connecting the government and the public, has become an important tool for promoting the modernization of social governance. With the popularization of internet technology and the intelligent upgrading of government service platforms, the number of visits and inquiries to online government consultation platforms has grown rapidly, and the public's activity in participating in policy discussions and reflecting their demands through online channels has significantly increased. However, this high level of participation places higher demands on the timeliness, professionalism, and standardization of government responses. How to efficiently respond to the massive and fragmented public inquiries has become a key challenge in improving government credibility and governance effectiveness.

[0118] The response to online government inquiries is a core component of the entire process, and its quality directly determines public satisfaction and trust in government services. Existing research indicates that online responses need to simultaneously satisfy both task-oriented and non-task-oriented values: task-oriented values ​​emphasize the practicality of the response, such as the accuracy of facts being fundamental, and ensuring the authenticity and reliability of the information conveyed being key to winning public trust; non-task-oriented values ​​focus on the emotional and communicative effects of the response, such as explaining events, expressing concerns, and describing efforts made, all of which contribute to enhancing public acceptance and satisfaction. Furthermore, the timeliness, relevance, and completeness of the information in the response are also important factors affecting its quality. However, current online government inquiries are still primarily handled manually. While manual responses offer some flexibility, their limitations are becoming increasingly apparent. On the one hand, the highly concentrated nature of public inquiries leads staff to repeatedly answer similar questions, resulting in an inefficient work cycle; on the other hand, the quality of manual responses heavily relies on individual experience, posing risks such as inconsistent standards and non-standard expression.

[0119] 2.2 Research on Response Generation Based on Large Language Models

[0120] Intelligent question answering is a core subfield of natural language processing (NLP), aiming to understand and answer natural language questions posed by users. Traditional question answering systems typically rely on predefined rules and limited corpora, making them unable to handle complex multi-turn dialogues. Large language models (MLMs) are a class of deep learning models with a large number of parameters. In NLP, they learn language patterns, syntax, and semantics by processing massive amounts of text data, thereby understanding and generating human language. MLMs have demonstrated powerful capabilities in text understanding and generation, solving complex tasks and significantly improving the accuracy and efficiency of question answering systems, thus driving the development of intelligent question answering technology. MLMs excel in generating grammatically correct and semantically coherent text, dynamically adjusting generated content based on context, solving complex tasks such as long text generation, multi-turn dialogues, and style transfer. They also exhibit reasoning ability and creativity, opening up new possibilities for the practical application of intelligent question answering. In building question-answering systems based on Large Language Models (LLMs), research primarily focuses on Prompt Learning, Knowledge Graphs (KG), and Retrieval-Augmented Generation (RAG). These methods play a crucial role in constructing efficient and intelligent question-answering systems.

[0121] 1) Prompt-based learning:

[0122] Prompt learning is a method that enables models to better understand human questions by constructing prompts without altering the structure of the pre-trained model. Combining prompts with pre-trained models can improve their performance in intelligent question-answering systems. Empirical studies by Pu Qiumei et al., using manually constructed prompt templates, have verified the effectiveness and practicality of prompt learning mechanisms in text summarization tasks. Ni Xuanfan and Li Piji proposed a story generation framework integrating an external commonsense base with a prompt learning mechanism, significantly improving the logical coherence of the generated text. However, basic prompting strategies still have performance limitations when handling complex reasoning tasks. To address this challenge, the chain-of-thought strategy proposed by academia enhances the model's logical reasoning ability by guiding the model to explicitly generate intermediate reasoning steps. Denny Zhou et al. further proposed a task-decomposition-based chain-of-thought strategy, deconstructing complex problems into a sequence of operable sub-problems, thereby optimizing the performance of large language models in complex reasoning tasks. PanLu et al. proposed a multimodal reasoning method based on the Chain of Thought (CoT), which significantly improves the performance of scientific question answering tasks by training a language model to generate detailed explanations and interpretations as reasoning steps. ChancharikMitra et al. proposed the RetLLM-E method, which significantly improves the quality of large language models answering course-related questions in student forums by combining text retrieval and course-content-specific prompting strategies.

[0123] 2) Knowledge graph-based:

[0124] Knowledge Graph Question Answering (KGQA) utilizes the structured knowledge representation of knowledge graphs to enhance LLMs (Local Language Models) with external knowledge, improving the robustness and intelligence of question answering systems and making them perform better in domain-specific or common-sense reasoning. When faced with domain-specific knowledge, Dong Zhaoan et al. used GraphRAG technology to retrieve relevant entities, relationships, and attributes from a traditional Chinese medicine knowledge graph. They then combined the retrieved structured knowledge to enhance and optimize prompts, providing background knowledge support for the answers generated by the large language model and effectively solving the "illusion" problem of large models. Regarding the improvement of reasoning ability, Feng Guofeng et al. used knowledge graph technology and Neo4j graph database technology to construct a knowledge base and implemented user question parsing and intent recognition based on a Naive Bayes model, meeting the practical needs of interactive question answering in the field of tunnel disease management. However, existing knowledge graph question answering methods that enhance large language models still have many limitations: on the one hand, the construction of knowledge graphs requires a large amount of data, which is difficult in the field of political inquiry; on the other hand, the retrieval and reasoning processes of this method often consume a lot of time, resulting in low efficiency.

[0125] 3) Based on search enhancement:

[0126] Retrieval-Augmented Generation (RAG) is an emerging technology in the field of intelligent question answering. It enhances the capabilities of language models by retrieving relevant document fragments from external knowledge bases through semantic similarity calculation. In 2020, Gu et al. pioneered the introduction of retrieval mechanisms into the pre-training process, constructing an enhanced BERT model based on knowledge retrieval, and for the first time validating the effectiveness of the retrieval-generation architecture in open-domain question answering tasks. Subsequently, Lewis' team systematically proposed a generalized RAG framework, innovatively integrating non-parametric retrieval tools (such as DPR) and parametric generators (such as BART), extending the technology's application to multiple knowledge-intensive scenarios such as open-domain question answering and fact verification. Thus, RAG technology has successfully constructed a collaborative mechanism for knowledge acquisition and content generation, effectively alleviating the knowledge illusion problem in large models. Huang Bing et al. explored the application of technologies such as Naive RAG, Graph RAG, and Agent RAG in teaching, and demonstrated their feasibility in paleontology. Hai Jiali et al. used the GPT3.5 model as the base model and combined it with data optimization and retrieval-enhanced generation techniques to develop a question-answering system for TCM standard knowledge with semantic analysis, contextual association, and generation capabilities. These research results fully validate the effectiveness and practicality of retrieval-enhanced generation techniques in intelligent question-answering tasks within professional fields.

[0127] However, current research on the application of intelligent question-answering technology in the generation of online government responses still has significant shortcomings. Existing academic research mainly focuses on processing standardized long texts, which typically possess characteristics such as rigorous logic, clear structural hierarchy, and high degree of terminology standardization. In contrast, public government response texts, as informal language data spontaneously generated by citizens, exhibit typical non-standard linguistic features: at the lexical level, they show low usage of professional terminology and frequent colloquial expressions; at the syntactic level, they exhibit loose structure and weak logical connections; and at the discourse level, they suffer from disordered information organization and scattered semantic focus. These native text characteristics differ significantly from traditional research corpora, leading to an adaptive bottleneck for existing intelligent question-answering technologies in the task of generating government responses. To address this, this invention reconstructs a new intelligent question-answering method that effectively solves the problem of processing non-standard texts, providing theoretical and practical references for the automatic generation of online government responses and promoting the intelligent transformation and development of online government services.

[0128] 3. An Enhanced Generation Method for Online Government Affairs Response Retrieval Based on a Large Language Model

[0129] 3.1 Method Framework

[0130] Research has revealed that citizens' demands for government services exhibit thematic focus; that is, for similar issues, different members of the public will respond through online channels, resulting in multiple similar demands. If government staff could automatically generate responses based on historically similar demands, it would significantly improve response efficiency, ensure the professionalism and consistency of the responses, and increase public satisfaction. To address this issue, this invention proposes a retrieval-augmented generation method for online government service responses based on a large language model. This method uses a large language model as the foundation for response generation and employs a Retrieval-Augmented Generation (RAG) framework to enhance the generation effect. RAG is a technology that combines information retrieval and generation models, aiming to improve the accuracy, professionalism, and timeliness of generated content by dynamically introducing external knowledge bases. RAG technology mainly consists of three steps: retrieval, enhancement, and generation. Retrieval is the first step in the RAG process, extracting information related to the question from the knowledge base to provide context and knowledge support for subsequent generation. Then, the extracted information is used as input to the generation model, enhancing the model's understanding and answering ability, making the generated content richer and more accurate. Finally, a generative model is used to generate answers that meet user needs, ensuring output quality and accuracy.

[0131] like Figure 1The method proposed in this invention mainly consists of three modules: similar appeal case retrieval, response enhancement generation, and case library reconstruction and expansion. The similar appeal case retrieval module obtains the text of a citizen's appeal and converts it into a vector. Then, it uses a retrieval algorithm to retrieve several similar cases from the historical case library of online governance. The response enhancement generation module generates prompt words based on the retrieved similar cases and citizen appeals according to a pre-designed prompt template, and inputs these prompts into a large model, which then generates a governance response. The case library reconstruction and expansion module uses text clustering methods to reconstruct the case library into multiple sub-case libraries and expands the case library using incremental clustering methods to improve the efficiency of similar appeal case retrieval and case library expansion, thereby meeting the ever-increasing demand for massive online governance in the information age. The implementation methods of the three modules will be described in detail below.

[0132] 3.2 Search for similar claims

[0133] Online platforms for public consultation serve as a crucial channel for interaction between citizens and the government, allowing citizens to fully express their demands. However, due to varying individual expression preferences, colloquial language, complex and diverse demands, and varying levels of education, citizen demands, compared to standardized case texts such as legal documents, exhibit diverse expressions, complex logic, and strong emotional overtones, increasing the computational difficulty of retrieving similar cases. While citizen consultation texts possess these characteristics, they typically have clearly defined issues and demands. Therefore, this section focuses on the themes of these texts, proposing a vector representation method for consultation cases that integrates text themes, and then using this integrated text vector to retrieve similar demand cases. The method extracts keywords representing the main demands of citizens, integrates them into the original text of the demands, and then vectorizes them to highlight the main demands, thereby finding similar cases that better match the themes of the demands and improving the relevance of the generated responses.

[0134] 3.2.1 Text Vector Representation for Integrating Text Themes

[0135] (1) Generation of citizen appeal text vectors based on MacBERT

[0136] Text vectors, as numerical representations of text data, can capture semantic information and significantly improve the accuracy and efficiency of case recommendation systems. Compared to traditional keyword matching, vector matching mechanisms based on semantic similarity effectively reduce the high complexity of original text comparison through low-dimensional space operations, while dynamically adapting to the needs of expanding the case library. In recent years, pre-trained models, represented by BERT, have demonstrated outstanding performance in NLP tasks by learning general language representations from large-scale corpora, but their direct splitting of Chinese characters weakens semantic integrity. To address this, the MacBERT model introduces LTP word segmentation for Chinese word boundary recognition and pre-trains using a 5.4 billion-character corpus from sources such as Chinese Wikipedia. Combined with improved training strategies such as N-Gram masking and similar word replacement, it more accurately captures Chinese contextual features. Research shows that this model exhibits stronger semantic modeling capabilities in Chinese text understanding tasks, providing a more efficient semantic matching solution for case recommendation systems.

[0137] This invention utilizes the MacBERT model to transform citizen appeal texts into computable vectors, preparing for subsequent calculations. The algorithm flow for calculating the text vectors of a set of n citizen appeal texts C={c1,c2,...,cn} is shown in Table 1. The text set is iteratively input into the algorithm, and the text vector for each appeal is calculated separately. In each iteration, a appeal text ci is segmented, and the segmented text is then fed into the MacBERT model to obtain the output of the last hidden layer for each token. Finally, the vector obtained by average pooling the outputs of the hidden layers of all tokens is used as the vector representation of the text ci.

[0138] Table 1. Steps for generating citizen appeal text vectors based on MacBERT

[0139]

[0140] (2) Extraction and embedding of keywords in the appeal text

[0141] Keyword extraction and effective embedding of public appeal texts, as concise expressions of citizens' core demands, play a crucial role in improving the quality of similar case retrieval. However, selecting keywords that fully represent citizens' demands and embedding these keywords into the text of public appeals, transforming them into text vectors capable of similarity calculation, are problems that need to be addressed. This invention proposes a deep keyword extraction and embedding method that integrates KeyBERT. Compared to shallow models such as TF-IDF and TextRank, which rely on dictionaries or statistical features, KeyBERT automatically captures deep semantic relationships through a self-supervised learning mechanism. This avoids the limitations of manually constructing dictionaries and generates fixed-dimensional keyword vectors. This method generates sentence-level vectors using the MacBERT pre-trained model mentioned above, dynamically calculates the semantic similarity between word vectors and sentence vectors, selects highly relevant appeal keywords, and fuses their vector representations with the original text vectors to form a hybrid representation with enhanced appeal characteristics. The generated fused vectors exhibit stronger appeal identification capabilities in semantic similarity calculation, enabling more accurate matching of retrieved similar cases with citizens' concerns.

[0142] Table 2 illustrates the algorithm steps for keyword extraction and embedding from the petition text. The input set of citizen petition texts C={c1,c2,...,cn} is used. The algorithm iteratively calculates the vector after keyword embedding for each petition text. First, the petition text ci is segmented and stop words are removed to filter out meaningless words. Then, the first q keywords are obtained using the KeyBERT model and concatenated, with each keyword separated by a space, to form the keyword representation text ki of text ci. Then, ki is input into a text vector generation algorithm to obtain the keyword vector kvi. Finally, the sentence vector cvi of ci and the keyword vector kvi are fused using a method of summation followed by L2 norm normalization to obtain the new vector ckvi after keyword embedding of the petition text. L2 norm normalization of the text vectors can eliminate the differences between different text vectors due to different original scales and reduce the impact of outliers on similarity calculation. Most importantly, after L2 norm normalization, the Euclidean distance and cosine similarity of vectors are, to some extent, equivalent. This means that regardless of which metric (Euclidean distance or cosine similarity) is used in the similarity calculation, vectors normalized by L2 norm will give the same similarity score, while also reducing subsequent computation. Assuming cvi and kvi are both m-dimensional vectors, the fusion formula is as follows:

[0143] (1)

[0144] Table 2. Keyword Extraction and Embedding Algorithm Steps for Appeal Text

[0145]

[0146] Figure 2 A flowchart illustrating keyword embedding in a citizen's petition text (ci) is provided below. A citizen's petition text is transformed by the algorithm into a text vector capable of efficient comparison calculations. This vector embeds keyword features that fully represent the citizen's petition, enabling the fused vector to prominently describe the petition and improve recommendation performance in subsequent case studies. The following section will further introduce a similar case recommendation method based on the fused text vector.

[0147] 3.2.2 Similar Case Search

[0148] In the online public opinion case database, a responded historical case often includes information such as the content of the request, the time of the request, the content of the response, the time of the response, and the responding department. The content of the request fully expresses the citizen's needs; therefore, in similar case retrieval, this invention can retrieve cases by comparing the similarity between the target request and the content of the response cases. This invention employs a nearest-neighbor similarity case retrieval method, which is highly interpretable and allows for easy expansion of the case database without retraining the model. The nearest-neighbor similarity case retrieval method first transforms the citizen's request into a vector, then compares its cosine similarity with all case request vectors in the case database, retrieving the most similar cases to provide a reference for subsequent response generation. Clearly, the time complexity of the retrieval is directly affected by the size of the case database. With the popularization of internet technology and the improvement of citizens' political awareness, the number of online public opinion cases is constantly increasing, placing higher demands on retrieval efficiency. In this invention, the entire online public opinion case database is reconstructed into several sub-case databases. The distance between the target request and the center of each sub-case database is calculated to determine the target sub-case database. Finally, only the target sub-case database is retrieved to achieve similar case retrieval. The computational burden of retrieval has been reduced from traversing the entire case library to traversing only the target sub-case library, thereby improving the efficiency of similar case retrieval. The case library reconstruction method will be described in detail below.

[0149] 3.3 Case Library Restructuring and Expansion

[0150] To address the immense computational burden placed on retrieval by the ever-expanding database of public opinion cases, this section proposes a case database reconstruction method based on content clustering of demands. This method organizes the entire case database by theme, forming multiple sub-case databases with different themes. When performing similar case retrieval, only the similarity between the target demand and cases in a specific sub-case database is calculated, significantly reducing the number of comparison calculations and effectively improving retrieval efficiency. Furthermore, the reconstructed case database can be expanded based on incremental clustering, ensuring efficient and dynamic expansion.

[0151] 3.3.1 Reconstruction of the Case Library Based on Clustering of Demand Content

[0152] This invention clusters the textual content of petitions in a case library, and reorganizes the case library into multiple sub-case libraries based on the clustering results. This textual clustering of petition content in the case library also integrates information from different public opinion issues, helping relevant departments identify common issues of public concern. In this invention, the K-Means++ algorithm is used for textual clustering of petition content in the case library. The K-Means++ algorithm is a commonly used partition-based clustering algorithm designed to address the sensitivity of traditional K-Means algorithms to the selection of initial cluster centers. It has advantages such as simplicity, efficiency, strong interpretability, and applicability to large-scale datasets. This invention designs the similarity calculation method and convergence conditions according to the needs of online public opinion case retrieval. The calculation process of the K-Means++ algorithm is as follows:

[0153] 1) Randomly select the first cluster center: Randomly select a sample from the set as the first cluster center.

[0154] 2) Calculate distance and probability: For each sample in the dataset, calculate the shortest distance between it and the selected cluster centers, and calculate the probability that each sample will be selected as the next cluster center based on these distances. The farther a sample is from the selected cluster center, the higher its probability of being selected.

[0155] 3) Selecting new cluster centers: Based on the calculated probability, randomly select a new sample as the next cluster center. This process is repeated until k initial cluster centers have been selected.

[0156] 4) Calculate the class to which all samples belong: Calculate the distance between the sample and each cluster center, and assign it to the nearest class.

[0157] 5) Update cluster centers: For each cluster center, recalculate the mean similarity among all points to which it belongs, and use this mean as the new cluster center.

[0158] 6) Repeat steps 4 and 5 until the convergence condition is met, and the clustering is completed.

[0159] The K-Means++ algorithm typically has three convergence conditions:

[0160] 1) Cluster centers are stable, meaning that the cluster centers do not shift significantly after two consecutive iterations;

[0161] 2) Cluster members are stable, meaning that the cluster members belong to the same category in two consecutive iterations;

[0162] 3) Reach the preset maximum number of iterations.

[0163] Typically, this invention aims for stable clustering results, meaning the sample's category remains unchanged. However, as the case library grows, the convergence speed of K-Means++ clustering slows down. When clustering nears convergence, most sample categories stabilize, with only a few marginal samples potentially changing categories, leading to minor adjustments in cluster centers. Cases at the cluster edges usually have relatively unclear themes and are few in number; therefore, changes in the categories of a few marginal samples have a smaller impact on similar case retrieval. This invention considers both the efficiency and effectiveness of similar case retrieval, and the convergence condition for case text clustering is simply that the cluster centers are stable. During iteration, if the sum of changes in the cluster centers of all categories is less than a pre-set threshold θ, the cluster centers are considered stable, and the iteration stops upon reaching the convergence condition. Assume that after the t-th iteration, the cluster center vector of cluster Ci is... Become The change in cluster centers is shown in Formula 2. If the change in cluster centers of the k classes in the algorithm satisfies Formula 3, then clustering is complete. After clustering, based on the clustering results, the case library is organized into t sub-case libraries, and the cluster center vector ui of each sub-case library is recorded. When performing similar case retrieval, the cosine distance between the target appeal vector and the cluster center vectors of the t sub-case libraries is first calculated, and the sub-case library with the smallest distance is selected as the target sub-case library. Finally, the target sub-case library is traversed, the distances between the target appeal vector and all case appeal vectors are calculated and sorted, and the most similar cases are found for reference in subsequent response generation.

[0164] (2); (3)

[0165] 3.3.2 Case Library Expansion Based on Incremental Clustering

[0166] With the increasing number of citizens engaging in online governance, the number of online governance cases is constantly growing, making the efficient inclusion of new cases into the database a key issue. Incremental clustering algorithms can handle dynamically updated datasets, meaning that as the case database expands and updates, the algorithm can gradually adjust the clustering results without re-clustering the entire database. This significantly improves the efficiency of updating the case database. Compared to full clustering, incremental clustering reduces unnecessary redundant calculations, adjusting clustering only for newly added or changed cases, thereby reducing computational costs and resource consumption.

[0167] Integrating the concept of incremental clustering, this invention designs a case library expansion method based on incremental clustering. For a new online political consultation case to be added to the library, the content of the case's appeal is first extracted and vectorized as x*. Then, the cosine distance between x* and the cluster center of each sub-case library is calculated. The cluster center u with the smallest distance is found, and the new case is added to this sub-case library. Finally, the cluster center of this sub-case library is updated to u*. Typically, after updating the cluster centers, the category of a small number of samples located on the cluster edges may change. However, considering that a small number of edge cases will not have a significant impact on the retrieval of similar cases, the original category of edge cases is maintained when the cluster center offset is small. If the offset of the cluster center is greater than a pre-set threshold θ1, clustering iteration is triggered until the convergence condition is met. The case library is reconstructed based on the new clustering results, completing one round of case library expansion.

[0168] In practical applications, adding a single case doesn't significantly impact case recommendations. The case library can be continuously expanded through batch updates. That is, the case library is expanded in batches only after the system has accumulated n new cases. The distance between the request content vector and each cluster center is calculated sequentially, and all cases are placed into the category with the smallest distance before triggering clustering iterations until convergence is met. This effectively saves the overhead of frequent case library updates and improves the efficiency of case library expansion.

[0169] 3.4 Enhanced Response Generation

[0170] This section constructs a method for enhancing the generation of online government responses based on a large-scale pre-trained language model. Its core mechanism references the cognitive processing flow of human administrative writing. The method comprises two progressive processing stages: In the task parsing and strategy construction stage, the semantic features of the request content are first analyzed to clarify the task boundaries. Then, structured solution paradigms are extracted through similar request cases, ultimately integrating them into an operable response framework. In the content generation and knowledge integration stage, based on the established response framework, in-depth analysis of similar request cases is used to professionally expand the elements of the response content. This two-stage processing mode retains the planning characteristics of human writing while improving the adaptability of the language model to text generation in government scenarios through a historical case-driven mechanism.

[0171] Research has shown that for pre-trained language models based on dialogue interaction architectures (such as ChatGPT), a phased task planning strategy has significant advantages over single long-term instruction input. Specifically, deconstructing the overall task into a logically related sequence of sub-tasks and implementing progressive instruction input through multi-turn dialogue mechanisms can effectively improve the model's understanding depth and execution accuracy of complex tasks. This iterative guidance method reduces the cognitive load of a single instance, allowing the model to focus more on sub-objective optimization, thereby improving overall performance in the dynamic process of task decomposition and integration. Therefore, this section, based on the cognitive processing flow of human writing and the theory and technology of Prompt Engineering, achieves accurate generation of responses to political inquiries through precise analysis and prompt optimization of political questions. The following section will elaborate on the method of enhanced response generation.

[0172] 3.4.1 Context-Based Learning-Based Response Framework Generation Path

[0173] In-Context Learning (ICL), a novel machine learning paradigm in the field of large language models, is characterized by its ability to achieve knowledge transfer and task adaptation with a small number of demonstration samples without adjusting model parameters. This invention applies this method to the field of generating responses to online government inquiries. A template-based large model can learn new rules from a small number of case samples and effectively generalize to new government consultation texts. For different types of government consultation content (such as "problem reflection" and "consultation"), the response strategies differ significantly: the former requires an emphasis on emotional reassurance, while the latter requires enhancing information credibility. Therefore, before generating a response, each government consultation text needs to dynamically construct an adapted response framework across three dimensions: word order, emotional relevance, and response structure.

[0174] Specifically, the generated framework for responding to public inquiries should address the following issues step by step: 1) Citizens' demands often contain multiple specific issues, requiring separate analysis and responses. 2) Different types of demands require different response approaches. For example, complaint and suggestion texts should first investigate the complaint issue to clarify whether it targets the policy itself or its implementation, then determine existing solutions, and finally propose improvement suggestions and clarify the attitude of government staff. 3) The language used in government responses must meet the requirements of official format and style. Therefore, this invention, based on the concept of context learning, utilizes similar cases to generate a framework for responding to demands, providing framework support for the subsequent generation of response texts. Figure 3This paper demonstrates the response framework path of the present invention, which comprises two key components: the prompting engineering as the main architectural element of the template design, and the thought process output generated by the DeepSeek model under the paradigm of the present invention. In particular, the thought process output by the model not only demonstrates the reasoning process, but also provides interpretable evidence for the methodological design intent of the present invention.

[0175] The specific method for generating the response framework is as follows:

[0176] (1) Categorization and breakdown of requests. By inputting the text of the request and receiving structured prompts, suggestions are provided, such as... Figure 3 As shown, the large language model is guided to complete two core tasks: first, classifying demands and clarifying their core response requirements; second, deconstructing problems, identifying and breaking down the specific issues to be addressed within the demands. In this process, the invention clarifies the model's task positioning through role definition prompts, namely, as a government official, the model must provide professional responses to citizens' inquiries, and specifies in detail the specific task objectives to be completed at this stage.

[0177] (2) Response paradigm extraction. By inputting a set of similar cases and corresponding prompts, prompts such as Figure 3 As shown, the guided model performs the following core tasks for each case: First, it summarizes the response patterns of similar cases. Second, it extracts essential content, accurately refining the key elements that must be included in the response. During this process, the large language model can accurately identify and extract the core response elements from the cases.

[0178] (3) Standardize content elements. Provide prompts such as... Figure 3 As shown, the large language model is guided to adaptively generalize the inductive response paradigm and apply it to the current political demands to be addressed.

[0179] (4) Standardize the elements of expression. Hints include: Figure 3 As shown, by emphasizing key information such as word expression, tone, and intonation, the large language model is prompted to summarize the emotional and word expressions that should be followed in response based on similar cases.

[0180] 3.4.2 Refinement and Integration of Generating Responses to Public Inquiries

[0181] After completing the framework generation process, the next step is to fine-tune the content within the template. First, clarify the main goal of this refinement and integration: based on the generated response framework, fill in the corresponding positions with actual policy documents, phone numbers, email addresses, etc., to ensure the response is more specific, detailed, and reflects reality. Second, by integrating this information, ensure the coherence of the response, making it appear more natural and human-like, avoiding obvious traces of human-computer interaction. The specific refinement and integration process is as follows: Figure 4As shown, its core comprises two key components: the prompting engineering, which serves as the main architectural element of the prompt template during the refinement and integration process, and the DeepSeek model's refinement and integration compared to the framework during this process. This part can intuitively demonstrate the design philosophy of this process.

[0182] (1) Information Filling and Refinement. In this stage, based on each specific inquiry and the actual situation, relevant policy clauses, contact information, and other specific details need to be filled into the corresponding positions in the framework. For example, if the inquiry involves the implementation of a specific policy, the response should clearly cite the policy document number or specific clause; if the inquiry involves contacting relevant departments or personnel, accurate contact information such as telephone numbers and email addresses should be provided. The key to this process is accurate information filling to ensure the relevance and practicality of the response.

[0183] (2) Information Integration and Optimization. After filling in the information, the next step is to integrate the content. Hints include... Figure 4 As shown, this process requires rearranging fragmented information in a logical order to create a smooth and coherent response. During this process, special attention should be paid to the connection and transition of sentences to avoid information appearing too disjointed or disjointed. Furthermore, consistency in tone and style should be ensured, minimizing overly mechanical expressions to create a more natural sense of communication. Of particular note is the need to eliminate the traces of human-computer interaction in enumerative responses within the template while optimizing content, increasing semantic coherence and textual friendliness.

[0184] 4. Experimental Design and Results Analysis

[0185] 4.1 Experimental Design

[0186] This chapter's experiment uses Python to crawl government inquiries from the Luzhou City, Sichuan Province, China, from 2020 to 2023 that have received responses. The data includes three fields: inquiry content, responding unit, and response content. First, the data is cleaned by removing duplicates, meaningless characters, and meaningless content, resulting in 45,805 online government inquiries. 1,500 cases are randomly selected from this dataset to generate a test set, with the remaining 44,305 cases serving as the original case library. Based on this data, the following three experiments are designed:

[0187] (1) Similar case retrieval quality experiment: to analyze the retrieval quality of similar case retrieval methods proposed in the text.

[0188] (2) Experiment on similar case retrieval efficiency: Analyze the retrieval efficiency of the case library reconstruction method proposed in the text.

[0189] (3) Experiment on the quality of responses generated from public inquiries, and analysis of the quality of the text generated by the enhanced responses.

[0190] 4.2 Similar Case Retrieval Quality Experiment

[0191] In this experiment, the similar complaint case retrieval method proposed in this invention was used to retrieve four similar cases from each of the 1500 test case samples. This task is unsupervised, and the experimental data consists of real public opinion data crawled from the web, making it difficult to evaluate the retrieval results from the perspectives of precision and recall. Considering that the public's public opinion content is ultimately responded to by relevant government departments, the matching degree of the departments corresponding to the similar cases can be used to evaluate the retrieval quality. In addition, the degree of topic relevance can also measure the reliability of the retrieval results from one aspect. Therefore, this invention designs similar case retrieval quality indicators based on the matching degree of the response department and the keyword matching degree. RC__num represents the number of similar cases, and RC__simd represents the number of similar cases whose processing department is the same as the experimental sample Ci. The matching degree of the response department, dept__sim, can be used... Let CK__num represent the number of keywords in the sample's claim, and RCK__num represent the number of keywords that overlap between similar cases and the experimental sample. This can be represented using... This represents the keyword matching degree between a specific similar case and the experimental sample. The average keyword matching degree of RC__num similar cases. The keyword matching degree kw__sim can be used to represent the keyword matching degree of experimental sample C. The retrieval quality rec__qual of experimental sample C can be represented by the average of the response department matching degree and the keyword matching degree, and its calculation formula is shown in Formula 4.

[0192]

[0193] The advantage of the similar case retrieval method proposed in this invention lies in embedding citizens' demands into text vectors to highlight their main demands, thereby improving the effectiveness of similar case retrieval. To verify the promoting effect of topic embedding on similar case retrieval, this invention uses experimental results based on BERT and MacBERT vectors without demand topic embedding as two control groups. The selected BERT pre-trained model is bert-base-chinese, and the MacBERT pre-trained model is chinese-macbert-base. The key parameters of the two models are the same, as shown in Table 3.

[0194] Table 3 Pre-trained model parameters

[0195]

[0196] The experimental results of similar case retrieval quality are shown in Table 4. It can be seen that the online government affairs similar case retrieval method proposed in this invention performs best in both response department matching and keyword matching, achieving the highest retrieval quality index. The comparative advantages of MacBERT and BERT demonstrate that the pre-trained model trained on Chinese corpus has a significant advantage in text similarity calculation. Utilizing MacBERT's advantage in Chinese vector representation, after incorporating text theme keywords into the petition text, the response department matching improved by 0.04, the keyword matching improved by 0.09, and the retrieval quality index improved by 0.06. This clearly shows, as analyzed above, that incorporating text themes can effectively highlight citizens' main demands, thereby improving the quality of similar case retrieval.

[0197] Table 4 Comparison of Search Quality Results for Similar Request Cases

[0198]

[0199] To more intuitively demonstrate the effectiveness of the retrieval method proposed in this invention, this invention selects and displays the top three similar cases of three typical cases with significant characteristics: housing provident fund withdrawal (the government inquiry text is relatively long and the semantics are relatively complex), airport route planning (containing a large number of place names), and freight transport qualification certificate (the government inquiry text is relatively short).

[0200] 1) Housing provident fund withdrawal

[0201] The inquiry text reads: "Hello, I work at Tuzhu School in Luzhou, but my registered residence is in Chongqing, and I purchased a house in my registered residence location. Last time I consulted the Municipal Housing Provident Fund Center, they replied that I can withdraw my housing provident fund in Luzhou County if I purchased a house in my registered residence location. I have been paying my mortgage for a year now, and my housing provident fund contribution period has also exceeded one year. What procedures are required for my first withdrawal?" The inquiry department is the Municipal Housing Provident Fund Center. This inquiry text is quite long and semantically complex. The first three similar cases and their similarity are shown in Table 5. It can be seen that for long and semantically complex housing provident fund withdrawal inquiries, the recommendation algorithm can provide high-similarity and high-quality inquiry cases for the staff of the Municipal Housing Provident Fund Center to refer to.

[0202] Table 5: Recommendation Results of Similar Cases Regarding Housing Provident Fund Withdrawal Requests

[0203]

[0204] 2) Airport route planning

[0205] The inquiry text reads, "I would like to inquire when Luzhou Airport will introduce new airlines, or which airlines it plans to introduce, and whether new routes will be added this season. When are the routes to Xichang, Nanjing, Dali, Changchun, Shenyang, Xinyang, and Ordos expected to resume?" The inquiry department is Luzhou Airport (Group) Co., Ltd. This inquiry text is quite long, has a clear theme, and contains numerous place names. The first three similar cases and their similarity are shown in Table 6. It can be seen that for long inquiry texts on airport route planning containing many place name keywords, the recommendation algorithm can provide high-similarity and high-quality inquiry cases for the staff of Luzhou Airport Co., Ltd. to refer to. The route planning in the recommended cases is highly consistent with the route planning in the inquiry text.

[0206] 3) Freight transport operator qualification certificate

[0207] The inquiry text was titled "Does the current freight transport qualification certificate require continuing education and examinations every two years?", and the inquiry department was the Municipal Transportation Bureau. This inquiry text is short and contains clear keywords. The first three similar cases and their similarity are shown in Table 7. It can be seen that for short inquiry texts with a clear theme regarding freight transport qualification certificates, the recommendation algorithm can provide high-similarity and high-quality inquiry cases for the staff of the Municipal Transportation Bureau to refer to. The content of the recommended cases is highly consistent with the inquiry text. Combining objective and subjective evaluations of the recommendation quality, it can be concluded that the case vector representation with keyword embedding has a positive impact on case recommendation and can effectively...

[0208] Improve the quality of case recommendations.

[0209] Table 6. Recommendation Results of Similar Cases Regarding Airport Route Planning Needs

[0210]

[0211] Table 7: Recommended Results of Similar Cases Regarding Freight Transport Practitioner Qualification Certificate Requests

[0212]

[0213] 4.3 Experiment on similar case retrieval efficiency

[0214] When reconstructing the online public opinion case database, the number of clusters directly affects the efficiency of similar case retrieval. A larger number of clusters results in a smaller sub-case database after reorganization, and less similarity calculation is required within the sub-case database. However, for retrieval performance, a larger number of clusters means a smaller sub-case database for each recommendation, leading to poorer recommendation results. Therefore, determining the number of clusters is crucial for balancing efficiency and effectiveness during case database reconstruction. From the perspective of similar case retrieval applications, if the reconstructed sub-case databases each represent a clear type of demand, meaning clear boundaries between clusters, this will simultaneously guarantee retrieval efficiency and effectiveness. Clear cluster boundaries align with the goals of the K-Means++ algorithm. Therefore, this invention will select an appropriate number of clusters for case database reconstruction based on relevant performance indicators for cluster quality evaluation.

[0215] The method for selecting the number of clusters depends on the distance metric used between text vectors. When using Euclidean distance, common methods include the Kalinsky-Hallabus index (CH), sum of squared errors within groups (SSE), Davis-Boulding index (DBI), and interval statistics. If other distance metrics are used, the optimal number of clusters can be determined using the silhouette coefficient. The citizen appeal text vectors processed in this invention have all been standardized (L2 norm normalized to unit vectors). Since squared Euclidean distance and cosine distance are equivalent in cluster determination, this invention uses both the sum of squared errors within groups and the silhouette coefficient to select the number of clusters. The sum of squared errors within groups reflects the density of clusters, while the silhouette coefficient comprehensively measures both intra-cluster cohesion and inter-cluster separation; combining the two effectively determines the optimal number of clusters. By plotting the curves of both versus the number of clusters, the clustering effect can be visually observed.

[0216] like Figure 5 As shown, the silhouette coefficient peaks at a cluster size of 7, indicating high similarity within clusters, significant differences between clusters, and a reasonable clustering structure. The SSE of the elbow plot flattens out after a cluster size of 10, indicating that increasing the number of clusters no longer significantly improves cluster compactness. When the cluster size is 7, the elbow plot shows a significant decrease, and the silhouette coefficient reaches its maximum value, with a large decrease after 7. Therefore, considering all factors, the number of clusters in this experiment was determined to be 7. To further observe the clustering effect, this invention calculates the TF-IDF score for the top 50 keywords of each cluster, and uses the top 10 keywords of each cluster as the theme representation of that cluster. The clustering results and keywords are shown in Table 8, with the TF-IDF score in parentheses. The case library is divided into seven sub-case libraries: urban construction, urban transportation and public order, urban planning, housing, social security and housing provident fund, public services, professional qualifications, and education examinations. Each keyword exhibits clear thematic characteristics.

[0217] To verify the impact of appeal content clustering on case recommendation efficiency, this invention designed two sets of comparative experiments based on the full case database and the reconstructed case database. Ten similar cases were retrieved from 1500 cases in the test set, and the retrieval time was calculated. The results are shown in Table 9. It can be seen that the retrieval efficiency of the reconstructed case database is 5.39 times higher than that of the full case database, proving that similar cases based on appeal content clustering significantly improve recommendation efficiency.

[0218] 4.4 Experiment on the quality of government response generation

[0219] Current research still lacks significant evaluation metrics for automated response generation systems in the field of public opinion inquiry. Existing general retrieval-enhanced evaluation systems (such as RAGAs) have dual limitations when applied to the evaluation of public opinion inquiry texts: First, in terms of technology, existing methods suffer from insufficient structural adaptation. The core metrics of frameworks like RAGAs (such as answer fidelity and contextual relevance) are mainly geared towards fragment-level semantic alignment, and their evaluation mechanisms have two shortcomings: 1) a lack of quantitative standards for the global coherence of long texts (such as cross-paragraph logical connections and thematic consistency); 2) insufficient semantic parsing ability for unstructured public opinion inquiry content (such as multi-level nested administrative terms and policy references). Second, in terms of domain characteristics, general metrics fail to cover the core requirements of public opinion inquiry responses. Online policy inquiry texts have distinct government attributes, and their quality assessment requires comprehensive consideration of: 1) Compliance with administrative norms: including official document format standards (such as the "three elements" structure) and the accuracy of policy expression; 2) Emotional appropriateness: it is necessary to balance professionalism and accessibility, and avoid bureaucracy or excessive colloquialism; 3) Logical traceability: it requires that the policy basis, handling plan, and responsible department form a closed-loop argument; therefore, the text has constructed corresponding indicators for the characteristics of online policy inquiry texts.

[0220] Based on the evaluation framework of the RAGAS indicator system, this invention constructs a fine-grained hierarchical evaluation method to address the multi-issue characteristics of government inquiry texts.

[0221] (1) Factual relevance

[0222] FactCorrelation, a key indicator for evaluating the quality of online government responses, focuses on measuring the authenticity and reliability of the generated content, aiming to ensure that government responses can withstand factual verification and logical scrutiny. The core evaluation logic of this indicator lies in deeply exploring potential factual errors and logical contradictions in the response text, focusing on examining whether there are internal inconsistencies, reversed causality, or other problems within the response text at the content logic level. This indicator is calculated by comparing the response information with the basic facts and the text of the demands. The answer value is scaled to the range of (0,1), with higher values ​​indicating better factcorrelation.

[0223] If the generated response is consistent with basic facts and conforms to common sense, and there are no logical flaws in the text context, then the response is considered factually relevant. Specifically, the factual relevance evaluation system adopts a three-level assessment framework:

[0224] Text deconstruction layer: Considering the complex problem characteristics of political inquiry texts (i.e., a single political inquiry may contain multiple interrelated sub-problems), this invention uses a large language model to perform semantic segmentation on the political inquiry texts;

[0225] Statement Evaluation Layer: A multi-dimensional scoring system is set up for each deconstructed statement. The scoring mechanism has the following characteristics: 1) It uses continuous values ​​in the range of 0-1, with precision retained to four decimal places; 2) Each statement is evaluated independently to avoid scoring interference between questions;

[0226] Comprehensive Calculation Layer: After obtaining the scores for all statements, the average score is calculated to determine the overall score. This hierarchical evaluation method effectively solves two major problems in traditional evaluation systems when dealing with complex policy documents: 1) scoring bias caused by the coupling of multiple issues; 2) standardization difficulties caused by the variable number of issues.

[0227] Let R be the set of response information generated from the test set; G be the original response information in the test set; S be the appeal text in the test set; Ri be the response information corresponding to each case in each test set; Gi be the original response information corresponding to each case in the test set; n represent the number of cases in the test set; Si be the appeal text corresponding to each case in the test set; ϕI represent the relevance score of each statement of fact calculated using a large language model; and ∘ be the connection symbol. The specific calculation method is shown in Formula 5:

[0228]

[0229] (2) Relevance of answers

[0230] Answer relevance aims to assess the relevance and completeness of responses, determining whether they are relevant to the policy inquiry text, whether any questions have been omitted or unanswered, or whether they contain redundant information or irrelevant answers. The evaluation of answer relevance follows a three-tiered assessment framework based on factual consistency. The formula for this indicator is defined as the average semantic similarity between the policy inquiry text and a series of manually generated questions based on basic facts, as shown in Formula 6:

[0231]

[0232] Where R is the set of response information generated from the test set; S is the appeal text in the test set; Ri is the response information corresponding to each case in each test set; n represents the number of cases in the test set; Si is the appeal text corresponding to each case in the test set; ϕr represents the fact relevance score of each statement calculated using a large language model; ∘ is the connection symbol. The fact relevance score can be calculated in the following way.

[0233] (3) Attitude appropriateness

[0234] Attitudinal Appropriateness evaluates whether the response attitude is appropriate. Yao Lan's research points out that in government-media integrated question-and-answer platforms, the phenomenon of "mutual buck-passing" is an important factor affecting the evaluation of the quality of question-and-answer responses and should be considered as one of the key dimensions for measuring response attitude. In addition, some scholars believe that the use of empathetic language is widely regarded as one of the key indicators for measuring the quality of information services. Based on the above research, this paper specifically defines "attitudinal appropriateness" as: evaluating whether there is a buck-passing phenomenon in the response attitude, whether empathetic language is used to enhance emotional resonance, and measuring whether the text effectively conveys concern, empathy, and responsibility. Specifically, it includes two aspects: 1) No buck-passing: whether the contradiction is not shifted to issues that are indeed within the scope of responsibility, and whether the subsequent handling path is clearly defined; 2) Empathetic language: whether concerned language (such as "attached great importance" and "deeply apologized") is used.

[0235] Attitude appropriateness was assessed using a large language model, evaluating two aspects: "no shirking of responsibility" and "empathic language." This paper employs an equally spaced scoring method.

[0236] Table 10 Attitude Appropriateness Scoring Criteria

[0237]

[0238] Based on the above evaluation metrics, we used a large language model to evaluate the generated response information. Although the values ​​obtained from the large language model evaluation may fluctuate to some extent, multiple evaluations can reflect the true performance of the RAG application to a certain extent.

[0239] The choice of the generation model depends on its capabilities demonstrated in the evaluation metrics. In this paper, three large models, DeepSeek, Qwen, and Baichuan2, are used for comparison, and the models are made to generate responses through the method proposed in this paper. Qwen (Tongyi Qianwen) is a large language model developed by Alibaba Cloud, aiming to provide an efficient, open-source, and commercially available large language model that supports tasks such as text, code, and mathematical reasoning and performs well in multiple benchmark tests. Baichuan2 is a new generation of open-source large language model launched by Baichuan Intelligence. It has achieved the best results of the same size in authoritative Chinese and English benchmarks. Moreover, it has demonstrated excellent performance in tasks in specific fields (such as medicine and law), which provides strong support for applications in specific fields. In addition, in order to comprehensively evaluate the effectiveness of the method for generating responses to government affairs inquiries, the present invention also sets up a baseline model for comparative experiments. The baseline model uses the retrieval-enhanced generation method proposed in the present invention and directly generates responses only using the ChatGLM model according to the given response requirements. In this paper, the test set is used to evaluate the response generation, and the results are shown in Table 11:

[0240] Table 11 Comparative Experiment on the Response Quality of Models

[0241]

[0242] The experimental results of the present invention show that the DeepSeek model exhibits the best performance in all three evaluation metrics. This advantage mainly stems from the following two factors: First, DeepSeek shows stronger semantic understanding ability and analogical reasoning ability in logical reasoning tasks, can more accurately parse similar case information, and perform more logical reasoning and analysis under the guidance of a structured prompt template; Second, from the perspective of the model architecture, the DeepSeek model used in this experiment has 70 billion parameters, while the Baichuan2 and Qwen models used as the control group both have 7 billion parameters. Existing research shows that there is a positive correlation between the number of model parameters and reasoning performance. Therefore, a larger-scale model architecture provides a stronger reasoning ability foundation for DeepSeek, which is also verified in the experimental results. Therefore, the present invention selects DeepSeek as the model for generating responses to government affairs inquiries.

[0243] Meanwhile, the large language model, after using the retrieval enhancement generation method proposed in this paper, showed a significant performance improvement in policy response generation compared to the baseline model ChatGLM. Baichuan2, Qwen, and DeepSeek improved their factual relevance by 12.44%, 10.29%, and 19.37%, respectively, after using the response generation method; they achieved improvements of 6.43%, 5.13%, and 16.35% in answer completeness; and Baichuan2 and DeepSeek achieved improvements of 3.41% and 12.7% in attitude appropriateness, respectively. Experimental results show that although the Qwen model did not improve in attitude appropriateness, it made significant progress in factual relevance and answer completeness. Therefore, in summary, the method proposed in this paper can effectively utilize similar cases to generate online policy response texts under the guidance of prompt templates, and the generated results show significant improvements in content authenticity, information completeness, and sentiment expression.

[0244] To address the question of whether the retrieval and suggestion modules effectively improve the quality of model response generation, this invention evaluates the proposed retrieval enhancement generation method based on a constructed test set of cases and various metrics. Table 12 records the results of the ablation experiments conducted on the test set.

[0245] Table 12 Comparison of the Quality Results of Responses to Public Inquiries

[0246]

[0247] Experimental results show that, compared to the unenhanced base model, this hybrid approach demonstrates significant advantages in key evaluation metrics: factual relevance improved by 8.12%, response completeness by 3.8%, and attitude appropriateness by 3.61%. Specifically, compared to simply adding prompt templates or similar case studies, this method also improves in all three metrics. This performance improvement stems primarily from the following reasons: relevant clauses and cases ensure the policy basis and factual accuracy of the responses; simultaneously, the optimized prompt templates, through structured guidance, effectively integrate similar case responses into the generation process, standardizing the format, content organization, and expression of the responses. The combined use of these two approaches strengthens the factual basis of the generated content and improves the matching degree between the responses and the policy demands, thereby enhancing the overall response quality of the system.

[0248] In particular, the results of this study show that both the prompting module and the retrieval module play a key role in the response generation process: (1) The effectiveness of the prompting template. Compared with the unoptimized basic large model, the policy response generated using the prompting template of this study showed improvements in key evaluation indicators: factual relevance improved by 0.19%, answer completeness improved by 0.34%, and attitude appropriateness improved by 0.48%. This improvement is mainly attributed to the two core optimization mechanisms of the prompting template: First, by systematically analyzing the key information elements that the policy response should contain, the logic of the large model generation was enhanced, and the emotional expression of the policy response generation was improved, so that the template effectively guided the large model to achieve comprehensive improvement in terms of format standardization, content completeness, expression accuracy, and emotional appropriateness. Second, by adopting a progressive refinement strategy from "coarse" to "fine", the common problem of generality in the response of the large model was effectively improved. However, the improvement effect of factual relevance was not very obvious, mainly because the prompting template did not improve the "illusion" problem of the large model. (2) The effectiveness of the retrieval model. The responses generated based on similar cases improved by 7.14% in fact relevance, 3.54% in answer completeness, and 3.58% in attitude appropriateness compared to the pure large language model. This improvement stems from the fact that similar cases obtained from the retrieval model provide reliable "fact anchors" for the generation process, effectively constraining the generation space of the large language model.

[0249] 4.5 Discussion of Experimental Results

[0250] (1) Similar case retrieval quality experiment: Integrating text topics to improve retrieval accuracy

[0251] Experimental results show that the online public opinion similar case retrieval method proposed in this invention performs optimally in terms of response department matching and keyword matching, with retrieval quality indicators significantly higher than traditional methods. This conclusion verifies the theoretical analysis above: by integrating text topic features, the model can more accurately capture the core semantics of citizens' demands, thereby effectively highlighting key information in the demands. This topic fusion mechanism not only improves the comprehensiveness of case matching but also achieves a deeper understanding of the essence of the demands through proximity calculation in the semantic vector space, providing more accurate case references for subsequent public opinion response generation.

[0252] (2) Experiment on similar case retrieval efficiency: case database reconstruction achieves efficiency leap

[0253] Experiments on case database reconstruction demonstrate that the sub-case database constructed using text clustering improves similar case retrieval speed by 5.93 times. This efficiency improvement is mainly attributed to dividing the full case database into N topic sub-databases based on themes. During retrieval, only the target sub-database needs to be traversed instead of the entire database, significantly reducing computational complexity. Furthermore, the incremental clustering method dynamically updates the sub-database structure, accurately locating the most relevant sub-database for insertion when adding new cases, avoiding the exponential computational cost of re-clustering the entire database, and exhibiting good scalability.

[0254] (3) Experiment on the quality of government response generation: RAG technology enhances the reliability of responses

[0255] Experimental results on response generation show that responses generated based on Retrieval Augmentation Generation (RAG) technology improve fact relevance by 8.12%, completeness by 3.8%, and attitude appropriateness by 3.61% compared to the pure large model. This improvement stems from the dual advantages of the RAG framework: on the one hand, similar cases extracted from the case library by the retrieval module provide reliable fact anchors for the generation process, effectively constraining the generation space of the large model; on the other hand, by designing prompt templates to semantically fuse citizens' demands with similar cases, the generation model gains richer background information when understanding the context.

[0256] (4) Comprehensive discussion and future outlook

[0257] This invention verified the effectiveness of the proposed network response retrieval enhancement generation method integrating a large language model through three experiments. However, there is still room for improvement, and future research should focus on: dynamic knowledge update mechanism: establishing a real-time synchronization channel between policy texts and case libraries, automatically triggering and fine-tuning the generation model when new policies are released; multimodal information fusion: exploring the inclusion of structured data such as netizens' sentiment analysis and regional characteristics into the retrieval dimension to construct a more comprehensive demand representation space; and optimization of generation result stability: introducing reinforcement learning to constrain the generation process and guiding the model output to maintain higher consistency with official statements through a reward mechanism.

[0258] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for extracting and embedding keywords from a petition text, characterized in that, include The segmented appeal text c i The first q keywords are obtained by passing them into the KeyBERT model. The first q keywords are concatenated into a string to obtain the appeal text c. i The keywords represent text s; The keyword representation text s is converted into a keyword vector kv. i ; The request text c i Convert to sentence vector cv i ; The sentence vector cv i and keyword vector kv i The text is fused using a method of first summing and then L2 norm normalization to obtain the vector ckv after keyword embedding. i .

2. The text keyword extraction and embedding method according to claim 1, characterized in that, in, Regarding the request text c i Perform word segmentation and stop word removal to generate the segmented appeal text c i .

3. The text keyword extraction and embedding method according to claim 1, characterized in that, in, Keywords are separated by spaces.

4. The text keyword extraction and embedding method according to claim 1, characterized in that, Translate the sentence vector cv i and keyword vector kv i The fusion method, which involves summation followed by L2 norm normalization, is expressed by the following formula: 。 5. The text keyword extraction and embedding method according to claim 1, characterized in that, in, In this step, the text s is converted into a keyword vector kv. i ,include Perform word segmentation on text s; The segmented text s is fed into the MacBERT model to obtain the output of the last hidden layer for each token; The vector obtained by average pooling the outputs of the hidden layers of all tokens is used as the appeal text c. i The keywords represent the vector representation of text s, kv. i .

6. The text keyword extraction and embedding method according to claim 1, characterized in that, in, The step involves the request text c i Convert to sentence vector cv i ,include Regarding the request text c i Perform word segmentation; The segmented appeal text c i Input the MacBERT model and get the output of the last hidden layer for each token; The vector obtained by average pooling the outputs of the hidden layers of all tokens is used as the appeal text c. i sentence vector cv i .

7. The text keyword extraction and embedding method according to claim 6, characterized in that, in, The first q keywords are obtained, including the KeyBERT model automatically capturing deep semantic relationships through a self-supervised learning mechanism, and the sentence vectors generated by the MacBERT model. i Dynamically calculate word vectors and sentence vectors (CVs) i Based on semantic similarity, highly relevant keywords are selected.

8. A method for obtaining similar cases of appeal texts, characterized in that, include According to any one of claims 1-7, the claim vector after keyword embedding is calculated from the claim text; The target sub-case library is determined based on the cosine distance between the claim vector and the center of each sub-case library clustered based on the claim content. Similar cases are identified based on the cosine distance between the claim vector and the claim vectors of cases in the target sub-case library.

9. The application of the method according to any one of claims 1-8 in enhanced generation of network response retrieval.

10. The online response in the application described in claim 9 includes online political inquiry response, wherein, The response content is the content of the inquiry response.

Citation Information

Patent Citations

  • Law provision recommendation method based on multi-level matching and pre-training language model

    CN118427306A

  • Multi-modal knowledge representation method for information compliance governance

    CN119478617A

  • Multi-modal document retrieval enhancement generation method based on large model

    CN119988588A

  • Knowledge base enhancement-based large model class case recommendation method and system

    CN120123581A

  • Keyword recommendation model training method and apparatus, keyword recommendation method and apparatus, device, and medium

    WO2023155304A1