Government affair intelligent question and answer method, device and equipment and medium
By constructing a knowledge base for e-government project management, extracting semantic feature vectors of consultation questions, and using a large language model to generate accurate e-government responses, the problem of e-government systems being unable to understand complex semantics has been solved, and accurate responses have been achieved.
Patent Information
- Application Number
- CN202511273847.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-11-04
AI Technical Summary
Existing government service systems are unable to understand complex semantics, resulting in mismatches between responses to inquiries and user inquiries, or the inability to find matching responses.
By constructing a knowledge base for e-government project management, semantic feature vectors of consultation question samples are extracted, and accurate e-government responses are generated using a large language model.
It improves the accuracy of government responses, enabling the government to understand the contextual semantics of inquiries and generate precise answers.
Smart Images

Figure CN120892533A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to natural language processing technology, and in particular to a government affair intelligent question and answer method, device, equipment and medium. BACKGROUND
[0002] With the acceleration of the digital transformation of government affairs, the complexity of project management (such as multi-department cooperation, compliance requirements, etc.) is increasing, and there is an urgent need for related consulting services to improve the efficiency of government service and government informationization project management. Through natural language interaction, accurate, instant and standardized responses are achieved.
[0003] Most of the current government systems rely on keyword search or fixed template matching of user consultation questions and give answers. However, this approach cannot understand complex semantics, resulting in answers that do not match the user's consultation questions, or even cannot find matching answers to the questions. SUMMARY
[0004] The present application provides a government affair intelligent question and answer method, device, equipment and medium to improve the accuracy of government answers.
[0005] In a first aspect, the present application provides a government affair intelligent question and answer method, comprising:
[0006] obtaining a consultation question input by a user;
[0007] retrieving a target consultation question sample matching the semantics of the consultation question from a government informationization project management knowledge base, and determining a target text block corresponding to the target consultation question sample, wherein the government informationization project management knowledge base stores a plurality of consultation question samples in the government field, and a text block containing key information of the answer of the consultation question sample is segmented from the government informationization project knowledge data;
[0008] inputting the target text block into a large language model for processing, and generating a government answer matching the consultation question by the large language model.
[0009] Optionally, retrieving a target consultation question sample matching the semantics of the consultation question from a government informationization project management knowledge base, and determining a target text block corresponding to the target consultation question sample, comprises:
[0010] extracting the semantic features of the consultation question to obtain a semantic feature vector of the consultation question;
[0011] traversing the semantic feature vectors of all consultation question samples in the government informationization project management knowledge base, and calculating the cosine similarity between the semantic feature vector of the consultation question and the semantic feature vector of the consultation question sample;
[0012] The consultation question sample with a cosine similarity greater than a similarity threshold is taken as a target consultation question sample.
[0013] The text block corresponding to the target consultation question sample is taken as a target text block.
[0014] Optionally, the semantic feature of the consultation question is extracted to obtain a semantic feature vector of the consultation question, including:
[0015] The word segmentation in the consultation question is converted into vector expression to obtain a word embedding vector;
[0016] The position of the word segmentation in the consultation question in the consultation question is converted into vector expression to obtain a position embedding vector;
[0017] The word embedding vector and the position embedding vector are fused to obtain a fusion vector;
[0018] The fusion vector is input into an encoding layer for processing to obtain the semantic feature vector of the consultation question, and the encoding layer includes a plurality of stacked multi-head attention units, and the output of a previous multi-head attention unit is taken as the input of a subsequent multi-head attention unit.
[0019] Optionally, before obtaining the consultation question input by the user, the method further includes:
[0020] Obtaining government informationization project knowledge data;
[0021] Extracting a consultation question sample and a text block associated with the consultation question sample from the government informationization project knowledge data;
[0022] Storing the consultation question sample and the associated text block into a government informationization project management knowledge base.
[0023] Optionally, extracting a consultation question sample and a text block associated with the consultation question sample from the government informationization project knowledge data includes:
[0024] Preprocessing the government informationization project knowledge data to obtain text data of the government informationization project knowledge data, and the preprocessing includes data cleaning and format conversion;
[0025] Splitting the text data by using recursive character segmentation to split the text data into a plurality of text blocks with a specified length;
[0026] Extracting a target sentence containing a potential consultation answer from the text block;
[0027] Extracting key information of the consultation answer from the target sentence;
[0028] Fill the key information into the pre-constructed consultation question template to obtain a consultation question sample;
[0029] Extract semantic features of the consultation question sample to obtain a semantic feature vector of the consultation question sample;
[0030] Correlate the semantic feature vector of the consultation question sample with the text block.
[0031] Optionally, after obtaining the government informationization project knowledge data, further comprising:
[0032] Taking a provincial government informationization project management knowledge field as a trunk, a project type as a branch, and a knowledge type classification as a leaf, a government informationization project management knowledge field label tree is constructed.
[0033] Optionally, after extracting the consultation question sample from the government informationization project knowledge data, further comprising:
[0034] Classify the consultation question sample according to the government informationization project management knowledge field label tree.
[0035] In a second aspect, the present application further provides a government intelligent question and answer device, comprising:
[0036] A consultation question acquisition module is configured to acquire a consultation question input by a user;
[0037] A semantic matching module is configured to search a target consultation question sample matched in semantics with the consultation question from a government informationization project management knowledge base, and determine a target text block corresponding to the target consultation question sample, wherein the government informationization project management knowledge base stores a plurality of consultation question samples in a government field, and a text block containing key information of an answer of the consultation question sample is segmented from government informationization project knowledge data;
[0038] A reply generation module is configured to input the target text block into a large language model for processing, and generate a government reply matched with the consultation question by the large language model.
[0039] In a third aspect, the present application further provides an electronic device, comprising:
[0040] One or more processors;
[0041] A storage device is configured to store one or more programs;
[0042] When the one or more programs are executed by the one or more processors, the one or more processors implement the government intelligent question and answer method provided in the first aspect of the present application.
[0043] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the government affair intelligent question and answer method according to the first aspect of the present application.
[0044] The government affair intelligent question and answer method provided by the present application acquires a consultation question input by a user, retrieves a target consultation question sample matched with the semantic of the consultation question from a government informationization project management knowledge base, and determines a target text block corresponding to the target consultation question sample, wherein the government informationization project management knowledge base stores a plurality of consultation question samples in a government field, and a text block containing key information of an answer of the consultation question sample is segmented from a government informationization project knowledge data, and the target text block is input into a large language model for processing, and a government reply matched with the consultation question is generated by the large language model. The present application retrieves the target consultation question sample matched with the semantic of the consultation question through semantic retrieval, fully understands the context semantic of the consultation question, inputs the target text block containing the key information of the answer of the target consultation question sample into the language model for processing, and the large language model performs logical reasoning and information integration based on the government informationization project management knowledge base to generate an accurate and context-aware government reply, which can improve the accuracy of the government reply.
[0045] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0047] Figure 1 A flow chart of a government affair intelligent question and answer method provided by the present application;
[0048] Figure 2 A structural schematic diagram of a government affair intelligent question and answer device provided by the present application;
[0049] Figure 3 A structural schematic diagram of an electronic device provided by the embodiments of the present application.
[0050] The above drawings have shown the specific embodiments of the present application, and more detailed descriptions will be given in the following. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application by any means, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Implementation
[0051] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0052] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0053] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.
[0054] Figure 1 The flowchart illustrates a government affairs intelligent question-answering method provided by this invention. This embodiment is applicable to understanding users' inquiries at the semantic level and generating accurate responses by combining a large language model. This method can be executed by the government affairs intelligent question-answering device provided by this invention. This device can be implemented in software and / or hardware, and is typically configured in an electronic device, such as... Figure 1 As shown, this intelligent government Q&A method includes the following steps:
[0055] S101. Obtain the user's input inquiry.
[0056] In this embodiment of the invention, the consultation question can be text directly entered by the user, or it can be extracted from other content entered by the user, such as voice or images. The consultation question can be extracted from the voice or images. This invention does not limit this.
[0057] S102. Retrieve a target consultation question sample that semantically matches the consultation question from the e-government project management knowledge base, and determine the target text block corresponding to the target consultation question sample.
[0058] In the embodiments of the present application, a government informationization project management knowledge base can be constructed in advance, and the government informationization project management knowledge base stores a plurality of consultation question samples in the government field and text blocks containing key information of answers to the consultation question samples segmented from the government informationization project knowledge data. Exemplarily, one text block can correspond to one consultation question sample or a plurality of consultation question samples, and the present application does not make any limitation here.
[0059] In some embodiments of the present application, the process of constructing the government informationization project management knowledge base is as follows:
[0060] 1. Obtain government informationization project knowledge data.
[0061] In the embodiments of the present application, for each government informationization project, the corresponding knowledge data of the project is obtained, which includes but is not limited to document (Word, PDF, Excel, PPT, etc.), picture and other types of data related to the project. The obtaining approach can include: connecting the enterprise knowledge government informationization project management knowledge base through the API interface, and importing by the administrator through the UI interface, so as to realize data aggregation and centralized storage in the system government informationization project management knowledge base, and prepare for subsequent analysis, processing.
[0062] In some embodiments of the present application, after obtaining the government informationization project knowledge data, the government informationization project knowledge data can also be analyzed to construct a government informationization project management knowledge field label tree with the provincial government informationization project management knowledge field as the trunk, the project type as the branch and the knowledge type classification as the leaf. Exemplarily, first, define the trunk to determine the first-level theme "provincial government informationization project management knowledge field". Then, proceed in the order of "trunk-->branch-->leaf". The branch is first subdivided according to "project type", including "software development project", "infrastructure project", "operation project" and "operation and maintenance project"; and then further refined according to dimensions such as "project approval method", "scale" and "whether involving secret". The leaf layer is classified according to specific knowledge type, including "policy document", "process system", "template", "example" and "experience and lesson". The knowledge field label also supports manual calibration, and the administrator can add, delete or modify, so as to finally form a provincial government informationization project management exclusive knowledge field classification system.
[0063] 2. Extract consultation question samples and text blocks associated with the consultation question samples from the government informationization project knowledge data.
[0064] In the embodiments of the present application, the government informationization project knowledge data is analyzed, and the consultation question samples and the text blocks associated with the consultation question samples (i.e. the text blocks containing key information of answers to the consultation question samples) are extracted from the government informationization project knowledge data.
[0065] In some embodiments of the present application, the specific process of extracting the consultation question sample and the text block is as follows:
[0066] 2.1, pre-process the government informationization project knowledge data to obtain text data of the government informationization project knowledge data, the pre-processing includes data cleaning and format conversion.
[0067] For example, first, the government informationization project knowledge data is subjected to data cleaning, and all the government informationization project knowledge data is subjected to de-duplication and abnormality processing, including deleting duplicate samples, repairing missing values and abnormal values. Then, the heterogeneous knowledge data is extracted into a unified text format (TXT), for example, the picture type knowledge data is converted by means of OCR technology.
[0068] 2.2, the text data is cut by recursive character segmentation, and the text data is cut into multiple text blocks of specified length.
[0069] Since the large language model has a length limit in the training and application process, if the length limit is exceeded, the large language model will discard the part that exceeds the length limit, resulting in the loss of input information, thereby affecting the accuracy of the answer. Therefore, in the embodiments of the present application, the text data is intelligently cut by recursive character segmentation, and the text data is cut into multiple text blocks of specified length. The recursive character segmentation automatically segments the text data according to chapter marks, line breaks, periods, commas and other delimiters. Specifically, first, the text data is segmented according to chapters, and each chapter content is cut. Then, for the content of each chapter, the content is segmented according to paragraphs according to line breaks, and each paragraph is cut. Then, the paragraphs are segmented into sentences according to periods, and finally, the sentences are segmented into short sentences according to commas. In the segmentation process, if the length of the segmented content is greater than the specified length, further segmentation is continued until there is no delimiter in the segmented content. If the length of the segmented content is less than the specified length, the segmented content is merged with the next sentence. In this way, the semantic relevance can be ensured.
[0070] 2.3, extracting the target sentence of the potential consultation answer from the text block.
[0071] For each text block obtained by the above segmentation, the target sentence containing the potential consultation answer is extracted from the text block. For example, if the text block mentions "the change of the scope of pre-acceptance conformity review regulations cannot exceed 10%", it can be understood that there is a target sentence of the consultation answer about "pre-acceptance conformity review regulations", "scope change rate calculation method" and "scope control method". For example, the natural language processing technology can be used to understand the semantics of the text block, and the target sentence of the potential consultation answer is extracted from the text block, which will not be described here.
[0072] 2.4, extract the key information of the consultation answer from the target sentence.
[0073] In the embodiment of the application, for the determined target sentence, the key information of the consultation answer is extracted from the target sentence, and the key information includes entities (such as character names, stage names, system names, process names, etc.), time (such as pre-acceptance conformity review), attributes (such as pre-acceptance necessary activities), etc. The goal of information extraction is to extract useful information from raw data and convert it into a structured format for further data analysis, machine learning, and other tasks. For example, in the embodiment of the application, a rule-based method can be used to identify and extract information through pre-defined rules or patterns, or a template-based method can be used to extract information through pre-defined templates, which can be fixed structures or adjustable templates, or a feature-based method can be used to automatically identify and extract information through machine learning algorithms, or a deep learning-based method can be used to extract information through the construction of deep neural networks, which is not limited in the application.
[0074] 2.5, fill the key information into the pre-constructed consultation question template to obtain a consultation question sample.
[0075] In the embodiment of the application, a consultation question template library can be pre-constructed. For example, according to the characteristics of provincial government informationization project fields, a library containing various consultation question templates can be constructed. The consultation question template can be open or closed. For example, in the field of project management, there can be “How to solve [project type] [problem description]?” (open) and “[character name] whether to participate in [management activity]?” (closed) templates.
[0076] After the key information is extracted, the key information is matched with the consultation question template, and then filled into the matched consultation question template to obtain a consultation question sample. For example, the extracted key information is “project type” is “software development project” and “problem description” is “scope creep”, which can be filled into the template “How to solve [software development project] [scope creep]?” to generate a consultation question sample “How to solve software development project [scope creep]?” The granularity of the question can be configured and adjusted by parameters, and one text block can be set to generate one question or multiple consultation question samples.
[0077] In the embodiment of the application, the consultation question sample can also be de-duplicated and screened to remove duplicate questions and screen according to the representativeness, importance, and other standards of the questions. For example, if multiple text blocks generate similar questions, one of the more concise questions can be selected to be retained.
[0078] In the embodiment of the present application, after the consultation question samples are extracted from the government informationization project knowledge data, the consultation question samples can also be classified according to the government informationization project management knowledge field label tree. The generated consultation question samples are classified and labeled according to the divided field label tree architecture, facilitating subsequent management and retrieval in the knowledge base.
[0079] 2.6, extract the semantic features of the consultation question samples to obtain the semantic feature vectors of the consultation question samples.
[0080] In the embodiment of the present application, the semantic features of the consultation question samples are extracted to obtain the semantic feature vectors of the consultation question samples. For example, a semantic feature extraction network model can be used to extract the semantic features of the consultation question samples, which will not be described here.
[0081] 2.7, associate the semantic feature vectors of the consultation question samples with the text blocks.
[0082] In the embodiment of the present application, the semantic feature vectors of the consultation question samples are associated with the text blocks.
[0083] 3, store the consultation question samples and the associated text blocks into the government informationization project management knowledge base.
[0084] In the embodiment of the present application, the semantic feature vectors of the consultation question samples and the associated text blocks are stored into the government informationization project management knowledge base.
[0085] In the embodiment of the present application, the semantic retrieval method is used to retrieve the target consultation question samples that match the semantics of the consultation questions from the government informationization project management knowledge base.
[0086] The existing intelligent question and answer based on large language model mainly faces the life, education, medical and other livelihood related and open and transparent knowledge question and answer services, and has not covered the government informationization project management field. The present application builds a government informationization project management knowledge base to provide government informationization project knowledge data for the large model, which can provide accurate replies for the consultation in the government informationization project management field.
[0087] In addition, the existing knowledge management and sharing in the government field has bottlenecks, although a large number of project management documents are accumulated, when the existing knowledge base is mostly unstructured data such as PDF, Word or scanned copies, the knowledge is dispersed, resulting in low efficiency of manual retrieval. If the file is directly given to AI learning and reference, the Q&A effect of AI for large files is poor. Moreover, AI itself has context limitations, and cannot generate too many questions at a time, and batch processing will generate repeated questions. The present application can improve the retrieval efficiency, facilitate batch processing of consultation questions and improve the efficiency of question and answer by structuring the unstructured data, extracting consultation question samples and associated text blocks, and constructing a tree-shaped government informationization project management exclusive knowledge field classification system.
[0088] In some embodiments of the present application, the above step S102 comprises the following sub-steps:
[0089] S1021, extracting semantic features of the consultation question to obtain a semantic feature vector of the consultation question.
[0090] In the embodiments of the present application, the semantic feature extraction network model can be used to extract the semantic features of the consultation question to obtain the semantic feature vector of the consultation question.
[0091] In some embodiments of the present application, the BERT (Bidirectional Encoder Representations from Transformers) model is used to extract the semantic features of the consultation question. The traditional language model processes the text in sequence, from left to right or from right to left, and this method limits the perception of the model to the direct context before the target word. BERT uses a bidirectional method to consider the left and right context of the word segmentation in the sentence, rather than analyzing the text in sequence, and BERT simultaneously views all word segmentation in the sentence, and the specific process is as follows:
[0092] 1. converting the word segmentation in the consultation question into vector representation to obtain a word embedding vector.
[0093] In the embodiments of the present application, the input layer of the BERT model performs word segmentation on the consultation question, and performs word embedding (Token Embedding) operation on the word segmentation, converts the word segmentation in the consultation question into vector representation, and obtains a word embedding vector. Wherein, the word embedding refers to representing each word with the encoding in the dictionary library, and converting it into a fixed-dimensional word embedding vector.
[0094] 2. converting the position of the word segmentation in the consultation question into vector representation to obtain a position embedding vector.
[0095] In the embodiment of the present application, the input layer of the BERT model performs position embedding operation on the word segmentation in the consultation question, converts the position of the word segmentation in the consultation question into vector expression, and obtains a position embedding vector. Position embedding refers to numbering each word segmentation in the consultation question, and then each number corresponds to a vector. By combining the position vector and the word vector, a certain position information is introduced to each word segmentation.
[0096] 3. Fuse the word embedding vector and the position embedding vector to obtain a fusion vector.
[0097] In the embodiment of the present application, the word embedding vectors of all word segmentations are spliced according to the order of the word segmentations in the consultation question, and the position embedding vectors of all word segmentations are spliced according to the order of the word segmentations in the consultation question. Then, the two spliced vectors are aligned and added at corresponding positions to obtain a fusion vector.
[0098] 4. The fusion vector is input into the encoding layer for processing to obtain a semantic feature vector of the consultation question. The encoding layer includes a plurality of stacked multi-head attention units, and the output of a previous multi-head attention unit is used as the input of a subsequent multi-head attention unit.
[0099] In the embodiment of the present application, the fusion vector is input into the encoding layer of the BERT model for processing. The encoding layer of the BERT model encodes the fusion vector based on a multi-head self-attention mechanism to obtain a semantic feature vector of the consultation question. The encoding layer of the BERT model includes N layers of multi-head attention units stacked in sequence, where N is a positive integer greater than or equal to 2. The output of a previous multi-head attention unit is used as the input of a subsequent multi-head attention unit, and the output of the last multi-head attention unit is used as the semantic feature vector of the consultation question.
[0100] For example, the multi-head attention unit includes a multi-head attention layer, a normalization layer, a full connection layer, and a normalization layer. The multi-head attention layer processes the input vector based on a multi-head attention mechanism to obtain an attention vector. The normalization layer normalizes the attention vector to obtain a first normalized vector. Then, the first normalized vector and the corresponding elements of the input vector of the multi-head attention layer are added to obtain a second fusion vector. The second fusion vector is input into the full connection layer for full connection mapping to obtain a full connection vector. The normalization layer normalizes the full connection vector to obtain a second normalized vector. Then, the second normalized vector and the corresponding elements of the second fusion vector are added to obtain the output vector of the multi-head attention unit.
[0101] Exemplarily, in the foregoing step of extracting the semantic features of the consultation question sample, the BERT model can also be used to extract the semantic features of the consultation question sample, and details are not repeated herein.
[0102] S1022. The semantic feature vectors of all consultation question samples in the government informationization project management knowledge base are traversed, and the cosine similarity of the semantic feature vector of the consultation question and the semantic feature vector of the consultation question sample is calculated.
[0103] In the embodiment of the present application, the semantic feature vectors of all consultation question samples in the government informationization project management knowledge base are traversed, and the cosine similarity of the semantic feature vector of the consultation question and the semantic feature vector of the consultation question sample is calculated.
[0104] S1023. The consultation question sample with a cosine similarity greater than a similarity threshold is taken as a target consultation question sample.
[0105] In the embodiment of the present application, the consultation question sample with a cosine similarity greater than a similarity threshold is taken as a target consultation question sample. Exemplarily, if there are multiple consultation question samples with a cosine similarity greater than a similarity threshold, the cosine similarity can be arranged in descending order, and the top 5 are taken as target consultation question samples.
[0106] S1024. The text block corresponding to the target consultation question sample is taken as a target text block.
[0107] In the embodiment of the present application, the text block associated with the target consultation question sample in the government informationization project management knowledge base is taken as a target text block. As described above, if there are multiple target consultation question samples, there are multiple target text blocks, and the multiple target text blocks can be arranged in descending order according to the cosine similarity.
[0108] S103. The target text block is input into a large language model for processing, and the government reply matched with the consultation question is generated by the large language model.
[0109] In the embodiment of the present application, the API interface of the large language model is called, the target text block is input into the large language model for processing, the natural language processing capability is exerted, the logical reasoning and information integration are performed based on the government informationization project management knowledge base, and an accurate and context-aware government reply is generated.
[0110] Exemplarily, for the case where there are multiple target text blocks, one government reply can be generated for each target text block, and the multiple government replies can be arranged in descending order according to the cosine similarity, the top one of the multiple government replies is taken as a preferred government reply and fed back to the user, and the other government replies are taken as candidate government replies and pushed to the user in order according to the ranking when the user is not satisfied with the preferred government reply.
[0111] The government affair intelligent question answering method provided by the application obtains an inquiry question input by a user, retrieves a target inquiry question sample matched with the semantic of the inquiry question from a government informationization project management knowledge base, and determines a target text block corresponding to the target inquiry question sample, wherein the government informationization project management knowledge base stores a plurality of inquiry question samples in the government field, and a text block containing key information of an answer of the inquiry question sample is segmented from government informationization project knowledge data, the target text block is input into a large language model for processing, and a government reply matched with the inquiry question is generated by the large language model.
[0112] Figure 2 The structure diagram of the government affair intelligent question answering device provided by the application is shown in Figure 2 The government affair intelligent question answering device comprises:
[0113] The inquiry question acquisition module 201 is configured to acquire an inquiry question input by a user.
[0114] The semantic matching module 202 is configured to retrieve a target inquiry question sample matched with the semantic of the inquiry question from a government informationization project management knowledge base, and determine a target text block corresponding to the target inquiry question sample, wherein the government informationization project management knowledge base stores a plurality of inquiry question samples in the government field, and a text block containing key information of an answer of the inquiry question sample is segmented from government informationization project knowledge data.
[0115] The reply generation module 203 is configured to input the target text block into a large language model for processing, and generate a government reply matched with the inquiry question by the large language model.
[0116] In some embodiments of the application, the semantic matching module 202 comprises:
[0117] The first semantic feature extraction submodule is configured to extract the semantic features of the inquiry question to obtain a semantic feature vector of the inquiry question.
[0118] The similarity calculation submodule is configured to traverse the semantic feature vectors of all inquiry question samples in the government informationization project management knowledge base, and calculate the cosine similarity between the semantic feature vector of the inquiry question and the semantic feature vectors of the inquiry question samples.
[0119] a target question sample determination sub-module, configured to determine a consultation question sample with a cosine similarity greater than a similarity threshold as a target consultation question sample;
[0120] a target text block determination sub-module, configured to determine a text block corresponding to the target consultation question sample as a target text block.
[0121] In some embodiments of the present application, the semantic feature extraction sub-module comprises:
[0122] a word embedding unit, configured to convert a word segmentation in the consultation question into a vector expression to obtain a word embedding vector;
[0123] a position embedding unit, configured to convert a position of the word segmentation in the consultation question into a vector expression to obtain a position embedding vector;
[0124] a vector fusion unit, configured to fuse the word embedding vector and the position embedding vector to obtain a fusion vector;
[0125] an encoding unit, configured to input the fusion vector into an encoding layer for processing to obtain a semantic feature vector of the consultation question, the encoding layer comprising a plurality of stacked multi-head attention units, an output of a previous multi-head attention unit serving as an input of a next multi-head attention unit.
[0126] In some embodiments of the present application, the government affair intelligent question answering device further comprises:
[0127] a knowledge data acquisition module, configured to acquire government informationization project knowledge data before acquiring a user-input consultation question;
[0128] an extraction module, configured to extract a consultation question sample and a text block associated with the consultation question sample from the government informationization project knowledge data;
[0129] a storage module, configured to store the consultation question sample and the associated text block into a government informationization project management knowledge base.
[0130] In some embodiments of the present application, the extraction module comprises:
[0131] a preprocessing sub-module, configured to pre-process the government informationization project knowledge data to obtain text data of the government informationization project knowledge data, the preprocessing comprising data cleaning and format conversion;
[0132] a segmentation sub-module, configured to segment the text data into a plurality of text blocks of a specified length by using recursive character segmentation;
[0133] An extraction submodule is configured to extract a target sentence containing a potential consultation answer from the text block;
[0134] An extraction submodule is configured to extract the key information of the consultation answer from the target sentence;
[0135] A filling submodule is configured to fill the key information into a pre-constructed consultation question template to obtain a consultation question sample;
[0136] A second semantic feature extraction submodule is configured to extract semantic features of the consultation question sample to obtain a semantic feature vector of the consultation question sample;
[0137] An association submodule is configured to associate the semantic feature vector of the consultation question sample with the text block.
[0138] In some embodiments of the present application, the government affair intelligent question answering device further comprises:
[0139] A label tree construction module is configured to, after obtaining government informationization project knowledge data, construct a government informationization project management knowledge field label tree with a provincial government informationization project management knowledge field as a trunk, a project type as a branch, and a knowledge type classification as a leaf.
[0140] In some embodiments of the present application, the government affair intelligent question answering device further comprises:
[0141] A question sample classification module is configured to, after extracting a consultation question sample from the government informationization project knowledge data, classify the consultation question sample according to the government informationization project management knowledge field label tree.
[0142] The above-mentioned government affair intelligent question answering device can execute the government affair intelligent question answering method provided by the foregoing embodiments of the present application, and has the corresponding functional modules and beneficial effects of executing the government affair intelligent question answering method.
[0143] Figure 3 A structure schematic diagram of an electronic device is provided for the embodiments of the present application. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (such as headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections, and their functions, as well as their implementation, are merely examples and are not intended to limit the implementations described and / or claimed herein.
[0144] As Figure 3As shown, the electronic device includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for operation of the electronic device can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0145] Various components in the electronic device are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0146] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the government intelligent question answering method.
[0147] In some embodiments, the government intelligent question answering method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the government intelligent question answering method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the government intelligent question answering method by any other appropriate means, such as by means of firmware.
[0148] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0149] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program
[0150] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0151] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0152] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), blockchain network, and the Internet.
[0153] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0154] The embodiments of the present application further provide a computer program product, comprising a computer program which, when executed by a processor, implements the government affair intelligent question and answer method provided in any of the embodiments of the present application.
[0155] The computer program code can also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce the computer implemented process such that the
[0156] It should be understood that the various forms of flow shown in the figures are illustrative examples of implementing the steps of the application. Several steps have been described as being performed by a single device. It will be understood that these steps can be performed by a single device or multiple devices, and that the steps can be performed in an order different from that shown in the figures. For example, the steps described in the figures can be performed in parallel or in a different order, as long as the desired results of the application are achieved. The application is not limited in this regard.
[0157] The specific embodiments have been shown and described for the purposes of illustrating the physiological principles of the application. It will be understood that various modifications, combinations, sub-combinations, and alternatives can occur to one skilled in the art. These modifications, combinations, sub-combinations, and alternatives can be made without departing from the spirit and scope of the application, which is defined by the appended claims. Such claims should not be read to require nothing more than the preferred embodiments described.
Claims
1. A government affairs intelligent question-answering method, characterized in that, include: Obtain the user's input inquiry; Retrieve a target consultation question sample that semantically matches the consultation question from the e-government project management knowledge base, and determine the target text block corresponding to the target consultation question sample. The e-government project management knowledge base stores multiple consultation question samples in the e-government field, as well as text blocks containing key information of the answer to the consultation question sample, which are segmented from e-government project knowledge data. The target text block is input into a large language model for processing, and the large language model generates a government response that matches the inquiry question.
2. The government affairs intelligent question-answering method according to claim 1, characterized in that, Retrieve a target consultation question sample that semantically matches the consultation question from the e-government project management knowledge base, and determine the target text block corresponding to the target consultation question sample, including: Extract the semantic features of the consultation question to obtain the semantic feature vector of the consultation question; Traverse the semantic feature vectors of all consultation question samples in the government informatization project management knowledge base, and calculate the cosine similarity between the semantic feature vector of the consultation question and the semantic feature vector of the consultation question sample. Consultation question samples with a cosine similarity greater than the similarity threshold are used as target consultation question samples; Use the text block corresponding to the target consultation question sample as the target text block.
3. The government affairs intelligent question-answering method according to claim 2, characterized in that, Extracting the semantic features of the consultation question to obtain the semantic feature vector of the consultation question includes: The word segmentation in the consultation question is converted into a vector representation to obtain the word embedding vector; The position of the word segmentation in the consultation question is converted into a vector representation to obtain the position embedding vector; The word embedding vector and the position embedding vector are fused to obtain a fused vector; The fused vector is input into the encoding layer for processing to obtain the semantic feature vector of the consultation question. The encoding layer includes multiple stacked multi-head attention units, and the output of the previous multi-head attention unit is used as the input of the next multi-head attention unit.
4. The government affairs intelligent question-answering method according to any one of claims 1-3, characterized in that, Before obtaining the user's input inquiry, it also includes: Acquire knowledge data from e-government projects; Extract consultation question samples and text blocks associated with the consultation question samples from the knowledge data of the e-government project; The consultation question sample and the associated text block are stored in the e-government project management knowledge base.
5. The government affairs intelligent question-answering method according to claim 4, characterized in that, The consultation question samples and text blocks associated with the consultation question samples are extracted from the knowledge data of the e-government project, including: The knowledge data of the e-government information project is preprocessed to obtain text data of the e-government information project knowledge data. The preprocessing includes data cleaning and format conversion. The text data is segmented using recursive character segmentation, dividing the text data into multiple text blocks of a specified length; Extract target statements containing potential consultation answers from the text block; Extract key information from the consultation answer from the target statement; The key information is filled into a pre-built consultation question template to obtain a consultation question sample; Extract the semantic features of the consultation question sample to obtain the semantic feature vector of the consultation question sample; Associate the semantic feature vector of the consultation question sample with the text block.
6. The government affairs intelligent question-answering method according to claim 4, characterized in that, After acquiring knowledge data from e-government projects, the following is also included: A tag tree for the knowledge domain of provincial government informatization project management is constructed, with the knowledge domain of provincial government informatization project management as the main body, project type as the branch, and knowledge type classification as the leaf.
7. The government affairs intelligent question-answering method according to claim 6, characterized in that, After extracting consultation question samples from the knowledge data of the aforementioned e-government projects, the process also includes: The consultation question samples were categorized according to the knowledge domain tag tree of e-government project management.
8. A government affairs intelligent question-and-answer device, characterized in that, include: The consultation question acquisition module is used to acquire the consultation questions input by the user; The semantic matching module is used to retrieve a target consultation question sample that semantically matches the consultation question from the e-government project management knowledge base, and determine the target text block corresponding to the target consultation question sample. The e-government project management knowledge base stores multiple consultation question samples in the e-government field, as well as text blocks containing key information of the answer to the consultation question sample, which are segmented from e-government project knowledge data. The response generation module is used to input the target text block into a large language model for processing, and the large language model generates a government response that matches the inquiry question.
9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the government affairs intelligent question answering method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the government affairs intelligent question-and-answer method as described in any one of claims 1-7.
Citation Information
Cited By
Government affair intelligent question-answering method, government affair intelligent question-answering system, medium and product
CN121303150A